public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Zhong <zyw@rock-chips.com>
To: Heiko Stuebner <heiko@sntech.de>
Cc: dianders@chromium.org, djkurtz@chromium.org,
	sonnyrao@chromium.org, linux-rockchip@lists.infradead.org,
	Daniel Kurtz <djkurtz@google.com>,
	Russell King <linux@arm.linux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] ARM: rockchip: disable watchdog during suspend
Date: Tue, 03 Mar 2015 13:57:41 +0800	[thread overview]
Message-ID: <54F54D55.8040200@rock-chips.com> (raw)
In-Reply-To: <19262192.YHbflRWDXo@phil>


On 03/03/2015 04:50 AM, Heiko Stuebner wrote:
> Hi Chris,
>
> Am Montag, 9. Februar 2015, 21:12:23 schrieb Chris Zhong:
>> The watchdog clock should be disable in dw_wdt_suspend, but we set a
>> dummy clock to watchdog for rk3288. So the watchdog will continue to
>> work during suspend. And we switch the system clock to 32khz from 24Mhz,
>> during suspend, so the watchdog timer over count will increase to
>> 755 times, about 12.5 hours, the original value is 60 seconds. So
>> watchdog will reset the system over a night,  but voltage are all
>> incorrect, then it hang on reset.
>>
>> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
>> Signed-off-by: Daniel Kurtz <djkurtz@google.com>
> The SGRF is not writeable in all bootmodes (I've talked with Doug about this
> to verify I remembered this correctly), so handling the sgrf gate for the
> watchdog is not safe for all possible boards.
>
> Why not simply turn off the watchdog in the driver during suspend?
I think SGRF is writeable, since we would set this RK3288_SGRF_SOC_CON0 
register when suspend.
and this SGRF_PCLK_WDT_GATE is one bit of RK3288_SGRF_SOC_CON0.

I tried to set wdt_en(WDT_CR[bit 0]) to 0 in watchdog driver, but that 
would cause system reboot.
>
> Heiko
>
>> ---
>>
>>   arch/arm/mach-rockchip/pm.c | 11 ++++++++---
>>   arch/arm/mach-rockchip/pm.h |  2 ++
>>   2 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c
>> index a3ab397..b07d886 100644
>> --- a/arch/arm/mach-rockchip/pm.c
>> +++ b/arch/arm/mach-rockchip/pm.c
>> @@ -75,9 +75,13 @@ static void rk3288_slp_mode_set(int level)
>>   	regmap_read(pmu_regmap, RK3288_PMU_PWRMODE_CON,
>>   		    &rk3288_pmu_pwr_mode_con);
>>
>> -	/* set bit 8 so that system will resume to FAST_BOOT_ADDR */
>> +	/*
>> +	 * SGRF_FAST_BOOT_EN - system to boot from FAST_BOOT_ADDR
>> +	 * PCLK_WDT_GATE - disable WDT during suspend.
>> +	 */
>>   	regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0,
>> -		     SGRF_FAST_BOOT_EN | SGRF_FAST_BOOT_EN_WRITE);
>> +		     SGRF_PCLK_WDT_GATE | SGRF_FAST_BOOT_EN
>> +		     | SGRF_PCLK_WDT_GATE_WRITE | SGRF_FAST_BOOT_EN_WRITE);
>>
>>   	/* booting address of resuming system is from this register value */
>>   	regmap_write(sgrf_regmap, RK3288_SGRF_FAST_BOOT_ADDR,
>> @@ -122,7 +126,8 @@ static void rk3288_slp_mode_set_resume(void)
>>   		     rk3288_pmu_pwr_mode_con);
>>
>>   	regmap_write(sgrf_regmap, RK3288_SGRF_SOC_CON0,
>> -		     rk3288_sgrf_soc_con0 | SGRF_FAST_BOOT_EN_WRITE);
>> +		     rk3288_sgrf_soc_con0 | SGRF_PCLK_WDT_GATE_WRITE
>> +		     | SGRF_FAST_BOOT_EN_WRITE);
>>   }
>>
>>   static int rockchip_lpmode_enter(unsigned long arg)
>> diff --git a/arch/arm/mach-rockchip/pm.h b/arch/arm/mach-rockchip/pm.h
>> index 96beaa0..d463978 100644
>> --- a/arch/arm/mach-rockchip/pm.h
>> +++ b/arch/arm/mach-rockchip/pm.h
>> @@ -44,6 +44,8 @@ void __init rockchip_suspend_init(void);
>>
>>   #define RK3288_SGRF_SOC_CON0		(0x0000)
>>   #define RK3288_SGRF_FAST_BOOT_ADDR	(0x0120)
>> +#define SGRF_PCLK_WDT_GATE		BIT(6)
>> +#define SGRF_PCLK_WDT_GATE_WRITE	BIT(22)
>>   #define SGRF_FAST_BOOT_EN		BIT(8)
>>   #define SGRF_FAST_BOOT_EN_WRITE		BIT(24)
>
>
>



  reply	other threads:[~2015-03-03  5:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09 13:12 [PATCH 1/2] ARM: rockchip: decrease the wait time for resume Chris Zhong
2015-02-09 13:12 ` [PATCH 2/2] ARM: rockchip: disable watchdog during suspend Chris Zhong
2015-03-02 20:50   ` Heiko Stuebner
2015-03-03  5:57     ` Chris Zhong [this message]
2015-03-11 21:23       ` Doug Anderson
2015-03-11 21:43         ` Heiko Stuebner
2015-03-02 20:47 ` [PATCH 1/2] ARM: rockchip: decrease the wait time for resume Heiko Stuebner
2015-03-03  5:45   ` Chris Zhong
2015-03-11 21:31 ` Doug Anderson

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=54F54D55.8040200@rock-chips.com \
    --to=zyw@rock-chips.com \
    --cc=dianders@chromium.org \
    --cc=djkurtz@chromium.org \
    --cc=djkurtz@google.com \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    --cc=sonnyrao@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox