[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230815023426.15076-5-jiansheng.wu@unisoc.com>
Date: Tue, 15 Aug 2023 10:34:23 +0800
From: Jiansheng Wu <jiansheng.wu@...soc.com>
To: Mark Brown <broonie@...nel.org>, Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>
CC: <linux-spi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<yongzhi.chen@...soc.com>, <xiaoqing.wu@...soc.com>,
<jianshengwu16@...il.com>
Subject: [PATCH 5/8] Spi: sprd-adi: Checking panic reason from sml
Checking panic reason from sml and recording reboot mode to pmic's reg.
It used to check reboot reason on next boot.
Signed-off-by: XiaoQing Wu <xiaoqing.wu@...soc.com>
Signed-off-by: Jiansheng Wu <jiansheng.wu@...soc.com>
---
drivers/spi/spi-sprd-adi.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c
index eea64d20279e..c31035fffe4c 100644
--- a/drivers/spi/spi-sprd-adi.c
+++ b/drivers/spi/spi-sprd-adi.c
@@ -119,6 +119,7 @@
/* Definition of PMIC reset status register */
#define HWRST_STATUS_SECURITY 0x02
#define HWRST_STATUS_SECBOOT 0x03
+#define HWRST_STATUS_SML_PANIC 0x04
#define HWRST_STATUS_RECOVERY 0x20
#define HWRST_STATUS_NORMAL 0x40
#define HWRST_STATUS_ALARM 0x50
@@ -410,7 +411,7 @@ static int sprd_adi_restart_handler(struct notifier_block *this, unsigned long m
{
struct sprd_adi *sadi = container_of(this, struct sprd_adi,
restart_handler);
- u32 val, reboot_mode = 0;
+ u32 val = 0, reboot_mode = 0, sml_mode;
if (!cmd) {
if (strlen(panic_reason)) {
@@ -453,9 +454,12 @@ static int sprd_adi_restart_handler(struct notifier_block *this, unsigned long m
/* Record the reboot mode */
sprd_adi_read(sadi, sadi->data->rst_sts, &val);
- val &= ~0xFF;
- val |= reboot_mode;
- sprd_adi_write(sadi, sadi->data->rst_sts, val);
+ sml_mode = val & 0xFF;
+ if (sml_mode != HWRST_STATUS_SML_PANIC && sml_mode != HWRST_STATUS_SECURITY) {
+ val &= ~0xFF;
+ val |= reboot_mode;
+ sprd_adi_write(sadi, sadi->data->rst_sts, val);
+ }
/*enable register reboot mode*/
sprd_adi_read(sadi, sadi->data->swrst_base, &val);
--
2.17.1
Powered by blists - more mailing lists