[PATCH linux dev-4.10 v2 3/4] watchdog: aspeed: Support external signal drive and polarity bindings
Andrew Jeffery
andrew at aj.id.au
Thu Jul 27 02:08:30 AEST 2017
These bindings are optional, and only relevant on the AST2500 and
compatible watchdog controllers.
Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
---
drivers/watchdog/aspeed_wdt.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index d29f75e90bb6..9a07ef176054 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -42,6 +42,9 @@ MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
#define WDT_CTRL_WDT_INTR BIT(2)
#define WDT_CTRL_RESET_SYSTEM BIT(1)
#define WDT_CTRL_ENABLE BIT(0)
+#define WDT_RESET_WIDTH 0x18
+#define WDT_RESET_WIDTH_ACTIVE_HIGH BIT(31)
+#define WDT_RESET_WIDTH_PUSHPULL BIT(30)
#define WDT_RESTART_MAGIC 0x4755
@@ -204,6 +207,24 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
}
+ if (of_device_is_compatible(np, "aspeed,ast2500-wdt")) {
+ u32 from = readl(wdt->base + WDT_RESET_WIDTH);
+ u32 to = from;
+
+ if (of_property_read_bool(np, "aspeed,ext-push-pull"))
+ to |= WDT_RESET_WIDTH_PUSHPULL;
+ else
+ to &= ~WDT_RESET_WIDTH_PUSHPULL;
+
+ if (of_property_read_bool(np, "aspeed,ext-active-high"))
+ to |= WDT_RESET_WIDTH_ACTIVE_HIGH;
+ else
+ to &= ~WDT_RESET_WIDTH_ACTIVE_HIGH;
+
+ if (from != to)
+ writel(to, wdt->base + WDT_RESET_WIDTH);
+ }
+
ret = watchdog_register_device(&wdt->wdd);
if (ret) {
dev_err(&pdev->dev, "failed to register\n");
--
2.11.0
More information about the openbmc
mailing list