Timing with TOY on Au1100
PATCH 1/1 Timing with TOY on Au1100
I've checked the TOY programming on a board Au1100 based and I notice that the frequency is not correct. Infact the TOY frequency is just HZ/2... I suggest this patch that should fix this topic.
The patch also try to fix (in a poor manner) a problem related with the jiffie_drift and the fact that HZ may be in the range [100:1000].
The last block (@@ -189,15 +196,11 @@) remove a bug during system wake up when HZ is 1000. The while() may loose too much time computing the last_match20 parameter and if TOY must run at 1K the system hangs since the TOY is programmed with an alredy passed time stamp.
Ciao,
Rodolfo
Index: common/time.c
===================================================================
RCS file: /home/develop/cvs_private/linux-mips-exadron/arch/mips/au1000/common/time.c,v retrieving revision 1.3
common/time.c +11 -9
@@ -142,7 +143,7 @@ time_elapsed = pc0 - last_match20; } -while (time_elapsed >0 ) { + do { do_timer(regs); #ifndef CONFIG_SMP update_process_times(user_mode(regs));
@@ -150,14 +151,19 @@ time_elapsed -=MATCH20_INC ; last_match20 +=MATCH20_INC ; jiffie_drift++; - } + }while (time_elapsed >MATCH20_INC ); last_pc0 = pc0;au_writel (last_match20 +MATCH20_INC ,SYS_TOYMATCH2 );au_sync (); -/* our counter ticks at 10.009765625 ms/tick, we we're running -* almost 10uS too slow per tick. +#if HZ <400 +/* our counter ticks at +* HZ = 100 -> 10.009765625 ms/tick +* HZ = 400 -> 2.50244140625 ms/tick +* HZ = 500 -> 1.983642578125 ms/tick +* HZ = 1000 -> 0.9765625 ms/tick +* so HZ = 400 may be a good discriminating point... */ if (jiffie_drift >=999 ) {
@@ -167,6 +173,7 @@update_process_times (user_mode (regs)); #endif } +#endif return IRQ_HANDLED ; }
@@ -189,15 +196,11 @@ time_elapsed = pc0 - last_match20; } -while (time_elapsed >0 ) { - time_elapsed -=MATCH20_INC ; - last_match20 +=MATCH20_INC ; - } + last_match20 += time_elapsed - time_elapsed%MATCH20_INC ; last_pc0 = pc0;au_writel (last_match20 +MATCH20_INC ,SYS_TOYMATCH2 );au_sync (); - }/* This is just for debugging to set the timer for a sleep delay.
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems [email protected] UNIX programming phone: +39 349 2432127