linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Bostic <cbostic@linux.vnet.ibm.com>
To: wim@iguana.be, linux@roeck-us.net
Cc: Christopher Bostic <cbostic@linux.vnet.ibm.com>,
	joel@jms.id.au, linux-kernel@vger.kernel.org,
	linux-watchdog@vger.kernel.org, andrew@aj.id.au
Subject: [PATCH 2/2] drivers/watchdog: ASPEED reference dev tree properties for config
Date: Tue, 13 Jun 2017 15:38:18 -0500	[thread overview]
Message-ID: <20170613203818.17399-3-cbostic@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170613203818.17399-1-cbostic@linux.vnet.ibm.com>

Reference the system device tree when configuring the watchdog.
Configure for external signal generation if optional attribute
'external-signal' is present in device tree.  Configure for
reset system after timeout if the optional attribute
'no-system-reset' is not present.  Disabling system reset may be
required in situations where one of the other watchdogs in the
systems is responsible for this.

Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
---
 drivers/watchdog/aspeed_wdt.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/aspeed_wdt.c b/drivers/watchdog/aspeed_wdt.c
index 1c65258..9deb4be 100644
--- a/drivers/watchdog/aspeed_wdt.c
+++ b/drivers/watchdog/aspeed_wdt.c
@@ -140,6 +140,7 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 {
 	struct aspeed_wdt *wdt;
 	struct resource *res;
+	struct device_node *np;
 	int ret;
 
 	wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
@@ -170,8 +171,16 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
 	 * the SOC and not the full chip
 	 */
 	wdt->ctrl = WDT_CTRL_RESET_MODE_SOC |
-		WDT_CTRL_1MHZ_CLK |
-		WDT_CTRL_RESET_SYSTEM;
+		WDT_CTRL_1MHZ_CLK;
+
+	np = pdev->dev.of_node;
+	if (np && !of_get_property(np, "no-system-reset", NULL))
+		wdt->ctrl |= WDT_CTRL_RESET_SYSTEM;
+
+	if (np && of_get_property(np, "external-signal", NULL))
+		wdt->ctrl |= WDT_CTRL_WDT_EXT;
+
+	writel(wdt->ctrl, wdt->base + WDT_CTRL);
 
 	if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE)  {
 		aspeed_wdt_start(&wdt->wdd);
-- 
1.8.2.2


  parent reply	other threads:[~2017-06-13 20:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 20:38 [PATCH 0/2] drivers/watchdog ASPEED: Add optional dev tree configs Christopher Bostic
2017-06-13 20:38 ` [PATCH 1/2] drivers/watchdog: Document new aspeed optional dev tree properties Christopher Bostic
2017-06-24 22:07   ` [1/2] " Guenter Roeck
2017-06-27  2:16     ` Christopher Bostic
2017-06-27  2:59   ` [PATCH 1/2] " Joel Stanley
2017-06-27 19:44     ` Christopher Bostic
2017-06-13 20:38 ` Christopher Bostic [this message]
2017-06-24 22:17   ` [2/2] drivers/watchdog: ASPEED reference dev tree properties for config Guenter Roeck
2017-06-27  2:17     ` Christopher Bostic

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=20170613203818.17399-3-cbostic@linux.vnet.ibm.com \
    --to=cbostic@linux.vnet.ibm.com \
    --cc=andrew@aj.id.au \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@iguana.be \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).