Commit 49d4d277 authored by Eddie James's avatar Eddie James Committed by Wim Van Sebroeck

aspeed: watchdog: Set bootstatus during probe

Check the aspeed timeout status register to see if the system has booted
from the secondary boot source. If so, set the watchdog device
bootstatus flag for "Card previously reset the CPU."
Signed-off-by: default avatarEddie James <eajames@linux.vnet.ibm.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent fdac6a90
...@@ -55,6 +55,8 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table); ...@@ -55,6 +55,8 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
#define WDT_CTRL_WDT_INTR BIT(2) #define WDT_CTRL_WDT_INTR BIT(2)
#define WDT_CTRL_RESET_SYSTEM BIT(1) #define WDT_CTRL_RESET_SYSTEM BIT(1)
#define WDT_CTRL_ENABLE BIT(0) #define WDT_CTRL_ENABLE BIT(0)
#define WDT_TIMEOUT_STATUS 0x10
#define WDT_TIMEOUT_STATUS_BOOT_SECONDARY BIT(1)
/* /*
* WDT_RESET_WIDTH controls the characteristics of the external pulse (if * WDT_RESET_WIDTH controls the characteristics of the external pulse (if
...@@ -192,6 +194,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev) ...@@ -192,6 +194,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
struct device_node *np; struct device_node *np;
const char *reset_type; const char *reset_type;
u32 duration; u32 duration;
u32 status;
int ret; int ret;
wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
...@@ -307,6 +310,10 @@ static int aspeed_wdt_probe(struct platform_device *pdev) ...@@ -307,6 +310,10 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
writel(duration - 1, wdt->base + WDT_RESET_WIDTH); writel(duration - 1, wdt->base + WDT_RESET_WIDTH);
} }
status = readl(wdt->base + WDT_TIMEOUT_STATUS);
if (status & WDT_TIMEOUT_STATUS_BOOT_SECONDARY)
wdt->wdd.bootstatus = WDIOF_CARDRESET;
ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdd); ret = devm_watchdog_register_device(&pdev->dev, &wdt->wdd);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register\n"); dev_err(&pdev->dev, "failed to register\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment