[linux,dev-4.10,5/5] watchdog: aspeed: Allow configuring for alternate boot

Message ID 1516996404-25133-6-git-send-email-eajames@linux.vnet.ibm.com
State Not Applicable, archived
Headers show
Series
  • aspeed: watchdog and devicetree updates
Related show

Commit Message

Eddie James Jan. 26, 2018, 7:53 p.m.
From: Milton Miller <miltonm@us.ibm.com>

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.

Signed-off-by: Milton Miller <miltonm@us.ibm.com>
---
 Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt | 3 +++
 drivers/watchdog/aspeed_wdt.c                             | 3 +++
 2 files changed, 6 insertions(+)

Patch

diff --git a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
index 7aa885f..82dedaa 100644
--- a/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/aspeed-wdt.txt
@@ -33,6 +33,9 @@  Optional properties:
         - none: No reset is performed on timeout. Assumes another watchdog
                 engine is responsible for this.
 
+ - aspeed,secondary-boot: If property is present and watchdog activates,
+			  swtich to alternate boot source
+
  - aspeed,interrupt:	If property is present then interrupt CPU.
 			If not specified then don't interrupt CPU.
 
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index 7eef0dd..1dd687b 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -34,6 +34,7 @@  struct aspeed_wdt {
 #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)
@@ -210,6 +211,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,secondary-boot"))
+		wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY;
 
 	if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE)  {
 		/*