linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* patch against linuxppc_2_4_devel: ppc405_wdt.c needs to be fixed
@ 2003-06-04  7:10 Matthias Fuchs
  2003-06-04 13:06 ` Kenneth Johansson
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Fuchs @ 2003-06-04  7:10 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

Hi,

I noticed that the 405 watchdog driver's ioctl() for GETPERIOD and SETPERIOD
are not working correctly. The ioctls pass the watchdog timer period in microseconds.
The variable wdt_period stores the current period in seconds.

The attached patch fixes this behavior.

Matthias

[-- Attachment #2: ppc405_wdt.p --]
[-- Type: text/plain, Size: 681 bytes --]

--- drivers/char/ppc405_wdt.c	Wed Jun  4 08:58:42 2003
+++ /usr/src/linuxppc_2_4_devel/drivers/char/ppc405_wdt.c	Tue Dec 24 06:00:15 2002
@@ -190,8 +190,7 @@
 			}
 		case WDIOC_GETPERIOD:
 			/* return watchdog period (units = microseconds) */
-			period = wdt_period * MICROSECBASE;
-
+			period = (wdt_period / HZ) * MICROSECBASE;
 			if (copy_to_user((unsigned long *)arg, &period,
 			    sizeof(period))) {
 				return -EFAULT;
@@ -234,7 +233,8 @@
 			if (period == 0)
 				period = MAXONEHOUR * MICROSECBASE;

-			wdt_period = period / MICROSECBASE;
+			heartbeat_count(0) = (period / TENMSBASE) +
+				(period % TENMSBASE ? 1 : 0);
 			ppc405wd_update_timer();

 			break;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch against linuxppc_2_4_devel: ppc405_wdt.c needs to be fixed
  2003-06-04  7:10 patch against linuxppc_2_4_devel: ppc405_wdt.c needs to be fixed Matthias Fuchs
@ 2003-06-04 13:06 ` Kenneth Johansson
  2003-06-04 13:51   ` Matthias Fuchs
  0 siblings, 1 reply; 3+ messages in thread
From: Kenneth Johansson @ 2003-06-04 13:06 UTC (permalink / raw)
  To: Matthias Fuchs; +Cc: linuxppc-embedded@lists.linuxppc.org


Dose the watchdog actually work ??

What happens when you get into a infinite loop when interrupts are
turned off?

On Wed, 2003-06-04 at 09:10, Matthias Fuchs wrote:
> Hi,
>
> I noticed that the 405 watchdog driver's ioctl() for GETPERIOD and SETPERIOD
> are not working correctly. The ioctls pass the watchdog timer period in microseconds.
> The variable wdt_period stores the current period in seconds.
>
> The attached patch fixes this behavior.
>
> Matthias
> ----
>

> --- drivers/char/ppc405_wdt.c	Wed Jun  4 08:58:42 2003
> +++ /usr/src/linuxppc_2_4_devel/drivers/char/ppc405_wdt.c	Tue Dec 24 06:00:15 2002
> @@ -190,8 +190,7 @@
>  			}
>  		case WDIOC_GETPERIOD:
>  			/* return watchdog period (units = microseconds) */
> -			period = wdt_period * MICROSECBASE;
> -
> +			period = (wdt_period / HZ) * MICROSECBASE;
>  			if (copy_to_user((unsigned long *)arg, &period,
>  			    sizeof(period))) {
>  				return -EFAULT;
> @@ -234,7 +233,8 @@
>  			if (period == 0)
>  				period = MAXONEHOUR * MICROSECBASE;
>
> -			wdt_period = period / MICROSECBASE;
> +			heartbeat_count(0) = (period / TENMSBASE) +
> +				(period % TENMSBASE ? 1 : 0);
>  			ppc405wd_update_timer();
>
>  			break;
--
Kenneth Johansson
Ericsson AB                       Tel: +46 8 719 70 20
Tellusborgsvägen  90              Fax: +46 8 719 29 45
126 25 Stockholm                  ken@switchboard.ericsson.se


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: patch against linuxppc_2_4_devel: ppc405_wdt.c needs to be fixed
  2003-06-04 13:06 ` Kenneth Johansson
@ 2003-06-04 13:51   ` Matthias Fuchs
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Fuchs @ 2003-06-04 13:51 UTC (permalink / raw)
  To: Kenneth Johansson; +Cc: linuxppc-embedded


Hi Kenneth,

it seems that the 405 watchdog does not really work. It's something like a soft-watchdog
actually. I did not test it in a loop with irqs off.

At least my patch corrected the ioctls and I get a working software watchdog.
I wonder what happened to the 405 hardware watchdog support.

Matthias

Kenneth Johansson wrote:
> Dose the watchdog actually work ??
>
> What happens when you get into a infinite loop when interrupts are
> turned off?
>


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-04 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-04  7:10 patch against linuxppc_2_4_devel: ppc405_wdt.c needs to be fixed Matthias Fuchs
2003-06-04 13:06 ` Kenneth Johansson
2003-06-04 13:51   ` Matthias Fuchs

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).