From: Andrew Jeffery <andrew@aj.id.au>
To: joel@jms.id.au
Cc: Andrew Jeffery <andrew@aj.id.au>,
mspinler@linux.vnet.ibm.com, msbarth@linux.vnet.ibm.com,
openbmc@lists.ozlabs.org
Subject: [PATCH linux dev-4.10 v2 3/4] watchdog: aspeed: Support external signal drive and polarity bindings
Date: Thu, 27 Jul 2017 01:38:30 +0930 [thread overview]
Message-ID: <20170726160831.17867-4-andrew@aj.id.au> (raw)
In-Reply-To: <20170726160831.17867-1-andrew@aj.id.au>
These bindings are optional, and only relevant on the AST2500 and
compatible watchdog controllers.
Signed-off-by: Andrew Jeffery <andrew@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
next prev parent reply other threads:[~2017-07-26 16:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-26 16:08 [PATCH linux dev-4.10 v2 0/4] Witherspoon WDTRST1 enablement Andrew Jeffery
2017-07-26 16:08 ` [PATCH linux dev-4.10 v2 1/4] ARM: aspeed: Request WDTRST1 pinctrl function Andrew Jeffery
2017-07-26 16:08 ` [PATCH linux dev-4.10 v2 2/4] dt-bindings: watchdog: aspeed: External reset signal properties Andrew Jeffery
2017-07-26 16:08 ` Andrew Jeffery [this message]
2017-07-26 17:52 ` [PATCH linux dev-4.10 v2 3/4] watchdog: aspeed: Support external signal drive and polarity bindings Matt Spinler
2017-07-26 20:51 ` Andrew Jeffery
2017-07-26 16:08 ` [PATCH linux dev-4.10 v2 4/4] ARM: dts: aspeed: Witherspoon WDT1 external signal is push-pull Andrew Jeffery
2017-07-26 17:54 ` Matt Spinler
2017-07-26 20:56 ` Andrew Jeffery
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170726160831.17867-4-andrew@aj.id.au \
--to=andrew@aj.id.au \
--cc=joel@jms.id.au \
--cc=msbarth@linux.vnet.ibm.com \
--cc=mspinler@linux.vnet.ibm.com \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.