diff mbox

[U-Boot,2/3] imx: wdog: correct wcr register settings

Message ID 1442208885-32387-2-git-send-email-Peng.Fan@freescale.com
State Awaiting Upstream
Delegated to: Stefano Babic
Headers show

Commit Message

Peng Fan Sept. 14, 2015, 5:34 a.m. UTC
We should not simple use "writew(WCR_WDE, &wdog->wcr)" to set
wcr, since this will override bits set before reset_cpu.

Use clrsetbits_le32 instead of writew to fix this issue.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Sebastian Siewior <bigeasy@linutronix.de>
---
 drivers/watchdog/imx_watchdog.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Peng Fan Sept. 14, 2015, 11:46 a.m. UTC | #1
On Mon, Sep 14, 2015 at 09:11:30AM -0300, Fabio Estevam wrote:
>On Mon, Sep 14, 2015 at 2:34 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
>> We should not simple use "writew(WCR_WDE, &wdog->wcr)" to set
>> wcr, since this will override bits set before reset_cpu.
>>
>> Use clrsetbits_le32 instead of writew to fix this issue.
>
>There is a typo here: it should be clrsetbits_le16.

Fabio, thanks for pointing this out.

Stefano, can you help fix this when you plan to apply this patch?
Or do you need to send v2 to fix this commit log typo?

Thanks,
Peng.
Fabio Estevam Sept. 14, 2015, 12:09 p.m. UTC | #2
On Mon, Sep 14, 2015 at 2:34 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
> We should not simple use "writew(WCR_WDE, &wdog->wcr)" to set
> wcr, since this will override bits set before reset_cpu.
>
> Use clrsetbits_le32 instead of writew to fix this issue.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Sebastian Siewior <bigeasy@linutronix.de>

Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Fabio Estevam Sept. 14, 2015, 12:11 p.m. UTC | #3
On Mon, Sep 14, 2015 at 2:34 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
> We should not simple use "writew(WCR_WDE, &wdog->wcr)" to set
> wcr, since this will override bits set before reset_cpu.
>
> Use clrsetbits_le32 instead of writew to fix this issue.

There is a typo here: it should be clrsetbits_le16.
Stefano Babic Sept. 20, 2015, 7:42 a.m. UTC | #4
On 14/09/2015 14:11, Fabio Estevam wrote:
> On Mon, Sep 14, 2015 at 2:34 AM, Peng Fan <Peng.Fan@freescale.com> wrote:
>> We should not simple use "writew(WCR_WDE, &wdog->wcr)" to set
>> wcr, since this will override bits set before reset_cpu.
>>
>> Use clrsetbits_le32 instead of writew to fix this issue.
> 
> There is a typo here: it should be clrsetbits_le16.
> 


Corrected by applying, thanks to point it out.

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/drivers/watchdog/imx_watchdog.c b/drivers/watchdog/imx_watchdog.c
index 1d18d4b..9a77a54 100644
--- a/drivers/watchdog/imx_watchdog.c
+++ b/drivers/watchdog/imx_watchdog.c
@@ -55,7 +55,8 @@  void reset_cpu(ulong addr)
 {
 	struct watchdog_regs *wdog = (struct watchdog_regs *)WDOG1_BASE_ADDR;
 
-	writew(WCR_WDE, &wdog->wcr);
+	clrsetbits_le16(&wdog->wcr, 0, WCR_WDE);
+
 	writew(0x5555, &wdog->wsr);
 	writew(0xaaaa, &wdog->wsr);	/* load minimum 1/2 second timeout */
 	while (1) {