aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilton Miller <miltonm@us.ibm.com>2018-03-15 12:02:06 -0400
committerWim Van Sebroeck <wim@linux-watchdog.org>2018-03-24 05:19:39 -0400
commit6ffa3402211acc30e47e691e14d62f3fd065a54e (patch)
treea77ee4edf9fbdca29e2d0d95e3fb5f90372ede79
parent975b7f0fe669c313f925d60d67bce21f109b0f13 (diff)
watchdog: aspeed: Allow configuring for alternate boot
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. Also clear the secondary boot bit during the machine restart operation. Otherwise, the system will switch to the alternate boot after every reboot, which is not desired. Signed-off-by: Milton Miller <miltonm@us.ibm.com> Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com> Reviewed-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--drivers/watchdog/aspeed_wdt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index ca5b91e2eb92..65f23201c63a 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -46,6 +46,7 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
46#define WDT_RELOAD_VALUE 0x04 46#define WDT_RELOAD_VALUE 0x04
47#define WDT_RESTART 0x08 47#define WDT_RESTART 0x08
48#define WDT_CTRL 0x0C 48#define WDT_CTRL 0x0C
49#define WDT_CTRL_BOOT_SECONDARY BIT(7)
49#define WDT_CTRL_RESET_MODE_SOC (0x00 << 5) 50#define WDT_CTRL_RESET_MODE_SOC (0x00 << 5)
50#define WDT_CTRL_RESET_MODE_FULL_CHIP (0x01 << 5) 51#define WDT_CTRL_RESET_MODE_FULL_CHIP (0x01 << 5)
51#define WDT_CTRL_RESET_MODE_ARM_CPU (0x10 << 5) 52#define WDT_CTRL_RESET_MODE_ARM_CPU (0x10 << 5)
@@ -158,6 +159,7 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,
158{ 159{
159 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); 160 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd);
160 161
162 wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY;
161 aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000); 163 aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000);
162 164
163 mdelay(1000); 165 mdelay(1000);
@@ -242,6 +244,8 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
242 } 244 }
243 if (of_property_read_bool(np, "aspeed,external-signal")) 245 if (of_property_read_bool(np, "aspeed,external-signal"))
244 wdt->ctrl |= WDT_CTRL_WDT_EXT; 246 wdt->ctrl |= WDT_CTRL_WDT_EXT;
247 if (of_property_read_bool(np, "aspeed,alt-boot"))
248 wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY;
245 249
246 if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) { 250 if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) {
247 /* 251 /*