[PATCH 5/8] Spi: sprd-adi: Checking panic reason from sml

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Jiansheng Wu <jiansheng.wu@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux