lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251007-sc27xx-mfd-poweroff-v1-2-89a2f919b731@abscue.de>
Date: Tue, 07 Oct 2025 20:14:20 +0200
From: Otto Pflüger <otto.pflueger@...cue.de>
To: Lee Jones <lee@...nel.org>, Orson Zhai <orsonzhai@...il.com>, 
 Baolin Wang <baolin.wang@...ux.alibaba.com>, 
 Chunyan Zhang <zhang.lyra@...il.com>, Mark Brown <broonie@...nel.org>, 
 Sebastian Reichel <sre@...nel.org>
Cc: Rob Herring <robh@...nel.org>, linux-kernel@...r.kernel.org, 
 linux-spi@...r.kernel.org, linux-pm@...r.kernel.org, 
 Otto Pflüger <otto.pflueger@...cue.de>
Subject: [PATCH 2/3] spi: sprd-adi: Remove code for storing the reboot mode

This functionality is now provided by the PMIC driver. Ideally, the
entire reboot code should be removed since it does not belong in the bus
driver, but it is kept for now since there is no driver for the PMIC
watchdog on SC2731 yet.

Signed-off-by: Otto Pflüger <otto.pflueger@...cue.de>
---
 drivers/spi/spi-sprd-adi.c | 73 +---------------------------------------------
 1 file changed, 1 insertion(+), 72 deletions(-)

diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c
index 262c11d977ea350c3b8a861064d9f109cc57a45e..47e6fbbf9991dbe77ad22e03c9709e6ee3a1b01e 100644
--- a/drivers/spi/spi-sprd-adi.c
+++ b/drivers/spi/spi-sprd-adi.c
@@ -101,27 +101,10 @@
 #define BIT_WDG_EN			BIT(2)
 
 /* Registers definitions for PMIC */
-#define PMIC_RST_STATUS			0xee8
 #define PMIC_MODULE_EN			0xc08
 #define PMIC_CLK_EN			0xc18
 #define PMIC_WDG_BASE			0x80
 
-/* Definition of PMIC reset status register */
-#define HWRST_STATUS_SECURITY		0x02
-#define HWRST_STATUS_RECOVERY		0x20
-#define HWRST_STATUS_NORMAL		0x40
-#define HWRST_STATUS_ALARM		0x50
-#define HWRST_STATUS_SLEEP		0x60
-#define HWRST_STATUS_FASTBOOT		0x30
-#define HWRST_STATUS_SPECIAL		0x70
-#define HWRST_STATUS_PANIC		0x80
-#define HWRST_STATUS_CFTREBOOT		0x90
-#define HWRST_STATUS_AUTODLOADER	0xa0
-#define HWRST_STATUS_IQMODE		0xb0
-#define HWRST_STATUS_SPRDISK		0xc0
-#define HWRST_STATUS_FACTORYTEST	0xe0
-#define HWRST_STATUS_WATCHDOG		0xf0
-
 /* Use default timeout 50 ms that converts to watchdog values */
 #define WDG_LOAD_VAL			((50 * 32768) / 1000)
 #define WDG_LOAD_MASK			GENMASK(15, 0)
@@ -139,7 +122,6 @@ struct sprd_adi_data {
 	u32 slave_addr_size;
 	int (*read_check)(u32 val, u32 reg);
 	int (*restart)(struct sys_off_data *data);
-	void (*wdg_rst)(void *p);
 };
 
 struct sprd_adi {
@@ -355,58 +337,10 @@ static int sprd_adi_transfer_one(struct spi_controller *ctlr,
 	return ret;
 }
 
-static void sprd_adi_set_wdt_rst_mode(void *p)
-{
-#if IS_ENABLED(CONFIG_SPRD_WATCHDOG)
-	u32 val;
-	struct sprd_adi *sadi = (struct sprd_adi *)p;
-
-	/* Init watchdog reset mode */
-	sprd_adi_read(sadi, PMIC_RST_STATUS, &val);
-	val |= HWRST_STATUS_WATCHDOG;
-	sprd_adi_write(sadi, PMIC_RST_STATUS, val);
-#endif
-}
-
 static int sprd_adi_restart(struct sprd_adi *sadi, unsigned long mode,
 			    const char *cmd, struct sprd_adi_wdg *wdg)
 {
-	u32 val, reboot_mode = 0;
-
-	if (!cmd)
-		reboot_mode = HWRST_STATUS_NORMAL;
-	else if (!strncmp(cmd, "recovery", 8))
-		reboot_mode = HWRST_STATUS_RECOVERY;
-	else if (!strncmp(cmd, "alarm", 5))
-		reboot_mode = HWRST_STATUS_ALARM;
-	else if (!strncmp(cmd, "fastsleep", 9))
-		reboot_mode = HWRST_STATUS_SLEEP;
-	else if (!strncmp(cmd, "bootloader", 10))
-		reboot_mode = HWRST_STATUS_FASTBOOT;
-	else if (!strncmp(cmd, "panic", 5))
-		reboot_mode = HWRST_STATUS_PANIC;
-	else if (!strncmp(cmd, "special", 7))
-		reboot_mode = HWRST_STATUS_SPECIAL;
-	else if (!strncmp(cmd, "cftreboot", 9))
-		reboot_mode = HWRST_STATUS_CFTREBOOT;
-	else if (!strncmp(cmd, "autodloader", 11))
-		reboot_mode = HWRST_STATUS_AUTODLOADER;
-	else if (!strncmp(cmd, "iqmode", 6))
-		reboot_mode = HWRST_STATUS_IQMODE;
-	else if (!strncmp(cmd, "sprdisk", 7))
-		reboot_mode = HWRST_STATUS_SPRDISK;
-	else if (!strncmp(cmd, "tospanic", 8))
-		reboot_mode = HWRST_STATUS_SECURITY;
-	else if (!strncmp(cmd, "factorytest", 11))
-		reboot_mode = HWRST_STATUS_FACTORYTEST;
-	else
-		reboot_mode = HWRST_STATUS_NORMAL;
-
-	/* Record the reboot mode */
-	sprd_adi_read(sadi, wdg->rst_sts, &val);
-	val &= ~HWRST_STATUS_WATCHDOG;
-	val |= reboot_mode;
-	sprd_adi_write(sadi, wdg->rst_sts, val);
+	u32 val;
 
 	/* Enable the interface clock of the watchdog */
 	sprd_adi_read(sadi, wdg->wdg_en, &val);
@@ -448,7 +382,6 @@ static int sprd_adi_restart_sc9860(struct sys_off_data *data)
 {
 	struct sprd_adi_wdg wdg = {
 		.base = PMIC_WDG_BASE,
-		.rst_sts = PMIC_RST_STATUS,
 		.wdg_en = PMIC_MODULE_EN,
 		.wdg_clk = PMIC_CLK_EN,
 	};
@@ -568,9 +501,6 @@ static int sprd_adi_probe(struct platform_device *pdev)
 
 	sprd_adi_hw_init(sadi);
 
-	if (sadi->data->wdg_rst)
-		sadi->data->wdg_rst(sadi);
-
 	ctlr->dev.of_node = pdev->dev.of_node;
 	ctlr->bus_num = pdev->id;
 	ctlr->num_chipselect = num_chipselect;
@@ -606,7 +536,6 @@ static struct sprd_adi_data sc9860_data = {
 	.slave_addr_size = ADI_10BIT_SLAVE_ADDR_SIZE,
 	.read_check = sprd_adi_read_check_r2,
 	.restart = sprd_adi_restart_sc9860,
-	.wdg_rst = sprd_adi_set_wdt_rst_mode,
 };
 
 static struct sprd_adi_data sc9863_data = {

-- 
2.50.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ