2009-06-20 20:11:57

by Philippe De Muyter

[permalink] [raw]
Subject: [PATCH] m68k: restore lost coldfire CLOCK_TICK_RATE

Hello list,

The good definition of CLOCK_TICK_RATE for coldfires has been lost in the
merge of m68k and m68knommu include files. Restore it. Culprit :
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=ebafc17468d58bd903c886175ca84a4edc69ae1d;hp=34055b806a6334624e7e8af6eefc3aee42372a85

Signed-off-by: Philippe De Muyter <[email protected]>

diff -r 8dcc271a81a8 arch/m68k/include/asm/timex.h
--- a/arch/m68k/include/asm/timex.h Thu Jun 18 14:07:46 2009 -0700
+++ b/arch/m68k/include/asm/timex.h Sat Jun 20 21:46:25 2009 +0200
@@ -3,10 +3,23 @@
*
* m68k architecture timex specifications
*/
-#ifndef _ASMm68k_TIMEX_H
-#define _ASMm68k_TIMEX_H
+#ifndef _ASMm68K_TIMEX_H
+#define _ASMm68K_TIMEX_H

+#ifdef CONFIG_COLDFIRE
+/*
+ * CLOCK_TICK_RATE should give the underlying frequency of the tick timer
+ * to make ntp work best. For Coldfires, that's the main clock.
+ */
+#include <asm/coldfire.h>
+#define CLOCK_TICK_RATE MCF_CLK
+#else
+/*
+ * This default CLOCK_TICK_RATE is probably wrong for many 68k boards
+ * Users of those boards will need to check and modify accordingly
+ */
#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
+#endif

typedef unsigned long cycles_t;


2009-06-22 03:19:11

by Greg Ungerer

[permalink] [raw]
Subject: Re: [uClinux-dev] [PATCH] m68k: restore lost coldfire CLOCK_TICK_RATE

HI Philippe,

Philippe De Muyter wrote:
> Hello list,
>
> The good definition of CLOCK_TICK_RATE for coldfires has been lost in the
> merge of m68k and m68knommu include files. Restore it. Culprit :
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=ebafc17468d58bd903c886175ca84a4edc69ae1d;hp=34055b806a6334624e7e8af6eefc3aee42372a85
>
> Signed-off-by: Philippe De Muyter <[email protected]>

Is it needed?
What is broken with the existing value?

Regards
Greg



> diff -r 8dcc271a81a8 arch/m68k/include/asm/timex.h
> --- a/arch/m68k/include/asm/timex.h Thu Jun 18 14:07:46 2009 -0700
> +++ b/arch/m68k/include/asm/timex.h Sat Jun 20 21:46:25 2009 +0200
> @@ -3,10 +3,23 @@
> *
> * m68k architecture timex specifications
> */
> -#ifndef _ASMm68k_TIMEX_H
> -#define _ASMm68k_TIMEX_H
> +#ifndef _ASMm68K_TIMEX_H
> +#define _ASMm68K_TIMEX_H
>
> +#ifdef CONFIG_COLDFIRE
> +/*
> + * CLOCK_TICK_RATE should give the underlying frequency of the tick timer
> + * to make ntp work best. For Coldfires, that's the main clock.
> + */
> +#include <asm/coldfire.h>
> +#define CLOCK_TICK_RATE MCF_CLK
> +#else
> +/*
> + * This default CLOCK_TICK_RATE is probably wrong for many 68k boards
> + * Users of those boards will need to check and modify accordingly
> + */
> #define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
> +#endif
>
> typedef unsigned long cycles_t;
>
> _______________________________________________
> uClinux-dev mailing list
> [email protected]
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by [email protected]
> To unsubscribe see:
> http://mailman.uclinux.org/mailman/options/uclinux-dev
>

--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-06-24 21:11:55

by Philippe De Muyter

[permalink] [raw]
Subject: Re: [uClinux-dev] [PATCH] m68k: restore lost coldfire CLOCK_TICK_RATE

Hi Greg,

On Mon, Jun 22, 2009 at 01:18:55PM +1000, Greg Ungerer wrote:
> HI Philippe,
>
> Philippe De Muyter wrote:
>> Hello list,
>> The good definition of CLOCK_TICK_RATE for coldfires has been lost in the
>> merge of m68k and m68knommu include files. Restore it. Culprit :
>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=ebafc17468d58bd903c886175ca84a4edc69ae1d;hp=34055b806a6334624e7e8af6eefc3aee42372a85
>> Signed-off-by: Philippe De Muyter <[email protected]>
>
> Is it needed?
> What is broken with the existing value?

I am no ntp expert, but IIRC kernel/time/ntp.c needs to know the remainder
of CLOCK_TICK_RATE / HZ to obtain a good stability of the time. That's
probably only needed when you have ntpd running.

Philippe

2009-06-25 00:33:40

by Greg Ungerer

[permalink] [raw]
Subject: Re: [uClinux-dev] [PATCH] m68k: restore lost coldfire CLOCK_TICK_RATE

Hi Philippe,

Philippe De Muyter wrote:
> Hi Greg,
>
> On Mon, Jun 22, 2009 at 01:18:55PM +1000, Greg Ungerer wrote:
>> HI Philippe,
>>
>> Philippe De Muyter wrote:
>>> Hello list,
>>> The good definition of CLOCK_TICK_RATE for coldfires has been lost in the
>>> merge of m68k and m68knommu include files. Restore it. Culprit :
>>> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=ebafc17468d58bd903c886175ca84a4edc69ae1d;hp=34055b806a6334624e7e8af6eefc3aee42372a85
>>> Signed-off-by: Philippe De Muyter <[email protected]>
>> Is it needed?
>> What is broken with the existing value?
>
> I am no ntp expert, but IIRC kernel/time/ntp.c needs to know the remainder
> of CLOCK_TICK_RATE / HZ to obtain a good stability of the time. That's
> probably only needed when you have ntpd running.

I thought it did that based on gettimeofday()? And that ends up
going through the underlying timer code, which for both of
the ColdFire timer types doesn't use CLOCK_TICK_RATE. They directly
use the MCF_CLK definition.

Regards
Greg



------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: [email protected]
SnapGear Group, McAfee PHONE: +61 7 3435 2888
825 Stanley St, FAX: +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com

2009-06-25 11:30:26

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [uClinux-dev] [PATCH] m68k: restore lost coldfire CLOCK_TICK_RATE

On Thursday 25 June 2009, Greg Ungerer wrote:
> I thought it did that based on gettimeofday()? And that ends up
> going through the underlying timer code, which for both of
> the ColdFire timer types doesn't use CLOCK_TICK_RATE. They directly
> use the MCF_CLK definition.

The problem is the definition of TICK_NSEC, which is calculated from
CLOCK_TICK_RATE. If you use the i8253 PIT tick rate, this will be
slightly different from the regular TICK_NSEC value of (1000000000 / HZ).

Arnd <><