Skip to contentSkip to conversation

arm926ejs, timer:

U-Boot Heiko Schocher 5 participants 10 messages Dec 10, 2010 – Dec 16, 2010

lore
Share & tools
lore
#0 lore raw

Hello,

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

Or are there pending patches, which fix this issues for some (all) arm926ejs architectures?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

Dear Heiko Schocher,

Quoted 9 lines

Hello,

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

I would suggest to take tbu, tbl, lastinc out of the AT91FAMILY #ifdef to the generic part.

Quoted 3 lines

Or are there pending patches, which fix this issues for some (all) arm926ejs architectures?

at91 timer is still not perfect, it will break after 2**64 ticks. That is well after the end of the Solar System :)

Best Regards,
Reinhard

#2 lore raw
Quoted 11 lines · Reinhard Meyer

Dear Heiko Schocher,

Quoted 9 lines

Hello,

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

Quoted 2 lines

I would suggest to take tbu, tbl, lastinc out of the AT91FAMILY #ifdef to the generic part.

maybe "unify" last{inc,dec} into last_hw ? Because they are supposedly the last (hardware) decrementer/incrementer values from the previous call.

Quoted 5 lines
Quoted 3 lines

Or are there pending patches, which fix this issues for some (all) arm926ejs architectures?

at91 timer is still not perfect, it will break after 2**64 ticks. That is well after the end of the Solar System :)

#3 lore raw

Sorry for the noise, but...

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

Quoted 6 lines
Quoted 2 lines

I would suggest to take tbu, tbl, lastinc out of the AT91FAMILY #ifdef to the generic part.

maybe "unify" last{inc,dec} into last_hw ? Because they are supposedly the last (hardware) decrementer/incrementer values from the previous call.

define 4 u32's in the generic part:

u32 timer_use1;
u32 timer_use2;
u32 timer_use3;
u32 timer_use4;

and have the timer implementations themselves use defines to make them more readable.

#define lastinc gd->timer_use1

A future AT91 timer might not use tbu/tbl, but would need 4 values to keep track of 2 independant timers for udelay() and a 1kHz base for *_timer().

Reinhard

#4 lore raw

Hello Reinhard,

Quoted 11 lines · Reinhard Meyer

Sorry for the noise, but...

Quoted 9 lines
Quoted 9 lines
Quoted 7 lines

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

I would suggest to take tbu, tbl, lastinc out of the AT91FAMILY #ifdef to the generic part.

Thats already done ;-)

Quoted 5 lines
Quoted 3 lines

maybe "unify" last{inc,dec} into last_hw ? Because they are supposedly the last (hardware) decrementer/incrementer values from the previous call.

define 4 u32's in the generic part:

Quoted 8 lines

u32 timer_use1;
u32 timer_use2;
u32 timer_use3;
u32 timer_use4;

and have the timer implementations themselves use defines to make them more readable.

#define lastinc gd->timer_use1

Yep, that would be a good idea, but that will break again all arm boards, so I have to fixup all timer.c implementations ... in the first step, I think, I do a

#define lastinc gd->lastdec

for the arm926ejs boards which use lastinc ...

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#9 lore raw
In reply to Heiko Schocher
Quoted 10 lines · Heiko Schocher

Hello,

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

Quoted 2 lines

Or are there pending patches, which fix this issues for some (all) arm926ejs architectures?

There is an outstanding patch for davinci:

http://patchwork.ozlabs.org/patch/74860/

Nick.

#5 lore raw
In reply to Reinhard Meyer

Dear Reinhard Meyer,

Quoted 15 lines · In message <[email protected]> you wrote:

Sorry for the noise, but...

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

Quoted 6 lines
Quoted 2 lines

I would suggest to take tbu, tbl, lastinc out of the AT91FAMILY #ifdef to the generic part.

maybe "unify" last{inc,dec} into last_hw ? Because they are supposedly the last (hardware) decrementer/incrementer values from the previous call.

Quoted 6 lines

define 4 u32's in the generic part:

u32 timer_use1;
u32 timer_use2;
u32 timer_use3;
u32 timer_use4;

NAK. Please let's agree on common names. Eventually we will even come up with a common implementation later (with just arch-specific "accessor" routines).

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
As far as the laws of mathematics refer  to  reality,  they  are  not
certain;  and  as  far  as  they  are  certain,  they do not refer to
reality.                                           -- Albert Einstein
#6 lore raw

Dear Wolfgang Denk,

Quoted 20 lines

Dear Reinhard Meyer,

Quoted 17 lines · In message<[email protected]> you wrote:

Sorry for the noise, but...

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

Quoted 6 lines
Quoted 2 lines

I would suggest to take tbu, tbl, lastinc out of the AT91FAMILY #ifdef to the generic part.

maybe "unify" last{inc,dec} into last_hw ? Because they are supposedly the last (hardware) decrementer/incrementer values from the previous call.

define 4 u32's in the generic part:

Quoted 8 lines
Quoted 4 lines

u32 timer_use1;
u32 timer_use2;
u32 timer_use3;
u32 timer_use4;

NAK. Please let's agree on common names. Eventually we will even come up with a common implementation later (with just arch-specific "accessor" routines).

Replace "arch" by "SoC" here! ARM itself does not have a timer (in contrast to powerpc where tbu,tbl is part of the architecture) !

Then its a bad idea to take tbu,tbl out of the #ifdef AT91FAMILY part when all other ARM timer implementations do not use tbu.

Its simple to NAK attempts to come up with "common" names that are NOT misnomers on some implementations... tbu, tbl are certainly misnomers on all non AT91 timer implementations...

Reinhard

#7 lore raw

Le 13/12/2010 01:27, Reinhard Meyer a ?crit :

Quoted 33 lines

Dear Wolfgang Denk,

Quoted 20 lines

Dear Reinhard Meyer,

Quoted 17 lines · In message<[email protected]> you wrote:

Sorry for the noise, but...

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

just looked in the timer implementation for arm926ejs based boards, and found that there is just the at91, davinci, nomadik timer implementation fixed in actual u-boot. I want to cleanup this timers too, but there are kirkwood, mb86r0x, orion5x, spear, versatile archs which use a lastdec var, which is not in global_data.h defined. So the question is should we add a lastdec to global_data.h or is it Ok, if I use lastinc for cleaning up?

Quoted 6 lines
Quoted 2 lines

I would suggest to take tbu, tbl, lastinc out of the AT91FAMILY #ifdef to the generic part.

maybe "unify" last{inc,dec} into last_hw ? Because they are supposedly the last (hardware) decrementer/incrementer values from the previous call.

define 4 u32's in the generic part:

Quoted 8 lines
Quoted 4 lines

u32 timer_use1;
u32 timer_use2;
u32 timer_use3;
u32 timer_use4;

NAK. Please let's agree on common names. Eventually we will even come up with a common implementation later (with just arch-specific "accessor" routines).

Replace "arch" by "SoC" here! ARM itself does not have a timer (in contrast to powerpc where tbu,tbl is part of the architecture) !

Quoted 6 lines

Then its a bad idea to take tbu,tbl out of the #ifdef AT91FAMILY part when all other ARM timer implementations do not use tbu.

Its simple to NAK attempts to come up with "common" names that are NOT misnomers on some implementations... tbu, tbl are certainly misnomers on all non AT91 timer implementations...

I think Wolfgang NAK'ed the idea of *complete* misnomers; timer_use{1,2,3,4} are good for cross-board unicity but bad for readability and maintenability -- you'd need to re-#define their names for each arch, or SoC, or even maybe for some boards.

What we need, IIUC, is a (group of) field(s) that will provide a monotonous value of the time elapsed computed from the HW timer devoted to this use and name that accordingly.

My understanding is that there will be a need for at least one field for storing the last hardware time as directly read from the timer, because we'll need it to detect overruns if the timer alone does not provide the range that we require, and one other field for the 'more significant part' which is basically carried over through HW value overrun detection.

One could argue that only one field could be necessary, the lower bits of which would be the HW timer reads and the higher bits being fed from the overrun, but managing bitfieds would complicate the issue, plus maybe not all timers are free-running full-range powers of two?

Also, as for the size, there does not seem to be a consensus, but maybe we can choose 64 bits (and create such a type if necessary) for each and then SoCs or arches will cast that as necessary of 64-bit arithmetic is a problem. Or we can do a union, with 64 and 32 bit variants.

So, what about:

u64 timer_hw_reading;
u64 timer_sw_carry_over;

Quoted 1 line

Reinhard

Amicalement,

Signature · 1 line
Albert.
#8 lore raw
In reply to Reinhard Meyer

Dear Reinhard Meyer,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 4 lines

NAK. Please let's agree on common names. Eventually we will even come up with a common implementation later (with just arch-specific "accessor" routines).

Replace "arch" by "SoC" here! ARM itself does not have a timer (in contrast to powerpc where tbu,tbl is part of the architecture) !

Quoted 6 lines

Then its a bad idea to take tbu,tbl out of the #ifdef AT91FAMILY part when all other ARM timer implementations do not use tbu.

Its simple to NAK attempts to come up with "common" names that are NOT misnomers on some implementations... tbu, tbl are certainly misnomers on all non AT91 timer implementations...

Maybe we should lean back and have a look at what Linux is doing in this area?

The recent patch series "64-bit sched_clock" on the lak ML seems to fit pretty well :-)

See http://thread.gmane.org/gmane.linux.ports.arm.kernel/99740

Can we copy from Linux?

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... The things love can drive a man to -- the  ecstasies,  the  mise-
ries,  the broken rules, the desperate chances, the glorious failures
and the glorious victories.
	-- McCoy, "Requiem for Methuselah", stardate 5843.7