2015-11-18 02:45:28

by Nicolas Boichat

[permalink] [raw]
Subject: [PATCH] watchdog: mtk_wdt: Use MODE_KEY when stopping the watchdog

WDT_MODE value need to be or-ed with MODE_KEY when setting
watchdog mode. Add it to mtk_wdt_stop function, so that the
watchdog can be stopped (e.g. during suspend).

Signed-off-by: Nicolas Boichat <[email protected]>
---
drivers/watchdog/mtk_wdt.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 6ad9df9..b751f43 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -123,6 +123,7 @@ static int mtk_wdt_stop(struct watchdog_device *wdt_dev)

reg = readl(wdt_base + WDT_MODE);
reg &= ~WDT_MODE_EN;
+ reg |= WDT_MODE_KEY;
iowrite32(reg, wdt_base + WDT_MODE);

return 0;
--
2.6.0.rc2.230.g3dd15c0


2015-11-18 16:24:08

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] watchdog: mtk_wdt: Use MODE_KEY when stopping the watchdog

On 11/17/2015 06:45 PM, Nicolas Boichat wrote:
> WDT_MODE value need to be or-ed with MODE_KEY when setting
> watchdog mode. Add it to mtk_wdt_stop function, so that the
> watchdog can be stopped (e.g. during suspend).
>
> Signed-off-by: Nicolas Boichat <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/watchdog/mtk_wdt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
> index 6ad9df9..b751f43 100644
> --- a/drivers/watchdog/mtk_wdt.c
> +++ b/drivers/watchdog/mtk_wdt.c
> @@ -123,6 +123,7 @@ static int mtk_wdt_stop(struct watchdog_device *wdt_dev)
>
> reg = readl(wdt_base + WDT_MODE);
> reg &= ~WDT_MODE_EN;
> + reg |= WDT_MODE_KEY;
> iowrite32(reg, wdt_base + WDT_MODE);
>
> return 0;
>

2015-11-20 16:52:03

by Matthias Brugger

[permalink] [raw]
Subject: Re: [PATCH] watchdog: mtk_wdt: Use MODE_KEY when stopping the watchdog



On 18/11/15 17:24, Guenter Roeck wrote:
> On 11/17/2015 06:45 PM, Nicolas Boichat wrote:
>> WDT_MODE value need to be or-ed with MODE_KEY when setting
>> watchdog mode. Add it to mtk_wdt_stop function, so that the
>> watchdog can be stopped (e.g. during suspend).
>>
>> Signed-off-by: Nicolas Boichat <[email protected]>
>
> Reviewed-by: Guenter Roeck <[email protected]>

Acked-by: Matthias Brugger <[email protected]>

>
>> ---
>> drivers/watchdog/mtk_wdt.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
>> index 6ad9df9..b751f43 100644
>> --- a/drivers/watchdog/mtk_wdt.c
>> +++ b/drivers/watchdog/mtk_wdt.c
>> @@ -123,6 +123,7 @@ static int mtk_wdt_stop(struct watchdog_device
>> *wdt_dev)
>>
>> reg = readl(wdt_base + WDT_MODE);
>> reg &= ~WDT_MODE_EN;
>> + reg |= WDT_MODE_KEY;
>> iowrite32(reg, wdt_base + WDT_MODE);
>>
>> return 0;
>>
>