linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Bostic <cbostic@linux.vnet.ibm.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: wim@iguana.be, joel@jms.id.au, linux-kernel@vger.kernel.org,
	linux-watchdog@vger.kernel.org, andrew@aj.id.au
Subject: Re: [2/2] drivers/watchdog: ASPEED reference dev tree properties for config
Date: Mon, 26 Jun 2017 21:17:25 -0500	[thread overview]
Message-ID: <222152c4-a014-703c-29a0-a2a9ffdec5e9@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170624221747.GA10038@roeck-us.net>



On 6/24/17 5:17 PM, Guenter Roeck wrote:
> On Tue, Jun 13, 2017 at 03:38:18PM -0500, Christopher Bostic wrote:
>> 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;
>> +
> Please use of_property_read_bool(). Also, checking np for NULL is unnecessary
> since the called function does that. Note that the above code as written is
> wrong - if np is NULL, WDT_CTRL_RESET_SYSTEM will no longer be set.

Will make the suggested changes.

Thanks
-Chris

> The new properties should probably start with "aspeed," but I'll leave that
> up to DT maintainers to decide.
>
>> +	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);


      reply	other threads:[~2017-06-27  2:17 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 ` [PATCH 2/2] drivers/watchdog: ASPEED reference dev tree properties for config Christopher Bostic
2017-06-24 22:17   ` [2/2] " Guenter Roeck
2017-06-27  2:17     ` Christopher Bostic [this message]

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=222152c4-a014-703c-29a0-a2a9ffdec5e9@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).