Skip to contentSkip to conversation

aspeed: watchdog: fix reset, read alt-boot, and set alt-boot for witherspoon

PATCH In review Eddie James 2 participants 6 messages Mar 9, 2018 – Mar 13, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover aspeed: watchdog: fix reset, read alt-boot, and set alt-boot for witherspoon

This series provides a fix to correctly set the reset mode of the control register. Previously, configuring anything other than a full chip reset would not reset anything when the watchdog timer expires. The series also provides a patch to read in the existing aspeed,alt-boot boolean option from the device-tree and set the appropriate bit in the control register.

Finally, set the alt-boot option for witherspoon to enable "brick protection".

Eddie James (1):
ARM: dts: aspeed: witherspoon: set alternate boot

Milton Miller (2):
watchdog: aspeed: Fix translation of reset mode to ctrl register
watchdog: aspeed: Allow configuring for alternate boot

 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts |  4 ++++
 drivers/watchdog/aspeed_wdt.c                    | 12 +++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 watchdog: aspeed: Fix translation of reset mode to ctrl register

From: Milton Miller <[email protected]>

Assert RESET_SYSTEM bit for any reset and set MODE field from reset type.

The watchdog control register has a RESET_SYSTEM bit that is really closer to activate a reset, and RESET_SYSTEM_MODE field that chooses how much to reset.

Before this patch, a node without these optional property would do a SOC reset, but a node with properties requesting a cpu or SOC reset would do nothing and a node requesting a system reset would do a SOC reset.

Fixes dc36d8707159 ("drivers/watchdog: ASPEED reference dev tree properties for config")
---
 drivers/watchdog/aspeed_wdt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/watchdog/aspeed_wdt.c +6 -3
index ca5b91e..d1987d6 100644
@@ -232,11 +232,14 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 		wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC | WDT_CTRL_RESET_SYSTEM;
 	} else {
 		if (!strcmp(reset_type, "cpu"))
-			wdt->ctrl |= WDT_CTRL_RESET_MODE_ARM_CPU;
+			wdt->ctrl |= WDT_CTRL_RESET_MODE_ARM_CPU |
+				     WDT_CTRL_RESET_SYSTEM;
 		else if (!strcmp(reset_type, "soc"))
-			wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC;
+			wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC |
+				     WDT_CTRL_RESET_SYSTEM;
 		else if (!strcmp(reset_type, "system"))
-			wdt->ctrl |= WDT_CTRL_RESET_SYSTEM;
+			wdt->ctrl |= WDT_CTRL_RESET_MODE_FULL_CHIP |
+				     WDT_CTRL_RESET_SYSTEM;
 		else if (strcmp(reset_type, "none"))
 			return -EINVAL;
 	}
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/3 watchdog: aspeed: Allow configuring for alternate boot

In reply to Eddie James

From: Milton Miller <[email protected]>

Allow the device tree to specify a watchdog to fallover to the alternate boot source.

The aspeeed watchdog can set a latch directing flash chip select 0 to chip select 1, allowing boot from an alternate media if the watchdog is not reset in time. On the ast2400 bank 1 also goes to flash bank 1, while on the ast2500 the chip selects are swapped.

---
 drivers/watchdog/aspeed_wdt.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/watchdog/aspeed_wdt.c +3 -0
index d1987d6..f41d246 100644
@@ -46,6 +46,7 @@ struct aspeed_wdt_config {
 #define WDT_RELOAD_VALUE	0x04
 #define WDT_RESTART		0x08
 #define WDT_CTRL		0x0C
+#define   WDT_CTRL_BOOT_SECONDARY	BIT(7)
 #define   WDT_CTRL_RESET_MODE_SOC	(0x00 << 5)
 #define   WDT_CTRL_RESET_MODE_FULL_CHIP	(0x01 << 5)
 #define   WDT_CTRL_RESET_MODE_ARM_CPU	(0x10 << 5)
@@ -245,6 +246,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 	}
 	if (of_property_read_bool(np, "aspeed,external-signal"))
 		wdt->ctrl |= WDT_CTRL_WDT_EXT;
+	if (of_property_read_bool(np, "aspeed,alt-boot"))
+		wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY;
 
 	if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE)  {
 		/*
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/3 ARM: dts: aspeed: witherspoon: set alternate boot

In reply to Eddie James

Set watchdog 2 to boot from the alternate flash chip when the watchdog timer expires and the system is reset. This enables "brick protection."

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +4 -0
index 5f8dbffa..e8e4d30 100644
@@ -633,6 +633,10 @@
 	pinctrl-0 = <&pinctrl_wdtrst1_default>;
 };
 
+&wdt2 {
+	aspeed,alt-boot;
+};
+
 &ibt {
 	status = "okay";
 };
Signature · 1 line
1.8.3.1
maintainer
#4 lore raw

Re: [PATCH linux dev-4.13 3/3] ARM: dts: aspeed: witherspoon: set alternate boot

Quoted 13 lines · Eddie James

Set watchdog 2 to boot from the alternate flash chip when the watchdog timer expires and the system is reset. This enables "brick protection."

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index 5f8dbffa..e8e4d30 100644

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 637

Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +2 -0
@@ -633,6 +633,10 @@
        pinctrl-0 = <&pinctrl_wdtrst1_default>;
 };
 
+&wdt2 {
+       aspeed,alt-boot;

When you enable this, how does the machine tell the difference between a normal reboot (which uses the watchdog) and a real expired watchdog?

Cheers,

Joel

maintainer
#5 lore raw
In reply to Eddie James
Quoted 6 lines · Eddie James

This series provides a fix to correctly set the reset mode of the control register. Previously, configuring anything other than a full chip reset would not reset anything when the watchdog timer expires. The series also provides a patch to read in the existing aspeed,alt-boot boolean option from the device-tree and set the appropriate bit in the control register.

Quoted 8 lines

Finally, set the alt-boot option for witherspoon to enable "brick protection".

Eddie James (1):
ARM: dts: aspeed: witherspoon: set alternate boot

Milton Miller (2):
watchdog: aspeed: Fix translation of reset mode to ctrl register
watchdog: aspeed: Allow configuring for alternate boot

I've merged these three into the openbmc tree. If we decide to change the way it works upstream with respect to restarting the system we can backport that change.

Cheers,

Joel

Quoted 8 lines
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts |  4 ++++
 drivers/watchdog/aspeed_wdt.c                    | 12 +++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

--
1.8.3.1