* [PATCH] powerpc: Fix Book-E watchdog timer interval setting
@ 2008-08-07 12:48 Matthias Fuchs
2008-08-07 13:19 ` Kumar Gala
0 siblings, 1 reply; 9+ messages in thread
From: Matthias Fuchs @ 2008-08-07 12:48 UTC (permalink / raw)
To: linuxppc-dev
This patch fixes the setting of the Book-E watchdog timer interval setup
on initialization and by ioctl().
Tested on PPC440EPx sequoia evaluation board.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
drivers/watchdog/booke_wdt.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 7708244..9db5478 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -42,8 +42,10 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
#ifdef CONFIG_FSL_BOOKE
#define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15))
+#define WDTP_MASK (WDTP(63))
#else
#define WDTP(x) (TCR_WP(x))
+#define WDTP_MASK (TCR_WP_MASK)
#endif
static DEFINE_SPINLOCK(booke_wdt_lock);
@@ -65,6 +67,7 @@ static void __booke_wdt_enable(void *data)
/* clear status before enabling watchdog */
__booke_wdt_ping(NULL);
val = mfspr(SPRN_TCR);
+ val &= ~WDTP_MASK;
val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period));
mtspr(SPRN_TCR, val);
@@ -106,7 +109,8 @@ static int booke_wdt_ioctl(struct inode *inode, struct file *file,
case WDIOC_SETTIMEOUT:
if (get_user(booke_wdt_period, p))
return -EFAULT;
- mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
+ tmp = mfspr(SPRN_TCR) & ~WDTP_MASK;
+ mtspr(SPRN_TCR, tmp | WDTP(booke_wdt_period));
return 0;
case WDIOC_GETTIMEOUT:
return put_user(booke_wdt_period, p);
--
1.5.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] powerpc: Fix Book-E watchdog timer interval setting
2008-08-07 12:48 [PATCH] powerpc: Fix Book-E watchdog timer interval setting Matthias Fuchs
@ 2008-08-07 13:19 ` Kumar Gala
2008-08-07 14:04 ` Matthias Fuchs
2008-09-19 21:28 ` Matthias Fuchs
0 siblings, 2 replies; 9+ messages in thread
From: Kumar Gala @ 2008-08-07 13:19 UTC (permalink / raw)
To: Matthias Fuchs; +Cc: linuxppc-dev
On Aug 7, 2008, at 7:48 AM, Matthias Fuchs wrote:
> This patch fixes the setting of the Book-E watchdog timer interval
> setup
> on initialization and by ioctl().
>
> Tested on PPC440EPx sequoia evaluation board.
>
> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
> ---
> drivers/watchdog/booke_wdt.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
can you be more explicit about what the bug was.
- k
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] powerpc: Fix Book-E watchdog timer interval setting
2008-08-07 13:19 ` Kumar Gala
@ 2008-08-07 14:04 ` Matthias Fuchs
2008-09-19 21:28 ` Matthias Fuchs
1 sibling, 0 replies; 9+ messages in thread
From: Matthias Fuchs @ 2008-08-07 14:04 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
Sure,
the former line:
mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
tries to mask the wdt interval period bits by and'ing with ~WDTP(0) which
is 0xffffffff. So no bits are cleared and or'ing a new value does not change anything.
The default interval is '3' which is the maximum, so any attempt to set a new
interval keeps the former '3'.
The patch correctly masks the period bits in SPRN_TCR before writing the new value.
That's all.
Matthias
On Thursday 07 August 2008 15:19, Kumar Gala wrote:
>
> On Aug 7, 2008, at 7:48 AM, Matthias Fuchs wrote:
>
> > This patch fixes the setting of the Book-E watchdog timer interval
> > setup
> > on initialization and by ioctl().
> >
> > Tested on PPC440EPx sequoia evaluation board.
> >
> > Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
> > ---
> > drivers/watchdog/booke_wdt.c | 6 +++++-
> > 1 files changed, 5 insertions(+), 1 deletions(-)
>
> can you be more explicit about what the bug was.
>
> - k
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] powerpc: Fix Book-E watchdog timer interval setting
2008-08-07 13:19 ` Kumar Gala
2008-08-07 14:04 ` Matthias Fuchs
@ 2008-09-19 21:28 ` Matthias Fuchs
2008-09-19 21:44 ` Kumar Gala
1 sibling, 1 reply; 9+ messages in thread
From: Matthias Fuchs @ 2008-09-19 21:28 UTC (permalink / raw)
To: linuxppc-dev
Hi Kumar,
should I resend this my patch? Is there chance to get it applied.
It really fixes a bug!
Matthias
On Thursday 07 August 2008 15:19:10 Kumar Gala wrote:
> On Aug 7, 2008, at 7:48 AM, Matthias Fuchs wrote:
> > This patch fixes the setting of the Book-E watchdog timer interval
> > setup
> > on initialization and by ioctl().
> >
> > Tested on PPC440EPx sequoia evaluation board.
> >
> > Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
> > ---
> > drivers/watchdog/booke_wdt.c | 6 +++++-
> > 1 files changed, 5 insertions(+), 1 deletions(-)
>
> can you be more explicit about what the bug was.
>
> - k
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] powerpc: Fix Book-E watchdog timer interval setting
2008-09-19 21:28 ` Matthias Fuchs
@ 2008-09-19 21:44 ` Kumar Gala
2008-09-23 15:04 ` [PATCH V2] " Matthias Fuchs
0 siblings, 1 reply; 9+ messages in thread
From: Kumar Gala @ 2008-09-19 21:44 UTC (permalink / raw)
To: Matthias Fuchs; +Cc: linuxppc-dev
Please repost and I'll look at it again.. I'm trying to be more
diligent about patchworks.ozlabs.org and tracking things there.
- k
On Sep 19, 2008, at 4:28 PM, Matthias Fuchs wrote:
> Hi Kumar,
>
> should I resend this my patch? Is there chance to get it applied.
> It really fixes a bug!
>
> Matthias
>
> On Thursday 07 August 2008 15:19:10 Kumar Gala wrote:
>> On Aug 7, 2008, at 7:48 AM, Matthias Fuchs wrote:
>>> This patch fixes the setting of the Book-E watchdog timer interval
>>> setup
>>> on initialization and by ioctl().
>>>
>>> Tested on PPC440EPx sequoia evaluation board.
>>>
>>> Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
>>> ---
>>> drivers/watchdog/booke_wdt.c | 6 +++++-
>>> 1 files changed, 5 insertions(+), 1 deletions(-)
>>
>> can you be more explicit about what the bug was.
>>
>> - k
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@ozlabs.org
>> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH V2] powerpc: Fix Book-E watchdog timer interval setting
2008-09-19 21:44 ` Kumar Gala
@ 2008-09-23 15:04 ` Matthias Fuchs
2008-09-23 16:31 ` Timur Tabi
0 siblings, 1 reply; 9+ messages in thread
From: Matthias Fuchs @ 2008-09-23 15:04 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
This patch fixes the setting of the Book-E watchdog timer interval setup
on initialization and by ioctl().
On initialization the period bits have to be masked before setting
a new period.
In WDIOC_SETTIMEOUT ioctl we have to use the currect mask.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
drivers/watchdog/booke_wdt.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index c3b78a7..41ba9b8 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -42,8 +42,10 @@ u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
#ifdef CONFIG_FSL_BOOKE
#define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15))
+#define WDTP_MASK (WDTP(63))
#else
#define WDTP(x) (TCR_WP(x))
+#define WDTP_MASK (TCR_WP_MASK)
#endif
static DEFINE_SPINLOCK(booke_wdt_lock);
@@ -65,6 +67,7 @@ static void __booke_wdt_enable(void *data)
/* clear status before enabling watchdog */
__booke_wdt_ping(NULL);
val = mfspr(SPRN_TCR);
+ val &= ~WDTP_MASK;
val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period));
mtspr(SPRN_TCR, val);
@@ -114,7 +117,7 @@ static long booke_wdt_ioctl(struct file *file,
case WDIOC_SETTIMEOUT:
if (get_user(booke_wdt_period, p))
return -EFAULT;
- mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) |
+ mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP_MASK) |
WDTP(booke_wdt_period));
return 0;
case WDIOC_GETTIMEOUT:
--
1.5.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH V2] powerpc: Fix Book-E watchdog timer interval setting
2008-09-23 15:04 ` [PATCH V2] " Matthias Fuchs
@ 2008-09-23 16:31 ` Timur Tabi
2008-11-03 8:56 ` Matthias Fuchs
0 siblings, 1 reply; 9+ messages in thread
From: Timur Tabi @ 2008-09-23 16:31 UTC (permalink / raw)
To: Matthias Fuchs; +Cc: linuxppc-dev
On Tue, Sep 23, 2008 at 10:04 AM, Matthias Fuchs
<matthias.fuchs@esd-electronics.com> wrote:
> #ifdef CONFIG_FSL_BOOKE
> #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15))
> +#define WDTP_MASK (WDTP(63))
WDTP(63) is "((((63-63)&0x3)<<30)|(((63-63)&0x3c)<<15))", which is
equal to 0. Shouldn't WDTP_MASK be equal to "(3 << 30) | (15 << 15)"?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] powerpc: Fix Book-E watchdog timer interval setting
2008-09-23 16:31 ` Timur Tabi
@ 2008-11-03 8:56 ` Matthias Fuchs
2008-11-03 16:28 ` Timur Tabi
0 siblings, 1 reply; 9+ messages in thread
From: Matthias Fuchs @ 2008-11-03 8:56 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
Timur,
I missed you posting. But you are right. My patch is ok for 4xx CPUs and touching
the CONFIG_FSL_BOOKE path was not my intention.
So for CONFIG_FSL_BOOKE WDTP_MASK should be WDTP(0). There is still a slightly difference
between WDTP(0)="(3 << 30) | (0x3c << 15)" and "(3 << 30) | (15 << 15)".
Can you check that please and I will resend my patch.
Thanks for pointing that out.
Matthias
On Tuesday 23 September 2008 18:31, Timur Tabi wrote:
> On Tue, Sep 23, 2008 at 10:04 AM, Matthias Fuchs
> <matthias.fuchs@esd-electronics.com> wrote:
> > #ifdef CONFIG_FSL_BOOKE
> > #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15))
> > +#define WDTP_MASK (WDTP(63))
>
> WDTP(63) is "((((63-63)&0x3)<<30)|(((63-63)&0x3c)<<15))", which is
> equal to 0. Shouldn't WDTP_MASK be equal to "(3 << 30) | (15 << 15)"?
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH V2] powerpc: Fix Book-E watchdog timer interval setting
2008-11-03 8:56 ` Matthias Fuchs
@ 2008-11-03 16:28 ` Timur Tabi
0 siblings, 0 replies; 9+ messages in thread
From: Timur Tabi @ 2008-11-03 16:28 UTC (permalink / raw)
To: Matthias Fuchs; +Cc: linuxppc-dev
Matthias Fuchs wrote:
> Timur,
>
> I missed you posting. But you are right. My patch is ok for 4xx CPUs and touching
> the CONFIG_FSL_BOOKE path was not my intention.
>
> So for CONFIG_FSL_BOOKE WDTP_MASK should be WDTP(0). There is still a slightly difference
> between WDTP(0)="(3 << 30) | (0x3c << 15)" and "(3 << 30) | (15 << 15)".
> Can you check that please and I will resend my patch.
Yes, I think WDTP(0) is correct for Book E.
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-11-03 16:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-07 12:48 [PATCH] powerpc: Fix Book-E watchdog timer interval setting Matthias Fuchs
2008-08-07 13:19 ` Kumar Gala
2008-08-07 14:04 ` Matthias Fuchs
2008-09-19 21:28 ` Matthias Fuchs
2008-09-19 21:44 ` Kumar Gala
2008-09-23 15:04 ` [PATCH V2] " Matthias Fuchs
2008-09-23 16:31 ` Timur Tabi
2008-11-03 8:56 ` Matthias Fuchs
2008-11-03 16:28 ` Timur Tabi
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).