API Rewrite
Subsystems (27)
PATCH v2 7/7 Timer: Remove reset_timer_masked()
In reply to Graeme RussIn some circumstances, reset_timer_masked() was called be timer_init() in order to perform architecture specific timer initialisation. In such cases, the required code in reset_timer_masked() has been moved into timer_init()
---
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Updated description
arch/arm/cpu/arm1136/mx31/timer.c | 7 ------- arch/arm/cpu/arm1136/omap24xx/timer.c | 14 +++++++------- arch/arm/cpu/arm1176/s3c64xx/timer.c | 7 ------- arch/arm/cpu/arm720t/interrupts.c | 7 ------- arch/arm/cpu/arm920t/at91/timer.c | 8 -------- arch/arm/cpu/arm920t/at91rm9200/timer.c | 7 ------- arch/arm/cpu/arm920t/ep93xx/timer.c | 10 +++------- arch/arm/cpu/arm920t/imx/timer.c | 10 +++------- arch/arm/cpu/arm920t/ks8695/timer.c | 15 +++++---------- arch/arm/cpu/arm920t/s3c24x0/timer.c | 7 ------- arch/arm/cpu/arm925t/timer.c | 12 +++--------- arch/arm/cpu/arm926ejs/armada100/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/kirkwood/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/mb86r0x/timer.c | 14 +++----------- arch/arm/cpu/arm926ejs/mx25/timer.c | 9 --------- arch/arm/cpu/arm926ejs/mx27/timer.c | 9 --------- arch/arm/cpu/arm926ejs/orion5x/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/pantheon/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/spear/timer.c | 11 +++-------- arch/arm/cpu/armv7/mx5/timer.c | 10 ++++------ arch/arm/cpu/armv7/omap-common/timer.c | 11 +++-------- arch/arm/cpu/armv7/tegra2/timer.c | 7 ------- arch/arm/cpu/pxa/timer.c | 8 +------- arch/arm/cpu/s3c44b0/timer.c | 7 ------- arch/arm/cpu/sa1100/timer.c | 6 ------ board/armltd/integrator/timer.c | 13 ++++--------- 26 files changed, 47 insertions(+), 202 deletions(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -7
@@ -106,13 +106,6 @@ int timer_init (void)return 0 ; } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->lastinc =GPTCNT ;/* capture current incrementer value time */ - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -unsigned long long get_ticks (void ) {ulong now =GPTCNT ;/* current tick value */
arch/arm/cpu/arm1136/omap24xx/timer.c +7 -7
@@ -41,6 +41,13 @@DECLARE_GLOBAL_DATA_PTR ; +static void reset_timer_masked (void ) +{ +/* reset time */ + gd->lastinc =READ_TIMER ;/* capture current incrementer value time */ + gd->tbl =0 ;/* start "advancing" time stamp from 0 */ +} +int timer_init (void ) {int32_t val;
@@ -85,13 +92,6 @@ void __udelay (unsigned long usec)/*NOP*/ ; } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->lastinc =READ_TIMER ;/* capture current incrementer value time */ - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;/* current tick value */
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -7
@@ -135,13 +135,6 @@ ulong get_tbclk(void)return (ulong)(timer_load_val /100 ); } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =read_timer (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {unsigned long long res =get_ticks ();
arch/arm/cpu/arm720t/interrupts.c +0 -7
@@ -233,13 +233,6 @@ void __udelay (unsigned long usec)#endif } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;
arch/arm/cpu/arm920t/at91/timer.c +0 -8
@@ -82,14 +82,6 @@ void __udelay(unsigned long usec)udelay_masked (usec); } -void reset_timer_masked (void ) -{ -/* reset time */ -at91_tc_t *tc = (at91_tc_t *)ATMEL_BASE_TC ; - gd->lastinc =readl (&tc->tc[0 ].cv) &0x0000ffff ; - gd->tbl =0 ; -} -ulong get_timer_raw (void ) {at91_tc_t *tc = (at91_tc_t *)ATMEL_BASE_TC ;
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -7
@@ -81,13 +81,6 @@ void __udelay (unsigned long usec)udelay_masked (usec); } -void reset_timer_masked (void ) -{ -/* reset time */ - lastinc =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_raw (void ) {ulong now =READ_TIMER ;
arch/arm/cpu/arm920t/ep93xx/timer.c +3 -7
@@ -91,12 +91,6 @@ unsigned long get_timer(unsigned long base)return get_timer_masked () - base; } -void reset_timer_masked (void ) -{ -read_timer (); - timer.ticks =0 ; -} -void __udelay (unsigned long usec) {unsigned long long target;
@@ -123,7 +117,9 @@ int timer_init(void)writel (TIMER_ENABLE |TIMER_CLKSEL , &timer_regs->timer3.control); -reset_timer_masked (); +/* Reset the timer */ +read_timer (); + timer.ticks =0 ;return 0 ; }
arch/arm/cpu/arm920t/imx/timer.c +3 -7
@@ -43,7 +43,9 @@ int timer_init (void)TPRER1 =get_PERCLK1 () /1000000 ;/* 1 MHz */ TCTL1 |=TCTL_FRR | (1 <<1 );/* Freerun Mode, PERCLK1 input */ -reset_timer_masked (); +/* Reset the timer */ +TCTL1 &= ~TCTL_TEN ; +TCTL1 |=TCTL_TEN ;/* Enable timer */ return (0 ); }
@@ -56,12 +58,6 @@ ulong get_timer (ulong base)return get_timer_masked () - base; } -void reset_timer_masked (void ) -{ -TCTL1 &= ~TCTL_TEN ; -TCTL1 |=TCTL_TEN ;/* Enable timer */ -} -ulong get_timer_masked (void ) {return TCN1 ;
arch/arm/cpu/arm920t/ks8695/timer.c +5 -10
@@ -33,7 +33,11 @@ ulong timer_ticks;int timer_init (void ) { -reset_timer_masked (); +/* Set the hadware timer for 1ms */ +ks8695_write (KS8695_TIMER1 ,TIMER_COUNT ); +ks8695_write (KS8695_TIMER1_PCOUNT ,TIMER_PULSE ); +ks8695_write (KS8695_TIMER_CTRL ,0x2 ); + timer_ticks =0 ;return 0 ; }
@@ -46,15 +50,6 @@ int timer_init (void)#define TIMER_COUNT (TIMER_INTERVAL / 2)#define TIMER_PULSE TIMER_COUNT -void reset_timer_masked (void ) -{ -/* Set the hadware timer for 1ms */ -ks8695_write (KS8695_TIMER1 ,TIMER_COUNT ); -ks8695_write (KS8695_TIMER1_PCOUNT ,TIMER_PULSE ); -ks8695_write (KS8695_TIMER_CTRL ,0x2 ); - timer_ticks =0 ; -} -ulong get_timer_masked (void ) {/* Check for timer wrap */
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -7
@@ -101,13 +101,6 @@ void __udelay (unsigned long usec)/*NOP*/ ; } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong tmr =get_ticks ();
arch/arm/cpu/arm925t/timer.c +3 -9
@@ -56,7 +56,9 @@ int timer_init (void) CONFIG_SYS_TIMERBASE + CNTL_TIMER);/* init the timestamp and lastdec value */ -reset_timer_masked (); + lastdec =__raw_readl (CONFIG_SYS_TIMERBASE +READ_TIM ) / + (TIMER_CLOCK /CONFIG_SYS_HZ ); + timestamp =0 ;/* start "advancing" time stamp from 0 */ return 0 ; }
@@ -85,14 +87,6 @@ void __udelay (unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =__raw_readl (CONFIG_SYS_TIMERBASE +READ_TIM ) / - (TIMER_CLOCK /CONFIG_SYS_HZ ); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) { uint32_t now = __raw_readl(CONFIG_SYS_TIMERBASE + READ_TIM) /
arch/arm/cpu/arm926ejs/armada100/timer.c +2 -8
@@ -77,13 +77,6 @@ ulong read_timer(void)return (readl (&armd1timers->cvwr)); } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->tbl =read_timer (); - gd->tbu =0 ; -} -ulong get_timer_masked (void ) {ulong now =read_timer ();
@@ -142,7 +135,8 @@ int timer_init(void)/* Enable timer 0 */ writel (0x1 , &armd1timers->cer);/* init the gd->tbu and gd->tbl value */ -reset_timer_masked (); + gd->tbl =read_timer (); + gd->tbu =0 ;return 0 ; }
arch/arm/cpu/arm926ejs/kirkwood/timer.c +2 -8
@@ -88,13 +88,6 @@ DECLARE_GLOBAL_DATA_PTR;#define timestamp gd->tbl#define lastdec gd->lastinc -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;
@@ -154,7 +147,8 @@ int timer_init(void)writel (cntmrctrl,CNTMR_CTRL_REG );/* init the timestamp and lastdec value */ -reset_timer_masked (); + lastdec =READ_TIMER ; + timestamp =0 ;return 0 ; }
arch/arm/cpu/arm926ejs/mb86r0x/timer.c +3 -11
@@ -68,7 +68,9 @@ int timer_init(void)writel (ctrl, &timer->control); -reset_timer_masked (); +/* capture current value time */ + lastdec =readl (&timer->value); + timestamp =0 ;/* start "advancing" time stamp from 0 */ return 0 ; }
@@ -94,16 +96,6 @@ unsigned long long get_ticks(void)return timestamp; } -void reset_timer_masked (void ) -{ -struct mb86r0x_timer * timer = (struct mb86r0x_timer *) - MB86R0x_TIMER_BASE; - -/* capture current value time */ - lastdec =readl (&timer->value); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {return tick_to_time (get_ticks ());
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -9
@@ -121,15 +121,6 @@ int timer_init(void)return 0 ; } -void reset_timer_masked (void ) -{ -struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE ; -/* reset time */ -/* capture current incrementer value time */ - lastinc =readl (&gpt->counter); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -unsigned long long get_ticks (void ) {struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE ;
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -9
@@ -124,15 +124,6 @@ int timer_init(void)return 0 ; } -void reset_timer_masked (void ) -{ -struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE ; -/* reset time */ -/* capture current incrementer value time */ - lastinc =readl (®s->gpt_tcn); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -unsigned long long get_ticks (void ) {struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE ;
arch/arm/cpu/arm926ejs/orion5x/timer.c +2 -8
@@ -95,13 +95,6 @@ DECLARE_GLOBAL_DATA_PTR;#define timestamp gd->tbl#define lastdec gd->lastinc -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =read_timer (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =read_timer ();
@@ -171,5 +164,6 @@ int timer_init(void)void timer_init_r (void ) {/* init the timestamp and lastdec value */ -reset_timer_masked (); + lastdec =read_timer (); + timestamp =0 ; }
arch/arm/cpu/arm926ejs/pantheon/timer.c +2 -8
@@ -85,13 +85,6 @@ ulong read_timer(void)return val; } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->tbl =read_timer (); - gd->tbu =0 ; -} -ulong get_timer_masked (void ) {ulong now =read_timer ();
@@ -151,7 +144,8 @@ int timer_init(void)/* Enable timer 0 */ writel (0x1 , &panthtimers->cer);/* init the gd->tbu and gd->tbl value */ -reset_timer_masked (); + gd->tbl =read_timer (); + gd->tbu =0 ;return 0 ; }
arch/arm/cpu/arm926ejs/spear/timer.c +3 -8
@@ -68,7 +68,9 @@ int timer_init(void)/* auto reload, start timer */ writel (readl (&gpt_regs_p->control) |GPT_ENABLE , &gpt_regs_p->control); -reset_timer_masked (); +/* Reset the timer */ + lastdec =READ_TIMER (); + timestamp =0 ;return 0 ; }
@@ -97,13 +99,6 @@ void __udelay(unsigned long usec) ; } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ();
arch/arm/cpu/armv7/mx5/timer.c +4 -6
@@ -52,6 +52,7 @@ DECLARE_GLOBAL_DATA_PTR;int timer_init (void ) {int i; +ulong val;/* setup GP Timer 1 */ __raw_writel (GPTCR_SWR , &cur_gpt->control);
@@ -65,15 +66,12 @@ int timer_init(void)/* Freerun Mode, PERCLK1 input */ i =__raw_readl (&cur_gpt->control);__raw_writel (i |GPTCR_CLKSOURCE_32 |GPTCR_TEN , &cur_gpt->control); -reset_timer_masked (); -return 0 ; -} -void reset_timer_masked (void ) -{ -ulong val =__raw_readl (&cur_gpt->counter); + val =__raw_readl (&cur_gpt->counter); lastinc = val / (CONFIG_SYS_MX5_CLK32 /CONFIG_SYS_HZ ); timestamp =0 ; + +return 0 ; }ulong get_timer_masked (void )
arch/arm/cpu/armv7/omap-common/timer.c +3 -8
@@ -55,7 +55,9 @@ int timer_init(void)writel ((CONFIG_SYS_PTV <<2 ) |TCLR_PRE |TCLR_AR |TCLR_ST , &timer_base->tclr); -reset_timer_masked ();/* init the timestamp and lastinc value */ +/* reset time, capture current incrementer value time */ + gd->lastinc =readl (&timer_base->tcrr) / (TIMER_CLOCK /CONFIG_SYS_HZ ); + gd->tbl =0 ;/* start "advancing" time stamp from 0 */ return 0 ; }
@@ -84,13 +86,6 @@ void __udelay(unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* reset time, capture current incrementer value time */ - gd->lastinc =readl (&timer_base->tcrr) / (TIMER_CLOCK /CONFIG_SYS_HZ ); - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {/* current tick value */
arch/arm/cpu/armv7/tegra2/timer.c +0 -7
@@ -69,13 +69,6 @@ void __udelay(unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* reset time, capture current incrementer value time */ - gd->lastinc =readl (&timer_base->cntr_1us) / (TIMER_CLK /CONFIG_SYS_HZ ); - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {ulong now;
arch/arm/cpu/pxa/timer.c +1 -7
@@ -59,7 +59,7 @@ static inline unsigned long long us_to_tick(unsigned long long us)int timer_init (void ) { -reset_timer_masked (); +writel (0 ,OSCR );return 0 ; }
@@ -74,12 +74,6 @@ void __udelay (unsigned long usec)udelay_masked (usec); } - -void reset_timer_masked (void ) -{ -writel (0 ,OSCR ); -} -ulong get_timer_masked (void ) {return tick_to_time (get_ticks ());
arch/arm/cpu/s3c44b0/timer.c +0 -7
@@ -78,13 +78,6 @@ void __udelay (unsigned long usec)/*NOP*/ ; } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;
arch/arm/cpu/sa1100/timer.c +0 -6
@@ -44,12 +44,6 @@ void __udelay (unsigned long usec)udelay_masked (usec); } - -void reset_timer_masked (void ) -{ -OSCR =0 ; -} -ulong get_timer_masked (void ) {return OSCR ;
board/armltd/integrator/timer.c +4 -9
@@ -95,7 +95,10 @@ int timer_init (void)/* init the timestamp */ total_count =0ULL ; -reset_timer_masked (); +/* capure current decrementer value */ + lastdec =READ_TIMER ; +/* start "advancing" time stamp from 0 */ + timestamp =0L ; div_timer =CONFIG_SYS_HZ_CLOCK ;do_div (div_timer,CONFIG_SYS_HZ );
@@ -129,14 +132,6 @@ void __udelay (unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* capure current decrementer value */ - lastdec =READ_TIMER ; -/* start "advancing" time stamp from 0 */ - timestamp =0L ; -} -/* converts the timer reading to U-Boot ticks */ /* the timestamp is the number of ticks since reset */ ulong get_timer_masked (void )
--
1.7.5.2.317.g391b14
PATCH v3 7/7 Timer: Remove reset_timer_masked()
In some circumstances, reset_timer_masked() was called by timer_init() in order to perform architecture specific timer initialisation. In such cases, the required code in reset_timer_masked() has been moved into timer_init()
---
Changes since v2:
- Added Signed-off-by
- Fixed typo in description (be->by)
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Updated description
arch/arm/cpu/arm1136/mx31/timer.c | 7 ------- arch/arm/cpu/arm1136/omap24xx/timer.c | 14 +++++++------- arch/arm/cpu/arm1176/s3c64xx/timer.c | 7 ------- arch/arm/cpu/arm720t/interrupts.c | 7 ------- arch/arm/cpu/arm920t/at91/timer.c | 8 -------- arch/arm/cpu/arm920t/at91rm9200/timer.c | 7 ------- arch/arm/cpu/arm920t/ep93xx/timer.c | 10 +++------- arch/arm/cpu/arm920t/imx/timer.c | 10 +++------- arch/arm/cpu/arm920t/ks8695/timer.c | 15 +++++---------- arch/arm/cpu/arm920t/s3c24x0/timer.c | 7 ------- arch/arm/cpu/arm925t/timer.c | 12 +++--------- arch/arm/cpu/arm926ejs/armada100/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/kirkwood/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/mb86r0x/timer.c | 14 +++----------- arch/arm/cpu/arm926ejs/mx25/timer.c | 9 --------- arch/arm/cpu/arm926ejs/mx27/timer.c | 9 --------- arch/arm/cpu/arm926ejs/orion5x/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/pantheon/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/spear/timer.c | 11 +++-------- arch/arm/cpu/armv7/mx5/timer.c | 10 ++++------ arch/arm/cpu/armv7/omap-common/timer.c | 11 +++-------- arch/arm/cpu/armv7/tegra2/timer.c | 7 ------- arch/arm/cpu/pxa/timer.c | 8 +------- arch/arm/cpu/s3c44b0/timer.c | 7 ------- arch/arm/cpu/sa1100/timer.c | 6 ------ board/armltd/integrator/timer.c | 13 ++++--------- 26 files changed, 47 insertions(+), 202 deletions(-)
arch/arm/cpu/arm1136/mx31/timer.c +0 -7
@@ -106,13 +106,6 @@ int timer_init (void)return 0 ; } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->lastinc =GPTCNT ;/* capture current incrementer value time */ - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -unsigned long long get_ticks (void ) {ulong now =GPTCNT ;/* current tick value */
arch/arm/cpu/arm1136/omap24xx/timer.c +7 -7
@@ -41,6 +41,13 @@DECLARE_GLOBAL_DATA_PTR ; +static void reset_timer_masked (void ) +{ +/* reset time */ + gd->lastinc =READ_TIMER ;/* capture current incrementer value time */ + gd->tbl =0 ;/* start "advancing" time stamp from 0 */ +} +int timer_init (void ) {int32_t val;
@@ -85,13 +92,6 @@ void __udelay (unsigned long usec)/*NOP*/ ; } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->lastinc =READ_TIMER ;/* capture current incrementer value time */ - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;/* current tick value */
arch/arm/cpu/arm1176/s3c64xx/timer.c +0 -7
@@ -135,13 +135,6 @@ ulong get_tbclk(void)return (ulong)(timer_load_val /100 ); } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =read_timer (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {unsigned long long res =get_ticks ();
arch/arm/cpu/arm720t/interrupts.c +0 -7
@@ -233,13 +233,6 @@ void __udelay (unsigned long usec)#endif } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;
arch/arm/cpu/arm920t/at91/timer.c +0 -8
@@ -82,14 +82,6 @@ void __udelay(unsigned long usec)udelay_masked (usec); } -void reset_timer_masked (void ) -{ -/* reset time */ -at91_tc_t *tc = (at91_tc_t *)ATMEL_BASE_TC ; - gd->lastinc =readl (&tc->tc[0 ].cv) &0x0000ffff ; - gd->tbl =0 ; -} -ulong get_timer_raw (void ) {at91_tc_t *tc = (at91_tc_t *)ATMEL_BASE_TC ;
arch/arm/cpu/arm920t/at91rm9200/timer.c +0 -7
@@ -81,13 +81,6 @@ void __udelay (unsigned long usec)udelay_masked (usec); } -void reset_timer_masked (void ) -{ -/* reset time */ - lastinc =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_raw (void ) {ulong now =READ_TIMER ;
arch/arm/cpu/arm920t/ep93xx/timer.c +3 -7
@@ -91,12 +91,6 @@ unsigned long get_timer(unsigned long base)return get_timer_masked () - base; } -void reset_timer_masked (void ) -{ -read_timer (); - timer.ticks =0 ; -} -void __udelay (unsigned long usec) {unsigned long long target;
@@ -123,7 +117,9 @@ int timer_init(void)writel (TIMER_ENABLE |TIMER_CLKSEL , &timer_regs->timer3.control); -reset_timer_masked (); +/* Reset the timer */ +read_timer (); + timer.ticks =0 ;return 0 ; }
arch/arm/cpu/arm920t/imx/timer.c +3 -7
@@ -43,7 +43,9 @@ int timer_init (void)TPRER1 =get_PERCLK1 () /1000000 ;/* 1 MHz */ TCTL1 |=TCTL_FRR | (1 <<1 );/* Freerun Mode, PERCLK1 input */ -reset_timer_masked (); +/* Reset the timer */ +TCTL1 &= ~TCTL_TEN ; +TCTL1 |=TCTL_TEN ;/* Enable timer */ return (0 ); }
@@ -56,12 +58,6 @@ ulong get_timer (ulong base)return get_timer_masked () - base; } -void reset_timer_masked (void ) -{ -TCTL1 &= ~TCTL_TEN ; -TCTL1 |=TCTL_TEN ;/* Enable timer */ -} -ulong get_timer_masked (void ) {return TCN1 ;
arch/arm/cpu/arm920t/ks8695/timer.c +5 -10
@@ -33,7 +33,11 @@ ulong timer_ticks;int timer_init (void ) { -reset_timer_masked (); +/* Set the hadware timer for 1ms */ +ks8695_write (KS8695_TIMER1 ,TIMER_COUNT ); +ks8695_write (KS8695_TIMER1_PCOUNT ,TIMER_PULSE ); +ks8695_write (KS8695_TIMER_CTRL ,0x2 ); + timer_ticks =0 ;return 0 ; }
@@ -46,15 +50,6 @@ int timer_init (void)#define TIMER_COUNT (TIMER_INTERVAL / 2)#define TIMER_PULSE TIMER_COUNT -void reset_timer_masked (void ) -{ -/* Set the hadware timer for 1ms */ -ks8695_write (KS8695_TIMER1 ,TIMER_COUNT ); -ks8695_write (KS8695_TIMER1_PCOUNT ,TIMER_PULSE ); -ks8695_write (KS8695_TIMER_CTRL ,0x2 ); - timer_ticks =0 ; -} -ulong get_timer_masked (void ) {/* Check for timer wrap */
arch/arm/cpu/arm920t/s3c24x0/timer.c +0 -7
@@ -101,13 +101,6 @@ void __udelay (unsigned long usec)/*NOP*/ ; } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong tmr =get_ticks ();
arch/arm/cpu/arm925t/timer.c +3 -9
@@ -56,7 +56,9 @@ int timer_init (void) CONFIG_SYS_TIMERBASE + CNTL_TIMER);/* init the timestamp and lastdec value */ -reset_timer_masked (); + lastdec =__raw_readl (CONFIG_SYS_TIMERBASE +READ_TIM ) / + (TIMER_CLOCK /CONFIG_SYS_HZ ); + timestamp =0 ;/* start "advancing" time stamp from 0 */ return 0 ; }
@@ -85,14 +87,6 @@ void __udelay (unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =__raw_readl (CONFIG_SYS_TIMERBASE +READ_TIM ) / - (TIMER_CLOCK /CONFIG_SYS_HZ ); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) { uint32_t now = __raw_readl(CONFIG_SYS_TIMERBASE + READ_TIM) /
arch/arm/cpu/arm926ejs/armada100/timer.c +2 -8
@@ -77,13 +77,6 @@ ulong read_timer(void)return (readl (&armd1timers->cvwr)); } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->tbl =read_timer (); - gd->tbu =0 ; -} -ulong get_timer_masked (void ) {ulong now =read_timer ();
@@ -142,7 +135,8 @@ int timer_init(void)/* Enable timer 0 */ writel (0x1 , &armd1timers->cer);/* init the gd->tbu and gd->tbl value */ -reset_timer_masked (); + gd->tbl =read_timer (); + gd->tbu =0 ;return 0 ; }
arch/arm/cpu/arm926ejs/kirkwood/timer.c +2 -8
@@ -88,13 +88,6 @@ DECLARE_GLOBAL_DATA_PTR;#define timestamp gd->tbl#define lastdec gd->lastinc -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;
@@ -154,7 +147,8 @@ int timer_init(void)writel (cntmrctrl,CNTMR_CTRL_REG );/* init the timestamp and lastdec value */ -reset_timer_masked (); + lastdec =READ_TIMER ; + timestamp =0 ;return 0 ; }
arch/arm/cpu/arm926ejs/mb86r0x/timer.c +3 -11
@@ -68,7 +68,9 @@ int timer_init(void)writel (ctrl, &timer->control); -reset_timer_masked (); +/* capture current value time */ + lastdec =readl (&timer->value); + timestamp =0 ;/* start "advancing" time stamp from 0 */ return 0 ; }
@@ -94,16 +96,6 @@ unsigned long long get_ticks(void)return timestamp; } -void reset_timer_masked (void ) -{ -struct mb86r0x_timer * timer = (struct mb86r0x_timer *) - MB86R0x_TIMER_BASE; - -/* capture current value time */ - lastdec =readl (&timer->value); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {return tick_to_time (get_ticks ());
arch/arm/cpu/arm926ejs/mx25/timer.c +0 -9
@@ -121,15 +121,6 @@ int timer_init(void)return 0 ; } -void reset_timer_masked (void ) -{ -struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE ; -/* reset time */ -/* capture current incrementer value time */ - lastinc =readl (&gpt->counter); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -unsigned long long get_ticks (void ) {struct gpt_regs *gpt = (struct gpt_regs *)IMX_GPT1_BASE ;
arch/arm/cpu/arm926ejs/mx27/timer.c +0 -9
@@ -124,15 +124,6 @@ int timer_init(void)return 0 ; } -void reset_timer_masked (void ) -{ -struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE ; -/* reset time */ -/* capture current incrementer value time */ - lastinc =readl (®s->gpt_tcn); - timestamp =0 ;/* start "advancing" time stamp from 0 */ -} -unsigned long long get_ticks (void ) {struct gpt_regs *regs = (struct gpt_regs *)IMX_TIM1_BASE ;
arch/arm/cpu/arm926ejs/orion5x/timer.c +2 -8
@@ -95,13 +95,6 @@ DECLARE_GLOBAL_DATA_PTR;#define timestamp gd->tbl#define lastdec gd->lastinc -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =read_timer (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =read_timer ();
@@ -171,5 +164,6 @@ int timer_init(void)void timer_init_r (void ) {/* init the timestamp and lastdec value */ -reset_timer_masked (); + lastdec =read_timer (); + timestamp =0 ; }
arch/arm/cpu/arm926ejs/pantheon/timer.c +2 -8
@@ -85,13 +85,6 @@ ulong read_timer(void)return val; } -void reset_timer_masked (void ) -{ -/* reset time */ - gd->tbl =read_timer (); - gd->tbu =0 ; -} -ulong get_timer_masked (void ) {ulong now =read_timer ();
@@ -151,7 +144,8 @@ int timer_init(void)/* Enable timer 0 */ writel (0x1 , &panthtimers->cer);/* init the gd->tbu and gd->tbl value */ -reset_timer_masked (); + gd->tbl =read_timer (); + gd->tbu =0 ;return 0 ; }
arch/arm/cpu/arm926ejs/spear/timer.c +3 -8
@@ -68,7 +68,9 @@ int timer_init(void)/* auto reload, start timer */ writel (readl (&gpt_regs_p->control) |GPT_ENABLE , &gpt_regs_p->control); -reset_timer_masked (); +/* Reset the timer */ + lastdec =READ_TIMER (); + timestamp =0 ;return 0 ; }
@@ -97,13 +99,6 @@ void __udelay(unsigned long usec) ; } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER (); - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ();
arch/arm/cpu/armv7/mx5/timer.c +4 -6
@@ -52,6 +52,7 @@ DECLARE_GLOBAL_DATA_PTR;int timer_init (void ) {int i; +ulong val;/* setup GP Timer 1 */ __raw_writel (GPTCR_SWR , &cur_gpt->control);
@@ -65,15 +66,12 @@ int timer_init(void)/* Freerun Mode, PERCLK1 input */ i =__raw_readl (&cur_gpt->control);__raw_writel (i |GPTCR_CLKSOURCE_32 |GPTCR_TEN , &cur_gpt->control); -reset_timer_masked (); -return 0 ; -} -void reset_timer_masked (void ) -{ -ulong val =__raw_readl (&cur_gpt->counter); + val =__raw_readl (&cur_gpt->counter); lastinc = val / (CONFIG_SYS_MX5_CLK32 /CONFIG_SYS_HZ ); timestamp =0 ; + +return 0 ; }ulong get_timer_masked (void )
arch/arm/cpu/armv7/omap-common/timer.c +3 -8
@@ -55,7 +55,9 @@ int timer_init(void)writel ((CONFIG_SYS_PTV <<2 ) |TCLR_PRE |TCLR_AR |TCLR_ST , &timer_base->tclr); -reset_timer_masked ();/* init the timestamp and lastinc value */ +/* reset time, capture current incrementer value time */ + gd->lastinc =readl (&timer_base->tcrr) / (TIMER_CLOCK /CONFIG_SYS_HZ ); + gd->tbl =0 ;/* start "advancing" time stamp from 0 */ return 0 ; }
@@ -84,13 +86,6 @@ void __udelay(unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* reset time, capture current incrementer value time */ - gd->lastinc =readl (&timer_base->tcrr) / (TIMER_CLOCK /CONFIG_SYS_HZ ); - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {/* current tick value */
arch/arm/cpu/armv7/tegra2/timer.c +0 -7
@@ -69,13 +69,6 @@ void __udelay(unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* reset time, capture current incrementer value time */ - gd->lastinc =readl (&timer_base->cntr_1us) / (TIMER_CLK /CONFIG_SYS_HZ ); - gd->tbl =0 ;/* start "advancing" time stamp from 0 */ -} -ulong get_timer_masked (void ) {ulong now;
arch/arm/cpu/pxa/timer.c +1 -7
@@ -59,7 +59,7 @@ static inline unsigned long long us_to_tick(unsigned long long us)int timer_init (void ) { -reset_timer_masked (); +writel (0 ,OSCR );return 0 ; }
@@ -74,12 +74,6 @@ void __udelay (unsigned long usec)udelay_masked (usec); } - -void reset_timer_masked (void ) -{ -writel (0 ,OSCR ); -} -ulong get_timer_masked (void ) {return tick_to_time (get_ticks ());
arch/arm/cpu/s3c44b0/timer.c +0 -7
@@ -78,13 +78,6 @@ void __udelay (unsigned long usec)/*NOP*/ ; } -void reset_timer_masked (void ) -{ -/* reset time */ - lastdec =READ_TIMER ; - timestamp =0 ; -} -ulong get_timer_masked (void ) {ulong now =READ_TIMER ;
arch/arm/cpu/sa1100/timer.c +0 -6
@@ -44,12 +44,6 @@ void __udelay (unsigned long usec)udelay_masked (usec); } - -void reset_timer_masked (void ) -{ -OSCR =0 ; -} -ulong get_timer_masked (void ) {return OSCR ;
board/armltd/integrator/timer.c +4 -9
@@ -95,7 +95,10 @@ int timer_init (void)/* init the timestamp */ total_count =0ULL ; -reset_timer_masked (); +/* capure current decrementer value */ + lastdec =READ_TIMER ; +/* start "advancing" time stamp from 0 */ + timestamp =0L ; div_timer =CONFIG_SYS_HZ_CLOCK ;do_div (div_timer,CONFIG_SYS_HZ );
@@ -129,14 +132,6 @@ void __udelay (unsigned long usec) } } -void reset_timer_masked (void ) -{ -/* capure current decrementer value */ - lastdec =READ_TIMER ; -/* start "advancing" time stamp from 0 */ - timestamp =0L ; -} -/* converts the timer reading to U-Boot ticks */ /* the timestamp is the number of ticks since reset */ ulong get_timer_masked (void )
--
1.7.5.2.317.g391b14
Wolfgang Denk
AppliedPATCH v3 7/7 Timer: Remove reset_timer_masked()
Dear Graeme Russ,
Quoted 34 lines · In message <[email protected]> you wrote:
In some circumstances,
reset_timer_masked()was called bytimer_init()in order to perform architecture specific timer initialisation. In such cases, the required code inreset_timer_masked()has been moved intotimer_init()Signed-off-by Graeme Russ <[email protected]>---
Changes since v2:
- Added Signed-off-by
- Fixed typo in description (be->by)Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Updated descriptionarch/arm/cpu/arm1136/mx31/timer.c | 7 ------- arch/arm/cpu/arm1136/omap24xx/timer.c | 14 +++++++------- arch/arm/cpu/arm1176/s3c64xx/timer.c | 7 ------- arch/arm/cpu/arm720t/interrupts.c | 7 ------- arch/arm/cpu/arm920t/at91/timer.c | 8 -------- arch/arm/cpu/arm920t/at91rm9200/timer.c | 7 ------- arch/arm/cpu/arm920t/ep93xx/timer.c | 10 +++------- arch/arm/cpu/arm920t/imx/timer.c | 10 +++------- arch/arm/cpu/arm920t/ks8695/timer.c | 15 +++++---------- arch/arm/cpu/arm920t/s3c24x0/timer.c | 7 ------- arch/arm/cpu/arm925t/timer.c | 12 +++--------- arch/arm/cpu/arm926ejs/armada100/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/kirkwood/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/mb86r0x/timer.c | 14 +++----------- arch/arm/cpu/arm926ejs/mx25/timer.c | 9 --------- arch/arm/cpu/arm926ejs/mx27/timer.c | 9 --------- arch/arm/cpu/arm926ejs/orion5x/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/pantheon/timer.c | 10 ++-------- arch/arm/cpu/arm926ejs/spear/timer.c | 11 +++--------
Quoted 8 lines
arch/arm/cpu/armv7/mx5/timer.c | 10 ++++------ arch/arm/cpu/armv7/omap-common/timer.c | 11 +++-------- arch/arm/cpu/armv7/tegra2/timer.c | 7 ------- arch/arm/cpu/pxa/timer.c | 8 +------- arch/arm/cpu/s3c44b0/timer.c | 7 ------- arch/arm/cpu/sa1100/timer.c | 6 ------ board/armltd/integrator/timer.c | 13 ++++--------- 26 files changed, 47 insertions(+), 202 deletions(-)
Applied, thanks.
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
No, I'm not going to explain it. If you can't figure it out, you
didn't want to know anyway... :-)
- Larry Wall in <[email protected]>PATCH 8/16 Create new userland timer API
In reply to Graeme Russ--- include/common.h | 36 ++++++++++++++++++++---------------- lib/time.c | 26 ++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 16 deletions(-)
include/common.h +20 -16
@@ -584,11 +584,29 @@ void timer_interrupt (struct pt_regs *);void external_interrupt (struct pt_regs *);void irq_install_handler (int ,interrupt_handler_t *,void *);void irq_free_handler (int ); -void reset_timer (void ); -ulong get_timer (ulong base);void enable_interrupts (void );int disable_interrupts (void ); +/* +* Timer API +*/ +void reset_timer (void ); +ulong get_timer (ulong base); +u64 get_ticks (void ); +void wait_ticks (unsigned long ); +void __udelay (unsigned long ); +ulong usec2ticks (unsigned long usec); +ulong ticks2usec (unsigned long ticks); +int init_timebase (void ); + +/* lib/time.c */ +void udelay (unsigned long ); + +u32 time_now_ms (void ); +u32 time_since_ms (u32 from,u32 to); +u32 time_max_since_ms (u32 from,u32 to); +u32 time_resolution_ms (void ); +/* $(CPU)/.../commproc.c */ int dpram_init (void );uint dpram_base (void );
@@ -616,17 +634,6 @@ void flush_cache (unsigned long, unsigned long);void flush_dcache_range (unsigned long start,unsigned long stop);void invalidate_dcache_range (unsigned long start,unsigned long stop); - -/* arch/$(ARCH)/lib/ticks.S */ -unsigned long long get_ticks (void ); -void wait_ticks (unsigned long ); - -/* arch/$(ARCH)/lib/time.c */ -void __udelay (unsigned long ); -ulong usec2ticks (unsigned long usec); -ulong ticks2usec (unsigned long ticks); -int init_timebase (void ); -/* lib/gunzip.c */ int gunzip (void *,int ,unsigned char *,unsigned long *); int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
@@ -644,9 +651,6 @@ void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));int strcmp_compar (const void *,const void *); -/* lib/time.c */ -void udelay (unsigned long ); -/* lib/vsprintf.c */ ulong simple_strtoul (const char *cp,char **endp,unsigned int base);int strict_strtoul (const char *cp,unsigned int base,unsigned long *res);
lib/time.c +26 -0
@@ -41,3 +41,29 @@ void udelay(unsigned long usec) usec -= kv; }while (usec); } + +u32 time_since_ms (u32 from) +{ +u32 delta =time_now_ms () - from; + +/* round down */ +if (delta <time_ms_resolution ()) +return 0 ; + +return delta -time_resolution_ms (); +} + +u32 time_max_since_ms (u32 from) +{ +u32 delta =time_now_ms () - from; + +return delta +time_resolution_ms (); +} + +__attribute__((weak)) +u32 time_resolution_ms (void ) {return 1 ;} + +u32 time_now_ms (void ) +{ +return get_timer (0 ); +}
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 8/16 Create new userland timer API
Hi Graeme,
What a mammoth effort and what a fantastic clean up.
I'm a bit unsure of this patch which seems to have two prototypes for the since functions:
Quoted 28 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>---
?include/common.h | ? 36 ++++++++++++++++++++---------------- ?lib/time.c ? ? ? | ? 26 ++++++++++++++++++++++++++ ?2 files changed, 46 insertions(+), 16 deletions(-)include/common.h +8
-2@@ -584,11 +584,29 @@ void ? ? ?timer_interrupt ? ?(struct pt_regs *); ?void ? external_interrupt (struct pt_regs *); ?void ? irq_install_handler(int, interrupt_handler_t *, void *); ?void ? irq_free_handler ? (int); -void ? reset_timer ? ? ? ?(void); -ulong ?get_timer ? ? ? ? ?(ulong base); ?void ? enable_interrupts ?(void); ?int ? ?disable_interrupts (void); +/* + * Timer API + */ +void reset_timer (void); +ulong get_timer (ulong base); +u64 get_ticks(void); +void wait_ticks(unsigned long); +void __udelay(unsigned long);
include/common.h void ? ? ?timer_interrupt ? ?(struct pt_regs *); · line 607
Quoted 10 lines
include/common.h +10
-0+ulong usec2ticks (unsigned long usec); +ulong ticks2usec (unsigned long ticks); +int init_timebase (void ); + +/* lib/time.c */ +void udelay (unsigned long ); + +u32 time_now_ms (void ); +u32 time_since_ms (u32 from,u32 to); +u32 time_max_since_ms (u32 from,u32 to);
Here they have two parameters
Quoted 38 lines
include/common.h +2
-0+u32 time_resolution_ms (void ); +?/* $(CPU)/.../commproc.c */
?int ? ?dpram_init (void);
?uint ?dpram_base(void);include/common.h +0
-11@@ -616,17 +634,6 @@ void ? ? ? flush_cache ? (unsigned long, unsigned long); ?void ? flush_dcache_range(unsigned long start, unsigned long stop); ?void ? invalidate_dcache_range(unsigned long start, unsigned long stop); - -/* arch/$(ARCH)/lib/ticks.S */ -unsigned long long get_ticks(void); -void ? wait_ticks ? ?(unsigned long); - -/* arch/$(ARCH)/lib/time.c */ -void ? __udelay ? ? ?(unsigned long); -ulong ?usec2ticks ? ?(unsigned long usec); -ulong ?ticks2usec ? ?(unsigned long ticks); -int ? ?init_timebase (void); -?/*
lib/gunzip.c*/
?intgunzip(void *, int, unsigned char *, unsigned long *); ?int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,include/common.h +0
-3@@ -644,9 +651,6 @@ void qsort(void *base, size_t nmemb, size_t size, ? ? ? ? ? int(*compar)(const void *, const void *)); ?int strcmp_compar(const void *, const void *); -/* lib/time.c */ -void ? udelay ? ? ? ?(unsigned long); -?/*
lib/vsprintf.c*/
?ulong ?simple_strtoul(const char *cp,char **endp,unsigned int base); ?intstrict_strtoul(const char *cp, unsigned int base, unsigned long *res);lib/time.c +0
-0
lib/time.c void udelay(unsigned long usec) · line 45
Quoted 5 lines
lib/time.c +2
-0@@ -41,3 +41,29 @@ void udelay(unsigned long usec) ? ? ? ? ? ? ? ?usec -= kv; ? ? ? ?} while(usec); ?} + +u32 time_since_ms (u32 from)
and here only one (which is what I expect).
Can you please explain what I am missing?
Thanks,
Simon
Quoted 32 lines
lib/time.c +24
-1+{ + ? ? ? u32 delta = time_now_ms() - from; + + ? ? ? /* round down */ + ? ? ? if (delta < time_ms_resolution()) + ? ? ? ? ? ? ? return 0; + + ? ? ? return delta - time_resolution_ms(); +} + +u32 time_max_since_ms (u32 from) +{ + ? ? ? u32 delta = time_now_ms() - from; + + ? ? ? return delta + time_resolution_ms(); +} + +__attribute__((weak)) +u32 time_resolution_ms (void ) {return 1 ;} + +u32 time_now_ms (void ) +{ + ? ? ? return get_timer(0); +} --1.7.5.2.317.g391b14
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 8/16 Create new userland timer API
Hi Simon,
Quoted 7 lines · Simon Glass
Hi Graeme,
What a mammoth effort and what a fantastic clean up.
I'm a bit unsure of this patch which seems to have two prototypes for the since functions:
[snip]
Quoted 6 lines
include/common.h void timer_interrupt (struct pt_regs *); · line 607
Quoted 3 lines
include/common.h +3
-0+u32 time_now_ms (void ); +u32 time_since_ms (u32 from,u32 to); +u32 time_max_since_ms (u32 from,u32 to);Here they have two parameters
[snip]
Quoted 6 lines
lib/time.c void udelay(unsigned long usec) · line 45
Quoted 2 lines
lib/time.c +2
-0+ +u32 time_since_ms (u32 from)and here only one (which is what I expect).
Can you please explain what I am missing?
The fact I haven't tried to build it yet ;)
I'll add that to the list of fixes for v2 - Thanks
Regards,
Graeme
PATCH 8/16 Create new userland timer API
Hi Graeme,
Quoted 4 lines · Graeme Russ
Hi Simon,
Quoted 1 line
Can you please explain what I am missing?
The fact I haven't tried to build it yet ;)
Oh, OK. That explains the mystery :-) I haven't built it yet either but it certainly looks good.
Regards,
Simon
Quoted 7 lines
I'll add that to the list of fixes for v2 - Thanks
Regards,
Graeme
PATCH 8/16 Create new userland timer API
In reply to Graeme RussDear Graeme Russ,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Graeme Russ <[email protected]>
Please define "userland" in U-Boot context ?
include/common.h void timer_interrupt (struct pt_regs *); · line 608
Quoted 4 lines
include/common.h +4
-0+u32 time_now_ms (void ); +u32 time_since_ms (u32 from,u32 to); +u32 time_max_since_ms (u32 from,u32 to); +u32 time_resolution_ms (void );
I'm unhappy about these. Sorry, but I don't want to have that. See previous message(s).
Best regards,
Wolfgang Denk
Signature · 5 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
I am not now, nor have I ever been, a member of the demigodic party.
-- Dennis RitchiePATCH 8/16 Create new userland timer API
Hi Wolfgang,
Quoted 7 lines · Wolfgang Denk
Dear Graeme Russ,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Graeme Russ <[email protected]>Please define "userland" in U-Boot context ?
Used outside of /arch (i.e. in board or driver code). Anything in arch/ binds the architecture specific implementation to lib/
Quoted 7 lines
include/common.h void timer_interrupt (struct pt_regs *); · line 608
Quoted 4 lines
include/common.h +4
-0+u32 time_now_ms (void ); +u32 time_since_ms (u32 from,u32 to); +u32 time_max_since_ms (u32 from,u32 to); +u32 time_resolution_ms (void );I'm unhappy about these. Sorry, but I don't want to have that. See previous message(s).
Will do
Thanks,
Graeme
PATCH 9/16 Replace get_timer() usage in drivers/block/
In reply to Graeme Russ--- drivers/block/mg_disk.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
drivers/block/mg_disk.c +4 -5
@@ -88,17 +88,16 @@ static void mg_dump_status (const char *msg, unsigned int stat, unsigned err)static unsigned int mg_wait (u32 expect,u32 msec) {u8 status; -u32 from, cur, err; +u32 ts, err; err =MG_ERR_NONE ;#ifdef CONFIG_NIOS2 reset_timer ();#endif - from =get_timer (0 ); + ts =time_now_ms (); status =readb (mg_base () +MG_REG_STATUS ); do { - cur = get_timer(from); if (status & MG_REG_STATUS_BIT_BUSY) { if (expect == MG_REG_STATUS_BIT_BUSY) break;
@@ -119,9 +118,9 @@ static unsigned int mg_wait (u32 expect, u32 msec)break ; } status =readb (mg_base () +MG_REG_STATUS ); - }while (cur < msec); + }while (time_since_ms (ts) < msec); -if (cur >= msec) +if (time_since_ms (ts) >= msec) err =MG_ERR_TIMEOUT ;return err;
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 9/16 Replace get_timer() usage in drivers/block/
Hi Graeme,
Quoted 27 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>---
?drivers/block/mg_disk.c | ? ?9 ++++-----
?1 files changed, 4 insertions(+), 5 deletions(-)drivers/block/mg_disk.c +1
-1@@ -88,17 +88,16 @@ static void mg_dump_status (const char *msg, unsigned int stat, unsigned err) ?static unsigned int mg_wait (u32 expect, u32 msec) ?{ ? ? ? ?u8 status; - ? ? ? u32 from, cur, err; + ? ? ? u32 ts, err; ? ? ? ?err = MG_ERR_NONE;?#ifdef
CONFIG_NIOS2
? ? ? ?reset_timer();
?#endif
- ? ? ? from =get_timer(0);
+ ? ? ? ts =time_now_ms();? ? ? ?status =
readb(mg_base() + MG_REG_STATUS);
? ? ? ?do {
- ? ? ? ? ? ? ? cur =get_timer(from);
...
Quoted 3 lines
- ? ? ? } while (cur < msec);
+ ? ? ? } while (time_since_ms(ts)< msec);
Well I know i have asked this before, but I feel I should ask again because I didn't like the answer much.
Imagine we change this code to:
ts = time_now_ms() + msec
do {
...
} while (time_since_ms(ts) < 0);
That should be legal, right? But I don't think this can work since the 'since' functions return an unsigned.
[aside: this provides for another idiom that I think we talked about:
ts = time_future_ms(msec)
do {
...
} while (!time_passed(ts))
which I am not@all suggesting should be in the API :-) end aside]
Regards.
Simon
Quoted 13 lines
- ? ? ? if (cur >= msec)
+ ? ? ? if (time_since_ms(ts)>= msec)
? ? ? ? ? ? ? ?err =MG_ERR_TIMEOUT;? ? ? ?return err;
--
1.7.5.2.317.g391b14_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 9/16 Replace get_timer() usage in drivers/block/
Dear All,
Quoted 15 lines
Well I know i have asked this before, but I feel I should ask again because I didn't like the answer much.
Imagine we change this code to:
ts =
time_now_ms()+ msec
do {
...
} while (time_since_ms(ts)< 0);That should be legal, right? But I don't think this can work since the 'since' functions return an unsigned.
[aside: this provides for another idiom that I think we talked about:
Quoted 7 lines
ts =
time_future_ms(msec)
do {
...
} while (!time_passed(ts))which I am not at all suggesting should be in the API :-) end aside]
I still vouch for this concept, which is simple, clean, and easy to understand.
Reinhard
PATCH 9/16 Replace get_timer() usage in drivers/block/
Hi Reinhard,
Quoted 22 lines · Reinhard Meyer
Dear All,
Quoted 21 lines
Well I know i have asked this before, but I feel I should ask again because I didn't like the answer much.
Imagine we change this code to:
ts =
time_now_ms()+ msec
do {
...
} while (time_since_ms(ts)< ?0);That should be legal, right? But I don't think this can work since the 'since' functions return an unsigned.
[aside: this provides for another idiom that I think we talked about:
ts =
time_future_ms(msec)
do {
...
} while (!time_passed(ts))
Quoted 5 lines
Quoted 2 lines
which I am not at all suggesting should be in the API :-) end aside]
I still vouch for this concept, which is simple, clean, and easy to understand.
It really is a matter of personal taste ;) I find
u32 start = time_now_ms();
do {
...blah...
} while(time_since_ms(start) < timeout);much easier to understand (Do whatever while time elapsed since I started is less than the timeout)
u32 end = time_future_ms(timeout);
do {
...blah...
} while(time_now_ms() < end);to me is a bit more clunky. Yes, it is probably computationally more efficient, but it does not naturally support:
u32 start = time_now_ms(); u32 duration; ...blah... duration = time_since_ms(start); /* or duration = time_max_since_ms(start); */
Which we want for profiling.
Also there are a few instances where there are multiple cascaded timeouts
u32 start = time_now_ms();
do {
...blah...
} while(time_since_ms(start) < timeout_1);
do {
...blah...
} while(time_since_ms(start) < timeout_2);Which means setting up all your timeouts in advance
Regards,
Graeme
PATCH 9/16 Replace get_timer() usage in drivers/block/
Hi Graeme,
Quoted 40 lines · Graeme Russ
Hi Reinhard,
Quoted 22 lines · Reinhard Meyer
Dear All,
Quoted 21 lines
Well I know i have asked this before, but I feel I should ask again because I didn't like the answer much.
Imagine we change this code to:
ts =
time_now_ms()+ msec
do {
...
} while (time_since_ms(ts)< ?0);That should be legal, right? But I don't think this can work since the 'since' functions return an unsigned.
[aside: this provides for another idiom that I think we talked about:
ts =
time_future_ms(msec)
do {
...
} while (!time_passed(ts))Quoted 5 lines
Quoted 2 lines
which I am not at all suggesting should be in the API :-) end aside]
I still vouch for this concept, which is simple, clean, and easy to understand.
It really is a matter of personal taste ;) I find
? ? ? ?u32 start =
time_now_ms();? ? ? ?do {
? ? ? ? ? ? ? ?...blah...
? ? ? ?}while(time_since_ms(start) < timeout);
Quoted 8 lines
much easier to understand (Do whatever while time elapsed since I started is less than the timeout)
? ? ? ?u32 end =
time_future_ms(timeout);? ? ? ?do {
? ? ? ? ? ? ? ?...blah...
? ? ? ?}while(time_now_ms() < end);
...
Actually:
} while (time_passed_ms(end))
but anyway I agree it is a matter of taste and I'm quite happy with the approach here@the moment.
But what about my question about signed ints for deltas?
Regards,
Simon
PATCH 9/16 Replace get_timer() usage in drivers/block/
Hi Simon,
Quoted 11 lines
Quoted 6 lines
? ? ? ?u32 end =
time_future_ms(timeout);? ? ? ?do {
? ? ? ? ? ? ? ?...blah...
? ? ? ?}while(time_now_ms() < end);...
Actually:
} while (
time_passed_ms(end))
Sorry, but I think you've lost me here...
Quoted 5 lines
but anyway I agree it is a matter of taste and I'm quite happy with the approach here at the moment.
But what about my question about signed ints for deltas?
We use signed int's to allow seamless roll-overs of the timer counter. One thing the API does not require is that a given low-level timer counts from zero - It can start with any value and therefore may roll-over at any time. By using unsigned provided there is at most one rollover between timing events (which for a 32-bit millisecond counter is a very long time) the logic remain trivial (time = end - start) - We don't have to try and detect the rollover.
Also, we assume the u-Boot will never be installed in a time machine, and will therefore never need to calculate negative time. Please let us know if you plan to boot a TARDIS using U-Boot ;)
Regards,
Graeme
PATCH 10/16 Replace get_timer() usage in driver/mtd and driver/block
In reply to Graeme RussThis prepares for final removal of reset_timer() from Nios2
--- drivers/mtd/cfi_flash.c | 12 ++++++------ drivers/mtd/nand/nand_base.c | 17 +++++++++-------- drivers/mtd/spi/eeprom_m95xxx.c | 6 +++--- drivers/mtd/spi/spi_flash.c | 6 +++--- 4 files changed, 21 insertions(+), 20 deletions(-)
drivers/mtd/cfi_flash.c +6 -6
@@ -563,7 +563,7 @@ static int flash_is_busy (flash_info_t * info, flash_sect_t sect)static int flash_status_check (flash_info_t * info,flash_sect_t sector,ulong tout,char *prompt) { -ulong start; +u32 start;#if CONFIG_SYS_HZ !=1000 if ((ulong )CONFIG_SYS_HZ >100000 )
@@ -576,9 +576,9 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,#ifdef CONFIG_NIOS2 reset_timer ();#endif - start =get_timer (0 ); + start =time_now_ms ();while (flash_is_busy (info, sector)) { -if (get_timer (start) > tout) { +if (time_since_ms (start) > tout) {printf ("Flash %s timeout at address %lx data %lx\n" , prompt, info->start[sector],flash_read_long (info, sector,0 ));
@@ -653,7 +653,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, ulong tout, char *prompt) { #ifdef CONFIG_SYS_CFI_FLASH_STATUS_POLL - ulong start; + u32 start;int ready;#if CONFIG_SYS_HZ !=1000
@@ -667,7 +667,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst,#ifdef CONFIG_NIOS2 reset_timer ();#endif - start =get_timer (0 ); + start =time_now_ms ();while (1 ) {switch (info->portwidth) {case FLASH_CFI_8BIT :
@@ -688,7 +688,7 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst, }if (ready)break ; -if (get_timer (start) > tout) { +if (time_since_ms (start) > tout) {printf ("Flash %s timeout at address %lx data %lx\n" , prompt, (ulong )dst, (ulong )flash_read8 (dst));return ERR_TIMOUT ;
drivers/mtd/nand/nand_base.c +9 -8
@@ -33,6 +33,7 @@*/ #include <common.h> +#include <time.h> #define ENOTSUPP 524/* Operation is not supported */
@@ -439,12 +440,12 @@ void nand_wait_ready(struct mtd_info *mtd) {struct nand_chip *chip = mtd->priv;u32 timeo = (CONFIG_SYS_HZ *20 ) /1000 ; -u32 time_start; +u32 start; - time_start =get_timer (0 ); + start =time_now_ms ();/* wait until command is processed or timeout occures */ -while (get_timer (time_start) < timeo) { +while (time_since_ms (start) < timeo) {if (chip->dev_ready)if (chip->dev_ready (mtd))break ;
@@ -705,7 +706,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this) {unsigned long timeo;int state = this->state; -u32 time_start; +u32 start;if (state ==FL_ERASING ) timeo = (CONFIG_SYS_HZ *400 ) /1000 ;
@@ -717,10 +718,10 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this)else this->cmdfunc (mtd,NAND_CMD_STATUS ,-1 ,-1 ); - time_start =get_timer (0 ); + start =time_now_ms ();while (1 ) { -if (get_timer (time_start) > timeo) { +if (time_since_ms (start) > timeo) {printf ("Timeout!" );return 0x01 ; }
@@ -734,8 +735,8 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this) } }#ifdef PPCHAMELON_NAND_TIMER_HACK - time_start =get_timer (0 ); -while (get_timer (time_start) <10 ) + start =time_now_ms (); +while (time_since_ms (start) <10 ) ;#endif /* PPCHAMELON_NAND_TIMER_HACK */
drivers/mtd/spi/eeprom_m95xxx.c +3 -3
@@ -75,7 +75,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len) {struct spi_slave *slave;char buf[3 ]; -ulong start; +u32 start; slave =spi_setup_slave (CONFIG_DEFAULT_SPI_BUS ,1 ,1000000 ,CONFIG_DEFAULT_SPI_MODE );
@@ -103,7 +103,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)if (spi_xfer (slave, len *8 , buffer,NULL ,SPI_XFER_END ))return -1 ; - start =get_timer (0 ); + start =time_now_ms (); do { buf[0] = SPI_EEPROM_RDSR; buf[1] = 0;
@@ -112,7 +112,7 @@ ssize_t spi_write (uchar *addr, int alen, uchar *buffer, int len)if (!(buf[1 ] &1 ))break ; - }while (get_timer (start) <CONFIG_SYS_SPI_WRITE_TOUT ); + }while (time_since_ms (start) <CONFIG_SYS_SPI_WRITE_TOUT );if (buf[1 ] &1 )printf ("*** spi_write: Time out while writing!\n" );
drivers/mtd/spi/spi_flash.c +3 -3
@@ -94,7 +94,7 @@ int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout, u8 cmd, u8 poll_bit) {struct spi_slave *spi = flash->spi; -unsigned long timebase; +u32 start;int ret;u8 status;
@@ -104,7 +104,7 @@ int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout,return ret; } - timebase =get_timer (0 ); + start =time_now_ms (); do { WATCHDOG_RESET();
@@ -115,7 +115,7 @@ int spi_flash_cmd_poll_bit(struct spi_flash *flash, unsigned long timeout,if ((status & poll_bit) ==0 )break ; - }while (get_timer (timebase) < timeout); + }while (time_since_ms (start) < timeout);spi_xfer (spi,0 ,NULL ,NULL ,SPI_XFER_END );
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 11/16 Remove reset_timer() completely
In reply to Graeme Russ--- arch/nios2/cpu/interrupts.c | 38 -------------------------------------- drivers/block/mg_disk.c | 3 --- drivers/mtd/cfi_flash.c | 6 ------ 3 files changed, 0 insertions(+), 47 deletions(-)
arch/nios2/cpu/interrupts.c +0 -38
@@ -54,44 +54,6 @@ static struct irq_action vecs[32];/*************************************************************************/ volatile ulong timestamp =0 ; -void reset_timer (void ) -{ -nios_timer_t *tmr =(nios_timer_t *)CONFIG_SYS_NIOS_TMRBASE ; - -/* From Embedded Peripherals Handbook: -* -* "When the hardware is configured with Writeable period -* disabled, writing to one of the period_n registers causes -* the counter to reset to the fixed Timeout Period specified -* at system generation time." -* -* Here we force a reload to prevent early timeouts from -* get_timer() when the interrupt period is greater than -* than 1 msec. -* -* Simply write to periodl with its own value to force an -* internal counter reload, THEN reset the timestamp. -*/ -writel (readl (&tmr->periodl), &tmr->periodl); - timestamp =0 ; - -/* From Embedded Peripherals Handbook: -* -* "Writing to one of the period_n registers stops the internal -* counter, except when the hardware is configured with Start/Stop -* control bits off. If Start/Stop control bits is off, writing -* either register does not stop the counter." -* -* In order to accomodate either configuration, the control -* register is re-written. If the counter is stopped, it will -* be restarted. If it is running, the write is essentially -* a nop. -*/ -writel (NIOS_TIMER_ITO |NIOS_TIMER_CONT |NIOS_TIMER_START , - &tmr->control); - -} -ulong get_timer (ulong base) {WATCHDOG_RESET ();
drivers/block/mg_disk.c +0 -3
@@ -91,9 +91,6 @@ static unsigned int mg_wait (u32 expect, u32 msec)u32 ts, err; err =MG_ERR_NONE ; -#ifdef CONFIG_NIOS2 -reset_timer (); -#endif ts =time_now_ms (); status =readb (mg_base () +MG_REG_STATUS );
drivers/mtd/cfi_flash.c +0 -6
@@ -573,9 +573,6 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,#endif /* Wait for command completion */ -#ifdef CONFIG_NIOS2 -reset_timer (); -#endif start =time_now_ms ();while (flash_is_busy (info, sector)) {if (time_since_ms (start) > tout) {
@@ -664,9 +661,6 @@ static int flash_status_poll(flash_info_t *info, void *src, void *dst,#endif /* Wait for command completion */ -#ifdef CONFIG_NIOS2 -reset_timer (); -#endif start =time_now_ms ();while (1 ) {switch (info->portwidth) {
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 12/16 Replace get_timer() usage in drivers/
In reply to Graeme Russ--- drivers/fpga/ACEX1K.c | 5 ++- drivers/fpga/cyclon2.c | 5 ++- drivers/fpga/spartan2.c | 30 +++++++++++-------- drivers/fpga/spartan3.c | 32 +++++++++++++-------- drivers/fpga/virtex2.c | 20 ++++++++----- drivers/i2c/bfin-twi_i2c.c | 6 ++-- drivers/i2c/spr_i2c.c | 28 ++++++++++-------- drivers/i2c/u8500_i2c.c | 8 ++-- drivers/input/ps2mult.c | 6 ++-- drivers/mmc/omap_hsmmc.c | 57 ++++++++++++++++++++----------------- drivers/mtd/spi/atmel.c | 4 +- drivers/net/4xx_enet.c | 8 ++--- drivers/net/bcm570x.c | 2 +- drivers/net/cs8900.c | 17 ++++++----- drivers/net/dm9000x.c | 6 ++-- drivers/net/ethoc.c | 6 ++-- drivers/net/fec_mxc.c | 18 ++++++------ drivers/net/ftgmac100.c | 6 ++-- drivers/net/ftmac100.c | 6 ++-- drivers/net/greth.c | 16 +++++----- drivers/net/lan91c96.c | 5 ++- drivers/net/ne2000_base.c | 6 ++-- drivers/net/netarm_eth.c | 12 ++++--- drivers/net/ns7520_eth.c | 5 ++- drivers/net/ns9750_eth.c | 4 +- drivers/net/rtl8139.c | 6 ++-- drivers/net/rtl8169.c | 26 ++++++++--------- drivers/net/smc91111.c | 4 +- drivers/serial/serial_clps7111.c | 6 ++-- drivers/serial/serial_netarm.c | 4 +- drivers/spi/atmel_dataflash_spi.c | 8 ++--- drivers/usb/gadget/ether.c | 25 ++++++++-------- drivers/usb/host/ehci-hcd.c | 8 ++-- drivers/usb/host/sl811-hcd.c | 5 ++- 34 files changed, 220 insertions(+), 190 deletions(-)
drivers/fpga/ACEX1K.c +3 -2
@@ -156,10 +156,11 @@ static int ACEX1K_ps_load (Altera_desc * desc, void *buf, size_t bsize)udelay (2 );/* T_cf2st1 < 4us */ /* Wait for nSTATUS to be released (i.e. deasserted) */ - ts =get_timer (0 );/* get current time */ + ts =timer_ms_now ();/* get current time */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + if (time_ms_delta_min(ts, timer_ms_now()) > + CONFIG_SYS_FPGA_WAIT) { /* check the time */ puts ("** Timeout waiting for STATUS to go high.\n"); (*fn->abort) (cookie); return FPGA_FAIL;
drivers/fpga/cyclon2.c +3 -2
@@ -139,10 +139,11 @@ static int CYC2_ps_load (Altera_desc * desc, void *buf, size_t bsize)udelay (2 );/* T_cfg > 2us */ /* Wait for nSTATUS to be asserted */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + /* check the time */ + if (time_since_ms(ts) > CONFIG_SYS_FPGA_WAIT) { puts ("** Timeout waiting for STATUS to go high.\n"); (*fn->abort) (cookie); return FPGA_FAIL;
drivers/fpga/spartan2.c +18 -12
@@ -168,11 +168,12 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->pgm) (FALSE, TRUE, cookie);/* Deassert the program, commit */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ /* Now wait for INIT and BUSY to go high */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + /* check the time */ + if (time_sine_ms(ts) > CONFIG_SYS_FPGA_WAIT) { puts ("** Timeout waiting for INIT to clear.\n"); (*fn->abort) (cookie); /* abort the burn */ return FPGA_FAIL;
@@ -195,7 +196,7 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->clk) (TRUE, TRUE, cookie);/* Assert the clock pin */ #ifdef CONFIG_SYS_FPGA_CHECK_BUSY - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ while ((*fn->busy) (cookie)) {/* XXX - we should have a check in here somewhere to * make sure we aren't busy forever... */
@@ -205,7 +206,8 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->clk) (TRUE, TRUE, cookie);/* Assert the clock pin */ -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT ) {/* check the time */ +/* check the time */ +if (time_since_ms (ts) >CONFIG_SYS_FPGA_WAIT ) {puts ("** Timeout waiting for BUSY to clear.\n" ); (*fn->abort) (cookie);/* abort the burn */ return FPGA_FAIL ;
@@ -228,7 +230,7 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)#endif /* now check for done signal */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ ret_val =FPGA_SUCCESS ;while ((*fn->done) (cookie) ==FPGA_FAIL ) {
@@ -237,7 +239,8 @@ static int Spartan2_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->clk) (TRUE, TRUE, cookie);/* Assert the clock pin */ -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT ) {/* check the time */ +/* check the time */ +if (time_sine_ms (ts) >CONFIG_SYS_FPGA_WAIT ) {puts ("** Timeout waiting for DONE to clear.\n" ); (*fn->abort) (cookie);/* abort the burn */ ret_val =FPGA_FAIL ;
@@ -354,10 +357,11 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->pgm) (TRUE, TRUE, cookie);/* Assert the program, commit */ /* Wait for INIT state (init low) */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + /* check the time */ + if (time_since_ms(ts) > CONFIG_SYS_FPGA_WAIT) { puts ("** Timeout waiting for INIT to start.\n"); return FPGA_FAIL; }
@@ -367,11 +371,12 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->pgm) (FALSE, TRUE, cookie);/* Deassert the program, commit */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ /* Now wait for INIT to go high */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + /* check the time */ + if (time_since_ms(ts) > CONFIG_SYS_FPGA_WAIT) { puts ("** Timeout waiting for INIT to clear.\n"); return FPGA_FAIL; }
@@ -415,7 +420,7 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)#endif /* now check for done signal */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ ret_val =FPGA_SUCCESS ; (*fn->wr) (TRUE, TRUE, cookie);
@@ -428,7 +433,8 @@ static int Spartan2_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)putc ('*' ); -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT ) {/* check the time */ +/* check the time */ +if (time_since_ms (ts) >CONFIG_SYS_FPGA_WAIT ) {puts ("** Timeout waiting for DONE to clear.\n" ); ret_val =FPGA_FAIL ;break ;
drivers/fpga/spartan3.c +20 -12
@@ -173,11 +173,12 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->pgm) (FALSE, TRUE, cookie);/* Deassert the program, commit */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ /* Now wait for INIT and BUSY to go high */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + /* check the time */ + if (time_since_ms(ts) > CONFIG_SYS_FPGA_WAIT) { puts ("** Timeout waiting for INIT to clear.\n"); (*fn->abort) (cookie); /* abort the burn */ return FPGA_FAIL;
@@ -200,7 +201,7 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->clk) (TRUE, TRUE, cookie);/* Assert the clock pin */ #ifdef CONFIG_SYS_FPGA_CHECK_BUSY - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ while ((*fn->busy) (cookie)) {/* XXX - we should have a check in here somewhere to * make sure we aren't busy forever... */
@@ -210,7 +211,8 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->clk) (TRUE, TRUE, cookie);/* Assert the clock pin */ -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT ) {/* check the time */ +/* check the time */ +if (time_since_ms (ts) >CONFIG_SYS_FPGA_WAIT ) {puts ("** Timeout waiting for BUSY to clear.\n" ); (*fn->abort) (cookie);/* abort the burn */ return FPGA_FAIL ;
@@ -233,7 +235,7 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)#endif /* now check for done signal */ - ts =get_timer (0 );/* get current time */ + ts =time_since_ms ();/* get current time */ ret_val =FPGA_SUCCESS ;while ((*fn->done) (cookie) ==FPGA_FAIL ) {/* XXX - we should have a check in here somewhere to
@@ -244,7 +246,8 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->clk) (TRUE, TRUE, cookie);/* Assert the clock pin */ -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT ) {/* check the time */ +/* check the time */ +if (time_since_ms (ts) >CONFIG_SYS_FPGA_WAIT ) {puts ("** Timeout waiting for DONE to clear.\n" ); (*fn->abort) (cookie);/* abort the burn */ ret_val =FPGA_FAIL ;
@@ -361,10 +364,12 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->pgm) (TRUE, TRUE, cookie);/* Assert the program, commit */ /* Wait for INIT state (init low) */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + + /* check the time */ + if (time_since_ms(ts) > CONFIG_SYS_FPGA_WAIT) { puts ("** Timeout waiting for INIT to start.\n"); if (*fn->abort) (*fn->abort) (cookie);
@@ -376,11 +381,13 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)CONFIG_FPGA_DELAY (); (*fn->pgm) (FALSE, TRUE, cookie);/* Deassert the program, commit */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ /* Now wait for INIT to go high */ do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT) { /* check the time */ + + /* check the time */ + if (time_since_ms(ts) > CONFIG_SYS_FPGA_WAIT) { puts ("** Timeout waiting for INIT to clear.\n"); if (*fn->abort) (*fn->abort) (cookie);
@@ -432,7 +439,7 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)#endif /* now check for done signal */ - ts =get_timer (0 );/* get current time */ + ts =time_now_ms ();/* get current time */ ret_val =FPGA_SUCCESS ; (*fn->wr) (TRUE, TRUE, cookie);
@@ -447,7 +454,8 @@ static int Spartan3_ss_load (Xilinx_desc * desc, void *buf, size_t bsize)putc ('*' ); -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT ) {/* check the time */ +/* check the time */ +if (time_since_ms (ts) >CONFIG_SYS_FPGA_WAIT ) {puts ("** Timeout waiting for DONE to clear.\n" ); ret_val =FPGA_FAIL ;break ;
drivers/fpga/virtex2.c +12 -8
@@ -223,9 +223,10 @@ static int Virtex2_ssm_load (Xilinx_desc * desc, void *buf, size_t bsize)*/ (*fn->pgm) (TRUE, TRUE, cookie);udelay (10 ); - ts =get_timer (0 ); + ts =time_ms_now (); do { - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT_INIT) { + if (time_ms_delta_min(ts, timer_ms_now()) + > CONFIG_SYS_FPGA_WAIT_INIT) { printf ("%s:%d: ** Timeout after %d ticks waiting for INIT" " to assert.\n", __FUNCTION__, __LINE__, CONFIG_SYS_FPGA_WAIT_INIT);
@@ -241,10 +242,11 @@ static int Virtex2_ssm_load (Xilinx_desc * desc, void *buf, size_t bsize)/* * Start a timer and wait for INIT_B to go high */ - ts =get_timer (0 ); + ts =time_ms_now (); do { CONFIG_FPGA_DELAY (); - if (get_timer (ts) > CONFIG_SYS_FPGA_WAIT_INIT) { + if (time_ms_delta_min(ts, timer_ms_now()) + > CONFIG_SYS_FPGA_WAIT_INIT) { printf ("%s:%d: ** Timeout after %d ticks waiting for INIT" " to deassert.\n", __FUNCTION__, __LINE__, CONFIG_SYS_FPGA_WAIT_INIT);
@@ -297,9 +299,10 @@ static int Virtex2_ssm_load (Xilinx_desc * desc, void *buf, size_t bsize) (*fn->clk) (TRUE, TRUE, cookie);#ifdef CONFIG_SYS_FPGA_CHECK_BUSY - ts =get_timer (0 ); + ts =time_ms_now ();while ((*fn->busy) (cookie)) { -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT_BUSY ) { +if (time_ms_delta_min (ts,timer_ms_now ()) + >CONFIG_SYS_FPGA_WAIT_BUSY ) {printf ("%s:%d: ** Timeout after %d ticks waiting for" " BUSY to deassert\n" , __FUNCTION__, __LINE__,CONFIG_SYS_FPGA_WAIT_BUSY );
@@ -330,10 +333,11 @@ static int Virtex2_ssm_load (Xilinx_desc * desc, void *buf, size_t bsize)* Check for successful configuration. FPGA INIT_B and DONE should * both be high upon successful configuration. */ - ts =get_timer (0 ); + ts =time_ms_now (); ret_val =FPGA_SUCCESS ;while (((*fn->done) (cookie) ==FPGA_FAIL ) || (*fn->init) (cookie)) { -if (get_timer (ts) >CONFIG_SYS_FPGA_WAIT_CONFIG ) { +if (time_ms_delta_min (ts,timer_ms_now ()) + >CONFIG_SYS_FPGA_WAIT_CONFIG ) {printf ("%s:%d: ** Timeout after %d ticks waiting for DONE to" "assert and INIT to deassert\n" , __FUNCTION__, __LINE__,CONFIG_SYS_FPGA_WAIT_CONFIG );
drivers/i2c/bfin-twi_i2c.c +3 -3
@@ -94,7 +94,7 @@ struct i2c_msg {static int wait_for_completion (struct i2c_msg *msg) {uint16_t int_stat; -ulong timebase =get_timer (0 ); +u32 timebase =time_ms_now (); do { int_stat = twi->int_stat;
@@ -146,9 +146,9 @@ static int wait_for_completion(struct i2c_msg *msg)/* If we were able to do something, reset timeout */ if (int_stat) - timebase =get_timer (0 ); + timebase =time_ms_now (); - }while (get_timer (timebase) <I2C_TIMEOUT ); + } while time_ms_delta_min(timebase, timer_ms_now()) < I2C_TIMEOUT);return msg->len; }
drivers/i2c/spr_i2c.c +16 -12
@@ -168,13 +168,14 @@ static void i2c_flush_rxfifo(void)*/ static int i2c_wait_for_bb (void ) { -unsigned long start_time_bb =get_timer (0 ); +u32 start_time_bb =time_ms_now ();while ((readl (&i2c_regs_p->ic_status) &IC_STATUS_MA ) || !(readl (&i2c_regs_p->ic_status) &IC_STATUS_TFE )) {/* Evaluate timeout */ -if (get_timer (start_time_bb) > (unsigned long )(I2C_BYTE_TO_BB )) +if (time_ms_delta_min (start_time_bb,timer_ms_now ()) + > (unsigned long )(I2C_BYTE_TO_BB ))return 1 ; }
@@ -217,13 +218,14 @@ static int i2c_xfer_init(uchar chip, uint addr)static int i2c_xfer_finish (void ) { -ulong start_stop_det =get_timer (0 ); +u32 start_stop_det =time_ms_now ();while (1 ) {if ((readl (&i2c_regs_p->ic_raw_intr_stat) &IC_STOP_DET )) {readl (&i2c_regs_p->ic_clr_stop_det);break ; - }else if (get_timer (start_stop_det) >I2C_STOPDET_TO ) { + }else if (time_ms_delta_min (start_stop_det,timer_ms_now ()) + >I2C_STOPDET_TO ) {break ; } }
@@ -253,7 +255,7 @@ static int i2c_xfer_finish(void)*/ int i2c_read (uchar chip,uint addr,int alen,uchar *buffer,int len) { -unsigned long start_time_rx; +u32 start_time_rx;if (check_params (addr, alen, buffer, len))return 1 ;
@@ -261,16 +263,17 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)if (i2c_xfer_init (chip, addr))return 1 ; - start_time_rx =get_timer (0 ); + start_time_rx =time_ms_now ();while (len) {writel (IC_CMD , &i2c_regs_p->ic_cmd_data);if (readl (&i2c_regs_p->ic_status) &IC_STATUS_RFNE ) { *buffer++ = (uchar )readl (&i2c_regs_p->ic_cmd_data); len--; - start_time_rx =get_timer (0 ); + start_time_rx =time_ms_now (); - }else if (get_timer (start_time_rx) >I2C_BYTE_TO ) { + }else if (time_ms_delta_min (start_time_rx,timer_ms_now ()) + >I2C_BYTE_TO ) {printf ("Timed out. i2c read Failed\n" );return 1 ; }
@@ -292,7 +295,7 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)int i2c_write (uchar chip,uint addr,int alen,uchar *buffer,int len) {int nb = len; -unsigned long start_time_tx; +u32 start_time_tx;if (check_params (addr, alen, buffer, len))return 1 ;
@@ -300,15 +303,16 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)if (i2c_xfer_init (chip, addr))return 1 ; - start_time_tx =get_timer (0 ); + start_time_tx =time_ms_now ();while (len) {if (readl (&i2c_regs_p->ic_status) &IC_STATUS_TFNF ) {writel (*buffer, &i2c_regs_p->ic_cmd_data); buffer++; len--; - start_time_tx =get_timer (0 ); + start_time_tx =time_ms_now (); - }else if (get_timer (start_time_tx) > (nb *I2C_BYTE_TO )) { + }else if (time_ms_delta_min (start_time_tx,timer_ms_now () + > (nb * I2C_BYTE_TO)) {printf ("Timed out. i2c write Failed\n" );return 1 ; }
drivers/i2c/u8500_i2c.c +4 -4
@@ -180,12 +180,12 @@ void i2c_init(int speed, int slaveaddr)*/ static int loop_till_bit_clear (void *io_reg,u32 mask,unsigned long timeout) { -unsigned long timebase =get_timer (0 ); +unsigned long timebase =time_now_ms ();do {if ((readl (io_reg) & mask) ==0x0UL )return 0 ; - }while (get_timer (timebase) < timeout); + }while (time_since_ms (timebase) < timeout);debug ("loop_till_bit_clear timed out\n" );return -1 ;
@@ -199,12 +199,12 @@ static int loop_till_bit_clear(void *io_reg, u32 mask, unsigned long timeout)*/ static int loop_till_bit_set (void *io_reg,u32 mask,unsigned long timeout) { -unsigned long timebase =get_timer (0 ); +unsigned long timebase =time_now_ms ();do {if ((readl (io_reg) & mask) !=0x0UL )return 0 ; - }while (get_timer (timebase) < timeout); + }while (time_since_ms (timebase) < timeout);debug ("loop_till_bit_set timed out\n" );return -1 ;
drivers/input/ps2mult.c +3 -3
@@ -39,7 +39,7 @@#endif -static ulong start_time; +static u32 st;static int init_done =0 ;static int received_escape =0 ;
@@ -66,7 +66,7 @@ static u_char ps2mult_buf_status [PS2BUF_SIZE];#endif void ps2mult_early_init (void ) { - start_time =get_timer (0 ); + st = time_ms_now()); }static void ps2mult_send_byte (u_char byte,u_char sel)
@@ -365,7 +365,7 @@ int ps2mult_init (void)int kbd_found =0 ;int mouse_found =0 ; -while (get_timer (start_time) <CONFIG_PS2MULT_DELAY ); +while (time_ms_delta_min (ts,time_ms_now ()) <CONFIG_PS2MULT_DELAY );ps2ser_init ();
drivers/mmc/omap_hsmmc.c +31 -26
163 lines not on this page · raw message
drivers/mtd/spi/atmel.c +2 -2
@@ -119,7 +119,7 @@ static int at45_wait_ready(struct spi_flash *flash, unsigned long timeout)u8 cmd =CMD_AT45_READ_STATUS ;u8 status; - timebase =get_timer (0 ); + timebase =time_now_ms (); ret =spi_xfer (spi,8 , &cmd,NULL ,SPI_XFER_BEGIN );if (ret)
@@ -132,7 +132,7 @@ static int at45_wait_ready(struct spi_flash *flash, unsigned long timeout)if (status &AT45_STATUS_READY )break ; - }while (get_timer (timebase) < timeout); + }while (time_since_ms (timebase) < timeout);/* Deactivate CS */ spi_xfer (spi,0 ,NULL ,NULL ,SPI_XFER_END );
drivers/net/4xx_enet.c +3 -5
@@ -1564,7 +1564,7 @@ static int ppc_4xx_eth_send (struct eth_device *dev, volatile void *ptr, int len) {struct enet_frame *ef_ptr; -ulong time_start, time_now; +u32 ts;unsigned long temp_txm0;EMAC_4XX_HW_PST hw_p = dev->priv;
@@ -1609,7 +1609,7 @@ static int ppc_4xx_eth_send (struct eth_device *dev, volatile void *ptr,/*-----------------------------------------------------------------------+ * poll unitl the packet is sent and then make sure it is OK *-----------------------------------------------------------------------*/ - time_start =get_timer (0 ); + ts =time_ms_now ();while (1 ) { temp_txm0 =in_be32 ((void *)EMAC0_TMR0 + hw_p->hw_addr);/* loop until either TINT turns on or 3 seconds elapse */
@@ -1618,10 +1618,8 @@ static int ppc_4xx_eth_send (struct eth_device *dev, volatile void *ptr,* If there is an error, an interrupt should * happen when we return */ - time_now =get_timer (0 ); -if ((time_now - time_start) >3000 ) { +if (time_ms_delta_min (ts,time_ms_now ()) >3000 )return (-1 ); - } }else {return (len); }
drivers/net/bcm570x.c +1 -1
@@ -1204,7 +1204,7 @@ LM_STATUS MM_FreeRxBuffer (PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket)unsigned long MM_AnGetCurrentTime_us (PAN_STATE_INFO pAnInfo) { -return get_timer (0 ); +return time_ms_now (); }/*
drivers/net/cs8900.c +9 -8
@@ -98,7 +98,7 @@ static void put_reg(struct eth_device *dev, int regno, u16 val)static void cs8900_reset (struct eth_device *dev) { -int tmo; +u32 st;u16 us;/* reset NIC */
@@ -108,9 +108,10 @@ static void cs8900_reset(struct eth_device *dev)udelay (200000 );/* Wait until the chip is reset */ - tmo =get_timer (0 ) +1 *CONFIG_SYS_HZ ; + st =time_ms_now ();while ((((us =get_reg_init_bus (dev, PP_SelfSTAT)) & - PP_SelfSTAT_InitD) ==0 ) && tmo <get_timer (0 )) + PP_SelfSTAT_InitD) ==0 ) && + (time_ms_delta_min (st,time_ms_now ()) <1000 ))/*NOP*/ ; }
@@ -220,7 +221,7 @@ static int cs8900_send(struct eth_device *dev, volatile void *packet, int length) { volatile u16 *addr; -int tmo; +u32 st;u16 s;struct cs8900_priv *priv = (struct cs8900_priv *)(dev->priv);
@@ -233,8 +234,8 @@ retry:if ((get_reg (dev, PP_BusSTAT) & PP_BusSTAT_TxRDY) ==0 ) {/* Oops... this should not happen! */ debug ("cs: unable to send packet; retrying...\n" ); -for (tmo =get_timer (0 ) +5 *CONFIG_SYS_HZ ; -get_timer (0 ) < tmo;) +for (st =time_ms_now (); +time_ms_delta_min (st,time_ms_now ()) <5000 ;)/*NOP*/ ;cs8900_reset (dev);cs8900_reginit (dev);
@@ -247,9 +248,9 @@ retry:REG_WRITE (*addr++, &priv->regs->rtdata);/* wait for transfer to succeed */ - tmo =get_timer (0 ) +5 *CONFIG_SYS_HZ ; + st =time_ms_now ();while ((s =get_reg (dev,PP_TER ) & ~0x1F ) ==0 ) { -if (get_timer (0 ) >= tmo) +if (time_ms_delta_min (st,time_ms_now ()) >=5000 )break ; }
drivers/net/dm9000x.c +3 -3
@@ -401,7 +401,7 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)static int dm9000_send (struct eth_device *netdev,volatile void *packet,int length) { -int tmo; +u32 st;struct board_info *db = &dm9000_info;DM9000_DMP_PACKET (__func__ , packet, length);
@@ -422,10 +422,10 @@ static int dm9000_send(struct eth_device *netdev, volatile void *packet,DM9000_iow (DM9000_TCR ,TCR_TXREQ );/* Cleared after TX complete */ /* wait for end of transmission */ - tmo =get_timer (0 ) +5 *CONFIG_SYS_HZ ; + st =time_ms_now ();while ( !(DM9000_ior (DM9000_NSR ) & (NSR_TX1END |NSR_TX2END )) || !(DM9000_ior (DM9000_ISR ) &IMR_PTM ) ) { -if (get_timer (0 ) >= tmo) { +if (time_ms_delta_min (st,time_ms_now ()) >=5000 ) {printf ("transmission timeout\n" );break ; }
drivers/net/ethoc.c +3 -3
@@ -420,7 +420,7 @@ static int ethoc_send(struct eth_device *dev, volatile void *packet, int length)struct ethoc_bd bd;u32 entry;u32 pending; -int tmo; +u32 st; entry = priv->cur_tx % priv->num_tx;ethoc_read_bd (dev, entry, &bd);
@@ -440,7 +440,7 @@ static int ethoc_send(struct eth_device *dev, volatile void *packet, int length)ethoc_write_bd (dev, entry, &bd);/* wait for transfer to succeed */ - tmo =get_timer (0 ) +5 *CONFIG_SYS_HZ ; + st =time_ms_now ();while (1 ) { pending =ethoc_read (dev,INT_SOURCE );ethoc_ack_irq (dev, pending & ~INT_MASK_RX );
@@ -451,7 +451,7 @@ static int ethoc_send(struct eth_device *dev, volatile void *packet, int length)ethoc_tx (dev);break ; } -if (get_timer (0 ) >= tmo) { +if (time_ms_delta_min (st,time_ms_now ()) >=5000 ) {debug ("%s(): timed out\n" , __func__);return -1 ; }
drivers/net/fec_mxc.c +9 -9
@@ -70,7 +70,7 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, uint8_t regAddr,uint32_t reg;/* convenient holder for the PHY register */ uint32_t phy;/* convenient holder for the PHY */ -uint32_t start; +u32 st;/* * reading from any PHY's register is done by properly
@@ -86,9 +86,9 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, uint8_t regAddr,/* * wait for the related interrupt */ - start =get_timer (0 ); + start =time_ms_now ();while (!(readl (&fec->eth->ievent) &FEC_IEVENT_MII )) { -if (get_timer (start) > (CONFIG_SYS_HZ /1000 )) { +if (time_ms_delta_min (st,time_ms_now ()) >1 ) {printf ("Read MDIO failed...\n" );return -1 ; }
@@ -127,7 +127,7 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr,uint32_t reg;/* convenient holder for the PHY register */ uint32_t phy;/* convenient holder for the PHY */ -uint32_t start; +u32 st; reg = regAddr <<FEC_MII_DATA_RA_SHIFT ; phy = phyAddr <<FEC_MII_DATA_PA_SHIFT ;
@@ -138,9 +138,9 @@ static int fec_miiphy_write(const char *dev, uint8_t phyAddr, uint8_t regAddr,/* * wait for the MII interrupt */ - start =get_timer (0 ); + st =time_ms_now ();while (!(readl (&fec->eth->ievent) &FEC_IEVENT_MII )) { -if (get_timer (start) > (CONFIG_SYS_HZ /1000 )) { +if (time_ms_delta_min (st,time_ms_now ()) >1 ) {printf ("Write MDIO failed...\n" );return -1 ; }
@@ -183,15 +183,15 @@ static int miiphy_restart_aneg(struct eth_device *dev)static int miiphy_wait_aneg (struct eth_device *dev) { -uint32_t start; +u32 st;uint16_t status;/* * Wait for AN completion */ - start =get_timer (0 ); + st =time_ms_now (); do { - if (get_timer(start) > (CONFIG_SYS_HZ * 5)) { + if (time_ms_delta_min(st, time_ms_now()) > 5000) { printf("%s: Autonegotiation timeout\n", dev->name); return -1; }
drivers/net/ftgmac100.c +3 -3
@@ -490,7 +490,7 @@ ftgmac100_send(struct eth_device *dev, void *packet, int length)struct ftgmac100 *ftgmac100 = (struct ftgmac100 *)dev->iobase;struct ftgmac100_data *priv = dev->priv;struct ftgmac100_txdes *curr_des = &priv->txdes[priv->tx_index]; -int start; +int st;if (curr_des->txdes0 &FTGMAC100_TXDES0_TXDMA_OWN ) {debug ("%s(): no TX descriptor available\n" , __func__);
@@ -515,9 +515,9 @@ ftgmac100_send(struct eth_device *dev, void *packet, int length)writel (1 , &ftgmac100->txpd);/* wait for transfer to succeed */ - start =get_timer (0 ); + st =time_ms_now ();while (curr_des->txdes0 &FTGMAC100_TXDES0_TXDMA_OWN ) { -if (get_timer (0 ) >=5 ) { +if (time_ms_delta_min (st,time_ms_now ()) >=5 ) {debug ("%s(): timed out\n" , __func__);return -1 ; }
drivers/net/ftmac100.c +3 -3
@@ -196,7 +196,7 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)struct ftmac100 *ftmac100 = (struct ftmac100 *)dev->iobase;struct ftmac100_data *priv = dev->priv;struct ftmac100_txdes *curr_des = priv->txdes; -ulong start; +ulong st;if (curr_des->txdes0 &FTMAC100_TXDES0_TXDMA_OWN ) {debug ("%s(): no TX descriptor available\n" , __func__);
@@ -224,9 +224,9 @@ ftmac100_send (struct eth_device *dev, volatile void *packet, int length)/* wait for transfer to succeed */ - start =get_timer (0 ); + st =time_ms_now ();while (curr_des->txdes0 &FTMAC100_TXDES0_TXDMA_OWN ) { -if (get_timer (start) >=5 ) { +if (time_ms_delta_min (st,time_ms_now ()) >=5 ) {debug ("%s(): timed out\n" , __func__);return -1 ; }
drivers/net/greth.c +8 -8
@@ -230,7 +230,7 @@ int greth_init_phy(greth_priv * dev, bd_t * bis) {greth_regs *regs = dev->regs;int tmp, tmp1, tmp2, i; -unsigned int start, timeout; +unsigned int st;int phyaddr =GRETH_PHY_ADR_DEFAULT ;#ifndef CONFIG_SYS_GRLIB_GRETH_PHYADDR
@@ -252,18 +252,16 @@ int greth_init_phy(greth_priv * dev, bd_t * bis)debug ("GRETH PHY ADDRESS: %d\n" , phyaddr); -/* X msecs to ticks */ - timeout =usec2ticks (GRETH_PHY_TIMEOUT_MS *1000 ); -/* Get system timer0 current value * Total timeout is 5s */ - start =get_timer (0 ); + st =time_ms_now ();/* get phy control register default values */ while ((tmp =read_mii (phyaddr,0 , regs)) &0x8000 ) { -if (get_timer (start) > timeout) { +if (time_ms_delta_min (st,time_ms_now ()) + >GRETH_PHY_TIMEOUT_MS ) {debug ("greth_init_phy: PHY read 1 failed\n" );return 1 ;/* Fail */ }
@@ -273,7 +271,8 @@ int greth_init_phy(greth_priv * dev, bd_t * bis)write_mii (phyaddr,0 ,0x8000 | tmp, regs);while (((tmp =read_mii (phyaddr,0 , regs))) &0x8000 ) { -if (get_timer (start) > timeout) { +if (time_ms_delta_min (st,time_ms_now ()) + >GRETH_PHY_TIMEOUT_MS ) {debug ("greth_init_phy: PHY read 2 failed\n" );return 1 ;/* Fail */ }
@@ -293,7 +292,8 @@ int greth_init_phy(greth_priv * dev, bd_t * bis) dev->auto_neg =1 ; i =0 ;while (!(((tmp =read_mii (phyaddr,1 , regs)) >>5 ) &1 )) { -if (get_timer (start) > timeout) { +if (time_ms_delta_min (st,time_ms_now ()) + >GRETH_PHY_TIMEOUT_MS ) {printf ("Auto negotiation timed out. " "Selecting default config\n" ); tmp =read_mii (phyaddr,0 , regs);
drivers/net/lan91c96.c +3 -2
@@ -175,14 +175,15 @@ static void print_packet (byte *, int);static int poll4int (struct eth_device *dev,byte mask,int timeout) { -int tmo =get_timer (0 ) + timeout *CONFIG_SYS_HZ ; +int ts =time_ms_now ();int is_timeout =0 ;word old_bank =SMC_inw (dev,LAN91C96_BANK_SELECT );PRINTK2 ("Polling...\n" );SMC_SELECT_BANK (dev,2 );while ((SMC_inw (dev,LAN91C96_INT_STATS ) & mask) ==0 ) { -if (get_timer (0 ) >= tmo) { +if (time_ms_delta_min (start,time_ms_now ()) + >= timeout *1000 ) { is_timeout =1 ;break ; }
drivers/net/ne2000_base.c +3 -3
@@ -733,21 +733,21 @@ int eth_rx() { }int eth_send (volatile void *packet,int length) { -int tmo; +int ts;PRINTK ("### eth_send\n" ); pkey =-1 ;dp83902a_send ((u8 *) packet, length,666 ); - tmo =get_timer (0 ) +TOUT *CONFIG_SYS_HZ ; + ts =time_ms_now ();while (1 ) {dp83902a_poll ();if (pkey !=-1 ) {PRINTK ("Packet sucesfully sent\n" );return 0 ; } -if (get_timer (0 ) >= tmo) { +if (time_ms_delta_min (ts,time_ms_now ()) >=TOUT *1000 ) {printf ("transmission error (timoeut)\n" );return 0 ; }
drivers/net/netarm_eth.c +7 -5
@@ -83,8 +83,9 @@ static int na_mii_poll_busy (void) {ulong start;/* arm simple, non interrupt dependent timer */ - start = get_timer(0)); -while (get_timer (start) <NA_MII_POLL_BUSY_DELAY ) { + start =time_ms_now (); +while (time_ms_delta_min (start,time_ms_now ()) + <NA_MII_POLL_BUSY_DELAY ) {if (!(GET_EADDR (NETARM_ETH_MII_IND ) &NETARM_ETH_MIII_BUSY )) {return 1 ; }
@@ -172,13 +173,14 @@ static int reset_eth (void)/* reset the phy */ na_mii_write (MII_PHY_CONTROL ,0x8000 ); - start =get_timer (0 ); -while (get_timer (start) <NA_MII_NEGOTIATE_DELAY ) { + start =time_ms_now (); +while (time_ms_delta_min (start,time_ms_now ()) + <NA_MII_NEGOTIATE_DELAY ) {if ((na_mii_read (MII_PHY_STATUS ) &0x8000 ) ==0 ) {break ; } } -if (get_timer (start) >=NA_MII_NEGOTIATE_DELAY ) +if (time_ms_delta_min (start,time_ms_now ()) >=NA_MII_NEGOTIATE_DELAY )printf ("phy reset timeout\n" );/* set the PCS reg */
drivers/net/ns7520_eth.c +3 -2
@@ -449,8 +449,9 @@ static void ns7520_link_auto_negotiate(void)/* wait for completion */ - ulStartJiffies =get_timer (0 ); -while (get_timer (0 ) < ulStartJiffies +NS7520_MII_NEG_DELAY ) { + ulStartJiffies =time_ms_now (); +while (time_ms_delta_min (ulStartJiffies,time_ms_now ()) + <NS7520_MII_NEG_DELAY ) { uiStatus =ns7520_mii_read (MII_BMSR ); if ((uiStatus & (BMSR_ANEGCOMPLETE | BMSR_LSTATUS)) ==
drivers/net/ns9750_eth.c +2 -2
@@ -291,7 +291,7 @@ int eth_send (volatile void *pPacket, int nLen) *get_eth_reg_addr (NS9750_ETH_EGCR2 ) &= ~NS9750_ETH_EGCR2_TCLER ; *get_eth_reg_addr (NS9750_ETH_EGCR2 ) |=NS9750_ETH_EGCR2_TCLER ; - ulTimeout =get_timer (0 ); + ts =time_ms_now ();DEBUG_ARGS0 (DEBUG_TX |DEBUG_MINOR ,"Waiting for transmission to finish\n" );
@@ -299,7 +299,7 @@ int eth_send (volatile void *pPacket, int nLen) (*get_eth_reg_addr (NS9750_ETH_EINTR) & (NS9750_ETH_EINTR_TXDONE | NS9750_ETH_EINTR_TXERR))) {/* do nothing, wait for completion */ -if (get_timer (0 ) - ulTimeout >TX_TIMEOUT ) { +if (time_ms_delta_min (ts,time_ms_now ()) >TX_TIMEOUT ) {DEBUG_ARGS0 (DEBUG_TX ,"Transmit Timed out\n" );return -1 ; }
drivers/net/rtl8139.c +3 -3
@@ -98,7 +98,6 @@#undef DEBUG_TX#undef DEBUG_RX -#define currticks () get_timer(0)#define bus_to_phys (a) pci_mem_to_phys((pci_dev_t)dev->priv, a)#define phys_to_bus (a) pci_phys_to_mem((pci_dev_t)dev->priv, a)
@@ -425,6 +424,7 @@ static int rtl_transmit(struct eth_device *dev, volatile void *packet, int lengtmemcpy ((char *)tx_buffer, (char *)packet, (int )length);#ifdef DEBUG_TX +u32 ts =time_now_ms ();printf ("sending %d bytes\n" , len);#endif
@@ -454,8 +454,8 @@ static int rtl_transmit(struct eth_device *dev, volatile void *packet, int lengtif (status & TxOK) { cur_tx = (cur_tx +1 ) %NUM_TX_DESC ;#ifdef DEBUG_TX -printf ("tx done (%d ticks), status %hX txstatus %X\n" , - to-currticks (), status, txstatus); +printf ("tx done (%d ms), status %hX txstatus %X\n" , +time_max_since_ms (ts), status, txstatus);#endif return length; }else {
drivers/net/rtl8169.c +12 -14
@@ -68,9 +68,6 @@static u32 ioaddr; -/* Condensed operations for readability. */ -#define currticks () get_timer(0) -/* media options */ #define MAX_UNITS 8static int media[MAX_UNITS ] = {-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 };
@@ -473,9 +470,10 @@ static int rtl_send(struct eth_device *dev, volatile void *packet, int length)int entry = tpc->cur_tx %NUM_TX_DESC ;u32 len = length;int ret; +u32 ts;#ifdef DEBUG_RTL8169_TX -int stime =currticks (); +int stime =time_now_ms ();printf ("%s\n" , __FUNCTION__);printf ("sending %d bytes\n" , len);#endif
@@ -504,17 +502,17 @@ static int rtl_send(struct eth_device *dev, volatile void *packet, int length)RTL_W8 (TxPoll,0x40 );/* set polling bit */ tpc->cur_tx++; - to =currticks () +TX_TIMEOUT ; + ts =time_now_ms ();do {flush_cache ((unsigned long )&tpc->TxDescArray[entry],sizeof (struct TxDesc )); }while ((le32_to_cpu (tpc->TxDescArray[entry].status) & OWNbit) - && (currticks () < to));/* wait */ + && (time_since_ms (ts) <TX_TIMEOUT ));/* wait */ -if (currticks () >= to) { +if (time_since_ms (ts) >=TX_TIMEOUT ) {#ifdef DEBUG_RTL8169_TX puts ("tx timeout/error\n" ); -printf ("%s elapsed time : %d\n" , __FUNCTION__,currticks ()-stime); +printf ("%s elapsed time : %d\n" , __FUNCTION__,time_max_since_ms (stime));#endif ret =0 ; }else {
@@ -556,7 +554,7 @@ static void rtl8169_hw_start(struct eth_device *dev)u32 i;#ifdef DEBUG_RTL8169 -int stime =currticks (); +int stime =time_now_ms ();printf ("%s\n" , __FUNCTION__);#endif
@@ -616,7 +614,7 @@ static void rtl8169_hw_start(struct eth_device *dev)RTL_W16 (MultiIntr,RTL_R16 (MultiIntr) &0xF000 );#ifdef DEBUG_RTL8169 -printf ("%s elapsed time : %d\n" , __FUNCTION__,currticks ()-stime); +printf ("%s elapsed time : %d\n" , __FUNCTION__,time_max_since_ms (stime));#endif }
@@ -625,7 +623,7 @@ static void rtl8169_init_ring(struct eth_device *dev)int i;#ifdef DEBUG_RTL8169 -int stime =currticks (); +int stime =time_now_ms ();printf ("%s\n" , __FUNCTION__);#endif
@@ -654,7 +652,7 @@ static void rtl8169_init_ring(struct eth_device *dev) }#ifdef DEBUG_RTL8169 -printf ("%s elapsed time : %d\n" , __FUNCTION__,currticks ()-stime); +printf ("%s elapsed time : %d\n" , __FUNCTION__,time_max_sine_ms (stime));#endif }
@@ -666,7 +664,7 @@ static int rtl_reset(struct eth_device *dev, bd_t *bis)int i;#ifdef DEBUG_RTL8169 -int stime =currticks (); +int stime =time_now_ms ();printf ("%s\n" , __FUNCTION__);#endif
@@ -695,7 +693,7 @@ static int rtl_reset(struct eth_device *dev, bd_t *bis) txb[5 ] = dev->enetaddr[5 ];#ifdef DEBUG_RTL8169 -printf ("%s elapsed time : %d\n" , __FUNCTION__,currticks ()-stime); +printf ("%s elapsed time : %d\n" , __FUNCTION__,time_max_since_ms (stime));#endif return 0 ; }
drivers/net/smc91111.c +2 -2
@@ -251,14 +251,14 @@ static void print_packet( byte *, int );static int poll4int (struct eth_device *dev,byte mask,int timeout) { -int tmo =get_timer (0 ) + timeout *CONFIG_SYS_HZ ; +int ts =time_ms_now ();int is_timeout =0 ;word old_bank =SMC_inw (dev,BSR_REG );PRINTK2 ("Polling...\n" );SMC_SELECT_BANK (dev,2 );while ((SMC_inw (dev,SMC91111_INT_REG ) & mask) ==0 ) { -if (get_timer (0 ) >= tmo) { +if (time_ms_delta_min (ts,time_ms_now ()) >= (timeout *1000 )) { is_timeout =1 ;break ; }
drivers/serial/serial_clps7111.c +3 -3
@@ -76,15 +76,15 @@ int serial_init (void)*/ void serial_putc (const char c) { -int tmo; +u32 ts;/* If \n, also do \r */ if (c =='\n' )serial_putc ('\r' ); - tmo =get_timer (0 ) +1 *CONFIG_SYS_HZ ; + ts =time_now_ms ();while (IO_SYSFLG1 &SYSFLG1_UTXFF ) -if (get_timer (0 ) > tmo) +if (time_since_ms (ts) >1000 )break ;IO_UARTDR1 = c;
drivers/serial/serial_netarm.c +2 -2
@@ -43,9 +43,9 @@ DECLARE_GLOBAL_DATA_PTR;/* wait until transmitter is ready for another character */ #define TXWAITRDY (registers) \ { \ - ulong tmo = get_timer(0) + 1 * CONFIG_SYS_HZ; \ + u32 st = time_now_ms(); \ while (((registers)->status_a & NETARM_SER_STATA_TX_RDY) == 0 ) { \ - if (get_timer(0) > tmo) \ + if (time_since_ms(st) > 1000) \ break; \ } \ }
drivers/spi/atmel_dataflash_spi.c +3 -5
@@ -141,7 +141,6 @@ unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc);unsigned int AT91F_SpiWrite (AT91PS_DataflashDesc pDesc) { -unsigned int timeout;unsigned int timebase; pDesc->state =BUSY ;
@@ -174,19 +173,18 @@ unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) }/* arm simple, non interrupt dependent timer */ - timebase =get_timer (0 ); - timeout =0 ; + timebase =time_now_ms ();writel (AT91_SPI_TXTEN +AT91_SPI_RXTEN ,ATMEL_BASE_SPI0 +AT91_SPI_PTCR );while (!(readl (ATMEL_BASE_SPI0 +AT91_SPI_SR ) &AT91_SPI_RXBUFF ) && - ((timeout =get_timer (timebase)) <CONFIG_SYS_SPI_WRITE_TOUT )) + (time_since_ms (timebase) <CONFIG_SYS_SPI_WRITE_TOUT )) ;writel (AT91_SPI_TXTDIS +AT91_SPI_RXTDIS ,ATMEL_BASE_SPI0 +AT91_SPI_PTCR ); pDesc->state =IDLE ; -if (timeout >=CONFIG_SYS_SPI_WRITE_TOUT ) { +if (time_since_ms (timebase) >=CONFIG_SYS_SPI_WRITE_TOUT ) {printf ("Error Timeout\n\r" );return DATAFLASH_ERROR ; }
drivers/usb/gadget/ether.c +13 -12
@@ -1922,8 +1922,8 @@ static void eth_start(struct eth_dev *dev, gfp_t gfp_flags)static int eth_stop (struct eth_dev *dev) {#ifdef RNDIS_COMPLETE_SIGNAL_DISCONNECT -unsigned long ts; -unsigned long timeout =CONFIG_SYS_HZ ;/* 1 sec to stop RNDIS */ +u32 ts; +u32 timeout =CONFIG_SYS_HZ ;/* 1 sec to stop RNDIS */ #endif if (rndis_active (dev)) {
@@ -1932,8 +1932,8 @@ static int eth_stop(struct eth_dev *dev)#ifdef RNDIS_COMPLETE_SIGNAL_DISCONNECT /* Wait until host receives OID_GEN_MEDIA_CONNECT_STATUS */ - ts =get_timer (0 ); -while (get_timer (ts) < timeout) + ts =time_now_ms (); +while (time_since_ms (start) < timeout)usb_gadget_handle_interrupts ();#endif
@@ -2332,8 +2332,8 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd) {struct eth_dev *dev = &l_ethdev;struct usb_gadget *gadget; -unsigned long ts; -unsigned long timeout =USB_CONNECT_TIMEOUT ; +u32 ts; +u32 timeout =USB_CONNECT_TIMEOUT ;if (!netdev) {error ("received NULL ptr" );
@@ -2379,10 +2379,11 @@ static int usb_eth_init(struct eth_device *netdev, bd_t *bd)if (getenv ("cdc_connect_timeout" )) timeout =simple_strtoul (getenv ("cdc_connect_timeout" ),NULL ,10 ) *CONFIG_SYS_HZ ; - ts =get_timer (0 ); + ts =time_now_ms ();while (!l_ethdev.network_started) {/* Handle control-c and timeouts */ -if (ctrlc () || (get_timer (ts) > timeout)) { +if (ctrlc () || + (time_since_ms (ts) > timeout)) {error ("The remote end did not respond in time." ); goto fail; }
@@ -2403,8 +2404,8 @@ static int usb_eth_send(struct eth_device *netdev,void *rndis_pkt =NULL ;struct eth_dev *dev = &l_ethdev;struct usb_request *req = dev->tx_req; -unsigned long ts; -unsigned long timeout =USB_CONNECT_TIMEOUT ; +u32 ts; +u32 timeout =USB_CONNECT_TIMEOUT ;debug ("%s:...\n" , __func__);
@@ -2443,7 +2444,7 @@ static int usb_eth_send(struct eth_device *netdev, ? ((dev->tx_qlen % qmult) != 0) : 0;#endif dev->tx_qlen =1 ; - ts =get_timer (0 ); + ts =time_now_ms (); packet_sent =0 ; retval =usb_ep_queue (dev->in_ep, req,GFP_ATOMIC );
@@ -2451,7 +2452,7 @@ static int usb_eth_send(struct eth_device *netdev,if (!retval)debug ("%s: packet queued\n" , __func__);while (!packet_sent) { -if (get_timer (ts) > timeout) { +if (time_since_ms (ts) > timeout) {printf ("timeout sending packets to usb ethernet\n" );return -1 ; }
drivers/usb/host/ehci-hcd.c +4 -4
@@ -314,12 +314,12 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,struct QH *qh;struct qTD *td;volatile struct qTD *vtd; -unsigned long ts; +u32 ts;uint32_t *tdp;uint32_t endpt, token, usbsts;uint32_t c, toggle;uint32_t cmd; -int timeout; +u32 timeout;int ret =0 ; debug("dev=%p, pipe=%lx, buffer=%p, length=%d, req=%p\n", dev, pipe,
@@ -446,7 +446,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer, }/* Wait for TDs to be processed. */ - ts =get_timer (0 ); + ts =time_now_ms (); vtd = td; timeout =USB_TIMEOUT_MS (pipe); do {
@@ -456,7 +456,7 @@ ehci_submit_async(struct usb_device *dev, unsigned long pipe, void *buffer,if (!(token &0x80 ))break ;WATCHDOG_RESET (); - }while (get_timer (ts) < timeout); + }while (time_since_ms (ts) < timeout);/* Check that the TD processing happened */ if (token &0x80 ) {
drivers/usb/host/sl811-hcd.c +3 -2
@@ -234,7 +234,8 @@ static int sl811_send_packet(struct usb_device *dev, unsigned long pipe, __u8 *b {__u8 ctrl =SL811_USB_CTRL_ARM |SL811_USB_CTRL_ENABLE ;__u16 status =0 ; -int err =0 , time_start =get_timer (0 ); +int err =0 ; +u32 ts =time_now_ms ();int need_preamble = !(rh_status.wPortStatus &USB_PORT_STAT_LOW_SPEED ) &&usb_pipeslow (pipe);
@@ -264,7 +265,7 @@ static int sl811_send_packet(struct usb_device *dev, unsigned long pipe, __u8 *bsl811_write (SL811_CTRL_A , ctrl);while (!(sl811_read (SL811_INTRSTS ) &SL811_INTR_DONE_A )) { -if (5 *CONFIG_SYS_HZ <get_timer (time_start)) { +if (time_since_ms (ts) >=5000 ) {printf ("USB transmit timed out\n" );return -USB_ST_CRC_ERR ; }
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 12/16 Replace get_timer() usage in drivers/
Hello Graeme,
Graeme Russ wrote:
[...]
Quoted 4 lines
drivers/fpga/spartan3.c +0
-0
[...]
drivers/fpga/spartan3.c static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize) · line 238
Quoted 6 lines
drivers/fpga/spartan3.c +1
-1@@ -233,7 +235,7 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)#endif /* now check for done signal */ - ts =get_timer (0 );/* get current time */ + ts =time_since_ms ();/* get current time */
Shouldn't time_now_ms() be here?
____
Regards,
Vitaly.
PATCH 12/16 Replace get_timer() usage in drivers/
Hi Vitaly,
Quoted 9 lines · Vitaly Kuzmichev
Hello Graeme,
Graeme Russ wrote:
[...]Quoted 4 lines
drivers/fpga/spartan3.c +0
-0[...]
Quoted 8 lines
Quoted 6 lines
drivers/fpga/spartan3.c +0
-0@@ -233,7 +235,7 @@ static int Spartan3_sp_load (Xilinx_desc * desc, void *buf, size_t bsize)?#endif
? ? ? ? ? ? ? /* now check for done signal */
- ? ? ? ? ? ? ts =get_timer(0); ? ? ? ? ? ? /* get current time */
+ ? ? ? ? ? ? ts =time_since_ms(); ? ? ? ? ? /* get current time */Shouldn't
time_now_ms()be here?
Yes, it should be - Thanks
Regards,
Graeme
PATCH 13/16 Replace get_timer() usage in net/
In reply to Graeme Russ--- net/bootp.c | 6 +++--- net/net.c | 18 +++++++----------- net/sntp.c | 2 +- net/tftp.c | 4 ++-- 4 files changed, 13 insertions(+), 17 deletions(-)
net/bootp.c +3 -3
@@ -637,7 +637,7 @@ BootpRequest (void) bp->bp_htype =HWT_ETHER ; bp->bp_hlen =HWL_ETHER ; bp->bp_hops =0 ; - bp->bp_secs =htons (get_timer (0 ) /1000 ); + bp->bp_secs =htons (time_ms_now () /1000 );NetWriteIP (&bp->bp_ciaddr,0 );NetWriteIP (&bp->bp_yiaddr,0 );NetWriteIP (&bp->bp_siaddr,0 );
@@ -660,7 +660,7 @@ BootpRequest (void) | ((ulong)NetOurEther[3] << 16) | ((ulong )NetOurEther[4 ] <<8 ) | (ulong )NetOurEther[5 ]; - BootpID +=get_timer (0 ); + BootpID +=time_now_ms (); BootpID =htonl (BootpID);NetCopyLong (&bp->bp_id, &BootpID);
@@ -819,7 +819,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) bp->bp_htype =HWT_ETHER ; bp->bp_hlen =HWL_ETHER ; bp->bp_hops =0 ; - bp->bp_secs =htons (get_timer (0 ) /1000 ); + bp->bp_secs =htons (time_ms_now () /1000 );/* Do not set the client IP, your IP, or server IP yet, since it hasn't been ACK'ed by * the server yet */
net/net.c +7 -11
@@ -290,15 +290,11 @@ void ArpRequest(void)void ArpTimeoutCheck (void ) { -ulong t; -if (!NetArpWaitPacketIP)return ; - t =get_timer (0 ); -/* check for arp timeout */ -if ((t - NetArpWaitTimerStart) >ARP_TIMEOUT ) { +if (time_since_ms (NetArpWaitTimerStart) >ARP_TIMEOUT ) { NetArpWaitTry++;if (NetArpWaitTry >=ARP_TIMEOUT_COUNT ) {
@@ -306,7 +302,7 @@ void ArpTimeoutCheck(void) NetArpWaitTry =0 ;NetStartAgain (); }else { - NetArpWaitTimerStart = t; + NetArpWaitTimerStart =time_now_ms ();ArpRequest (); } }
@@ -535,7 +531,7 @@ restart:* Check for a timeout, and run the timeout handler * if we have one. */ -if (timeHandler && ((get_timer (0 ) - timeStart) > timeDelta)) { +if (timeHandler && (time_since_ms (timeStart) > timeDelta)) {thand_f *x;#if defined(CONFIG_MII ) || defined(CONFIG_CMD_MII )
@@ -672,7 +668,7 @@ NetSetTimeout(ulong iv, thand_f *f) timeHandler = (thand_f *)0 ; }else { timeHandler = f; - timeStart =get_timer (0 ); + timeStart =time_now_ms (); timeDelta = iv; } }
@@ -721,7 +717,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)/* and do the ARP request */ NetArpWaitTry =1 ; - NetArpWaitTimerStart =get_timer (0 ); + NetArpWaitTimerStart =time_now_ms ();ArpRequest ();return 1 ;/* waiting */ }
@@ -792,7 +788,7 @@ int PingSend(void)/* and do the ARP request */ NetArpWaitTry =1 ; - NetArpWaitTimerStart =get_timer (0 ); + NetArpWaitTimerStart =time_now_ms ();ArpRequest ();return 1 ;/* waiting */ }
@@ -1960,7 +1956,7 @@ void copy_filename(char *dst, const char *src, int size)*/ unsigned int random_port (void ) { -return 1024 + (get_timer (0 ) %0x4000 ); +return 1024 + (time_now_ms () %0x4000 ); }#endif
net/sntp.c +1 -1
@@ -33,7 +33,7 @@ SntpSend (void)memcpy ((char *)NetTxPacket +NetEthHdrSize () +IP_HDR_SIZE , (char *)&pkt, pktlen); - SntpOurPort =10000 + (get_timer (0 ) %4096 ); + SntpOurPort =10000 + (time_now_ms () %4096 ); sport =NTP_SERVICE_PORT ;NetSendUDPPacket (NetServerEther, NetNtpServerIP, sport, SntpOurPort, pktlen);
net/tftp.c +2 -2
@@ -338,7 +338,7 @@ TftpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, unsigned src,debug ("Got WRQ\n" ); TftpRemoteIP = sip; TftpRemotePort = src; - TftpOurPort =1024 + (get_timer (0 ) %3072 ); + TftpOurPort =1024 + (time_ms_now () %3072 ); TftpLastBlock =0 ; TftpBlockWrap =0 ; TftpBlockWrapOffset =0 ;
@@ -654,7 +654,7 @@ TftpStart(void) TftpTimeoutCount =0 ; TftpState =STATE_SEND_RRQ ;/* Use a pseudo-random port unless a specific port is set */ - TftpOurPort =1024 + (get_timer (0 ) %3072 ); + TftpOurPort =1024 + (time_now_ms () %3072 );#ifdef CONFIG_TFTP_PORT ep =getenv ("tftpdstp" );
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 14/16 Replace get_timer() usage in common/
In reply to Graeme Russ--- common/cmd_misc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
common/cmd_misc.c +2 -2
@@ -29,7 +29,7 @@int do_sleep (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -ulong start =get_timer (0 ); +ulong start =time_now_ms ();ulong delay;if (argc !=2 )
@@ -37,7 +37,7 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) delay =simple_strtoul (argv[1 ],NULL ,10 ) *CONFIG_SYS_HZ ; -while (get_timer (start) < delay) { +while (time_since_ms (start) < delay) {if (ctrlc ())return (-1 );
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 15/16 Replace get_timer() usage in board/
In reply to Graeme Russ--- board/BuS/EB+MCF-EV123/flash.c | 8 +++--- board/LEOX/elpt860/flash.c | 12 +++++----- board/Marvell/common/flash.c | 16 ++++++------ board/Marvell/common/intel_flash.c | 19 ++++++--------- board/RPXClassic/flash.c | 8 +++--- board/RPXlite/flash.c | 8 +++--- board/RPXlite_dw/flash.c | 8 +++--- board/RRvision/flash.c | 8 +++--- board/a3000/flash.c | 8 +++--- board/alaska/flash.c | 34 ++++++++++++++-------------- board/altera/common/AMDLV065D.c | 8 +++--- board/altera/common/flash.c | 10 ++++---- board/amcc/common/flash.c | 16 ++++++------ board/amcc/taihu/flash.c | 16 ++++++------ board/amcc/yucca/flash.c | 16 ++++++------ board/amirix/ap1000/flash.c | 4 +- board/armadillo/flash.c | 4 +- board/astro/mcf5373l/mcf5373l.c | 4 +- board/atc/flash.c | 22 +++++++++--------- board/atmel/at91rm9200dk/flash.c | 8 +++--- board/atmel/atstk1000/flash.c | 2 +- board/bmw/flash.c | 8 +++--- board/c2mon/flash.c | 8 +++--- board/cerf250/flash.c | 8 +++--- board/cm4008/flash.c | 8 +++--- board/cm41xx/flash.c | 8 +++--- board/cmc_pu2/flash.c | 8 +++--- board/cmi/flash.c | 12 +++++----- board/cobra5272/flash.c | 8 +++--- board/cogent/flash.c | 14 ++++++------ board/cpc45/flash.c | 8 +++--- board/cpu86/flash.c | 16 ++++++------ board/cpu87/flash.c | 16 ++++++------ board/cradle/flash.c | 8 +++--- board/cray/L1/flash.c | 8 +++--- board/csb226/flash.c | 8 +++--- board/cu824/flash.c | 8 +++--- board/dave/common/flash.c | 8 +++--- board/dnp1110/flash.c | 8 +++--- board/earthlcd/favr-32-ezkit/flash.c | 2 +- board/eltec/bab7xx/flash.c | 8 +++--- board/eltec/elppc/flash.c | 8 +++--- board/eltec/mhpc/flash.c | 8 +++--- board/emk/common/flash.c | 18 +++++++------- board/ep7312/flash.c | 8 +++--- board/ep8260/flash.c | 8 +++--- board/esd/common/flash.c | 8 +++--- board/esd/cpci5200/strataflash.c | 4 +- board/esd/pf5200/flash.c | 18 +++++++------- board/esteem192e/flash.c | 18 +++++++------- board/etin/debris/flash.c | 16 ++++++------ board/etx094/flash.c | 12 +++++----- board/evb4510/flash.c | 4 +- board/evb64260/flash.c | 8 +++--- board/evb64260/intel_flash.c | 18 ++++++-------- board/fads/flash.c | 8 +++--- board/flagadm/flash.c | 22 +++++++++--------- board/freescale/m5253demo/flash.c | 14 ++++++------ board/freescale/mpc8260ads/flash.c | 12 +++++----- board/freescale/mpc8266ads/flash.c | 12 +++++----- board/funkwerk/vovpn-gw/flash.c | 16 ++++++------ board/g2000/strataflash.c | 4 +- board/gcplus/flash.c | 8 +++--- board/gen860t/flash.c | 16 ++++++------ board/genietv/flash.c | 8 +++--- board/gw8260/flash.c | 8 +++--- board/hermes/flash.c | 8 +++--- board/hidden_dragon/flash.c | 8 +++--- board/hymod/flash.c | 10 ++++---- board/icecube/flash.c | 18 +++++++------- board/icu862/flash.c | 8 +++--- board/idmr/flash.c | 8 +++--- board/impa7/flash.c | 8 +++--- board/incaip/flash.c | 22 +++++++++--------- board/innokom/flash.c | 8 +++--- board/ip860/flash.c | 8 +++--- board/iphase4539/flash.c | 8 +++--- board/ivm/flash.c | 8 +++--- board/ixdp425/flash.c | 8 +++--- board/jse/flash.c | 8 +++--- board/kup/common/flash.c | 12 +++++----- board/lantec/flash.c | 8 +++--- board/lart/flash.c | 8 +++--- board/linkstation/avr.c | 40 +++++++++++++++++----------------- board/lpd7a40x/flash.c | 8 +++--- board/lubbock/flash.c | 8 +++--- board/lwmon/flash.c | 10 ++++---- board/mbx8xx/flash.c | 8 +++--- board/modnet50/flash.c | 12 +++++----- board/mpl/common/flash.c | 16 ++++++------ board/mpl/mip405/mip405.c | 11 ++++----- board/mpl/vcma9/flash.c | 8 +++--- board/musenki/flash.c | 8 +++--- board/mvblue/flash.c | 8 +++--- board/mx1ads/syncflash.c | 2 +- board/mx1fs2/flash.c | 16 ++++++------ board/netphone/flash.c | 8 +++--- board/netta/flash.c | 8 +++--- board/netta2/flash.c | 8 +++--- board/netvia/flash.c | 8 +++--- board/ns9750dev/flash.c | 8 +++--- board/nx823/flash.c | 8 +++--- board/o2dnt/flash.c | 26 +++++++++++----------- board/oxc/flash.c | 8 +++--- board/pcippc2/flash.c | 8 +++--- board/pcs440ep/flash.c | 12 +++++----- board/pleb2/flash.c | 12 +++++----- board/pm520/flash.c | 22 +++++++++--------- board/pm826/flash.c | 8 +++--- board/pm828/flash.c | 8 +++--- board/ppmc7xx/flash.c | 8 +++--- board/ppmc8260/strataflash.c | 4 +- board/prodrive/common/flash.c | 12 +++++----- board/psyent/common/AMDLV065D.c | 8 +++--- board/r360mpi/flash.c | 8 +++--- board/rbc823/flash.c | 8 +++--- board/rmu/flash.c | 8 +++--- board/rpxsuper/flash.c | 8 +++--- board/rsdproto/flash.c | 8 +++--- board/sacsng/flash.c | 8 +++--- board/samsung/smdk2400/flash.c | 8 +++--- board/sandburst/common/flash.c | 8 +++--- board/sandpoint/flash.c | 8 +++--- board/sbc2410x/flash.c | 8 +++--- board/sbc405/strataflash.c | 4 +- board/sbc8240/flash.c | 8 +++--- board/sbc8260/flash.c | 8 +++--- board/scb9328/flash.c | 4 +- board/shannon/flash.c | 8 +++--- board/siemens/IAD210/flash.c | 8 +++--- board/siemens/SCM/flash.c | 8 +++--- board/siemens/SMN42/flash.c | 8 +++--- board/sixnet/flash.c | 12 +++++----- board/snmc/qs850/flash.c | 8 +++--- board/snmc/qs860t/flash.c | 18 +++++++------- board/stx/stxgp3/flash.c | 12 +++++----- board/svm_sc8xx/flash.c | 16 ++++++------ board/tb0229/flash.c | 18 +++++++------- board/ti/omap1610inn/flash.c | 8 +++--- board/ti/omap730p2/flash.c | 8 +++--- board/tqc/tqm5200/cam5200_flash.c | 16 ++++++------ board/trab/cmd_trab.c | 6 ++-- board/trab/flash.c | 8 +++--- board/utx8245/flash.c | 8 +++--- board/v37/flash.c | 12 +++++----- board/w7o/flash.c | 20 ++++++++-------- board/w7o/fpga.c | 10 ++++---- board/westel/amx860/flash.c | 8 +++--- board/xaeniax/flash.c | 8 +++--- board/xm250/flash.c | 16 ++++++------ board/zeus/zeus.c | 4 +- board/zylonite/flash.c | 8 +++--- 152 files changed, 781 insertions(+), 787 deletions(-)
board/BuS/EB+MCF-EV123/flash.c +4 -4
@@ -172,13 +172,13 @@ int amd_flash_erase_sector(flash_info_t * info, int sector)/* wait until flash is ready */ state =0 ; - start =get_timer (0 ); + start =time_now_ms (); do { result = *addr; /* check timeout */ - if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) { + if (time_since_ms(start) > CONFIG_SYS_FLASH_ERASE_TOUT) { MEM_FLASH_ADDR1 = CMD_READ_ARRAY; state = ERR_TIMOUT; }
@@ -297,7 +297,7 @@ volatile static int amd_write_word (flash_info_t * info, ulong dest, u16 data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait until flash is ready */ state =0 ;
@@ -305,7 +305,7 @@ volatile static int amd_write_word (flash_info_t * info, ulong dest, u16 data) result = *addr;/* check timeout */ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { state =ERR_TIMOUT ; }if (!state && ((result &BIT_RDY_MASK ) == (data &BIT_RDY_MASK )))
board/LEOX/elpt860/flash.c +6 -6
@@ -378,12 +378,12 @@ flash_erase (flash_info_t *info,if ( l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (volatile unsigned char *)(info->start[l_sect]);while ( (addr[0 ] &0x80 ) !=0x80 ) { -if ( (now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) +if ( (now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return (1 );
@@ -553,10 +553,10 @@ write_word (flash_info_t *info,enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ( (*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 ) ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); }
@@ -599,10 +599,10 @@ write_byte (flash_info_t *info,enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ( (*((volatile unsigned char *)dest) &0x80 ) != (data &0x80 ) ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); }
board/Marvell/common/flash.c +8 -8
@@ -604,7 +604,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) mask =CHIP_STAT_RDY | (CHIP_STAT_RDY <<16 );/* init. the timeout counter */ - start =get_timer (0 ); + start =time_now_ms ();/* keep looping while the flash is not ready */ /* exit the loop by timing out or the flash */ /* becomes ready again */
@@ -615,7 +615,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) start[sect] & mask) != mask) {/* has the timeout limit been reached? */ -if (get_timer (start) +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {
@@ -771,12 +771,12 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (volatile unsigned char *) (info->start[l_sect]);/* broken for 2x16: TODO */ while ((addr[0 ] &0x80 ) !=0x80 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -940,7 +940,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)flash_cmd (info->portwidth, addr,0 ,CHIP_CMD_RD_STAT );/* init. the timeout counter */ - start =get_timer (0 ); + start =time_now_ms ();/* keep looping while the flash is not ready */ /* exit the loop by timing out or the flash */ /* becomes ready again */
@@ -955,7 +955,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)/* while (addr[0] & mask) != mask) */ {/* has the timeout limit been reached? */ -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {/* timeout limit reached */ printf ("Time out limit reached programming address %08lx with data %08lx\n" , dest, data);
@@ -1062,9 +1062,9 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *) dest) &0x00800080 ) != (data &0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/Marvell/common/intel_flash.c +8 -11
@@ -150,9 +150,9 @@ int write_word_intel (bank_addr_t addr, bank_word_t value) retval =0 ;/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms (); do { - if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) { + if (time_since_ms(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { retval = 1; goto done; }
@@ -208,13 +208,12 @@ int flash_erase_intel (flash_info_t * info, int s_first, int s_last)printf ("- Warning: %d protected sector%s will not be erased!\n" , prot, (prot >1 ?"s" :"" )); } - start =get_timer (0 ); - last =0 ; + start =time_ms_now (); + last = start; haderr =0 ;for (sect = s_first; sect <= s_last; sect++) {if (info->protect[sect] ==0 ) {/* not protected */ -ulong estart;int sectdone;bank_erase_init (info, sect);
@@ -222,21 +221,19 @@ int flash_erase_intel (flash_info_t * info, int s_first, int s_last)/* wait at least 80us - let's wait 1 ms */ udelay (1000 ); - estart =get_timer (start); + start =time_now_ms (); do { - now = get_timer (start); - - if (now - estart > CONFIG_SYS_FLASH_ERASE_TOUT) { + if (time_since_ms(start) > CONFIG_SYS_FLASH_ERASE_TOUT) { printf ("Timeout (sect %d)\n", sect); haderr = 1; break; } #ifndef FLASH_DEBUG /* show that we're waiting */ - if ((now - last) > 1000) { /* every second */ + if (time_since_ms(last) > 1000) { /* every second */ putc ('.'); - last = now; + last = time_now_ms(); } #endif
board/RPXClassic/flash.c +4 -4
@@ -309,11 +309,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);while ((addr[0 ] &0x80808080 ) !=0x80808080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -434,9 +434,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x80808080 ) != (data &0x80808080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/RPXlite/flash.c +4 -4
@@ -386,11 +386,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);while ((addr[0 ] &0x80808080 ) !=0x80808080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -511,9 +511,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x80808080 ) != (data &0x80808080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/RPXlite_dw/flash.c +4 -4
@@ -356,11 +356,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);while ((addr[0 ] &0x80808080 ) !=0x80808080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -480,9 +480,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x80808080 ) != (data &0x80808080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/RRvision/flash.c +4 -4
@@ -384,11 +384,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);while ((addr[0 ] &0x00800080 ) !=0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {puts ("Timeout\n" );return 1 ; }
@@ -509,9 +509,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/a3000/flash.c +4 -4
@@ -332,7 +332,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) {
@@ -356,7 +356,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while (((status =BS (*addr)) &BYTEME (0x00800080 )) !=BYTEME (0x00800080 )) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =BS (0xB0 );/* suspend erase */ *addr =BS (0xFF );/* reset to read mode */
@@ -436,10 +436,10 @@ static int write_data (flash_info_t *info, uchar *dest, uchar data)enable_interrupts (); } - start =get_timer (0 ); + start =time_now_ms ();while (((status =BS (*addr)) &BYTEME (0x00800080 )) !=BYTEME (0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =BS (0xFF );/* restore read mode */ return 1 ; }
board/alaska/flash.c +17 -17
@@ -359,9 +359,9 @@ static unsigned char intel_sector_protected (flash_info_t *info, ushort sector) addr = (FPWV *) info->start[sector]; *addr = (FPW )INTEL_STATUS ; - start =get_timer (0 ); + start =time_now_ms ();while ((*addr & (FPW )INTEL_FINISHED ) != (FPW )INTEL_FINISHED ) { -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { *addr = (FPW )INTEL_RESET ;/* restore read mode */ printf ("WSM busy too long, can't get prot status\n" );return 1 ;
@@ -443,7 +443,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Disable interrupts which might cause a timeout here */
@@ -458,7 +458,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (intel) { *addr = (FPW )0x00500050 ;/* clear status register */
@@ -479,7 +479,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );if (intel) { *addr = (FPW )0x00B000B0 ;/* suspend erase */
@@ -680,11 +680,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while ((*addr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr = (FPW )0x00FF00FF ;/* restore read mode */ return (1 ); }
@@ -724,11 +724,11 @@ static int write_data_block (flash_info_t * info, ulong src, ulong dest) *dstaddr = (FPW )0x00e800e8 ;/* write block setup */ /* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while ((*dstaddr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dstaddr = (FPW )0x00FF00FF ;/* restore read mode */ return (1 ); }
@@ -742,11 +742,11 @@ static int write_data_block (flash_info_t * info, ulong src, ulong dest) *dstaddr = (FPW )0x00d000d0 ;/* write 32 to buffer */ /* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while ((*dstaddr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dstaddr = (FPW )0x00FF00FF ;/* restore read mode */ return (1 ); }
@@ -794,12 +794,12 @@ static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while (res ==0 && (*dest & (FPW )0x00800080 ) != (data & (FPW )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00F000F0 ;/* reset bank */ res =1 ; }
@@ -853,10 +853,10 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) *addr =INTEL_CONFIRM ;/* clear */ } - start =get_timer (0 ); + start =time_now_ms ();while ((*addr &INTEL_FINISHED ) !=INTEL_FINISHED ) { -if (get_timer (start) >CONFIG_SYS_FLASH_UNLOCK_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_UNLOCK_TOUT ) {printf ("Flash lock bit operation timed out\n" ); rc =1 ;break ;
@@ -903,13 +903,13 @@ int flash_real_protect (flash_info_t * info, long sector, int prot) info = &flash_info[bank];for (i =0 ; i < info->sector_count; i++) {if (info->protect[i]) { - start =get_timer (0 ); + start =time_now_ms (); addr = (FPWV *) (info->start[i]); *addr =INTEL_LOCKBIT ;/* Sector lock bit */ *addr =INTEL_PROTECT ;/* set */ while ((*addr &INTEL_FINISHED ) !=INTEL_FINISHED ) { -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_UNLOCK_TOUT ) {printf ("Flash lock bit operation timed out\n" ); rc =1 ;
board/altera/common/AMDLV065D.c +4 -4
@@ -131,11 +131,11 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)/* Now just wait for 0xff & provide some user * feedback while we wait. */ - start =get_timer (0 ); + start =time_now_ms ();while (readb (addr2) !=0xff ) {udelay (1000 *1000 );putc ('.' ); -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("timeout\n" );return 1 ; }
@@ -175,9 +175,9 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)writeb (b, dst);/* Verify write */ - start =get_timer (0 ); + start =time_now_ms ();while (readb (dst) != b) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return 1 ; } }
board/altera/common/flash.c +5 -5
@@ -121,14 +121,14 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) *addr2 =0x30 ;/* Now just wait for 0xff & provide some user * feedback while we wait. Here we have to grant -* timer interrupts. Otherwise get_timer() can't +* timer interrupts. Otherwise time_*() can't * work right. */ ipri (oldpri); - start =get_timer (0 ); + start =time_now_ms ();while (*addr2 !=0xff ) {udelay (1000 *1000 );putc ('.' ); -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("timeout\n" );return 1 ; }
@@ -179,9 +179,9 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) *dst = b;/* Verify write */ - start =get_timer (0 ); + start =time_now_ms ();while (*dst != b) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {ipri (oldpri);return 1 ; }
board/amcc/common/flash.c +8 -8
@@ -359,11 +359,11 @@ static int wait_for_DQ7_1(flash_info_t * info, int sect)volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -603,11 +603,11 @@ static int write_word(flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
@@ -804,11 +804,11 @@ static int wait_for_DQ7_2(flash_info_t * info, int sect)volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -941,11 +941,11 @@ static int write_word_2(flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/amcc/taihu/flash.c +8 -8
@@ -473,11 +473,11 @@ static int wait_for_DQ7_1(flash_info_t * info, int sect)volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -720,11 +720,11 @@ static int write_word(flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return 1 ; } }
@@ -932,11 +932,11 @@ static int wait_for_DQ7_2(flash_info_t * info, int sect)volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while (((CONFIG_SYS_FLASH_WORD_SIZE )addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x80808080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x80808080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -1069,11 +1069,11 @@ static int write_word_2(flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x80808080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x80808080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return 1 ; } }
board/amcc/yucca/flash.c +8 -8
@@ -385,11 +385,11 @@ static int wait_for_DQ7_1(flash_info_t * info, int sect)volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -620,11 +620,11 @@ static int write_word(flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT )return (1 ); } }
@@ -810,11 +810,11 @@ static int wait_for_DQ7_2(flash_info_t * info, int sect)volatile CONFIG_SYS_FLASH_WORD_SIZE *addr = (CONFIG_SYS_FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -942,11 +942,11 @@ static int write_word_2(flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT )return (1 ); } }
board/amirix/ap1000/flash.c +2 -2
@@ -481,9 +481,9 @@ static int flash_status_check (flash_info_t * info, ulong sector, ulong tout,ulong start;/* Wait for command completion */ - start =get_timer (0 ); + start =time_now_ms ();while (!flash_isset (info, sector,0 ,FLASH_STATUS_DONE )) { -if (get_timer (start) > info->erase_blk_tout) { +if (time_since_ms (start) > info->erase_blk_tout) {printf ("Flash %s timeout at address %lx\n" , prompt, info->start[sector]);flash_write_cmd (info, sector,0 ,FLASH_CMD_RESET );
board/armadillo/flash.c +2 -2
@@ -193,7 +193,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)/* Start erase on unprotected sectors */ for (sect = s_first; sect <= s_last && !ctrlc (); sect++) {/* ARM simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */
@@ -252,7 +252,7 @@ static int write_word (flash_info_t * info, ulong dest, ushort data) flag =disable_interrupts ();/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms (); base = dest &0xF0000000 ;FL_WORD (base + (0x555 <<1 )) =0xAA ;
board/astro/mcf5373l/mcf5373l.c +2 -2
@@ -160,8 +160,8 @@ void astro_put_char(char ch)* Wait for last character to go. Timeout of 6ms should * be enough for our lowest baud rate of 2400. */ - timer =get_timer (0 ); -while (get_timer (timer) <6 ) { + timer =time_now_ms (); +while (time_since_ms (timer) <6 ) {if (readb (&uart->usr) &UART_USR_TXRDY )break ; }
board/atc/flash.c +11 -11
@@ -434,7 +434,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - last =get_timer (0 ); + last =time_now_ms ();/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last && rcode ==0 ; sect++) {
@@ -468,7 +468,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* wait@least 50us for AMD, 80us for Intel. * Let's wait 1 ms.
@@ -476,7 +476,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while ((*addr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );if (intel) {
@@ -490,16 +490,16 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); } }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); }flash_reset (info);/* reset to read mode */
@@ -597,11 +597,11 @@ static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while (res ==0 && (*dest & (FPW )0x00800080 ) != (data & (FPW )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00F000F0 ;/* reset bank */ res =1 ; }
@@ -644,10 +644,10 @@ static int write_word_intel (flash_info_t *info, FPWV *dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while (res ==0 && (*dest & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00B000B0 ;/* Suspend program */ res =1 ; }
board/atmel/at91rm9200dk/flash.c +4 -4
@@ -326,7 +326,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ volatile u16 *addr = (volatile u16 *) (info->start[sect]);
@@ -346,7 +346,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) result = *addr;/* check timeout */ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {MEM_FLASH_ADDR1 =CMD_READ_ARRAY ; chip1 =TMO ;break ;
@@ -427,7 +427,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait until flash is ready */ chip1 =0 ;
@@ -435,7 +435,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) result = *addr;/* check timeout */ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { chip1 =ERR |TMO ;break ; }
board/atmel/atstk1000/flash.c +1 -1
@@ -108,7 +108,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) flags =disable_interrupts (); - start_time =get_timer (0 ); + start_time =time_now_ms ();/* Unlock sector */ writew (0xaa , fb +0x555 );
board/bmw/flash.c +4 -4
@@ -620,14 +620,14 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (FLASH_WORD_SIZE *) (info->start[0 ] + ((info->start[l_sect] - info-> start[0 ]) << sh8b));while ((addr[0 ] & (FLASH_WORD_SIZE )0x00800080 ) != (FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -763,10 +763,10 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i << sh8b] & (FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/c2mon/flash.c +4 -4
@@ -432,11 +432,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);while ((addr[0 ] &0x00800080 ) !=0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -557,9 +557,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/cerf250/flash.c +4 -4
@@ -266,14 +266,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms (); *addr = (FPW )0x00500050 ;/* clear status register */ *addr = (FPW )0x00200020 ;/* erase setup */ *addr = (FPW )0x00D000D0 ;/* erase confirm */ while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr = (FPW )0x00B000B0 ;/* suspend erase */ *addr = (FPW )0x00FF00FF ;/* reset to read mode */
@@ -404,11 +404,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr = (FPW )0x00FF00FF ;/* restore read mode */ return (1 ); }
board/cm4008/flash.c +4 -4
@@ -251,7 +251,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms (); addr = (volatile unsigned char *) (info->start[sect]); *addr =0x50 ;/* clear status register */
@@ -259,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) *addr =0xD0 ;/* erase confirm */ while (((status = *addr) &0x80 ) !=0x80 ) { -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =0xB0 ;/* suspend erase */
@@ -386,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((status = *addr) &0x80 ) !=0x80 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =0xFF ;/* restore read mode */ return (1 ); }
board/cm41xx/flash.c +4 -4
@@ -251,7 +251,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms (); addr = (volatile unsigned char *) (info->start[sect]); *addr =0x50 ;/* clear status register */
@@ -259,7 +259,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) *addr =0xD0 ;/* erase confirm */ while (((status = *addr) &0x80 ) !=0x80 ) { -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =0xB0 ;/* suspend erase */
@@ -386,11 +386,11 @@ static int write_data (flash_info_t * info, ulong dest, unsigned char data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((status = *addr) &0x80 ) !=0x80 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =0xFF ;/* restore read mode */ return (1 ); }
board/cmc_pu2/flash.c +4 -4
@@ -335,11 +335,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last =0 ; addr = (vu_short *)(info->start[l_sect]);while ((addr[0 ] &0x0080 ) !=0x0080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -456,11 +456,11 @@ static int write_word_amd (flash_info_t *info, vu_short *dest, ushort data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while ((*dest &0x0080 ) != (data &0x0080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest =0x00F0 ;/* reset bank */ return (1 ); }
board/cmi/flash.c +6 -6
@@ -317,7 +317,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */
@@ -345,7 +345,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while (((status = *addr) &FLASH_STATUS_DONE ) !=FLASH_STATUS_DONE ) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Flash erase timeout at address %lx\n" , info->start[sect]); *addr =FLASH_CMD_SUSPEND_ERASE ; *addr =FLASH_CMD_RESET ;
@@ -469,11 +469,11 @@ static int write_short (flash_info_t *info, ulong dest, ushort data) }/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();/* wait for error or finish */ while (!(addr[0 ] &FLASH_STATUS_DONE )){ -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { addr[0 ] =FLASH_CMD_RESET ;return (1 ); }
@@ -502,9 +502,9 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) }/* wait for error or finish */ - start =get_timer (0 ); + start =time_now_ms ();while (!(addr[0 ] &FLASH_STATUS_DONE )){ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Flash protect timeout at address %lx\n" , info->start[sector]); addr[0 ] =FLASH_CMD_RESET ;return (1 );
board/cobra5272/flash.c +4 -4
@@ -191,7 +191,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ volatile u16 *addr =
@@ -212,7 +212,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) result = *addr;/* check timeout */ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {MEM_FLASH_ADDR1 =CMD_READ_ARRAY ; chip1 =TMO ;break ;
@@ -293,7 +293,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait until flash is ready */ chip1 =0 ;
@@ -301,7 +301,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) result = *addr;/* check timeout */ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { chip1 =ERR |TMO ;break ; }
board/cogent/flash.c +7 -7
@@ -262,9 +262,9 @@ c302f_write_word(c302f_addr_t addr, c302f_word_t value) retval =0 ;/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms (); do { - if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { + if (time_since_ms(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { retval = 1; goto done; }
@@ -453,7 +453,7 @@ flash_erase(flash_info_t *info, int s_first, int s_last) prot, (prot > 1 ? "s" : "")); } - start =get_timer (0 ); + start =time_now_ms (); last =0 ; haderr =0 ;
@@ -467,10 +467,10 @@ flash_erase(flash_info_t *info, int s_first, int s_last)/* wait at least 80us - let's wait 1 ms */ udelay (1000 ); - estart =get_timer (start); + estart =time_since_ms (start); do { - now = get_timer(start); + now = time_since_ms(start); if (now - estart > CONFIG_SYS_FLASH_ERASE_TOUT) { printf ("Timeout (sect %d)\n", sect);
@@ -559,7 +559,7 @@ write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)/* * handle word aligned part */ - start =get_timer (0 ); + start =time_now_ms (); last =0 ;while (cnt >=4 ) { data =0 ;
@@ -573,7 +573,7 @@ write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt) cnt -=4 ;/* show that we're waiting */ - now =get_timer (start); + now =time_since_ms (start);if ((now - last) >1000 ) {/* every second */ putc ('.' ); last = now;
board/cpc45/flash.c +4 -4
@@ -276,7 +276,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */ for (sect = s_first; sect <= s_last; sect++) {
@@ -308,7 +308,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)while (((addr[0 ] &0x00800080 ) !=0x00800080 ) || ((addr[1 ] &0x00800080 ) !=0x00800080 )) { -if ((now =get_timer (start)) > +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); addr[0 ] =0x00B000B0 ;/* suspend erase */
@@ -482,11 +482,11 @@ static int write_data (flash_info_t * info, ulong dest, ulong * data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while (((addr[0 ] &0x00800080 ) !=0x00800080 ) || ((addr[1 ] &0x00800080 ) !=0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { addr[0 ] =0x00FF00FF ;/* restore read mode */ return (1 ); }
board/cpu86/flash.c +8 -8
@@ -378,11 +378,11 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)if (l_sect <0 ) goto AMD_DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_char *)(info->start[l_sect]);while ((addr[0 ] &0x80 ) !=0x80 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -408,7 +408,7 @@ AMD_DONE:volatile ulong *addr = (volatile unsigned long *) info->start[sect]; - start =get_timer (0 ); + start =time_now_ms (); last = start;if (info->protect[sect] ==0 ) {/* Disable interrupts which might cause a timeout here
@@ -434,7 +434,7 @@ AMD_DONE: last = start;while ((addr[0 ] &0x00800080 ) !=0x00800080 || (addr[1 ] &0x00800080 ) !=0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout (erase suspended!)\n" );/* Suspend erase */
@@ -547,9 +547,9 @@ static int write_word (flash_info_t * info, volatile unsigned long *addr,if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while ((*addr &0x00800080 ) !=0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {/* Suspend program */ *addr =0x00B000B0 ;
@@ -602,9 +602,9 @@ static int write_byte (flash_info_t *info, ulong dest, uchar data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_char *)dest) &0x80 ) != (data &0x80 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/cpu87/flash.c +8 -8
@@ -387,11 +387,11 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)if (l_sect <0 ) goto AMD_DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_char *)(info->start[l_sect]);while ((addr[0 ] &0x80 ) !=0x80 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -417,7 +417,7 @@ AMD_DONE:volatile ulong *addr = (volatile unsigned long *) info->start[sect]; - start =get_timer (0 ); + start =time_now_ms (); last = start;if (info->protect[sect] ==0 ) {/* Disable interrupts which might cause a timeout here
@@ -443,7 +443,7 @@ AMD_DONE: last = start;while ((addr[0 ] &0x00800080 ) !=0x00800080 || (addr[1 ] &0x00800080 ) !=0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout (erase suspended!)\n" );/* Suspend erase */
@@ -556,9 +556,9 @@ static int write_word (flash_info_t * info, volatile unsigned long *addr,if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while ((*addr &0x00800080 ) !=0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {/* Suspend program */ *addr =0x00B000B0 ;
@@ -611,9 +611,9 @@ static int write_byte (flash_info_t *info, ulong dest, uchar data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_char *)dest) &0x80 ) != (data &0x80 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/cradle/flash.c +4 -4
@@ -174,7 +174,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ vu_short *addr = (vu_short *) (info->start[sect]);
@@ -183,7 +183,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) *addr =0xD0 ;/* erase confirm */ while ((*addr &0x80 ) !=0x80 ) { -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { *addr =0xB0 ;/* suspend erase */ *addr =0xFF ;/* reset to read mode */
@@ -248,11 +248,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((val = *addr) &0x80 ) !=0x80 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { rc =ERR_TIMOUT ;/* suspend program command */ *addr =0xB0 ;
board/cray/L1/flash.c +4 -4
@@ -250,10 +250,10 @@ int wait_for_DQ7(flash_info_t *info, int sect)ulong start, now, last;volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *)(info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((addr[0 ] & (FLASH_WORD_SIZE )0x00800080 ) != (FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -454,10 +454,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/csb226/flash.c +4 -4
@@ -176,7 +176,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ u32 *volatile addr = (u32 *volatile )(info->start[sect]);
@@ -190,7 +190,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) *addr =0x00D000D0 ;/* erase confirm */ while ((*addr &0x00800080 ) !=0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { *addr =0x00B000B0 ;/* suspend erase*/ *addr =0x00FF00FF ;/* read mode */ rc =ERR_TIMOUT ;
@@ -249,11 +249,11 @@ static int write_long (flash_info_t *info, ulong dest, ulong data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((val = *addr) &0x00800080 ) !=0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { rc =ERR_TIMOUT ;/* suspend program command */ *addr =0x00B000B0 ;
board/cu824/flash.c +4 -4
@@ -235,7 +235,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) {
@@ -267,7 +267,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)while (((addr[0 ] &0x00800080 ) !=0x00800080 ) || ((addr[1 ] &0x00800080 ) !=0x00800080 ) ) { -if ((now=get_timer (start)) > +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); addr[0 ] =0x00B000B0 ;/* suspend erase */
@@ -448,11 +448,11 @@ static int write_data (flash_info_t *info, ulong dest, ulong *data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while (((addr[0 ] &0x00800080 ) !=0x00800080 ) || ((addr[1 ] &0x00800080 ) !=0x00800080 ) ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { addr[0 ] =0x00FF00FF ;/* restore read mode */ return (1 ); }
board/dave/common/flash.c +4 -4
@@ -535,11 +535,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[l_sect]);while ((addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -691,10 +691,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/dnp1110/flash.c +4 -4
@@ -257,14 +257,14 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms (); *addr = (FPW )0x00500050 ;/* clear status register */ *addr = (FPW )0x00200020 ;/* erase setup */ *addr = (FPW )0x00D000D0 ;/* erase confirm */ while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr = (FPW )0x00B000B0 ;/* suspend erase */ *addr = (FPW )0x00FF00FF ;/* reset to read mode */
@@ -396,11 +396,11 @@ static int write_data (flash_info_t *info, ulong dest, FPW data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (start =get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (start =time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr = (FPW )0x00FF00FF ;/* restore read mode */ return (1 ); }
board/earthlcd/favr-32-ezkit/flash.c +1 -1
@@ -106,7 +106,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last) flags =disable_interrupts (); - start_time =get_timer (0 ); + start_time =time_now_ms ();/* Unlock sector */ writew (0xaa , fb +0x555 );
board/eltec/bab7xx/flash.c +4 -4
@@ -366,11 +366,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (FLASH_WORD_SIZE *)(info->start[l_sect]);while ((addr[0 ] & (FLASH_WORD_SIZE )0x00800080 ) != (FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -497,10 +497,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/eltec/elppc/flash.c +4 -4
@@ -366,11 +366,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (FLASH_WORD_SIZE *)(info->start[l_sect]);while ((addr[0 ] & (FLASH_WORD_SIZE )0x00800080 ) != (FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -497,10 +497,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/eltec/mhpc/flash.c +4 -4
@@ -254,7 +254,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) {
@@ -277,7 +277,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while (((status =SWAP (*addr)) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr = (FPW )0xB000B000 ;/* suspend erase */ *addr = (FPW )0xFF00FF00 ;/* reset to read mode */
@@ -416,10 +416,10 @@ static int write_data (flash_info_t *info, ulong dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while (((status =SWAP (*addr)) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr = (FPW )0xFF00FF00 ;/* restore read mode */ return (1 ); }
board/emk/common/flash.c +9 -9
@@ -417,7 +417,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - last =get_timer (0 ); + last =time_now_ms ();/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last && rcode ==0 ; sect++) {
@@ -451,7 +451,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* wait@least 50us for AMD, 80us for Intel. * Let's wait 1 ms.
@@ -459,7 +459,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while ((*addr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );if (intel) {
@@ -473,16 +473,16 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); } }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); }flash_reset (info);/* reset to read mode */
@@ -577,11 +577,11 @@ static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while (res ==0 && (*dest & (FPW )0x00800080 ) != (data & (FPW )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00F000F0 ;/* reset bank */ res =1 ; }
board/ep7312/flash.c +4 -4
@@ -157,7 +157,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ vu_short *addr = (vu_short *) (info->start[sect]);
@@ -166,7 +166,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) *addr =0xD0 ;/* erase confirm */ while ((*addr &0x80 ) !=0x80 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { *addr =0xB0 ;/* suspend erase */ *addr =0xFF ;/* reset to read mode */ rc =ERR_TIMOUT ;
@@ -230,11 +230,11 @@ static int write_word (flash_info_t * info, ulong dest, ushort data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((val = *addr) &0x80 ) !=0x80 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { rc =ERR_TIMOUT ;/* suspend program command */ *addr =0xB0 ;
board/ep8260/flash.c +4 -4
@@ -279,12 +279,12 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((V_ULONG ( info->start[l_sect] ) &0x00800080 ) !=0x00800080 || (V_ULONG ( info->start[l_sect] +4 ) &0x00800080 ) !=0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -400,10 +400,10 @@ static int write_dword (flash_info_t *info, ulong dest, unsigned char * pdata)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while (((V_ULONG ( dest ) &0x00800080 ) != (ch &0x00800080 )) || ((V_ULONG ( dest +4 ) &0x00800080 ) != (cl &0x00800080 ))) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/esd/common/flash.c +4 -4
@@ -527,11 +527,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (CONFIG_SYS_FLASH_WORD_SIZE *)(info->start[l_sect]);while ((addr[0 ] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -659,10 +659,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (CONFIG_SYS_FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/esd/cpci5200/strataflash.c +2 -2
@@ -408,9 +408,9 @@ static int flash_status_check(flash_info_t * info, ulong sector, ulong tout,ulong start;/* Wait for command completion */ - start =get_timer (0 ); + start =time_now_ms ();while (!flash_isset (info, sector,0 ,FLASH_STATUS_DONE )) { -if (get_timer (start) > info->erase_blk_tout) { +if (time_since_ms (start) > info->erase_blk_tout) {printf ("Flash %s timeout at address %lx\n" , prompt, info->start[sector]);flash_write_cmd (info, sector,0 ,FLASH_CMD_RESET );
board/esd/pf5200/flash.c +9 -9
@@ -297,7 +297,7 @@ int flash_erase(flash_info_t * info, int s_first, int s_last) {printf ("\n" ); } - last =get_timer (0 ); + last =time_now_ms ();/* Start erase on unprotected sectors */ for (sect = s_first; sect <= s_last && rcode ==0 ; sect++) {
@@ -329,14 +329,14 @@ int flash_erase(flash_info_t * info, int s_first, int s_last) {if (flag) {enable_interrupts (); } - start =get_timer (0 ); + start =time_now_ms ();/* wait@least 50us for AMD, 80us for Intel. */ /* Let's wait 1 ms. */ udelay (1000 );while ((*addr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );if (intel) {/* suspend erase */
@@ -347,17 +347,17 @@ int flash_erase(flash_info_t * info, int s_first, int s_last) {break ; }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) { +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); } }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) { +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); }flash_reset (info);/* reset to read mode */ }
@@ -447,12 +447,12 @@ static int write_word_amd(flash_info_t * info, FPWV * dest, FPW data) {if (flag) {enable_interrupts (); } - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while (res ==0 && (*dest & (FPW )0x00800080 ) != (data & (FPW )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00F000F0 ;/* reset bank */ res =1 ; }
board/esteem192e/flash.c +9 -9
@@ -764,12 +764,12 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (volatile FLASH_WORD_SIZE *) (info->start[l_sect]);while ((addr[0 ] & (0x00800080 &FLASH_ID_MASK )) != (0x00800080 &FLASH_ID_MASK )) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -1016,13 +1016,13 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();if (info->flash_id >FLASH_AMD_COMP ) {while ((*((vu_long *) dest) &0x00800080 ) != (data &0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
@@ -1030,7 +1030,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) }else {while (!(addr[0 ] &0x00800080 )) {/* wait for error or finish */ -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); }
@@ -1091,12 +1091,12 @@ static int write_short (flash_info_t * info, ulong dest, ushort data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();if (info->flash_id <FLASH_AMD_COMP ) {/* AMD stuff */ while ((*((vu_short *) dest) &0x0080 ) != (data &0x0080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
@@ -1104,7 +1104,7 @@ static int write_short (flash_info_t * info, ulong dest, ushort data) }else {/* intel stuff */ while (!(addr[0 ] &0x0080 )) {/* wait for error or finish */ -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT )return (1 ); }
@@ -1123,7 +1123,7 @@ static int write_short (flash_info_t * info, ulong dest, ushort data) *addr =0x00B0 ; *addr =0x0070 ;while (!(addr[0 ] &0x0080 )) {/* wait for error or finish */ -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT )return (1 ); } *addr =0x00FF ;
board/etin/debris/flash.c +8 -8
@@ -94,13 +94,13 @@ static int cfi_write_dword(flash_info_t *flash, ulong dest, cfi_word data)cfi_write (flash, data, dest);udelay (10 ); - start =get_timer (0 ); + start =time_now_ms ();for (;;) { status =cfi_read (flash, dest); status &=CMD (0x80 );if (status ==CMD (0x80 ))break ; -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {cfi_cmd (flash,0xff ,0 );return 1 ; }
@@ -126,10 +126,10 @@ static int jedec_write_dword (flash_info_t *flash, ulong dest, cfi_word data)cfi_write (flash, data, dest);udelay (10 ); - start =get_timer (0 ); + start =time_now_ms (); status = ~data;while (status != data) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT )return 1 ; status =cfi_read (flash, dest);udelay (1 );
@@ -223,7 +223,7 @@ static int cfi_erase_oneblock(flash_info_t *flash, uint32_t sect)enable_interrupts ();udelay (1000 ); - start =get_timer (0 ); + start =time_now_ms (); last = start;for (;;) {
@@ -231,7 +231,7 @@ static int cfi_erase_oneblock(flash_info_t *flash, uint32_t sect) status &=CMD (0x80 );if (status ==CMD (0x80 ))break ; -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {cfi_cmd (flash,0xff ,0 );printf ("Timeout\n" );return ERR_TIMOUT ;
@@ -290,14 +290,14 @@ static int jedec_erase(flash_info_t *flash, uint32_t s_first, uint32_t s_last) goto DONE;udelay (1000 ); - start =get_timer (0 ); + start =time_now_ms (); last = start;for (;;) { status =cfi_read (flash, sa);if (status ==CMD (0xffff ))break ; -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return ERR_TIMOUT ; }
board/etx094/flash.c +6 -6
@@ -506,7 +506,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) {
@@ -548,7 +548,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)#else while ((sect_addr[0 ] &0x00800080 ) !=0x00800080 ) {#endif -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -691,9 +691,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_short *)dest) &0x0080 ) != (high_data &0x0080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
@@ -725,7 +725,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();#ifdef CONFIG_FLASH_16BIT while ((*((vu_short *)dest) &0x0080 ) != (low_data &0x0080 )) {
@@ -733,7 +733,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)while ((*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 )) {#endif -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/evb4510/flash.c +2 -2
@@ -200,8 +200,8 @@ static u16 _flash_poll (FLASH_DEV dev, u32 addr, u16 data, ulong timeOut)volatile u16 flashData; data = data &0xFF ; - t0 =get_timer (0 ); -while (get_timer (t0) < timeOut) { + t0 =time_now_ms (); +while (time_since_ms (t0) < timeOut) {/* for( i = 0; i < POLL_LOOPS; i++) { */ /* Read the Data */ flashData =GET__U8 (addr);
board/evb64260/flash.c +4 -4
@@ -676,12 +676,12 @@ flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (volatile unsigned char *)(info->start[l_sect]);/* broken for 2x16: TODO */ while ((addr[0 ] &0x80 ) !=0x80 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -843,9 +843,9 @@ write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/evb64260/intel_flash.c +8 -10
@@ -155,9 +155,9 @@ write_word_intel(bank_addr_t addr, bank_word_t value) retval =0 ;/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms (); do { - if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { + if (time_now_ms(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { retval = 1; goto done; }
@@ -215,8 +215,8 @@ flash_erase_intel(flash_info_t *info, int s_first, int s_last) prot, (prot > 1 ? "s" : "")); } - start =get_timer (0 ); - last =0 ; + start =time_now_ms (); + last = start; haderr =0 ;for (sect = s_first; sect <= s_last; sect++) {
@@ -229,12 +229,10 @@ flash_erase_intel(flash_info_t *info, int s_first, int s_last)/* wait@least 80us - let's wait 1 ms */ udelay (1000 ); - estart =get_timer (start); + start =time_now_ms (); do { - now = get_timer(start); - - if (now - estart > CONFIG_SYS_FLASH_ERASE_TOUT) { + if (time_since_ms(start) > CONFIG_SYS_FLASH_ERASE_TOUT) { printf ("Timeout (sect %d)\n", sect); haderr = 1; break;
@@ -242,9 +240,9 @@ flash_erase_intel(flash_info_t *info, int s_first, int s_last)#ifndef FLASH_DEBUG /* show that we're waiting */ -if ((now - last) >1000 ) {/* every second */ +if (time_since_ms (last) >1000 ) {/* every second */ putc ('.' ); - last = now; + last =time_now_ms (); }#endif
board/fads/flash.c +4 -4
@@ -423,12 +423,12 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *) (info->start[l_sect]);while ((addr[0 ] &0xFFFFFFFF ) !=0xFFFFFFFF ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return ERR_TIMOUT ; }
@@ -549,10 +549,10 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *) dest) &0x80808080 ) != (data &0x80808080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return ERR_TIMOUT ; } }
board/flagadm/flash.c +11 -11
@@ -374,7 +374,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms ();/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) {
@@ -400,7 +400,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) *addr =0x70 ;/*Read status register command*/ tmp = (short )*addr &0x00FF ;/* Read the status */ while (!(tmp &INTEL_FLASH_STATUS_WSMS )) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { *addr =0x0050 ;/* Reset the status register */ *addr =0xffff ;printf ("Timeout\n" );
@@ -413,7 +413,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (100000 );/* 100 ms */ *addr =0x0070 ;/*Read status register command*/ tmp = (short )*addr &0x00FF ;/* Read status */ - start =get_timer (0 ); + start =time_now_ms (); }if ( tmp &INTEL_FLASH_STATUS_ES )flash_decode_status_bits (tmp);
@@ -557,11 +557,11 @@ int write_word (flash_info_t *info, ulong dest, ulong da)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms (); flag =0 ; *addr =0x0070 ;/*Read statusregister command */ while (((csr = *addr) &INTEL_FLASH_STATUS_WSMS )!=INTEL_FLASH_STATUS_WSMS ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { flag =1 ;break ; }
@@ -642,13 +642,13 @@ int _flash_real_protect(flash_info_t *info, long idx, int prot) addr = (vu_short *)(info->start[idx]);/* If chip is busy, wait for it */ - start =get_timer (0 ); + start =time_now_ms (); *addr =0x0070 ;/*Read status register command*/ tmp = ((ushort)(*addr))&0x00ff ;/*Read the status*/ while (!(tmp &INTEL_FLASH_STATUS_WSMS )) {/*Write State Machine Busy*/ /*Wait untill done or timeout.*/ -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =0x0050 ;/* Reset the status register */ *addr =0xffff ;/* Reset the chip */ printf ("TTimeout\n" );
@@ -656,7 +656,7 @@ int _flash_real_protect(flash_info_t *info, long idx, int prot) } *addr =0x0070 ; tmp = ((ushort)(*addr))&0x00ff ;/*Read the status*/ - start =get_timer (0 ); + start =time_now_ms (); }/* Disable interrupts which might cause a timeout here */
@@ -671,12 +671,12 @@ int _flash_real_protect(flash_info_t *info, long idx, int prot)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms (); *addr =0x0070 ;/*Read status register command*/ tmp = ((ushort)(*addr)) &0x00FF ;/* Read the status */ while (!(tmp &INTEL_FLASH_STATUS_WSMS )) {/* Write State Machine Busy */ -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =0x0050 ;/* Reset the status register */ *addr =0xffff ;printf ("Timeout\n" );
@@ -689,7 +689,7 @@ int _flash_real_protect(flash_info_t *info, long idx, int prot)udelay (100000 );/* 100 ms */ *addr =0x70 ;/*Read status register command*/ tmp = (short )*addr &0x00FF ;/* Read status */ - start =get_timer (0 ); + start =time_now_ms (); }if ( tmp &INTEL_FLASH_STATUS_PS )flash_decode_status_bits (tmp);
board/freescale/m5253demo/flash.c +7 -7
@@ -232,7 +232,7 @@ int flash_erase(flash_info_t * info, int s_first, int s_last) flag =disable_interrupts (); - start =get_timer (0 ); + start =time_now_ms (); last = start;if ((s_last - s_first) == (CONFIG_SYS_SST_SECT -1 )) {
@@ -247,7 +247,7 @@ int flash_erase(flash_info_t * info, int s_first, int s_last) *addr =0x0030 ;/* erase chip */ count =0 ; - start =get_timer (0 ); + start =time_now_ms ();while ((*addr &0x0080 ) !=0x0080 ) {if (count++ >0x10000 ) {
@@ -255,7 +255,7 @@ int flash_erase(flash_info_t * info, int s_first, int s_last) count =0 ; } -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =0x00F0 ;/* reset to read mode */
@@ -285,7 +285,7 @@ int flash_erase(flash_info_t * info, int s_first, int s_last)printf ("." );/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();switch (flashtype) {case 1 :
@@ -307,7 +307,7 @@ int flash_erase(flash_info_t * info, int s_first, int s_last)enable_interrupts ();while ((*addr &0x0080 ) !=0x0080 ) { -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =0x00F0 ;/* reset to read mode */
@@ -439,12 +439,12 @@ int write_word(flash_info_t * info, FPWV * dest, u16 data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while (res ==0 && (*dest & (u8 )0x00800080 ) != (data & (u8 )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (u8 )0x00F000F0 ;/* reset bank */ res =1 ; }
board/freescale/mpc8260ads/flash.c +6 -6
@@ -252,7 +252,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (info->protect[sect] ==0 ) {/* not protected */ vu_long *addr = (vu_long *)(info->start[sect]); - last = start =get_timer (0 ); + last = start =time_now_ms ();/* Disable interrupts which might cause a timeout here */ flag =disable_interrupts ();
@@ -274,7 +274,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)enable_interrupts ();while ((*addr &INTEL_FINISHED ) !=INTEL_FINISHED ) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =INTEL_RESET ;/* reset bank */ return 1 ;
@@ -336,9 +336,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*addr &INTEL_FINISHED ) !=INTEL_FINISHED ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {printf ("Write timed out\n" ); rc =1 ;break ;
@@ -452,9 +452,9 @@ int flash_real_protect(flash_info_t *info, long sector, int prot) *addr =INTEL_CONFIRM ;/* clear */ } - start =get_timer (0 ); + start =time_now_ms ();while ((*addr &INTEL_FINISHED ) !=INTEL_FINISHED ) { -if (get_timer (start) >CONFIG_SYS_FLASH_UNLOCK_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_UNLOCK_TOUT ) {printf ("Flash lock bit operation timed out\n" ); rc =1 ;break ;
board/freescale/mpc8266ads/flash.c +6 -6
@@ -304,7 +304,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (info->protect[sect] ==0 ) {/* not protected */ vu_long *addr = (vu_long *)(info->start[sect]); - last = start =get_timer (0 ); + last = start =time_now_ms ();/* Disable interrupts which might cause a timeout here */ flag =disable_interrupts ();
@@ -336,7 +336,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) *addr =0xFFFFFFFF ;/* reset bank */ return 1 ; } -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =0xFFFFFFFF ;/* reset bank */ return 1 ;
@@ -458,10 +458,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms (); flag =0 ;while (((csr = *addr) &0x80808080 ) !=0x80808080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { flag =1 ;break ; }
@@ -497,9 +497,9 @@ static int clear_block_lock_bit(vu_long * addr) *addr =0x60606060 ; *addr =0xd0d0d0d0 ; - start =get_timer (0 ); + start =time_now_ms ();while (*addr !=0x80808080 ){ -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout on clearing Block Lock Bit\n" ); *addr =0xFFFFFFFF ;/* reset bank */ return 1 ;
board/funkwerk/vovpn-gw/flash.c +8 -8
@@ -236,7 +236,7 @@ flash_erase(flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;for (sect = s_first; sect<=s_last; sect++) {
@@ -265,7 +265,7 @@ flash_erase(flash_info_t *info, int s_first, int s_last)udelay (1000 );while (((status = *addr) &FLASH_STATUS_DONE ) !=FLASH_STATUS_DONE ) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Flash erase timeout at address %lx\n" , info->start[sect]); *addr =FLASH_CMD_SUSPEND_ERASE ; *addr =FLASH_CMD_RESET ;
@@ -293,7 +293,7 @@ write_buff2( volatile FLASH_WORD_SIZE *dst,FLASH_WORD_SIZE status;int flag, i; - start =get_timer (0 ); + start =time_now_ms ();while (1 ) {/* Disable interrupts which might cause a timeout here */ flag =disable_interrupts ();
@@ -307,7 +307,7 @@ write_buff2( volatile FLASH_WORD_SIZE *dst,enable_interrupts (); } -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (-1 ); } }
@@ -329,7 +329,7 @@ poll_status( volatile FLASH_WORD_SIZE *addr ) {unsigned long start; - start =get_timer (0 ); + start =time_now_ms ();/* wait for error or finish */ while (1 ) {if (*addr ==FLASH_STATUS_DONE ) {
@@ -337,7 +337,7 @@ poll_status( volatile FLASH_WORD_SIZE *addr )break ; } } -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =FLASH_CMD_RESET ;return (-1 ); }
@@ -433,9 +433,9 @@ flash_real_protect(flash_info_t *info, long sector, int prot) }/* wait for error or finish */ - start =get_timer (0 ); + start =time_now_ms ();while (!(addr[0 ] &FLASH_STATUS_DONE )){ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Flash protect timeout at address %lx\n" , info->start[sector]); addr[0 ] =FLASH_CMD_RESET ;return (1 );
board/g2000/strataflash.c +2 -2
@@ -432,9 +432,9 @@ static int flash_status_check(flash_info_t * info, ulong sector, ulong tout, chaulong start;/* Wait for command completion */ - start =get_timer (0 ); + start =time_now_ms ();while (!flash_isset (info, sector,0 ,FLASH_STATUS_DONE )) { -if (get_timer (start) > info->erase_blk_tout) { +if (time_since_ms (start) > info->erase_blk_tout) {printf ("Flash %s timeout at address %lx\n" , prompt, info->start[sector]);flash_write_cmd (info, sector,0 ,FLASH_CMD_RESET );return ERR_TIMOUT ;
board/gcplus/flash.c +4 -4
@@ -270,7 +270,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms (); *addr = (FPW )0x00500050 ;/* clear status register */ *addr = (FPW )0x00200020 ;/* erase setup */
@@ -279,7 +279,7 @@ flash_erase(flash_info_t * info, int s_first, int s_last)while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr = (FPW )0x00B000B0 ;/* suspend erase */ *addr = (FPW )0x00FF00FF ;/* reset to read mode */
@@ -412,11 +412,11 @@ write_data(flash_info_t * info, ulong dest, FPW data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr = (FPW )0x00FF00FF ;/* restore read mode */ return (1 ); }
board/gen860t/flash.c +8 -8
@@ -353,7 +353,7 @@ flash_erase(flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/*
@@ -385,7 +385,7 @@ flash_erase(flash_info_t *info, int s_first, int s_last)udelay (1000 );while (((status = *addr) &SCS_SR7 ) !=SCS_SR7 ) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =SCS_BLOCK_ERASE_SUSPEND_CMD ; *addr =SCS_READ_CMD ;
@@ -425,7 +425,7 @@ write_flash_buffer8(flash_info_t *info_p, vu_char *src_p, vu_char *dest_p,ulong blocksize = info_p->size / (ulong )info_p->sector_count;int i; -uint time =get_timer (0 ); +uint time =time_now_ms ();PRINTF ("%s:%d: src: 0x%p dest: 0x%p count: %d\n" , __FUNCTION__, __LINE__, src_p, dest_p, count);
@@ -451,7 +451,7 @@ write_flash_buffer8(flash_info_t *info_p, vu_char *src_p, vu_char *dest_p,*/ *block_addr_p =SCS_WRITE_BUF_CMD ;while ((*block_addr_p &SCS_XSR7 ) !=SCS_XSR7 ) { -if (get_timer (time) >CONFIG_SYS_FLASH_ALLOC_BUFFER_TOUT ) { +if (time_since_ms (time) >CONFIG_SYS_FLASH_ALLOC_BUFFER_TOUT ) {PRINTF ("%s:%d: Buffer allocation timeout @ 0x%p (waited %d mS)\n" , __FUNCTION__, __LINE__, block_addr_p,CONFIG_SYS_FLASH_ALLOC_BUFFER_TOUT );
@@ -476,9 +476,9 @@ write_flash_buffer8(flash_info_t *info_p, vu_char *src_p, vu_char *dest_p,*/ *block_addr_p =SCS_PROGRAM_RESUME_CMD ;#if 1 - time =get_timer (0 ); + time =time_now_ms ();while ((*block_addr_p &SCS_SR7 ) !=SCS_SR7 ) { -if (get_timer (time) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (time) >CONFIG_SYS_FLASH_WRITE_TOUT ) {PRINTF ("%s:%d: Write timeout @ 0x%p (waited %d mS)\n" , __FUNCTION__, __LINE__, block_addr_p,CONFIG_SYS_FLASH_WRITE_TOUT );return 1 ;
@@ -629,10 +629,10 @@ write_data8 (flash_info_t *info, ulong dest, uchar data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while (((status = *addr) &SCS_SR7 ) !=SCS_SR7 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =SCS_READ_CMD ;return (1 ); }
board/genietv/flash.c +4 -4
@@ -316,13 +316,13 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (volatile unsigned char *)(info->start[l_sect]);while ((addr[0 ] &0xFF ) !=0xFF ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -451,10 +451,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*cdest ^ *cdata) &0x80 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/gw8260/flash.c +4 -4
@@ -353,11 +353,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);while ((addr[0 ] &0x80808080 ) !=0x80808080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -510,9 +510,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x80808080 ) != (data &0x80808080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/hermes/flash.c +4 -4
@@ -372,11 +372,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_char *)(info->start[l_sect]);while ((addr[0 ] &0x80 ) !=0x80 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -447,9 +447,9 @@ static int write_byte (flash_info_t *info, ulong dest, uchar data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_char *)dest) &0x80 ) != (data &0x80 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/hidden_dragon/flash.c +4 -4
@@ -419,14 +419,14 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (FLASH_WORD_SIZE *) (info->start[0 ] + ((info->start[l_sect] - info-> start[0 ]) << sh8b));while ((addr[0 ] & (FLASH_WORD_SIZE )0x00800080 ) != (FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -562,10 +562,10 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i << sh8b] & (FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/hymod/flash.c +5 -5
@@ -196,9 +196,9 @@ bank_write_word (volatile bank_addr_t addr, bank_word_t value) retval =0 ;/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms (); do { - if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) { + if (time_since_ms(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { retval = 1; goto done; }
@@ -349,7 +349,7 @@ flash_erase (flash_info_t *info, int s_first, int s_last) prot, (prot > 1 ? "s" : "")); } - start =get_timer (0 ); + start =time_now_ms (); last =0 ; haderr =0 ;
@@ -363,10 +363,10 @@ flash_erase (flash_info_t *info, int s_first, int s_last)/* wait at least 80us - let's wait 1 ms */ udelay (1000 ); - estart =get_timer (start); + estart =time_since_ms (start); do { - now = get_timer (start); + now = time_since_ms(start); if (now - estart > CONFIG_SYS_FLASH_ERASE_TOUT) { printf ("Timeout (sect %d)\n", sect);
board/icecube/flash.c +9 -9
@@ -318,7 +318,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - last =get_timer (0 ); + last =time_now_ms ();/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last && rcode ==0 ; sect++) {
@@ -352,7 +352,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* wait@least 50us for AMD, 80us for Intel. * Let's wait 1 ms.
@@ -360,7 +360,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while ((*addr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );if (intel) {
@@ -374,16 +374,16 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); } }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); }flash_reset (info);/* reset to read mode */
@@ -478,11 +478,11 @@ static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while (res ==0 && (*dest & (FPW )0x00800080 ) != (data & (FPW )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00F000F0 ;/* reset bank */ res =1 ; }
board/icu862/flash.c +4 -4
@@ -459,7 +459,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);#if 0
@@ -468,7 +468,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) while ((addr[0] & 0xFFFFFFFF) != 0xFFFFFFFF)#endif { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {puts ("Timeout\n" );return 1 ; }
@@ -599,14 +599,14 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();#if 0 while ((*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 )) #else while ((*((vu_long *)dest) & 0x80808080) != (data & 0x80808080))#endif { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/idmr/flash.c +4 -4
@@ -171,7 +171,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ volatile u16 *addr =
@@ -192,7 +192,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) result = *addr;/* check timeout */ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT *CONFIG_SYS_HZ /1000 ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT *CONFIG_SYS_HZ /1000 ) {MEM_FLASH_ADDR1 =CMD_READ_ARRAY ; chip1 =TMO ;break ;
@@ -274,7 +274,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait until flash is ready */ chip1 =0 ;
@@ -282,7 +282,7 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) result = *addr;/* check timeout */ -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT *CONFIG_SYS_HZ /1000 ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT *CONFIG_SYS_HZ /1000 ) { chip1 =ERR |TMO ;break ; }
board/impa7/flash.c +4 -4
@@ -166,7 +166,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ vu_long *addr = (vu_long *) (info->start[sect]);
@@ -175,7 +175,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last) *addr =0x00D000D0 ;/* erase confirm */ while ((*addr &0x00800080 ) !=0x00800080 ) { -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { *addr =0x00B000B0 ;/* suspend erase */ *addr =0x00FF00FF ;/* reset to read mode */
@@ -238,14 +238,14 @@ static int write_word (flash_info_t * info, ulong dest, ulong data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* read status register command */ *addr =0x00700070 ;/* wait while polling the status register */ while ((*addr &0x00800080 ) !=0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { rc =ERR_TIMOUT ;/* suspend program command */ *addr =0x00B000B0 ;
board/incaip/flash.c +11 -11
@@ -442,7 +442,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - last =get_timer (0 ); + last =time_now_ms ();/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last && rcode ==0 ; sect++) {
@@ -476,7 +476,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* wait@least 50us for AMD, 80us for Intel. * Let's wait 1 ms.
@@ -484,7 +484,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while ((*addr & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );if (intel) {
@@ -498,16 +498,16 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); } }/* show that we're waiting */ -if ((get_timer (last)) >CONFIG_SYS_HZ ) {/* every second */ +if ((time_since_ms (last)) >CONFIG_SYS_HZ ) {/* every second */ putc ('.' ); - last =get_timer (0 ); + last =time_now_ms (); }flash_reset (info);/* reset to read mode */
@@ -605,11 +605,11 @@ static int write_word_amd (flash_info_t *info, FPWV *dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();/* data polling for D7 */ while (res ==0 && (*dest & (FPW )0x00800080 ) != (data & (FPW )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00F000F0 ;/* reset bank */ res =1 ; }
@@ -652,10 +652,10 @@ static int write_word_intel (flash_info_t *info, FPWV *dest, FPW data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while (res ==0 && (*dest & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *dest = (FPW )0x00B000B0 ;/* Suspend program */ res =1 ; }
board/innokom/flash.c +4 -4
@@ -219,7 +219,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)PRINTK ("\n" );/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */ u16 *volatile addr = (u16 *volatile )(info->start[sect]);
@@ -236,7 +236,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)while ((*addr &0x0080 ) !=0x0080 ) {PRINTK ("." ); -if (get_timer (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) { *addr =0x00B0 ;/* suspend erase*/ *addr =0x00FF ;/* read mode */ rc =ERR_TIMOUT ;
@@ -304,11 +304,11 @@ static int write_word (flash_info_t *info, ulong dest, ushort data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((val = *addr) &0x80 ) !=0x80 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { rc =ERR_TIMOUT ; *addr =0xB0 ;/* suspend program command */ goto outahere;
board/ip860/flash.c +4 -4
@@ -283,7 +283,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */
@@ -309,7 +309,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while ((*addr &0x00800080 ) !=0x00800080 ) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =0xFFFFFFFF ;/* reset bank */ return 1 ;
@@ -431,10 +431,10 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms (); flag =0 ;while (((csr = *addr) &0x00800080 ) !=0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { flag =1 ;break ; }
board/iphase4539/flash.c +4 -4
@@ -277,11 +277,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = info->start[l_sect];while ((in8 (addr) &0x80 ) !=0x80 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -419,9 +419,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((in32 (dest) &0x80808080 ) != (data &0x80808080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); }iobarrier_rw ();
board/ivm/flash.c +4 -4
@@ -431,7 +431,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) {
@@ -454,7 +454,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)udelay (1000 );while (((status = *addr) &0x0080 ) !=0x0080 ) { -if ((now=get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now=time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr =0x00FF ;/* reset to read mode */ return 1 ;
@@ -580,10 +580,10 @@ static int write_data (flash_info_t *info, ulong dest, ulong data)if (flag)enable_interrupts (); - start =get_timer (0 ); + start =time_now_ms ();while (((status = *addr) &0x0080 ) !=0x0080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr =0x00FF ;/* restore read mode */ return (1 ); }
board/ixdp425/flash.c +4 -4
@@ -261,7 +261,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (start); + start =time_since_ms (start); *addr = (FPW )0x00500050 ;/* clear status register */ *addr = (FPW )0x00200020 ;/* erase setup */
@@ -270,7 +270,7 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) > +if (time_since_ms (start) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" ); *addr = (FPW )0x00B000B0 ;/* suspend erase */
@@ -404,11 +404,11 @@ static int write_data (flash_info_t * info, ulong dest, FPW data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait while polling the status register */ while (((status = *addr) & (FPW )0x00800080 ) != (FPW )0x00800080 ) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { *addr = (FPW )0x00FF00FF ;/* restore read mode */ return (1 ); }
board/jse/flash.c +4 -4
@@ -277,11 +277,11 @@ int wait_for_DQ7 (flash_info_t * info, int sect)volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *) (info->start[sect]); - start =get_timer (0 ); + start =time_now_ms (); last = start;while ((addr[0 ] & (FLASH_WORD_SIZE )0x00800080 ) != (FLASH_WORD_SIZE )0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return -1 ; }
@@ -506,11 +506,11 @@ static int write_word (flash_info_t * info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((dest2[i] & (FLASH_WORD_SIZE )0x00800080 ) != (data2[i] & (FLASH_WORD_SIZE )0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/kup/common/flash.c +6 -6
@@ -283,7 +283,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("\n" ); } - start =get_timer (0 ); + start =time_now_ms (); last = start;/* Start erase on unprotected sectors */ for (sect = s_first; sect<=s_last; sect++) {
@@ -325,7 +325,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)#else while ((sect_addr[0 ] &0x00800080 ) !=0x00800080 ) {#endif -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -465,9 +465,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_short *)dest) &0x0080 ) != (high_data &0x0080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
@@ -499,7 +499,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();#ifdef CONFIG_FLASH_16BIT while ((*((vu_short *)dest) &0x0080 ) != (low_data &0x0080 )) {
@@ -507,7 +507,7 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)while ((*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 )) {#endif -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/lantec/flash.c +4 -4
@@ -487,11 +487,11 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)if (l_sect <0 ) goto DONE; - start =get_timer (0 ); + start =time_now_ms (); last = start; addr = (vu_long *)(info->start[l_sect]);while ((addr[0 ] &0x00800080 ) !=0x00800080 ) { -if ((now =get_timer (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) { +if ((now =time_since_ms (start)) >CONFIG_SYS_FLASH_ERASE_TOUT ) {printf ("Timeout\n" );return 1 ; }
@@ -612,9 +612,9 @@ static int write_word (flash_info_t *info, ulong dest, ulong data)enable_interrupts ();/* data polling for D7 */ - start =get_timer (0 ); + start =time_now_ms ();while ((*((vu_long *)dest) &0x00800080 ) != (data &0x00800080 )) { -if (get_timer (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) { +if (time_since_ms (start) >CONFIG_SYS_FLASH_WRITE_TOUT ) {return (1 ); } }
board/lart/flash.c +4 -4
@@ -292,7 +292,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last)printf ("Erasing sector %2d ... " , sect);/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();if (info->protect[sect] ==0 ) {/* not protected */
@@ -306,7 +306,7 @@ int flash_erase (flash_info_t *info, int s_first, int s_last) do { /* check timeout */ - if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) + if (time_since_ms(start) > CONFIG_SYS_FLASH_ERASE_TOUT) { *addr = PUZZLE_TO_FLASH(CMD_SUSPEND); result = BIT_TIMEOUT;
@@ -379,13 +379,13 @@ static int write_word (flash_info_t *info, ulong dest, ulong data) *addr = data;/* arm simple, non interrupt dependent timer */ - start =get_timer (0 ); + start =time_now_ms ();/* wait until flash is ready */ do { /* check timeout */ - if (get_timer(start) > CONFIG_SYS_FLASH_ERASE_TOUT) + if (time_since_ms(start) > CONFIG_SYS_FLASH_ERASE_TOUT) { *addr = PUZZLE_TO_FLASH(CMD_SUSPEND); result = BIT_TIMEOUT;
board/linkstation/avr.c +20 -20
@@ -115,8 +115,8 @@ static inline char avr_getc(void)static int push_timeout (char button_code) { -ulong push_start =get_timer (0 ); -while (get_timer (push_start) <=PUSHHOLD ) +ulong push_start =time_now_ms (); +while (time_since_ms (push_start) <=PUSHHOLD )if (avr_tstc () &&avr_getc () == button_code)return 0 ;return 1 ;
@@ -132,21 +132,21 @@ static void next_boot_choice(void)char c; button_on =0 ; - return_start =get_timer (0 ); + return_start =time_now_ms (); on_times = boot_choice; led_state =0 ;miconCntl_SendCmd (HDDLEDOFF ); - pulse_start =get_timer (0 ); + pulse_start =time_now_ms (); -while (get_timer (return_start) <=NOBUTTON || button_on) { +while (time_since_ms (return_start) <=NOBUTTON || button_on) {if (avr_tstc ()) { c =avr_getc ();if (c ==PWRP ) button_on =1 ;else if (c ==PWRR ) { button_on =0 ; - return_start =get_timer (0 ); + return_start =time_now_ms ();if (++boot_choice >MAX_BOOT_CHOICE ) boot_choice =1 ;sprintf (envbuffer,"bootcmd%d" , boot_choice);
@@ -157,12 +157,12 @@ static void next_boot_choice(void) on_times = boot_choice; led_state =1 ;miconCntl_SendCmd (HDDLEDON ); - pulse_start =get_timer (0 ); + pulse_start =time_now_ms (); }else {perror ("Unexpected code: 0x%02X\n" , c); } } -if (on_times &&get_timer (pulse_start) >PULSETIME ) { +if (on_times &&time_since_ms (pulse_start) >PULSETIME ) {if (led_state ==1 ) { --on_times; led_state =0 ;
@@ -171,13 +171,13 @@ static void next_boot_choice(void) led_state =1 ;miconCntl_SendCmd (HDDLEDON ); } - pulse_start =get_timer (0 ); + pulse_start =time_now_ms (); } -if (!on_times &&get_timer (pulse_start) >LONGPAUSE ) { +if (!on_times &&time_since_ms (pulse_start) >LONGPAUSE ) { on_times = boot_choice; led_state =1 ;miconCntl_SendCmd (HDDLEDON ); - pulse_start =get_timer (0 ); + pulse_start =time_now_ms (); } }if (led_state)
@@ -195,21 +195,21 @@ void next_cons_choice(int console) button_on =0 ; cons_choice = console; - return_start =get_timer (0 ); + return_start =time_now_ms (); on_times = cons_choice+1 ; led_state =1 ;miconCntl_SendCmd (HDDLEDON ); - pulse_start =get_timer (0 ); + pulse_start =time_now_ms (); -while (get_timer (return_start) <=NOBUTTON || button_on) { +while (time_since_ms (return_start) <=NOBUTTON || button_on) {if (avr_tstc ()) { c =avr_getc ();if (c ==RESP ) button_on =1 ;else if (c ==RESR ) { button_on =0 ; - return_start =get_timer (0 ); + return_start =time_now_ms (); cons_choice = (cons_choice +1 ) %MAX_CONS_CHOICE ;console_assign (stdin, consoles[cons_choice]);console_assign (stdout, consoles[cons_choice]);
@@ -217,12 +217,12 @@ void next_cons_choice(int console) on_times = cons_choice+1 ; led_state =0 ;miconCntl_SendCmd (HDDLEDOFF ); - pulse_start =get_timer (0 ); + pulse_start =time_now_ms (); }else {
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.5.2.317.g391b14
Part of the diff is not shown here. View the raw message.
PATCH 16/16 Replace get_timer() usage in arch/
In reply to Graeme Russ--- arch/blackfin/cpu/jtag-console.c | 4 ++-- arch/microblaze/lib/time.c | 4 ++-- arch/nios2/cpu/epcs.c | 12 ++++++------ arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c | 8 ++++---- arch/powerpc/cpu/mpc8260/ether_fcc.c | 12 ++++++------ 5 files changed, 20 insertions(+), 20 deletions(-)
arch/blackfin/cpu/jtag-console.c +2 -2
@@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void)static bool jtag_write_emudat (uint32_t emudat) {static bool overflowed = false; -ulong timeout =get_timer (0 ) +CONFIG_JTAG_CONSOLE_TIMEOUT ; +ulong start =time_now_ms ();while (bfin_read_DBGSTAT () &0x1 ) {if (overflowed)return overflowed; -if (timeout <get_timer (0 )) +if (time_since_ms (start) >=CONFIG_JTAG_CONSOLE_TIMEOUT ) overflowed = true; } overflowed = false;
arch/microblaze/lib/time.c +2 -2
@@ -30,8 +30,8 @@void __udelay (unsigned long usec) {int i; - i =get_timer (0 ); -while ((get_timer (0 ) - i) < (usec /1000 )) ; + i =time_now_ms (); +while (time_since_ms (i) < (usec /1000 )) ; }#else void __udelay (unsigned long usec)
arch/nios2/cpu/epcs.c +6 -6
@@ -88,9 +88,9 @@ static int epcs_cs (int assert)writel (tmp |NIOS_SPI_SSO , &epcs->control); }else {/* Let all bits shift out */ - start =get_timer (0 ); + start =time_now_ms ();while ((readl (&epcs->status) &NIOS_SPI_TMT ) ==0 ) -if (get_timer (start) >EPCS_TIMEOUT ) +if (time_since_ms (start) >EPCS_TIMEOUT )return (-1 ); tmp =readl (&epcs->control);writel (tmp & ~NIOS_SPI_SSO , &epcs->control);
@@ -102,9 +102,9 @@ static int epcs_tx (unsigned char c) {ulong start; - start =get_timer (0 ); + start =time_now_ms ();while ((readl (&epcs->status) &NIOS_SPI_TRDY ) ==0 ) -if (get_timer (start) >EPCS_TIMEOUT ) +if (time_since_ms (start) >EPCS_TIMEOUT )return (-1 );writel (c, &epcs->txdata);return (0 );
@@ -114,9 +114,9 @@ static int epcs_rx (void) {ulong start; - start =get_timer (0 ); + start =time_now_ms ();while ((readl (&epcs->status) &NIOS_SPI_RRDY ) ==0 ) -if (get_timer (start) >EPCS_TIMEOUT ) +if (time_since_ms (start) >EPCS_TIMEOUT )return (-1 );return (readl (&epcs->rxdata)); }
arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c +4 -4
@@ -97,10 +97,10 @@ void i2c_init (int speed, int slaveadd)static __inline__int i2c_wait4bus (void ) { -ulong timeval =get_timer (0 ); +ulong timeval =time_now_ms ();while (readl (I2CCSR ) &MPC107_CSR_MBB ) -if (get_timer (timeval) >TIMEOUT ) +if (time_since_ms (timeval) >TIMEOUT )return -1 ;return 0 ;
@@ -109,7 +109,7 @@ static __inline__ int i2c_wait4bus (void)static __inline__int i2c_wait (int write) {u32 csr; -ulong timeval =get_timer (0 ); +ulong timeval =time_now_ms (); do { csr = readl (I2CCSR);
@@ -141,7 +141,7 @@ static __inline__ int i2c_wait (int write) }return 0 ; - }while (get_timer (timeval) <TIMEOUT ); + }while (time_since_ms (timeval) <TIMEOUT );#ifdef I2CDBG printf ("i2c_wait: timed out\n" );
arch/powerpc/cpu/mpc8260/ether_fcc.c +6 -6
@@ -887,7 +887,7 @@ eth_loopback_test (void)*/ clear_ctrlc (); - runtime =get_timer (0 ); + runtime =time_now_ms (); do { nclosed = 0;
@@ -931,7 +931,7 @@ eth_loopback_test (void) __asm__ __volatile__ ("eieio" ); }while (cp->cp_cpcr &CPM_CR_FLG ); - ecp->clstime =get_timer (0 ); + ecp->clstime =time_now_ms (); ecp->state = Closing; }/* fall through ... */
@@ -990,7 +990,7 @@ eth_loopback_test (void) }if (ecp->state == Closing) - ecp->clstime =get_timer (0 ); + ecp->clstime =time_now_ms ();/* make it ready again */ bdp->cbd_sc |=BD_ENET_TX_READY ;
@@ -1092,7 +1092,7 @@ eth_loopback_test (void) }if (ecp->state == Closing) - ecp->clstime =get_timer (0 ); + ecp->clstime =time_now_ms ();/* make it empty again */ bdp->cbd_sc |=BD_ENET_RX_EMPTY ;
@@ -1106,7 +1106,7 @@ eth_loopback_test (void)* waited long enough */ -if (get_timer (ecp->clstime) >=ELBT_CLSWAIT ) { +if (time_since_ms (ecp->clstime) >=ELBT_CLSWAIT ) {/* write GFMR: disable tx/rx */ fcp->fcc_gfmr &= \ ~(FCC_GFMR_ENT |FCC_GFMR_ENR );
@@ -1123,7 +1123,7 @@ eth_loopback_test (void) }while (nclosed < (FCC_END_LOOP -FCC_START_LOOP +1 )); - runtime =get_timer (runtime); + runtime =time_max_since_ms (runtime);if (runtime <=ELBT_CLSWAIT ) {printf ("Whoops! somehow elapsed time (%ld) is wrong (<= %d)\n" , runtime,ELBT_CLSWAIT );
Signature · 1 line
1.7.5.2.317.g391b14
PATCH 16/16 Replace get_timer() usage in arch/
Hi Graeme,
Quoted 18 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>---
?arch/blackfin/cpu/jtag-console.c ? ? ? ? ? | ? ?4 ++-- ?arch/microblaze/lib/time.c ? ? ? ? ? ? ? ? | ? ?4 ++-- ?arch/nios2/cpu/epcs.c ? ? ? ? ? ? ? ? ? ? ?| ? 12 ++++++------ ?arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c | ? ?8 ++++---- ?arch/powerpc/cpu/mpc8260/ether_fcc.c ? ? ? | ? 12 ++++++------?5 files changed, 20 insertions(+), 20 deletions(-)
arch/blackfin/cpu/jtag-console.c +0
-0@@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void) ?static bool jtag_write_emudat(uint32_t emudat) ?{ ? ? ? ?static bool overflowed = false;
arch/blackfin/cpu/jtag-console.c static inline uint32_t bfin_read_emudat(void) · line 58
Quoted 10 lines
arch/blackfin/cpu/jtag-console.c +2
-2- ? ? ? ulong timeout = get_timer(0) + CONFIG_JTAG_CONSOLE_TIMEOUT; + ? ? ? ulong start = time_now_ms(); ? ? ? ?while (bfin_read_DBGSTAT() & 0x1) { ? ? ? ? ? ? ? ?if (overflowed) ? ? ? ? ? ? ? ? ? ? ? ?return overflowed; - ? ? ? ? ? ? ? if (timeout < get_timer(0)) + ? ? ? ? ? ? ? if (time_since_ms(start) >= CONFIG_JTAG_CONSOLE_TIMEOUT) ? ? ? ? ? ? ? ? ? ? ? ?overflowed = true; ? ? ? ?} ? ? ? ?overflowed = false;
Here I think I have found a use of future time. It is true what they say (or should say) that there is every kind of timeout in U-Boot.
Regards,
Simon
PATCH 16/16 Replace get_timer() usage in arch/
Hi Simon,
Quoted 26 lines · Simon Glass
Hi Graeme,
Quoted 23 lines · Graeme Russ
Signed-off-by Graeme Russ <[email protected]>---
?arch/blackfin/cpu/jtag-console.c ? ? ? ? ? | ? ?4 ++-- ?arch/microblaze/lib/time.c ? ? ? ? ? ? ? ? | ? ?4 ++-- ?arch/nios2/cpu/epcs.c ? ? ? ? ? ? ? ? ? ? ?| ? 12 ++++++------ ?arch/powerpc/cpu/mpc824x/drivers/i2c/i2c.c | ? ?8 ++++---- ?arch/powerpc/cpu/mpc8260/ether_fcc.c ? ? ? | ? 12 ++++++------?5 files changed, 20 insertions(+), 20 deletions(-)
arch/blackfin/cpu/jtag-console.c +1
-1@@ -48,11 +48,11 @@ static inline uint32_t bfin_read_emudat(void) ?static bool jtag_write_emudat(uint32_t emudat) ?{ ? ? ? ?static bool overflowed = false; - ? ? ? ulong timeout = get_timer(0) + CONFIG_JTAG_CONSOLE_TIMEOUT; + ? ? ? ulong start = time_now_ms(); ? ? ? ?while (bfin_read_DBGSTAT() & 0x1) { ? ? ? ? ? ? ? ?if (overflowed) ? ? ? ? ? ? ? ? ? ? ? ?return overflowed;
Quoted 8 lines
arch/blackfin/cpu/jtag-console.c static inline uint32_t bfin_read_emudat(void) · line 58
Quoted 5 lines
arch/blackfin/cpu/jtag-console.c +1
-1- ? ? ? ? ? ? ? if (timeout < get_timer(0)) + ? ? ? ? ? ? ? if (time_since_ms(start) >= CONFIG_JTAG_CONSOLE_TIMEOUT) ? ? ? ? ? ? ? ? ? ? ? ?overflowed = true; ? ? ? ?} ? ? ? ?overflowed = false;Here I think I have found a use of future time. It is true what they say (or should say) that there is every kind of timeout in U-Boot.
I personally think that this particular use-case of the timer API is ugly, but I was not out to change any symantics, just do a blind translation from the old API to the new API
Hopefully, this will highlight a few dodgy use cases (which I am willing to apply fixes for as and when others suggest them)
Regards,
Graeme
PATCH 16/16 Replace get_timer() usage in arch/
Quoted 18 lines · On Wednesday, June 29, 2011 00:51:50 Graeme Russ wrote:
Quoted 4 lines · Simon Glass
Quoted 3 lines · Graeme Russ
arch/blackfin/cpu/jtag-console.c +0
-0Quoted 12 lines
arch/blackfin/cpu/jtag-console.c static inline uint32_t bfin_read_emudat(void) · line 57
Quoted 9 lines
arch/blackfin/cpu/jtag-console.c +2
-2-ulong timeout =get_timer (0 ) +CONFIG_JTAG_CONSOLE_TIMEOUT ; +ulong start =time_now_ms ();while (bfin_read_DBGSTAT () &0x1 ) {if (overflowed)return overflowed; -if (timeout <get_timer (0 )) +if (time_since_ms (start) >=CONFIG_JTAG_CONSOLE_TIMEOUT ) overflowed = true; }Here I think I have found a use of future time. It is true what they say (or should say) that there is every kind of timeout in U-Boot.
Quoted 6 lines
I personally think that this particular use-case of the timer API is ugly, but I was not out to change any symantics, just do a blind translation from the old API to the new API
Hopefully, this will highlight a few dodgy use cases (which I am willing to apply fixes for as and when others suggest them)
i wrote this long before i really understood the timer api. after all, even now, there is 0 documentation on the API in the u-boot tree.
should be easy to change the two lines to use the API as designed.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110629/46bce80b/attachment.pgp
PATCH 16/16 Replace get_timer() usage in arch/
Quoted 2 lines · On Wednesday, June 29, 2011 01:15:53 Mike Frysinger wrote:
i wrote this long before i really understood the timer api. after all, even now, there is 0 documentation on the API in the u-boot tree.
unless i missed something, even this patchset doesnt include a new doc/README.timer (or similar) file, nor does the header include any comments above the func prototypes, nor comments above the func definitions in lib/time.c ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110629/95987698/attachment.pgp
PATCH 16/16 Replace get_timer() usage in arch/
Hi Mike,
Quoted 8 lines · Mike Frysinger
Quoted 2 lines · On Wednesday, June 29, 2011 01:15:53 Mike Frysinger wrote:
i wrote this long before i really understood the timer api. ?after all, even now, there is 0 documentation on the API in the u-boot tree.
unless i missed something, even this patchset doesnt include a new doc/README.timer (or similar) file, nor does the header include any comments above the func prototypes, nor comments above the func definitions in
lib/time.c...
Correct - I am going on holidays on Friday and really needed to get something in the pipeline for discussion - The wiki has a detailed writeup of how the API works - I'll translate that into a README and code comments
Regards,
Graeme
cover API Rewrite
In reply to Graeme RussHi All,
[snip]
Quoted 10 lines
Graeme Russ (16):
?[Timer]Fix misuse of ARM*timer_masked()functions outsidearch/arm?[Timer]Remove calls toset_timeroutsidearch/?[Timer]Remove calls toset_timerinarch/
?[Timer]Allowreset_timer()only for Nios2
?[Timer]Removereset_timer()for non-Nios2 arches ?[Timer]Fixat91rm9200/spi.ctimer usage
?[Timer]Removereset_timer_masked()
?[Timer]Create new userland timer API
Quoted 9 lines
?[Timer]Replace
get_timer()usage indrivers/block/?[Timer]Replaceget_timer()usage in driver/mtd and driver/block ?[Timer]Removereset_timer()completely ?[Timer]Replaceget_timer()usage indrivers/?[Timer]Replaceget_timer()usage innet/?[Timer]Replaceget_timer()usage in common/ ?[Timer]Replaceget_timer()usage in board/ ?[Timer]Replaceget_timer()usage inarch/
Patch 15 ([Timer]Replace get_timer() usage in board/) didn't make it through (too big) - I'll have to split it up (rather that that putting a lone patch on the wiki)
Regards,
Graeme
cover API Rewrite
In reply to Graeme Russfor future reference, could we use the "foo: " style in subjects instead of "[foo]". git likes to eat "[...]" automatically and i find it hard to quickly parse. it's an abomination on my eyes.
-[PATCH v1 (WIP) 00/16] [Timer]API Rewrite
+[PATCH/WIP 00/16] timer: API Rewrite
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110629/9fd7e88f/attachment.pgp
cover API Rewrite
Hi Mike,
Quoted 8 lines · Mike Frysinger
for future reference, could we use the "foo: " style in subjects instead of "[foo]". ?git likes to eat "[...]" automatically and i find it hard to quickly parse. ?it's an abomination on my eyes.
-[PATCH v1 (WIP) 00/16] [Timer]API Rewrite
+[PATCH/WIP 00/16] timer: API Rewrite
-mike
Will do
Regards,
Graeme
cover API Rewrite
In reply to Graeme RussQuoted 4 lines · Graeme Russ
The following series is a work-in-progress revamp of the timer API. The aim is to create a new userland API consisting of the following functions (along with a few arch level support functions):
[snip]
Quoted 9 lines
Graeme Russ (16):
[Timer]Fix misuse of ARM*timer_masked()functions outsidearch/arm[Timer]Remove calls toset_timeroutsidearch/[Timer]Remove calls toset_timerinarch/
[Timer]Allowreset_timer()only for Nios2
[Timer]Removereset_timer()for non-Nios2 arches [Timer]Fixat91rm9200/spi.ctimer usage
[Timer]Removereset_timer_masked()
[Timer]Create new userland timer API
Quoted 8 lines
[Timer]Replace
get_timer()usage indrivers/block/[Timer]Replaceget_timer()usage in driver/mtd and driver/block [Timer]Removereset_timer()completely
[Timer]Replaceget_timer()usage indrivers/[Timer]Replaceget_timer()usage innet/[Timer]Replaceget_timer()usage in common/ [Timer]Replaceget_timer()usage in board/ [Timer]Replaceget_timer()usage inarch/
OK, I'm back from holidays and there has only been a few minor comments so far. I take that as either a) the work is generally OK as is and there are no major objections or b) everyone is too busy to care ;) - I'll work with option a) and rebase/re-spin this series. Now although the board/ patch was too big for the list, it looks like it hit patchwork OK, so I will leave that as is.
Wolfgang, a few quick question for you:
1) I understand that you would like each individual patch in the series to have the in-reply-to header set to the individual parent patch and not have the whole series in-reply-to the first (00/16) patch? (It will be a bit of a PITA to set in-reply-to for 16 individual patches, but I will do if that is the way you want it)
2) I will be changing the name of the series to a) drop the WIP and b) change "[Timer]" to "Timer:" as per Mike Frysinger's comment - Does this pose any issue to you provided the in-reply-to remains intact
3) The board/ series is a 'Big Patch' but it made it to Patchwork - Are you happy for me to leave it as-is? As it's in patchwork, can I forget about putting it on the Big Patches wiki?
4) I'm thinking about creating an Timer branch in my x86 repository and pushing the whole series through there - From there I can keep it rebased and simply issue a pull request when it's finished (and testers can just pull it if they want). Does this sound like a good plan?
5) Most importantly - Have you had a chance to look at this series? Is it to your liking?
Regards,
Graeme
cover API Rewrite
Hi Greame,
Le 08/07/2011 02:25, Graeme Russ a ?crit :
Quoted 5 lines
1) I understand that you would like each individual patch in the series to have the in-reply-to header set to the individual parent patch and not have the whole series in-reply-to the first (00/16) patch? (It will be a bit of a PITA to set in-reply-to for 16 individual patches, but I will do if that is the way you want it)
Not sure what you mean here, but if it is "make patch i/N of a series have be a reply-to patch i/N of the previous series, I agree that it would be a PITA which is not worth the effort considerong the benefit.
(the only benefit I can see is to be able to find back the previous series and e.g. check that comments to patch i/N-1 were taken into account by patch i/N. This can be accomplished more easily by having series N-1 and N in a local branch and doing a git diff between commits i/N and i/N-1)
Amicalement,
Signature · 1 line
Albert.
cover API Rewrite
In reply to Graeme RussDear Graeme Russ,
Quoted 3 lines · In message <[email protected]> you wrote:
The following series is a work-in-progress revamp of the timer API. The aim is to create a new userland API consisting of the following functions (along with a few arch level support functions):
I have to apologize for not commenting on all of this for such a long time. There are a number of reeasons for this silence - lack of available time being one of them (and probably the most pressing one), but I also needed some time to lean back and think through all of this.
One thing I always wanted to do in the previous discussion was to check what other projects (like Linux, barebox, etc.) are doing in this area. I think it is worth reading the Linux Documentation/timers/highres.txt document, especially the sections about John Stultz's Generic Time Of Day (GTOD) framework, please the documents linked there (i. e. the OLS slides [the link in Documentation/timers/highres.txt is stale; use
http://www.kernel.org/pub/linux/kernel/people/tglx/hrtimers/ols2006-hrtimers.pdf
instead] and the paper "We Are Not Getting Any Younger: A New Approach to Time and Timers" by J. Stultz et al. in
http://www.linuxsymposium.org/2005/linuxsymposium_procv1.pdf p. 219ff).
Having this still in mind, I took a look across the fence to what barebox is doing. Guess what? From "common/clock.c":
* clock.c - generic clocksource implementation
*
* This file contains the clocksource implementation from the Linux
* kernel originally by John Stultz
OK. Message received.
What I'm asking myself (and now you) is: Should we really re-invent the wheel again?
Regarding the function names:
Quoted 3 lines
u32
time_now_ms(void);
u32time_since_ms(u32 from, u32 to);
u32time_max_since_ms(u32 from, u32 to);
I don't like these. They appear wrong to me, and they are not in sync with the wiki page either.
First, I would very much like to get rid of this "_ms" thing. We should rather make very clear in the documentation which unit the time services are based on, and use this consequently. Only functions using a different unit should make this clean in their names.
Second, I don't feel well with "time_now()" - what is this, what does it do? Does it set or get a time? The "get_time()" suggestion we discussed earlier feels still much better to me (as it clearly says which operation the function performs). Or we could even follow the example of the Unix system call time(2) and just use "time()".
The signature of time_since(from, to) is broken. For "time since" it seems logically to expect a single argument only: time_since(when). The wiki page still lists this function as time_delta() which seems way more logical to me [although I have to admit that I don;t understand what the "delta_type" argument might be.
Third: all this time_*_max(), ..._min() and ...raw() stuff. Aren't we over-engineering here? We have been successfully writing U-Boot code for 11 years now, and never needed these before. Neither does Linux need any of those, nor every other project I'm aware of. Come on, let's keep the code small and efficient and do without these bells and whistles. Quote Antoine de Saint-Exupery: "Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away."
Quoted 3 lines
This current patch series migrates the users of the existing timer API consisting of
get_timer()andreset_timer()to the new API while still retaining the arch specific framework in the background.
I feel bad that you already have spent so much work, and only now I come and call everything into question again. Sorry.
Best regards,
Wolfgang Denk
Signature · 5 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 How many NASA managers does it take to screw in a lightbulb? "That's a known problem... don't worry about it."
cover API Rewrite
Hi Wolfgang,
Quoted 7 lines · Wolfgang Denk
Dear Graeme Russ,
Quoted 3 lines · In message <[email protected]> you wrote:
The following series is a work-in-progress revamp of the timer API. The aim is to create a new userland API consisting of the following functions (along with a few arch level support functions):
Quoted 5 lines
I have to apologize for not commenting on all of this for such a long time. There are a number of reeasons for this silence - lack of available time being one of them (and probably the most pressing one), but I also needed some time to lean back and think through all of this.
I understand - I also would rather spend more time on this and get it right now rather than going back and fixing it again
Quoted 10 lines
One thing I always wanted to do in the previous discussion was to check what other projects (like Linux, barebox, etc.) are doing in this area. I think it is worth reading the Linux
Documentation/timers/highres.txtdocument, especially the sections about John Stultz's Generic Time Of Day (GTOD) framework, please the documents linked there (i. e. the OLS slides [the link inDocumentation/timers/highres.txtis stale; use
http://www.kernel.org/pub/linux/kernel/people/tglx/hrtimers/ols2006-hrtimers.pdf
instead] and the paper "We Are Not Getting Any Younger: A New Approach to Time and Timers" by J. Stultz et al. in
http://www.linuxsymposium.org/2005/linuxsymposium_procv1.pdf p. 219ff).
Will do
Quoted 14 lines
Having this still in mind, I took a look across the fence to what barebox is doing. Guess what? From "
common/clock.c":*
clock.c- generic clocksource implementation
*
* This file contains the clocksource implementation from the Linux
* kernel originally by John StultzOK. Message received.
What I'm asking myself (and now you) is: Should we really re-invent the wheel again?
Quoted 8 lines
Regarding the function names:
Quoted 3 lines
u32
time_now_ms(void);
u32time_since_ms(u32 from, u32 to);
u32time_max_since_ms(u32 from, u32 to);I don't like these. They appear wrong to me, and they are not in sync with the wiki page either.
I know - there was some discussion about these names and they were in a little bit of flux (hence WIP). I was looking to get some community clarity on this first before updating the wiki. In hindsight, I'm glad I didn't update the wiki as it looks like there may be a better approach anyway
Quoted 4 lines
First, I would very much like to get rid of this "
_ms" thing. We should rather make very clear in the documentation which unit the time services are based on, and use this consequently. Only functions using a different unit should make this clean in their names.
Ideally, I think this should be microseconds (a lot happens in a microsecond on modern platforms, and a millisecond can be an eternity)
Quoted 5 lines
Second, I don't feel well with "
time_now()" - what is this, what does it do? Does it set or get a time? The "get_time()" suggestion we discussed earlier feels still much better to me (as it clearly says which operation the function performs). Or we could even follow the example of the Unix system call time(2) and just use "time()".
Well time_ was the namespace for the new API and now is, well, now ;)
Quoted 5 lines
The signature of
time_since(from, to)is broken. For "time since" it seems logically to expect a single argument only:time_since(when). The wiki page still lists this function astime_delta()which seems way more logical to me [although I have to admit that I don;t understand what the "delta_type" argument might be.
It was a refinement of your suggestion that sometimes we want to know that at least a specific period of time has passed (timeouts) and sometimes we want to know what the maximum amount of time that has passed is (profiling)
Quoted 3 lines
Third: all this time_*_max(), ..._min() and ...raw() stuff. Aren't we over-engineering here? We have been successfully writing U-Boot code for 11 years now, and never needed these before. Neither does Linux
Part of the problem came from the realisation that some architectures have really bad timer resolution (Nios2 in particular). In an ideal world, I think a uniform microsecond timer (millisecond is to coarse to cater for all needs such as udelay and profiling) would be sufficient to not need these functions but while ever we have platforms with 'poor' timers, I think you may find these functions have a place.
Quoted 5 lines
need any of those, nor every other project I'm aware of. Come on, let's keep the code small and efficient and do without these bells and whistles. Quote Antoine de Saint-Exupery: "Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away."
As stated - This started from a suggestion made by yourself (albeit one you did not think was apparently necessary). The idea of the separate functions (rather than a parameter to a single function) was that if the functions were not used, they would be optimised out.
Quoted 6 lines
Quoted 3 lines
This current patch series migrates the users of the existing timer API consisting of
get_timer()andreset_timer()to the new API while still retaining the arch specific framework in the background.I feel bad that you already have spent so much work, and only now I come and call everything into question again. Sorry.
That's OK - Thanks for the feedback.
What would you like me to do with the clean-up patches that you have already ack'd which do not relate directly to the new API? Should I mark the current series as Rejected in patchwork and create a brand new smaller series which only has those specific patches?
Regards,
Graeme
cover API Rewrite
Dear Graeme,
I'm trying to summarize your last 3 postings here.
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines
First, I would very much like to get rid of this "
_ms" thing. We should rather make very clear in the documentation which unit the time services are based on, and use this consequently. Only functions using a different unit should make this clean in their names.Ideally, I think this should be microseconds (a lot happens in a microsecond on modern platforms, and a millisecond can be an eternity)
Then we might as well follow the example of the Linux generic TOD framework and use nanoseconds instead - we will need u64 data types anyway when going for microseconds, so we can just follow their example.
Quoted 10 lines
Quoted 3 lines
Third: all this time_*_max(), ..._min() and ...raw() stuff. Aren't we over-engineering here? We have been successfully writing U-Boot code for 11 years now, and never needed these before. Neither does Linux
Part of the problem came from the realisation that some architectures have really bad timer resolution (Nios2 in particular). In an ideal world, I think a uniform microsecond timer (millisecond is to coarse to cater for all needs such as udelay and profiling) would be sufficient to not need these functions but while ever we have platforms with 'poor' timers, I think you may find these functions have a place.
No, I disagree here. We should not clutter up generic code with things that are only needed for a single (unusually restricted) architecture. Instead, we should try to come up with a design that hides such details in architecture specific code.
Quoted 4 lines
As stated - This started from a suggestion made by yourself (albeit one you did not think was apparently necessary). The idea of the separate functions (rather than a parameter to a single function) was that if the functions were not used, they would be optimised out.
You know how things go: if you offer the users a set of 20 functions so they can chose the one or two that fit their purposes best, they will end up with using all 20 of them, especially when diffferent parts of the code get maintained by different people with different preferences. Approaches like that always get out of hand quickly.
We don't have any such stuff now, and U-Boot is working fine. Let's keep it with that, or make it even more simple. But not the other way.
Quoted 4 lines
What would you like me to do with the clean-up patches that you have already ack'd which do not relate directly to the new API? Should I mark the current series as Rejected in patchwork and create a brand new smaller series which only has those specific patches?
I suggest you create a new patch series from the independent clean-up patches and submit this as normal patches (i. e. without the WIP / RFC part). This would already be a great improvement, I think. Thanks a lot for the efforts!
Quoted 6 lines · In message <[email protected]> you wrote:
- Looking at the low-level framework described in ols2006-hrtimers.pdf (Linux API), we are looking at implementing the same thing - An architecture specific free running, high speed, high resolution, high accuracy hardware counter/timer and a low speed interrupt which translates the hardware counter/timer to a common API. In this respect, we are not re-inventing that wheel at all
Indeed. We should also avoid re-inventing the algorithms, and eventually re-implementing the code. In any case, I think it would be great to use a compatible API so we don;t have to change too many things when adapting code from Linux etc.
Quoted 3 lines
- The rest of the Linux API is like hitting a thumb-tack with a sledgehammer - Timer Queues, NTP, Callbacks, Scheduling etc, etc, etc. We only want to do two things:
Right. Linux is a full-blown OS with a lot of needs we don't have in U-Boot.
Quoted 3 lines
1. Monitor timeouts
2. Calculate code execution time (and even then, not everyone all the time)
Actrually we need just timestamps.
All the rest (like delays, timeouts, executin times etc.) can be derived from that.
Quoted 2 lines
- The Linux API is nanosecond resolution. We are hard pressed to get the average hardware to support microsecond resolution
On the other hand, it makes little difference to the code wether we use microseconds or nanoseconds. It's just slightly different values in the u64 variables.
Quoted 4 lines
- The Linux API includes usage of 'clock events' - These are timer interrupts driven by programmable hardware and relieve the stress on the timer scheduler keeping track of every single timer - Overkill for a boot loader
Agreed. Well, partially. We should still follow the example of keeping the generic code clean of architecture / timer specific code. This should be implemented in the respective arechitecture specific code.
Quoted 3 lines
- The Linux API includes 'Time of Day' (Wall Time) - Again, I don't think we really need this in a boot loader (we have an RTC API we can use if we want to get the current Date and Time).
We could also say this is all we need. If we have a working high precision TOD timestamp, we can derive all other things we need from that.
Quoted 3 lines
So, all we need is a fixed resolution free running timer we can use to do simple (one at a time) timing operations. No callbacks, no scheduling, to 'Wall Time', no 'Clock Events', no NTP etc. The Linux API is 'Too Big'
I never proposed to adapt all of it.
My suggestion was to pick the parts that fit, and use them. especially, use the same API (like going for nanoseconds as unit of time), and use their algorithms (and ideally also their code) to solve the problems we have to deal with.
Quoted 1 line
I don't think we are re-inventing the wheel with our underlying concept -
Not with the concept, but with the code.
Quoted 8 lines · In message <[email protected]> you wrote:
I think I can safely say that:
a) We do not want to inherit the code from Linux. It's good code clean code, but it is just way too much for what we need. It handles registering and unregistering clock sources, change clock source 'rating' (what ever that is) and relies heavily on quite heavy (for U-Boot) struct's (which may need to be carted around in Global Data)
See above. You are right, simply copying code unreflected makes no sense. But we should use it as example for API, algorithms, and code.
Quoted 1 line
b) Barebox doesn't really inherit that much from Linux anyway
Right, they did what I proposed, and copied only a part of it, i. e. the generic TOD framework.
Even if we assume that they made a good choice for this selection for the purposes of barebox, this still does not mean that the same selection should be made for U-Boot.
I'm the last to complein if we come up with a leaner implementation that still solves the problems we're trying to solve.
Quoted 10 lines
I think we have the basics right (and that is the same as Linux). We just need to settle on a few finer points such as:
- Raw time interval. Linux uses nanoseconds. A 64-bit nanosecond clock source goes for >580 years so even if the highest resolution clock available to us right now is microsecond, it will not hurt to go with a nanosecond time-base as that will provide us with the greatest flexibility going forward. However, this will lead to a lot of integer divides and/or multiplies to scale to millisecond and microsecond intervals
You argumented above against milliseconds (which still works reasonably well with 32 bit data types) and suggested to use microseconds. With a 32 bit data type and using microseconds as unit, you can get some 4,300 seconds for unsigned and some 2,100 seconds for signed data types - in other words, in the order of a little over one hour resp. half an hour. This is too tight - so we would have to use 64 bit data types here, too.
Quoted 1 line
- Function naming
See my previous comments. And the longer I think about it, the more I think we should just use
u64 time(void)
as core of this new code.
Quoted 3 lines
- Performing time comparisons for timeouts - Barebox for example has a
is_timeoutfunction which takes a start time and a delay (in nanoseconds) an implements ndealy, udealy, and mdelay usingis_timeout
Well, here I think we should have a look at Linux again here. In include/linux/jiffies.h they provide a nice set of inlines, which in our case would reuse directly:
time_after() time_after_eq() time_before() time_before_eq() time_in_range() time_in_range_open()
The classic timeout code then becomes:
u64 then = time() + TIMEOUT;
...
if (time_after(time(), then)) {
/* handle timeout */
}Quoted 3 lines
I think what has been proposed here recently and documented (slightly out-of-date) on the wiki is the way to go. Taking the Linux or Barebox source will be more effort than it's worth for the complexity it brings in.
I don't want to take all of it. But there is alarge amount of good things, and we should pick up bits and pieces we can use to save us efforts and pain.
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
News is what a chap who doesn't care much about anything wants to
read. And it's only news until he's read it. After that it's dead.
- Evelyn Waugh _Scoop_ (1938) bk. 1, ch. 5cover API Rewrite
Hi Wolfgang,
Thanks for the renewed feedback
Quoted 11 lines · Wolfgang Denk
Dear Graeme,
I'm trying to summarize your last 3 postings here.
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 5 lines
First, I would very much like to get rid of this "
_ms" thing. We should rather make very clear in the documentation which unit the time services are based on, and use this consequently. Only functions using a different unit should make this clean in their names.
Quoted 7 lines
Quoted 2 lines
Ideally, I think this should be microseconds (a lot happens in a microsecond on modern platforms, and a millisecond can be an eternity)
Then we might as well follow the example of the Linux generic TOD framework and use nanoseconds instead - we will need u64 data types anyway when going for microseconds, so we can just follow their example.
Yes, I like the idea of using nanoseconds as a raw timebase
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
Third: all this time_*_max(), ..._min() and ...raw() stuff. Aren't we over-engineering here? We have been successfully writing U-Boot code for 11 years now, and never needed these before. Neither does Linux
Part of the problem came from the realisation that some architectures have really bad timer resolution (Nios2 in particular). In an ideal world, I think a uniform microsecond timer (millisecond is to coarse to cater for all needs such as udelay and profiling) would be sufficient to not need these functions but while ever we have platforms with 'poor' timers, I think you may find these functions have a place.
Quoted 4 lines
No, I disagree here. We should not clutter up generic code with things that are only needed for a single (unusually restricted) architecture. Instead, we should try to come up with a design that hides such details in architecture specific code.
So how do we deal with Nios2? It is what caused such a deep investigation into the timer API. We have three choices I can think of off the top of my head:
1. Move the whole timer API up to the architecture level and replicate
code everywhere
2. Make the whole timer API weak
3. Fundamentally allow the timer API to handle arbitrary timer resolutions
1. Way ugly. We already have this, and that is why we are here today
2. Well, you know what will happen - Someone will be unhappy with the generic API and rewrite a completely different one (timer_masked anyone!)
3. Why is this so evil?
I'm open to other options if you have any
Quoted 11 lines
Quoted 4 lines
As stated - This started from a suggestion made by yourself (albeit one you did not think was apparently necessary). The idea of the separate functions (rather than a parameter to a single function) was that if the functions were not used, they would be optimised out.
You know how things go: if you offer the users a set of 20 functions so they can chose the one or two that fit their purposes best, they will end up with using all 20 of them, especially when diffferent parts of the code get maintained by different people with different preferences. Approaches like that always get out of hand quickly.
Quoted 3 lines
We don't have any such stuff now, and U-Boot is working fine. Let's keep it with that, or make it even more simple. But not the other way.
Realistically we are looking at the following functionality:
1) Get the current time
2) Report the minimum time elapsed since an arbitrary epoch
3) Report the maximum time elapsed since an arbitrary epoch
4) Delay for an arbitrary period of time
4 is a derivative of 2 - Just loop until at least the required time has elapsed.
And you then suggest bringing in no less than 6 functions from Linux
Quoted 9 lines
Quoted 4 lines
What would you like me to do with the clean-up patches that you have already ack'd which do not relate directly to the new API? Should I mark the current series as Rejected in patchwork and create a brand new smaller series which only has those specific patches?
I suggest you create a new patch series from the independent clean-up patches and submit this as normal patches (i. e. without the WIP / RFC part). This would already be a great improvement, I think. Thanks a lot for the efforts!
Done - I will reject the current series and rebase/repost the patches you have already ack'd and assign them to you in patchwork - I'll leave it up to you to pull them in
Quoted 9 lines
Quoted 6 lines · In message <[email protected]> you wrote:
- Looking at the low-level framework described in ols2006-hrtimers.pdf (Linux API), we are looking at implementing the same thing - An architecture specific free running, high speed, high resolution, high accuracy hardware counter/timer and a low speed interrupt which translates the hardware counter/timer to a common API. In this respect, we are not re-inventing that wheel at all
Quoted 4 lines
Indeed. We should also avoid re-inventing the algorithms, and eventually re-implementing the code. In any case, I think it would be great to use a compatible API so we don;t have to change too many things when adapting code from Linux etc.
OK, I'll spend some time digging into the Linux framework a bit more - I have only had a brief look so far
Quoted 7 lines
Quoted 3 lines
- The rest of the Linux API is like hitting a thumb-tack with a sledgehammer - Timer Queues, NTP, Callbacks, Scheduling etc, etc, etc. We only want to do two things:
Right. Linux is a full-blown OS with a lot of needs we don't have in U-Boot.
Quoted 8 lines
Quoted 3 lines
1. Monitor timeouts
2. Calculate code execution time (and even then, not everyone all the time)Actrually we need just timestamps.
All the rest (like delays, timeouts, executin times etc.) can be derived from that.
Agree, but we need to implement the derivative functions in lib/ otherwise we doom ourselves to the current mess all over again
Quoted 6 lines
Quoted 2 lines
- The Linux API is nanosecond resolution. We are hard pressed to get the average hardware to support microsecond resolution
On the other hand, it makes little difference to the code wether we use microseconds or nanoseconds. It's just slightly different values in the u64 variables.
Agreed, nanoseconds it is
Quoted 9 lines
Quoted 4 lines
- The Linux API includes usage of 'clock events' - These are timer interrupts driven by programmable hardware and relieve the stress on the timer scheduler keeping track of every single timer - Overkill for a boot loader
Agreed. Well, partially. We should still follow the example of keeping the generic code clean of architecture / timer specific code. This should be implemented in the respective arechitecture specific code.
And that is exactly what the proposed framework was working towards. The only feature the architecture (be it the CPU, SOC, Chipset, Board, whatever) must provide is a method of accessing a free-running counter and an indication of how fast that counter increments. All the rest is done in lib/
Provided you have access to an incrementing value which increments at a fixed rate and you know the rate, the rest is architecture independent
Quoted 7 lines
Quoted 3 lines
- The Linux API includes 'Time of Day' (Wall Time) - Again, I don't think we really need this in a boot loader (we have an RTC API we can use if we want to get the current Date and Time).
We could also say this is all we need. If we have a working high precision TOD timestamp, we can derive all other things we need from that.
So you want to look at bringing in the Linux TOD API as well? That means we have to synchronise the timer to an RTC which is something not all boards have. I think we should stick (at least for the time being) to an arbitrary timer whose value means absolutely nothing other than the difference between two values during any given U-Boot execution represent the number of nanoseconds elapsed.
Quoted 5 lines
Quoted 3 lines
So, all we need is a fixed resolution free running timer we can use to do simple (one at a time) timing operations. No callbacks, no scheduling, to 'Wall Time', no 'Clock Events', no NTP etc. The Linux API is 'Too Big'
I never proposed to adapt all of it.
Phew ;)
Quoted 21 lines
My suggestion was to pick the parts that fit, and use them. especially, use the same API (like going for nanoseconds as unit of time), and use their algorithms (and ideally also their code) to solve the problems we have to deal with.
Quoted 1 line
I don't think we are re-inventing the wheel with our underlying concept -
Not with the concept, but with the code.
Quoted 8 lines · In message <[email protected]> you wrote:
I think I can safely say that:
a) We do not want to inherit the code from Linux. It's good code clean code, but it is just way too much for what we need. It handles registering and unregistering clock sources, change clock source 'rating' (what ever that is) and relies heavily on quite heavy (for U-Boot) struct's (which may need to be carted around in Global Data)
Quoted 7 lines
See above. You are right, simply copying code unreflected makes no sense. But we should use it as example for API, algorithms, and code.
Quoted 1 line
b) Barebox doesn't really inherit that much from Linux anyway
Right, they did what I proposed, and copied only a part of it, i. e. the generic TOD framework.
Actually, when I look at it I see so little in common I am surprised they even bothered with the attribution at all. Maybe they started with more and progressively stripped it bare - I'll have a better look
Quoted 18 lines
Even if we assume that they made a good choice for this selection for the purposes of barebox, this still does not mean that the same selection should be made for U-Boot.
I'm the last to complein if we come up with a leaner implementation that still solves the problems we're trying to solve.
Quoted 10 lines
I think we have the basics right (and that is the same as Linux). We just need to settle on a few finer points such as:
- Raw time interval. Linux uses nanoseconds. A 64-bit nanosecond clock source goes for >580 years so even if the highest resolution clock available to us right now is microsecond, it will not hurt to go with a nanosecond time-base as that will provide us with the greatest flexibility going forward. However, this will lead to a lot of integer divides and/or multiplies to scale to millisecond and microsecond intervals
Quoted 7 lines
You argumented above against milliseconds (which still works reasonably well with 32 bit data types) and suggested to use microseconds. With a 32 bit data type and using microseconds as unit, you can get some 4,300 seconds for unsigned and some 2,100 seconds for signed data types - in other words, in the order of a little over one hour resp. half an hour. This is too tight - so we would have to use 64 bit data types here, too.
Well for starters, that was before I read the Linux framework and I never suggested a 32-bit timer either.
Quoted 8 lines
Quoted 1 line
- Function naming
See my previous comments. And the longer I think about it, the more I think we should just use
u64 time(void)as core of this new code.
Agreed - As said before (for the time being) the return value of any arbitrary call to time() means nothing. It _may_ mean the number of nanoseconds since power-up, but this is by no means guaranteed.
But what about delays (no-brainer - ndelay, udelay, mdelay) and 'elapsed time'
Quoted 8 lines
Quoted 3 lines
- Performing time comparisons for timeouts - Barebox for example has a
is_timeoutfunction which takes a start time and a delay (in nanoseconds) an implements ndealy, udealy, and mdelay usingis_timeoutWell, here I think we should have a look at Linux again here. In
include/linux/jiffies.hthey provide a nice set of inlines, which in our case would reuse directly:
Quoted 7 lines
time_after() time_after_eq() time_before() time_before_eq() time_in_range() time_in_range_open()
When would we use time_in_range and time_in_range_open? I don't think we can build an argument based on portability of code from Linux as we will need to do a lot of code touch-ups because we will not be bringing in the complete Linux timer API anyway.
In some respects, I think it less confusing to clearly define our own API rather than generating a illusion of compatibility.
Quoted 7 lines
The classic timeout code then becomes:
u64 then = time() + TIMEOUT; ... if (time_after(time(), then)) { /* handle timeout */ }
Arrrgh - Sorry, but we have been around and around and around this. There are sooooo many way to do this - The two big contenders have been:
1)
u64 start = time();
do {
...stuff...
} while (time_since(start) < TIMEOUT);2)
u64 now = time();
u64 end = future_time(now, TIMEOUT);
do {
...stuff...
} while(time() < end);And now we throw a third into the mix.
time_since and future_time are designed to take into account the underlying resolution of the hardware timer/counter. The big thing to remember is that we _must_ handle the case where the underlying timer is too coarse
Quoted 7 lines
Quoted 3 lines
I think what has been proposed here recently and documented (slightly out-of-date) on the wiki is the way to go. Taking the Linux or Barebox source will be more effort than it's worth for the complexity it brings in.
I don't want to take all of it. But there is alarge amount of good things, and we should pick up bits and pieces we can use to save us efforts and pain.
As I said, I will have a closer look at the Linux API...
Regards,
Graeme
cover API Rewrite
Dear Graeme Russ,
Quoted 10 lines · In message <[email protected]> you wrote:
So how do we deal with Nios2? It is what caused such a deep investigation into the timer API. We have three choices I can think of off the top of my head:
1. Move the whole timer API up to the architecture level and replicate
code everywhere
2. Make the whole timer API weak
3. Fundamentally allow the timer API to handle arbitrary timer resolutions
Quoted 4 lines
1. Way ugly. We already have this, and that is why we are here today
2. Well, you know what will happen - Someone will be unhappy with the generic API and rewrite a completely different one (timer_maskedanyone!)
3. Why is this so evil?
The big disadvantage of 3) is that you cannot make any reasonable assumptions any more in the code. If I place a "udelay(10)" in some device driver, I am probably aware that we don't have exact times, and that the actual delay may be 10 or 12 or eventually even 20 micro- seconds. We should make sure that the delay never takes less than 10 us, but we also have to guarantee that it does not take - for example - 10 milliseconds.
What exactly is the reason that we cannot have better timer resolutions in NIOS? I'm anything but a NIOS export, but skimming through the "Altera Embedded Peripherals IP User Guide", section "28. Interval Timer Core" I see that we can have "32-bit and 64-bit counters", "Two count modes: count down once and continuous count-down", and the example in section "Configuration: Timeout Period" on p. 28-3 reads:
For example, if the associated system clock has a frequency of 30 ns, and the specified Timeout Period value is 1 ?s, the true timeout period will be 1.020 microseconds.
Well, if I understand this correctly, we can have a continuously running 64 bit counter with microsecond resolution.
There are other sections that describe configurations that might probably be used as well, for example in "HAL System Library Support":
Timestamp Driver
The interval timer core may be used as a timestamp device ...
Also, the "Nios II Software Developer's Handbook" says in "Chapter 6:
Developing Programs Using the Hardware Abstraction Layer - Using Timer Devices" on o. 6-16:
The HAL API provides two types of timer device drivers:
- System clock driver--Supports alarms, such as you would use in a scheduler.
- Timestamp driver--Supports high-resolution time measurement.
...
You can obtain the rate at which the timestamp counter increments by calling the function alt_timestamp_freq(). This rate is typically the hardware frequency of the Nios II processor system--usually millions of cycles per second. The timestamp drivers are defined in the alt_timestamp.h header file.
High-resolution time measurement? Isn't this what we are looking for?
Or am I missing something?
Scott, maybe you can comment here?
Quoted 1 line
I'm open to other options if you have any
At the moment I'm trying to understand if we really have a problem on NIOS2 that cannot be fixed in a way that is compatible with our current plans.
Quoted 1 line
1) Get the current time
Agreed. That's time().
Quoted 2 lines
2) Report the minimum time elapsed since an arbitrary epoch
3) Report the maximum time elapsed since an arbitrary epoch
I don't understand why we would need this.
Quoted 4 lines
4) Delay for an arbitrary period of time
4 is a derivative of 2 - Just loop until at least the required time has elapsed.
Right. Both delays and timeouts work like that, the difference being that delays are "blocking", i. e. there is no other code running inbetween, and you can just sit in a tight spinning loop.
I have not seen any requirement yet for 3.
Quoted 1 line
And you then suggest bringing in no less than 6 functions from Linux
It's just macros. And we don't need to use them all. Actually time_after() is all that's needed to satisfy our current usage.
Quoted 3 lines
Done - I will reject the current series and rebase/repost the patches you have already ack'd and assign them to you in patchwork - I'll leave it up to you to pull them in
Don't reject them - just mark them as RFC.
Quoted 2 lines
Provided you have access to an incrementing value which increments at a fixed rate and you know the rate, the rest is architecture independent
We also have to deal with decrementing counters, but this is just aan unimportant detail. And it appears that we actually can have this, even on NIOS.
Quoted 5 lines
Quoted 3 lines
We could also say this is all we need. If we have a working high precision TOD timestamp, we can derive all other things we need from that.
So you want to look at bringing in the Linux TOD API as well? That means we
No, I don't.
Quoted 10 lines
Quoted 6 lines
See my previous comments. And the longer I think about it, the more I think we should just use
u64 time(void)as core of this new code.
Agreed - As said before (for the time being) the return value of any arbitrary call to
time()means nothing. It _may_ mean the number of nanoseconds since power-up, but this is by no means guaranteed.
True. But it is also garanteet to be usable in constructs as the aforementioned
u64 then = time() + number_of_nanoseconds; ... if (time_after(time(), then)) ...
Quoted 1 line
But what about delays (no-brainer - ndelay, udelay, mdelay) and 'elapsed time'
Well, like this:
void udelay(u32 usec)
{
u64 then = time() + (u64)usec * (u64)1000;
while (!time_after(time(), then))
... do something, like trigger watchdogs etc ...
}For 'elapsed time' it should be sufficient to store the start value of time() as early as possible in the (architecture specific) code.
Quoted 12 lines
Quoted 11 lines
Well, here I think we should have a look at Linux again here. In
include/linux/jiffies.hthey provide a nice set of inlines, which in our case would reuse directly:time_after() time_after_eq() time_before() time_before_eq() time_in_range() time_in_range_open()
Quoted 1 line
When would we use
time_in_rangeandtime_in_range_open? I don't think we
I don;t suggest that we need to use all of these. As mentioned, currently I only see use for time_after() (and/or time_after_eq(), it if should make a difference).
Quoted 10 lines
Quoted 7 lines
The classic timeout code then becomes:
u64 then = time() + TIMEOUT; ... if (time_after(time(), then)) { /* handle timeout */ }Arrrgh - Sorry, but we have been around and around and around this. There are sooooo many way to do this - The two big contenders have been:
Yes, and both of them do the compare in local code. This is what we should get rid of.
Quoted 1 line
And now we throw a third into the mix.
Please read the comments for the implementation of the time_after() macro. It makes sense to do it this way.
Quoted 3 lines
time_sinceandfuture_timeare designed to take into account the underlying resolution of the hardware timer/counter. The big thing to remember is that we _must_ handle the case where the underlying timer is too coarse
Do we? What exactly is the needed resolution of the underlying hardware timer? So far, it appears sufficient to have it ticking with 1000 Hz or more. Are there really systems that cannot provide that? The only architecture I remember that seemed prolematic was NIOS - but then the NIOS documentation suggests that this might actually be solvable.
Best regards,
Wolfgang Denk
Signature · 5 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 Immortality consists largely of boredom. -- Zefrem Cochrane, "Metamorphosis", stardate 3219.8
cover API Rewrite
Dear Wolfgang
Quoted 2 lines · Wolfgang Denk
What exactly is the reason that we cannot have better timer resolutions in NIOS?
You _can_ have better timer resolutions in Nios. However, there are legacy systems that implement timer(s) with a fixed period of 10 msec. The use of such implementations is very common. How do I know? Because my customers have such implementations. Why not upgrade? Because most sane engineers are loathe to change their rtl just so they can fix a simple software bug or add a simple custom feature.
My obvious preference is to continue to use the latest u-boot in such systems ... without having to create a custom branch for customers with older Nios implementations, where I use the old timer interfaces ... simply because we "improved" the API.
Quoted 1 line
Scott, maybe you can comment here?
I have only one comment: Out of pure frustration, I have been avoiding any discussions regarding this timer re-write effort.
Quoted 3 lines
At the moment I'm trying to understand if we really have a problem on NIOS2 that cannot be fixed in a way that is compatible with our current plans.
This is where my frustration begins. I've said this several times before, and I don't know how else to say this ... but I'll give it one more try:
This is not a Nios problem.
If I can't use a 10 msec timer interrupt to detect a simple timeout condition when I'm programming a flash memory, then the timer API design is garbage. And quite frankly, the enormous amount of discussion in this matter reminds me of an undergraduate science project.
Quoted 3 lines
We also have to deal with decrementing counters, but this is just aan unimportant detail. And it appears that we actually can have this, even on NIOS.
Wow! Even on Nios! Arrggghh!
Quoted 1 line
The only architecture I remember that seemed prolematic was NIOS
Really? There have been occasional issues that have required a patch here and there. But I consider most of them far from "problematic."
This is exhausting. As I recall, this entire fuss was born out of an issue with nested calls to get_timer() ... and that begat removing reset_timer ... and that begat ... and so on. And we're still spilling lots of intellectual seed here. And now we have what? A jack-of-all-trades API that can do everything with exacting precision ... other than handling a 10 msec interrupt?
Best Regards,
--Scott
cover API Rewrite
Quoted 30 lines · Scott McNutt
Dear Wolfgang
Quoted 2 lines · Wolfgang Denk
What exactly is the reason that we cannot have better timer resolutions in NIOS?
You _can_ have better timer resolutions in Nios. However, there are legacy systems that implement timer(s) with a fixed period of 10 msec. The use of such implementations is very common. How do I know? Because my customers have such implementations. Why not upgrade? Because most sane engineers are loathe to change their rtl just so they can fix a simple software bug or add a simple custom feature.
My obvious preference is to continue to use the latest u-boot in such systems ... without having to create a custom branch for customers with older Nios implementations, where I use the old timer interfaces ... simply because we "improved" the API.
Quoted 1 line
Scott, maybe you can comment here?
I have only one comment: Out of pure frustration, I have been avoiding any discussions regarding this timer re-write effort.
Quoted 3 lines
At the moment I'm trying to understand if we really have a problem on NIOS2 that cannot be fixed in a way that is compatible with our current plans.
This is where my frustration begins. I've said this several times before, and I don't know how else to say this ... but I'll give it one more try:
Quoted 5 lines
This is not a Nios problem.
If I can't use a 10 msec timer interrupt to detect a simple timeout condition when I'm programming a flash memory, then the timer API design is garbage.
Hi All,
I agree with the idea that mandating a particular timer
resolution is an un-desired limitation. You may need it for some cases, but not for all. Proof of this concept is the number of legacy UNIX systems running on 10 ms timer ticks, or for that matter the number of systems running on line cycle interrupts (16.666 ms in the US). It is also however true that one cannot ignore the timer resolution. That is what produced the problem in the first place. Asking for a delay that is less than the resolution isn't going to work as expected. This problem can be easily fixed by always adding twice the timer resolution to any requested delay, to ensure you waited at least two ticks , or by having a routine that does this for you (like the suggested API does). Right now, there are many places in the u-boot code that wait a certain small number of milliseconds under the assumption that the timer resolution is either 1) not an issue at all, or 2) is 1 ms. Both cases are wrong, the first case more so than the second. I wonder how many delays in the program that say "wait 5 ms" are aware that you could exit the loop after 4ms plus epsilon every so often, even with 1 ms resolution? Perhaps the tolerance is built into the number 5, perhaps not. However, it is surely not if the timer resolution is 16.666 ms.
Quoted 3 lines
And quite frankly, the enormous amount of
discussion in this matter reminds me of an undergraduate science project.
Or any government project. But when you will effect lots of people, you often must kill a few trees to make sure nobody (such as yourself and other NIOS users) somehow gets a bad deal.
I am now returning to "real work" and will be offline for a while. Good Luck All.
Best Regards,
Bill Campbell
Quoted 25 lines
Quoted 3 lines
We also have to deal with decrementing counters, but this is just aan unimportant detail. And it appears that we actually can have this, even on NIOS.
Wow! Even on Nios! Arrggghh!
Quoted 1 line
The only architecture I remember that seemed prolematic was NIOS
Really? There have been occasional issues that have required a patch here and there. But I consider most of them far from "problematic."
This is exhausting. As I recall, this entire fuss was born out of an issue with nested calls to
get_timer()... and that begat removingreset_timer... and that begat ... and so on. And we're still spilling lots of intellectual seed here. And now we have what? A jack-of-all-trades API that can do everything with exacting precision ... other than handling a 10 msec interrupt?Best Regards,
--Scott_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
cover API Rewrite
In reply to Wolfgang DenkHi Wolfgang,
Quoted 18 lines · Wolfgang Denk
Dear Graeme Russ,
Quoted 10 lines · In message <[email protected]> you wrote:
So how do we deal with Nios2? It is what caused such a deep investigation into the timer API. We have three choices I can think of off the top of my head:
1. Move the whole timer API up to the architecture level and replicate
code everywhere
2. Make the whole timer API weak
3. Fundamentally allow the timer API to handle arbitrary timer resolutionsQuoted 4 lines
1. Way ugly. We already have this, and that is why we are here today
2. Well, you know what will happen - Someone will be unhappy with the generic API and rewrite a completely different one (timer_maskedanyone!)
3. Why is this so evil?
Quoted 7 lines
The big disadvantage of 3) is that you cannot make any reasonable assumptions any more in the code. If I place a "udelay(10)" in some device driver, I am probably aware that we don't have exact times, and that the actual delay may be 10 or 12 or eventually even 20 micro- seconds. We should make sure that the delay never takes less than 10 us, but we also have to guarantee that it does not take - for example - 10 milliseconds.
OK, I will assume you agree with me that #1 and #2 are unacceptable
In the case of Nios2 we cannot use the Timer API for udelay since any udelay will blow out to 20ms - Very Bad Indeed. Maybe udelay might need to be defined weak, but I fear this will be the thin end of the wedge...
[snip pondering on NIOS]
Also remember that if we are looking to inherit nanosecond time base from Linux, it will be extremely unlikely that every board will support a native 1ns clock source. Typical examples would be 33MHz (~30ns) or 66MHz (~15ns). In any case, there will be a lot of variance between boards, so we will still need to cater for arbitrary resolutions
Quoted 8 lines
Quoted 1 line
1) Get the current time
Agreed. That's
time().Quoted 2 lines
2) Report the minimum time elapsed since an arbitrary epoch
3) Report the maximum time elapsed since an arbitrary epochI don't understand why we would need this.
Profiling - Lets say your hardware counter is ms accurate, if an operation takes 0.5ms then using #2 would give a 50/50 chance of reporting that the elapsed time was 0ms. Using method #3, the 50/50 split would be 1ms/2ms. Now as you low-level hardware clock becomes more accurate, those numbers move down to the real 0.5ms, but will never report that the operation took 0ms.
I guess going to nanosecond time base, the need for #3 lessens as the hardware clock gets faster.
Also, given that the architecture will need to provide a 'nanoseconds per counter increment', #3 can be easily derived if someone really wants it, but as soon as two people want it, you may as well move it into lib/ as it is a trivial function which is 100% architecture independent.
Quoted 10 lines
Quoted 4 lines
4) Delay for an arbitrary period of time
4 is a derivative of 2 - Just loop until at least the required time has elapsed.
Right. Both delays and timeouts work like that, the difference being that delays are "blocking", i. e. there is no other code running inbetween, and you can just sit in a tight spinning loop.
I have not seen any requirement yet for 3.
See above
Quoted 4 lines
Quoted 1 line
And you then suggest bringing in no less than 6 functions from Linux
It's just macros. And we don't need to use them all. Actually
time_after()is all that's needed to satisfy our current usage.
Oh please, macro, inline function, function - They are all API 'functions'
- As you stated before, the bigger the API, the more people will abuse is by using the wrong functions. You stated that you want to keep the public profile of the API as small and tight as possible by rejecting the additional functions previously proposed.
Quoted 5 lines
Quoted 3 lines
Done - I will reject the current series and rebase/repost the patches you have already ack'd and assign them to you in patchwork - I'll leave it up to you to pull them in
Don't reject them - just mark them as RFC.
OK
Quoted 6 lines
Quoted 2 lines
Provided you have access to an incrementing value which increments at a fixed rate and you know the rate, the rest is architecture independent
We also have to deal with decrementing counters, but this is just aan unimportant detail. And it appears that we actually can have this, even on NIOS.
Trivial in the proposed architecture with a #define in the config CONFIG_SYS_HW_COUNTER_DECREMENTS (or similar)
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
We could also say this is all we need. If we have a working high precision TOD timestamp, we can derive all other things we need from that.
Quoted 14 lines
Quoted 1 line
So you want to look at bringing in the Linux TOD API as well? That means we
No, I don't.
Quoted 10 lines
Quoted 6 lines
See my previous comments. And the longer I think about it, the more I think we should just use
u64 time(void)as core of this new code.
Agreed - As said before (for the time being) the return value of any arbitrary call to
time()means nothing. It _may_ mean the number of nanoseconds since power-up, but this is by no means guaranteed.
Actually, I do agree will Bill - time() is probably not the best name - get_current_ns() or similar may be more meaningful (I still have not had a chance to look at the Linux code)
Quoted 12 lines
True. But it is also garanteet to be usable in constructs as the aforementioned
u64 then = time() + number_of_nanoseconds; ... if (time_after(time(), then)) ...Quoted 1 line
But what about delays (no-brainer - ndelay, udelay, mdelay) and 'elapsed time'
Well, like this:
Quoted 7 lines
void udelay(u32 usec)
{ u64 then = time() + (u64)usec * (u64)1000; while (!time_after(time(), then)) ... do something, like trigger watchdogs etc ... }
Yes, that is how I always imagined udelay()
Quoted 2 lines
For 'elapsed time' it should be sufficient to store the start value of
time()as early as possible in the (architecture specific) code.
I did mean 'elapsed between two code locations' such as profiling the init functions - That was what API function #3 was all about.
Quoted 26 lines
Quoted 12 lines
Quoted 11 lines
Well, here I think we should have a look at Linux again here. In
include/linux/jiffies.hthey provide a nice set of inlines, which in our case would reuse directly:time_after() time_after_eq() time_before() time_before_eq() time_in_range() time_in_range_open()Quoted 1 line
When would we use
time_in_rangeandtime_in_range_open? I don't think weI don;t suggest that we need to use all of these. As mentioned, currently I only see use for
time_after()(and/ortime_after_eq(), it if should make a difference).Quoted 8 lines
Quoted 7 lines
The classic timeout code then becomes:
u64 then = time() + TIMEOUT; ... if (time_after(time(), then)) { /* handle timeout */ }
Quoted 5 lines
Quoted 2 lines
Arrrgh - Sorry, but we have been around and around and around this. There are sooooo many way to do this - The two big contenders have been:
Yes, and both of them do the compare in local code. This is what we should get rid of.
OK, this is a new philosophy for the mix. I think it is a good one for the record. But since we will always use time_after(time(), then) why don't we simplify it to:
u64 start = time();
...
if (time_elapsed_since(start, TIMEOUT)) {
/* handle timeout */
}Again, I will look at the Linux code
Quoted 9 lines
Quoted 1 line
And now we throw a third into the mix.
Please read the comments for the implementation of the
time_after()macro. It makes sense to do it this way.Quoted 3 lines
time_sinceandfuture_timeare designed to take into account the underlying resolution of the hardware timer/counter. The big thing to remember is that we _must_ handle the case where the underlying timer is too coarse
Quoted 6 lines
Do we? What exactly is the needed resolution of the underlying hardware timer? So far, it appears sufficient to have it ticking with 1000 Hz or more. Are there really systems that cannot provide that? The only architecture I remember that seemed prolematic was NIOS - but then the NIOS documentation suggests that this might actually be solvable.
Yes, but as stated before, there is a FPGA gate count trade-off which may not always be possible. Plus, you break existing boards
Regards,
Graeme
cover API Rewrite
Dear Graeme Russ,
Quoted 6 lines · In message <[email protected]> you wrote:
Also remember that if we are looking to inherit nanosecond time base from Linux, it will be extremely unlikely that every board will support a native 1ns clock source. Typical examples would be 33MHz (~30ns) or 66MHz (~15ns). In any case, there will be a lot of variance between boards, so we will still need to cater for arbitrary resolutions
Please note that Linux makes no assumption of a 1 ns clock source. We should hav eno problems on this front.
Quoted 8 lines
Quoted 2 lines
It's just macros. And we don't need to use them all. Actually
time_after()is all that's needed to satisfy our current usage.Oh please, macro, inline function, function - They are all API 'functions'
- As you stated before, the bigger the API, the more people will abuse is by using the wrong functions. You stated that you want to keep the public profile of the API as small and tight as possible by rejecting the additional functions previously proposed.
OK, so let's start with time_after() only.
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
Agreed - As said before (for the time being) the return value of any arbitrary call to
time()means nothing. It _may_ mean the number of nanoseconds since power-up, but this is by no means guaranteed.Actually, I do agree will Bill -
time()is probably not the best name -get_current_ns()or similar may be more meaningful (I still have not had a chance to look at the Linux code)
If you don't want to use time, then let's use get_time() please - this is close enough to the existing name so everybody familiar with the code recognizes it immediately.
Quoted 9 lines
Quoted 7 lines
void udelay(u32 usec)
{ u64 then = time() + (u64)usec * (u64)1000; while (!time_after(time(), then)) ... do something, like trigger watchdogs etc ... }Yes, that is how I always imagined
udelay()
...except that udelay() is guaranteed to be available very early in the initialization sequence, long before we have "normal" timer services which may - for example - be interrupt based.
Quoted 5 lines
Quoted 2 lines
For 'elapsed time' it should be sufficient to store the start value of
time()as early as possible in the (architecture specific) code.I did mean 'elapsed between two code locations' such as profiling the init functions - That was what API function #3 was all about.
Sounds trivial: store the value of time() and the begin and the end of the interval and compute the difference?
Quoted 9 lines
OK, this is a new philosophy for the mix. I think it is a good one for the record. But since we will always use
time_after(time(), then)why don't we simplify it to:u64 start = time(); ... if (time_elapsed_since(start, TIMEOUT)) { /* handle timeout */ }
This does not fit. time_elapsed_since() suggests it returns the length of the interval, i. e. a number of tiume units - but it does something different.
I like the time_after() approach very much because it does exactly what the name says, and nothing more - so you can use it in a number of ways - I recognise good old UNIX philosophy here: do one simple thing, and do it well.
Regarding the "we will always use time_after(time() ...) - we might want to check if we really have to use time() here (and in a number of other places - or if we can manage to come up with a simple timestamp variable, similar to what jiffies is in Linux. That would simplify the code even further. [Maybe "#define jiffies time()"? ;-) }
Quoted 9 lines
Quoted 6 lines
Do we? What exactly is the needed resolution of the underlying hardware timer? So far, it appears sufficient to have it ticking with 1000 Hz or more. Are there really systems that cannot provide that? The only architecture I remember that seemed prolematic was NIOS - but then the NIOS documentation suggests that this might actually be solvable.
Yes, but as stated before, there is a FPGA gate count trade-off which may not always be possible. Plus, you break existing boards
Understood. Well, how work the Linux timers on these boards, then?
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 At the source of every error which is blamed on the computer you will find at least two human errors, including the error of blaming it on the computer.
cover API Rewrite
In reply to Graeme RussHi Wolfgang.
Quoted 1 line · Graeme Russ
As I said, I will have a closer look at the Linux API...
OK, I've had a look at how the Linux API is used - in particular time_after(). Here is a typical random example (from drivers/spi/ep93xx_spi.c):
timeout = jiffies + msecs_to_jiffies(SPI_TIMEOUT);
while (ep93xx_spi_read_u16(espi, SSPSR) & SSPSR_RNE) {
if (time_after(jiffies, timeout)) {
dev_warn(&espi->pdev->dev,
"timeout while flushing RX FIFO\n");
msg->status = -ETIMEDOUT;
return;
}
ep93xx_spi_read_u16(espi, SSPDR);
}Now I personally do not like the global 'jiffies' variable for two reasons:
a) It assumes there is some interrupt source updating jiffies which we cannot guarantee. The discussions of the new API had the background counter being update by both a background interrupt (if available) or a call to get_timer()
b) It has no fixed time base
So it looks like the nanosecond clocksource code and the time_after et al macros are not directly related (as evidenced by time_after being in jiffies.h)
So maybe we should look at something along the lines of:
timeout = get_ms_count() + SPI_TIMEOUT;
while (ep93xx_spi_read_u16(espi, SSPSR) & SSPSR_RNE) {
if (time_after(get_ms_count(), timeout)) {
dev_warn(&espi->pdev->dev,
"timeout while flushing RX FIFO\n");
msg->status = -ETIMEDOUT;
return;
}
ep93xx_spi_read_u16(espi, SSPDR);
}The get_ms_count() name is up for debate
So this would mean minimal timer related code conversion bringing drivers from Linux, and a namespace which does not match Linux that will hence generate obvious compile errors.
If you really wanted to we could
#define jiffies get_ms_count()
#define msecs_to_jiffies(x) x
But I think that might be dangerous
Now we can use the existing get_timer(0) call (as I already did with this patch series) now and create the underlying architecture intrusive re-write of the generic 'clocksource' API later.
And then phase 3 would be to revisit udelay
Regards,
Graeme
cover API Rewrite
In reply to Wolfgang DenkQuoted 2 lines · Wolfgang Denk
Dear Graeme Russ,
[snip]
Quoted 14 lines
One thing I always wanted to do in the previous discussion was to check what other projects (like Linux, barebox, etc.) are doing in this area. I think it is worth reading the Linux
Documentation/timers/highres.txtdocument, especially the sections about John Stultz's Generic Time Of Day (GTOD) framework, please the documents linked there (i. e. the OLS slides [the link inDocumentation/timers/highres.txtis stale; use
http://www.kernel.org/pub/linux/kernel/people/tglx/hrtimers/ols2006-hrtimers.pdf
instead] and the paper "We Are Not Getting Any Younger: A New Approach to Time and Timers" by J. Stultz et al. in
http://www.linuxsymposium.org/2005/linuxsymposium_procv1.pdf p. 219ff).Having this still in mind, I took a look across the fence to what barebox is doing. Guess what? From "
common/clock.c":
Quoted 6 lines
*
clock.c- generic clocksource implementation
*
* This file contains the clocksource implementation from the Linux
* kernel originally by John StultzOK. Message received.
Yes, and barebox is also pulling in slabs of other Linux code such as driver framework etc. I think you will find barebox will ultimately have a very large code-base and binary image because of that. I think that U-Boot and barebox are heading in two different directions (and so they should, what would be the point otherwise) - barebox will become modular but larger, U-Boot will continue to be homogeneous and small.
Quoted 2 lines
What I'm asking myself (and now you) is: Should we really re-invent the wheel again?
OK, I've now had a brief look and I have the following comments:
- Looking at the low-level framework described in ols2006-hrtimers.pdf (Linux API), we are looking at implementing the same thing - An architecture specific free running, high speed, high resolution, high accuracy hardware counter/timer and a low speed interrupt which translates the hardware counter/timer to a common API. In this respect, we are not re-inventing that wheel at all
- The rest of the Linux API is like hitting a thumb-tack with a sledgehammer - Timer Queues, NTP, Callbacks, Scheduling etc, etc, etc. We only want to do two things:
1. Monitor timeouts
2. Calculate code execution time (and even then, not everyone all the time)
- The Linux API is nanosecond resolution. We are hard pressed to get the average hardware to support microsecond resolution
- The Linux API includes usage of 'clock events' - These are timer interrupts driven by programmable hardware and relieve the stress on the timer scheduler keeping track of every single timer - Overkill for a boot loader
- The Linux API includes 'Time of Day' (Wall Time) - Again, I don't think we really need this in a boot loader (we have an RTC API we can use if we want to get the current Date and Time).
So, all we need is a fixed resolution free running timer we can use to do simple (one at a time) timing operations. No callbacks, no scheduling, to 'Wall Time', no 'Clock Events', no NTP etc. The Linux API is 'Too Big'
I don't think we are re-inventing the wheel with our underlying concept - Use a hardware counter to handle the accuracy and resolution and use a less frequent interrupt to map the hardware implementation to a common software API. In U-Boot, the interrupt can be as simple as the actual call into the API, but where the hardware timer does not have sufficient resolution (a 32-bit nanosecond timer of 16-bit millisecond timer for example) an additional hardware interrupt will be required.
I personally think we are headed in the right direction 'for U-Boot' - small, tight, elegant, and fit-for-purpose
Regards,
Graeme
cover API Rewrite
Quoted 2 lines · Graeme Russ
Quoted 1 line · Wolfgang Denk
Dear Graeme Russ,
[snip]
Quoted 17 lines
Quoted 9 lines
Having this still in mind, I took a look across the fence to what barebox is doing. Guess what? From "
common/clock.c":*
clock.c- generic clocksource implementation
*
* This file contains the clocksource implementation from the Linux
* kernel originally by John StultzOK. Message received.
Yes, and barebox is also pulling in slabs of other Linux code such as driver framework etc. I think you will find barebox will ultimately have a very large code-base and binary image because of that. I think that U-Boot and barebox are heading in two different directions (and so they should, what would be the point otherwise) - barebox will become modular but larger, U-Boot will continue to be homogeneous and small.
Quoted 4 lines
Quoted 2 lines
What I'm asking myself (and now you) is: Should we really re-invent the wheel again?
OK, I've now had a brief look and I have the following comments:
[snip]
OK, now I've had a look at the Linux code (\kernel\time\*) and Barebox
(http://git.pengutronix.de/?p=barebox.git;a=blob;f=common/clock.c;h=79c06c8ddc1b3f447f7c81bf8bb592458f895ab3;hb=HEAD)
I think I can safely say that:
a) We do not want to inherit the code from Linux. It's good code clean code, but it is just way too much for what we need. It handles registering and unregistering clock sources, change clock source 'rating' (what ever that is) and relies heavily on quite heavy (for U-Boot) struct's (which may need to be carted around in Global Data)
b) Barebox doesn't really inherit that much from Linux anyway
I think we have the basics right (and that is the same as Linux). We just need to settle on a few finer points such as:
- Raw time interval. Linux uses nanoseconds. A 64-bit nanosecond clock source goes for >580 years so even if the highest resolution clock available to us right now is microsecond, it will not hurt to go with a nanosecond time-base as that will provide us with the greatest flexibility going forward. However, this will lead to a lot of integer divides and/or multiplies to scale to millisecond and microsecond intervals
- Function naming
- Performing time comparisons for timeouts - Barebox for example has a is_timeout function which takes a start time and a delay (in nanoseconds) an implements ndealy, udealy, and mdelay using is_timeout
I think what has been proposed here recently and documented (slightly out-of-date) on the wiki is the way to go. Taking the Linux or Barebox source will be more effort than it's worth for the complexity it brings in.
I recall an apt quote 'Good programmers know when to re-use, great programmers know when to re-write'
Regards,
Graeme
cover API Rewrite
Quoted 2 lines · Wolfgang Denk
Dear Graeme Russ,
<snip>
Quoted 5 lines
Do we? What exactly is the needed resolution of the underlying hardware timer? So far, it appears sufficient to have it ticking with 1000 Hz or more. Are there really systems that cannot provide that? The only architecture I remember that seemed prolematic was NIOS - but then the NIOS documentation suggests that this might actually be
Hi All,
The NIOS2 "systems" are a FPGA based architecture ("soft" core).
They CAN have all different kinds of timers. However, there are many already out in the world that were built (generated) with a timer that has 10 ms resolution. We can't retro-actively change these. We can declare them not supported in future releases, but we can't fix the resolution problem retroactively.
I have two comments regarding this discussion so far. First, I
think using the "time" function name at all is a VERY BAD idea. People will confuse it with the "normal" c library function that returns the time of day since the epoch. One may say that they should RTFM, but it is lots easier to just use another name and avoid all such confusion. Second, I think forcing all systems to use 64 bit time stamps is not a good idea. The main purpose of the timer API is to provide hardware timeouts. 64 bits is vast overkill for such a purpose. Mandating 64 bit capability for all u-boots is I think counter-productive. A 32 bit timestamp in millisecond resolution plus udelay covers all practical cases. The 1 ms resolution is probably inadequate for performance measurement, but for every u-boot system that is sometimes used for performance measurement, there are 100 (probably even more, like 1000, but I don't really have the figures) systems that are just used to boot Linux or another stand alone program. So we may need a different API for performance measurement that uses higher resolution. On most "larger" CPUs, there are hardware timers that can already do this with minimal work. On some less-capable CPUs, it may be lots harder, but if you aren't doing performance measurement, you don't need it. So I suggest that mandating a 64 bit API for some of the processors (68K comes to mind) is not really a good idea. It seems counter to the elegant simplicity of the rest of u-boot to stick a 64 bit requirement on timestamps used to determine if the boot delay is expired.
Best Regards,
J. William Campbell
Quoted 5 lines
Best regards,
Wolfgang Denk
cover API Rewrite
Dear J. William Campbell, All
Quoted 15 lines
I have two comments regarding this discussion so far. First, I
think using the "time" function name at all is a VERY BAD idea. People will confuse it with the "normal" c library function that returns the time of day since the epoch. One may say that they should RTFM, but it is lots easier to just use another name and avoid all such confusion. Second, I think forcing all systems to use 64 bit time stamps is not a good idea. The main purpose of the timer API is to provide hardware timeouts. 64 bits is vast overkill for such a purpose. Mandating 64 bit capability for all u-boots is I think counter-productive. A 32 bit timestamp in millisecond resolution plus udelay covers all practical cases. The 1 ms resolution is probably inadequate for performance measurement, but for every u-boot system that is sometimes used for performance measurement, there are 100 (probably even more, like 1000, but I don't really have the figures) systems that are just used to boot Linux or another stand alone program. So we may need a different API for
Quoted 8 lines
performance measurement that uses higher resolution. On most "larger" CPUs, there are hardware timers that can already do this with minimal work. On some less-capable CPUs, it may be lots harder, but if you aren't doing performance measurement, you don't need it. So I suggest that mandating a 64 bit API for some of the processors (68K comes to mind) is not really a good idea. It seems counter to the elegant simplicity of the rest of u-boot to stick a 64 bit requirement on timestamps used to determine if the boot delay is expired.
I can only FULLY agree here !!!
Lets just keep the current functions udelay(us) and u32 get_timer(), the latter maybe without parameter. Remove all *masked() and *reset() functions and lets change the timeout values used in code that also NIOS uses to be 20ms more than the hardware requires. It does not really matter if a *timeout* of 20ms is blown up to 40ms.
Reinhard
cover API Rewrite
Hi Reinhard,
Quoted 1 line · Reinhard Meyer
Dear J. William Campbell, All
[snip]
Quoted 2 lines
Lets just keep the current functions udelay(us) and u32
get_timer(), the latter maybe without parameter. Remove all*masked()and*reset()functions
This is happening and has Wolfgang's 100% support. Patches are done, just need to be rebased and resent
Quoted 3 lines
and lets change the timeout values used in code that also NIOS uses to be 20ms more than the hardware requires. It does not really matter if a *timeout* of 20ms is blown up to 40ms.
Can't do that - That would mean winding out common code (CFI, Network, Serial, FPGA etc, etc) timeouts to global worst-case scenario unless you want to add a #define and start littering the code with macro's - Urgh!
Regards,
Graeme
cover API Rewrite
Quoted 11 lines · Graeme Russ
Hi Reinhard,
Quoted 1 line · Reinhard Meyer
Dear J. William Campbell, All
[snip]
Quoted 2 lines
Lets just keep the current functions udelay(us) and u32
get_timer(), the latter maybe without parameter. Remove all*masked()and*reset()functionsThis is happening and has Wolfgang's 100% support. Patches are done, just need to be rebased and resent
Quoted 6 lines
Quoted 3 lines
and lets change the timeout values used in code that also NIOS uses to be 20ms more than the hardware requires. It does not really matter if a *timeout* of 20ms is blown up to 40ms.
Can't do that - That would mean winding out common code (CFI, Network, Serial, FPGA etc, etc) timeouts to global worst-case scenario unless you want to add a #define and start littering the code with macro's - Urgh!
Hi All,
Yes, this is true. However, the time_elapsed_since routine can do
this dynamically (i.e. add twice the timer resolution) . I think you had another function name (at_least) involved, but you can define time_elapsed_since as always compensating for the resolution. That will fix any resolution questions in a processor-specific way. It is either that or the ifdefs. One way or another, the resolution must be addressed. Up to now, the implicit resolution has been 1 ms, but we now know that is not general enough.
Best Regards,
Bill Campbell
Quoted 10 lines
Regards,
Graeme
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
cover API Rewrite
Dear "J. William Campbell",
Quoted 3 lines · In message <[email protected]> you wrote:
Yes, this is true. However, the
time_elapsed_sinceroutine can do
this dynamically (i.e. add twice the timer resolution) . I think you had
That would IMHO be a very bad idea. We have a number of places where we have to deal with pretty long timeouts (usually because of protocol specifications that require this - often in the order of several seconds), where the normal path is very fast. The typical approach is to break the timeout into a large number of very short loops. Sometimes we use udelay() for this, other places use get_timer().
So assume we have a timeout of 5 seconds, and implement this as 50,000 loops of 100 microseconds. If you silently turn each of these into 20 milliseconds on NIOS, the timeout would become 1,000 seconds instead of 5 - users would return boards as broken and report "it just freezes" because nobody expects that it will wake up again after some 16 minutes.
Quoted 6 lines
another function name (
at_least) involved, but you can definetime_elapsed_sinceas always compensating for the resolution. That will fix any resolution questions in a processor-specific way. It is either that or the ifdefs. One way or another, the resolution must be addressed. Up to now, the implicit resolution has been 1 ms, but we now know that is not general enough.
It's not as simple as this. You have to change a lot of code to make this work for such slow clock systems.
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
Sometimes a man will tell his bartender things he'll never tell his doctor.
-- Dr. Phillip Boyce, "The Menagerie" ("The Cage"),
stardate unknown.cover API Rewrite
Quoted 12 lines · Wolfgang Denk
Dear "J. William Campbell",
Quoted 2 lines · In message<[email protected]> you wrote:
Yes, this is true. However, the
time_elapsed_sinceroutine can do
this dynamically (i.e. add twice the timer resolution) . I think you hadThat would IMHO be a very bad idea. We have a number of places where we have to deal with pretty long timeouts (usually because of protocol specifications that require this - often in the order of several seconds), where the normal path is very fast. The typical approach is to break the timeout into a large number of very short loops. Sometimes we use
udelay()for this, other places useget_timer().
Quoted 6 lines
So assume we have a timeout of 5 seconds, and implement this as 50,000 loops of 100 microseconds. If you silently turn each of these into 20 milliseconds on NIOS, the timeout would become 1,000 seconds instead of 5 - users would return boards as broken and report "it just freezes" because nobody expects that it will wake up again after some 16 minutes.
Hi All,
If such a condition existed, that is indeed what would
happen. However, at present, such code is not being used on NIOS. We know this because the current "work-around" of resetting the timer at the start of any timeout operation extends the timeout to a minimum of 10 milliseconds. So we would be waiting 8 minutes currently, not 16, and I am pretty sure that is long enough for someone to notice. . I would be interested in seeing an example of such code as you refer to. Could you point me to one, because it seems to me that the only reason to code such a delay is that for some reason the user didn't want to keep looking at the termination condition so often. I think that that equivalent operation can be produced by a pretty simple re-coding of the loop. In any case, NIOS does not have the problem at present, so the suggested new work-around would be no worse than the present situation.
It is also true that the hardware timer cannot be used in a
reasonable version of udelay, as most of the desired delays may be very short relative to the timebase. A calibrated timing loop would be the best approach to the udelay problem.
Quoted 8 lines
Quoted 6 lines
another function name (
at_least) involved, but you can definetime_elapsed_sinceas always compensating for the resolution. That will fix any resolution questions in a processor-specific way. It is either that or the ifdefs. One way or another, the resolution must be addressed. Up to now, the implicit resolution has been 1 ms, but we now know that is not general enough.It's not as simple as this. You have to change a lot of code to make this work for such slow clock systems.
In general, that is true. There may be a few cases where a delay of less than the resolution is essential to make something work. There are probably lots of other cases where we can easily remove the restriction on the resolution. We cannot fix the first kind, no matter what we do, to work on a lower resolution timer. The second kind we can and probably should fix, because they are coded in an overly-restrictive manner. In any case, we don't absolutely have to fix them until somebody decides to use the code on a CPU with a low resolution timer. Practically speaking, the suggested solution will therefore work on all extant cases.
Best Regards,
Bill Campbell
Quoted 5 lines
Best regards,
Wolfgang Denk
cover API Rewrite
Dear "J. William Campbell",
Quoted 6 lines · In message <[email protected]> you wrote:
I am pretty sure that is long enough for someone to notice. . I would be interested in seeing an example of such code as you refer to. Could you point me to one, because it seems to me that the only reason to code such a delay is that for some reason the user didn't want to keep looking at the termination condition so often. I think that that
arch/powerpc/cpu/mpc512x/i2c.c:
80 while (timeout-- && (status & I2C_BB)) {
...
88 udelay (1000);
89 status = mpc_reg_in (®s->msr);
90 }
103 while (timeout-- && !(*status & I2C_IF)) {
104 udelay (1000);
105 *status = mpc_reg_in (®s->msr);
106 }
arch/powerpc/cpu/mpc512x/pci.c:
87 /* We need to wait at least a 1sec based on PCI specs */
88 for (i = 0; i < 1000; i++)
89 udelay(1000);
arch/powerpc/cpu/mpc5xx/spi.c:
258 for (i = 0; i < 1000; i++) {
...
265 udelay(1000);
266 }
390 for (tm=0; tm<1000; ++tm) {
...
394 udelay (1000);
395 }
arch/powerpc/cpu/mpc5xxx/i2c.c:
102 while (timeout-- && (status & I2C_BB)) {
...
111 udelay(15);
112 status = mpc_reg_in(®s->msr);
113 }
125 while (timeout-- && !(*status & I2C_IF)) {
126 udelay(15);
127 *status = mpc_reg_in(®s->msr);
128 }
And just that you don't think this is in a single CPU only:
arch/powerpc/cpu/mpc8260/pci.c:
343 for (i = 0; i < 1000; ++i)
...
345 udelay (1000);
Or in board code:
board/altera/common/cfide.c:
29 /* wait 500 ms for power to stabilize */
30 for (i = 0; i < 500; i++)
31 udelay(1000);
board/amcc/bamboo/bamboo.c:
1019 for (i=0; i<500; i++)
1020 udelay(1000);
or common code:
common/cmd_fdc.c:
213 while((read_fdc_reg(FDC_SRA)&0x80)==0) {
214 timeout--; 215 udelay(10); 216 if(timeout==0) /* timeout occured */
217 return FALSE;
218 }
228 while((read_fdc_reg(FDC_MSR)&0xC0)!=0xC0) {
229 /* direction out and ready */ 230 udelay(10); 231 timeout--; 232 if(timeout==0) /* timeout occured */
233 return -1;
234 }
etc.etc.
375 for(val=0;val<255;val++)
376 udelay(500); /* wait some time to start motor */
418 for(i=0;i<100;i++)
419 udelay(500); /* wait 500usec for fifo overrun */
600 for(i=0; i<255; i++) /* then we wait some time */
601 udelay(500);
common/usb.c:
93 inline void wait_ms(unsigned long ms)
94 {
95 while (ms-- > 0)
96 udelay(1000);
97 }etc. etc. Note this last example which "spreads" the effect in a not so nice way.
Note that there are even places where udelay() is part of the protocol timing implementation - like in the soft-I2C and soft-SPI drivers.
Quoted 3 lines
equivalent operation can be produced by a pretty simple re-coding of the loop. In any case, NIOS does not have the problem at present, so the suggested new work-around would be no worse than the present situation.
I think it is not correct to state that "NIOS does not have the problem at present" - it does, only this is not a blatant problem at the moment. Which in turn might result from the fact that all presently supported NIOS boards has any support enabled for I2C or SPI or USB or MMC or watchdogs or ... you name it.
The first user who adds any of the currently unused (and thus untested) standard features that work just fine on all other architectures might run into issue...
Quoted 4 lines
It is also true that the hardware timer cannot be used in a
reasonable version of udelay, as most of the desired delays may be very short relative to the timebase. A calibrated timing loop would be the best approach to the udelay problem.
Just try using Soft-I2C on a NIOS board and you will immediately realize how crucial a working version of udelay() is.
Quoted 2 lines
In general, that is true. There may be a few cases where a delay of less than the resolution is essential to make something work. There are
These are not just "a few cases". There are tons of it, all over the place - from protocol implementations like soft-I2C or soft-I2C to timing requirements for RAM initializations etc. etc. And there are enough places that mandate that the timing is at least in the requested oder, and not off by factors of tens or hundrets or worse.
Quoted 7 lines
probably lots of other cases where we can easily remove the restriction on the resolution. We cannot fix the first kind, no matter what we do, to work on a lower resolution timer. The second kind we can and probably should fix, because they are coded in an overly-restrictive manner. In any case, we don't absolutely have to fix them until somebody decides to use the code on a CPU with a low resolution timer. Practically speaking, the suggested solution will therefore work on all extant cases.
It will work by chance, at best. See above - any attempt to enable one of the currently not yet used standard features in U-Boot may break your system. I don't consider this a sound base - to me it feels like building on qicksand.
Best regards,
Wolfgang Denk
Signature · 5 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 Do not simplify the design of a program if a way can be found to make it complex and wonderful.
cover API Rewrite
Quoted 110 lines · Wolfgang Denk
Dear "J. William Campbell",
Quoted 5 lines · In message<[email protected]> you wrote:
I am pretty sure that is long enough for someone to notice. . I would be interested in seeing an example of such code as you refer to. Could you point me to one, because it seems to me that the only reason to code such a delay is that for some reason the user didn't want to keep looking at the termination condition so often. I think that that
arch/powerpc/cpu/mpc512x/i2c.c:80 while (timeout--&& (status& I2C_BB)) { ... 88 udelay (1000); 89 status = mpc_reg_in (®s->msr); 90 }103 while (timeout--&& !(*status&
I2C_IF)) {
104 udelay (1000);
105 *status =mpc_reg_in(®s->msr);
106 }arch/powerpc/cpu/mpc512x/pci.c:87 /* We need to wait at least a 1sec based on PCI specs */
88 for (i = 0; i< 1000; i++)
89 udelay(1000);
arch/powerpc/cpu/mpc5xx/spi.c:258 for (i = 0; i< 1000; i++) {
...
265 udelay(1000);
266 }390 for (tm=0; tm<1000; ++tm) {
...
394 udelay (1000);
395 }
arch/powerpc/cpu/mpc5xxx/i2c.c:102 while (timeout--&& (status&
I2C_BB)) {
...
111 udelay(15);
112 status =mpc_reg_in(®s->msr);
113 }125 while (timeout--&& !(*status&
I2C_IF)) {
126 udelay(15);
127 *status =mpc_reg_in(®s->msr);
128 }And just that you don't think this is in a single CPU only:
arch/powerpc/cpu/mpc8260/pci.c:343 for (i = 0; i< 1000; ++i)
...
345 udelay (1000);Or in board code:
board/altera/common/cfide.c:29 /* wait 500 ms for power to stabilize */
30 for (i = 0; i< 500; i++)
31 udelay(1000);
board/amcc/bamboo/bamboo.c:1019 for (i=0; i<500; i++)
1020 udelay(1000);or common code:
common/cmd_fdc.c:213 while((read_fdc_reg(FDC_SRA)&0x80)==0) {
214 timeout--; 215 udelay(10); 216 if(timeout==0) /* timeout occured */217 return FALSE;
218 }228 while((read_fdc_reg(FDC_MSR)&0xC0)!=0xC0) {
229 /* direction out and ready */ 230 udelay(10); 231 timeout--; 232 if(timeout==0) /* timeout occured */233 return -1;
234 }
etc.etc.375 for(val=0;val<255;val++)
376 udelay(500); /* wait some time to start motor */418 for(i=0;i<100;i++)
419 udelay(500); /* wait 500usec for fifo overrun */600 for(i=0; i<255; i++) /* then we wait some time */
601 udelay(500);
common/usb.c:93 inline void wait_ms(unsigned long ms) 94 { 95 while (ms--> 0) 96 udelay(1000); 97 }
Quoted 6 lines
etc. etc. Note this last example which "spreads" the effect in a not so nice way.
Note that there are even places where
udelay()is part of the protocol timing implementation - like in the soft-I2C and soft-SPI drivers.
Hi All,
Thanks for the pointers Wolfgang. From your examples, it seems we
are talking exclusively about udelay. As I said in my previous post, on NIOS2, udelay needs to be mechanized on NIOS2 by a timed loop, not by using the same mechanism as the timer, as there is no way one can approximate microsecond resolution by the hardware timer. It is my opinion that there are many CPUs on which the udelay implementation must not be/should not be based on the same timer code as the get_time() operation, because in many cases the get_time() operation requires interrupts to be functional. As you have also pointed out, udelay needs to be available "early", before interrupts are available. Therefore, the udelay and get_timer must use the hardware at least somewhat differently. The must also not interfere with each other, which on some existing boards they did.
If the I2C protocol must be available before interrupts are
available, then udelay must be used. In the above examples, there are some loops in i2c and spi that appear to be waiting a full second. I assume they are using udelay because the get_timer feature is not yet available to them. I also assume that the example in common/usb.c uses udelay to wait for millisecond sized values for the same reason, i.e. that it may run before get_time() is available. However, if you examine the timer code on of the existing CPUs, you will find that udelay is NOT available early ( before interrupts are enabled) on quite a few of them. Therefore, none of the above code would work on these CPUs at present either. These CPUs must not have I2C or spi busses on them that are accessed "early".
Quoted 9 lines
Quoted 3 lines
equivalent operation can be produced by a pretty simple re-coding of the loop. In any case, NIOS does not have the problem at present, so the suggested new work-around would be no worse than the present situation.
I think it is not correct to state that "NIOS does not have the problem at present" - it does, only this is not a blatant problem at the moment. Which in turn might result from the fact that all presently supported NIOS boards has any support enabled for I2C or SPI or USB or MMC or watchdogs or ... you name it.
Quoted 3 lines
The first user who adds any of the currently unused (and thus untested) standard features that work just fine on all other architectures might run into issue...
True, although I expect you will find the statement "on all the other architectures" to be false. Many other architectures, yes, all, no. These other architectures just don't have spi or I2C yet, or if they do, they don't use it "early".
Quoted 7 lines
Quoted 5 lines
It is also true that the hardware timer cannot be used in a
reasonable version of udelay, as most of the desired delays may be very short relative to the timebase. A calibrated timing loop would be the best approach to the udelay problem.Just try using Soft-I2C on a NIOS board and you will immediately realize how crucial a working version of
udelay()is.
Agreed. The definition of "working" would need to include that the routine is available "early" and that it is accurate to within say +/-5% (other numbers welcome) of the specified delay, unless the delay is "small" relative to the CPU speed (not an issue on most CPUs, but is on some). On these existing NIOS2 processors, that will require a udelay based on a timing loop, as there is no microsecond level timer available. The timing loop can be calibrated using the 10 ms timer, so it can be accurate enough. It may need re-calibration if icache is turned on, but this is also doable.
Quoted 16 lines
Quoted 3 lines
In general, that is true. There may be a few cases where a delay of less than the resolution is essential to make something work. There are
These are not just "a few cases". There are tons of it, all over the place - from protocol implementations like soft-I2C or soft-I2C to timing requirements for RAM initializations etc. etc. And there are enough places that mandate that the timing is at least in the requested oder, and not off by factors of tens or hundrets or worse.
Quoted 7 lines
probably lots of other cases where we can easily remove the restriction on the resolution. We cannot fix the first kind, no matter what we do, to work on a lower resolution timer. The second kind we can and probably should fix, because they are coded in an overly-restrictive manner. In any case, we don't absolutely have to fix them until somebody decides to use the code on a CPU with a low resolution timer. Practically speaking, the suggested solution will therefore work on all extant cases.
Quoted 4 lines
It will work by chance, at best. See above - any attempt to enable one of the currently not yet used standard features in U-Boot may break your system. I don't consider this a sound base - to me it feels like building on qicksand.
In a perfect world, I would agree with you. Unfortunately (or maybe inevitably), large software projects are iterative. There are quite a few u-boot versions in the current code that do not meet all the requirements that exits for a fully compliant udelay. There were also quite a few board ports whose timers did not meet the implicit requirements to be fully "compliant". Full compliance is required for "plug and play" with u-boot code that has been written assuming this full compliance. Quite a few people have just made a port that works for them without worrying about this compliance. One could argue that compliance was not well enough documented, or that non-compliant boards should not have been accepted. All perhaps true (or not, because u-boot was still feeling its way forward), but we are where we are. We can't retro-actively change the NIOS2 boards that are out there already. However, we can require that if any of the boards are to be upgraded to include I2C or SPI devices, they must be supplied with a compliant udelay, either by a timed loop or increasing the hardware timer resolution. The get_timer design is sound for all existing designs if the resolution compensation is added. It preserves all working boards as working . If you modify the configuration of existing boards that currently are non-compliant in some way, they may quit working. That is true now, and it will be true if the change to include the resolution is made. If udelay doesn't have compliant resolution and accuracy, newly enabled code may fail. If you aren't using such code, you may not be motivated to fix the problem. It still should be fixed, but often will not be until it breaks something. So I think we are building on solid, backwards compatible ground. Yes, non-compliant boards need to be "fixed", but we need a way to move forward with minimum pain to the current users.
Best Regards,
Bill Campbell
Quoted 6 lines
Best regards,
Wolfgang Denk
cover API Rewrite
Dear "J. William Campbell",
Quoted 6 lines · In message <[email protected]> you wrote:
If the I2C protocol must be available before interrupts are
available, then udelay must be used. In the above examples, there are some loops in i2c and spi that appear to be waiting a full second. I assume they are using udelay because theget_timerfeature is not yet available to them. I also assume that the example incommon/usb.cuses
No, this is usually not the case. This long delay is the error case, which most probably will never happen. For the normal case, you want a tight spinning loop that introduces as little additional delay as possible.
Quoted 4 lines
True, although I expect you will find the statement "on all the other architectures" to be false. Many other architectures, yes, all, no. These other architectures just don't have spi or I2C yet, or if they do, they don't use it "early".
Are you aware of another architecture that cannot provide sub-microsecond timer resolution? Which is it?
Best regards,
Wolfgang Denk
Signature · 4 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 Make it right before you make it faster.
cover API Rewrite
Quoted 8 lines · Wolfgang Denk
Dear "J. William Campbell",
Quoted 5 lines · In message<[email protected]> you wrote:
If the I2C protocol must be available before interrupts are
available, then udelay must be used. In the above examples, there are some loops in i2c and spi that appear to be waiting a full second. I assume they are using udelay because theget_timerfeature is not yet available to them. I also assume that the example incommon/usb.cuses
Quoted 4 lines
No, this is usually not the case. This long delay is the error case, which most probably will never happen. For the normal case, you want a tight spinning loop that introduces as little additional delay as possible.
Hi All,
I understand why one would want to use udelay in those cases
where there are other conditions that should cause the loop to exit. However, in the 16 examples you cited, 7 of those usages are for delays of multiple milliseconds with no tests or escape conditions included. I therefore pointed out that I assume that it was being done that way (as opposed to using get_timer) because this code would be executed "early", before get_timer was available.
Quoted 6 lines
Quoted 4 lines
True, although I expect you will find the statement "on all the other architectures" to be false. Many other architectures, yes, all, no. These other architectures just don't have spi or I2C yet, or if they do, they don't use it "early".
Are you aware of another architecture that cannot provide sub-microsecond timer resolution? Which is it?
No, but I am aware of some that do not provide udelay at all until
after interrupts are enabled and the get_timer interface is available. Several ARM implementations have this property. There are one or two others (SPARC) that are similar as I recall. There were also some that called reset_timer, which would mess up nested timing loops, but this has already been fixed. There also quite a few udelay implementations that do not actually provide 1 ?s resolution. For instance, the first thing that happens in arm720t/interrupts.c __udelay is that the input microseconds is divided by 1000 and the remainder discarded. A udelay(10) won't work so well here. The lh7a40x/timer.c uses a 508 kHz clock, so delays are accurate to at best 2 ?s. There are other examples. For instance, I am pretty sure some u-boot based CPUs use a 32kHz clock as the timebase for udelay. The resolution in that case is 30 ?s, which would be a problem for your example code. I am sure further digging will reveal other resolution issues.
These udelay issues would need fixing if all u-boot options are to work "out of the box". In some cases of low resolution, the fix is not easy, or maybe not even possible. However, this problem has not prevented the use of u-boot on these CPUs. It does mean that some things do not work "out of the box", and these non-compliant udelays should be fixed wherever practical. In any case, this shouldn't stop progress on get_timer and the delay_at_least (or whatever it ends up being called) function being adopted. That is independent of the udelay issues. udelay must be implemented in a "compliant" manner, which may or may not use the same hardware as get_timer() does. It certainly can't use the same code (although some ARM version in effect do, resulting in a non-compliant, low resolution udelay).
It might be interesting to utilize something like "jiffies" for the loop delays that are looking for error exits. In those cases, the error case should be infrequent. It may not matter that the total delay is quite a bit longer than the user requested, as long as it isn't vastly shorter. If a 10 ?sec delay became a 30 ?sec delay inside the loop examples where we expect to exit due to another cause, it probably wouldn't matter much. It would matter a lot though if the delay were setting a baud rate on a "bit-banged" output, so jiffies may not be worth it. I put it out there for consideration, as it is easier to produce than a udelay that has a guaranteed low absolute error.
Best Regards,
Bill Campbell
Quoted 5 lines
Best regards,
Wolfgang Denk
cover API Rewrite
Wolfgang, Bill
This thread was getting a little long so I took the liberty to snip the lot ;)
Now, the way I see things we are looking at two entirely different issues - udelay() and the Timer API. Unfortunately, they are somewhat intertwined because:
a) Some Architectures/SoCs/Boards etc do not implement udelay() in a manner that is either 'available early' or 'inaccurate' (or in some cases both) and
b) There is a not insignificant amount of code that uses a counter/udelay combination to implement timeout detection
I think for the moment I would like to concentrate solely on the Timer API and leave udelay out of it. I know some architectures use the existing Timer API for udelay, but if you look at my patch series, I never actually touched the existing architecture timer implementations. To date, the series has mostly been a rename and tidy-up of the Timer API and it's usage.
So, I think it will be easier to progress if we forget about udelay for the moment. We can identify where it is broken/being abused as a separate task.
I can expand the scope of this patch series to look at those instances where an incrementing loop counter with a udelay in the loop is being used where get_time() and friend(s) should be used instead.
So in future, any architecture that can both initialise the timer sub-system 'early' and has a timer resolution of <= 1us can use the Timer API for udelay, otherwise, udelay will need an implementation (for that architecture) which is independent of the timer sub-system. As an aside, the x86 code _used_ to have a conditional udelay. If the timer sub-system was not initialised yet, udelay would be implemented as a NOP loop. After timers were available, they were used as they are more accurate.
Regards,
Graeme
v2 cover Timer: Simplify API
In reply to Graeme RussThis patch series is the first 'logical' half of the previous series titled '(WIP) [Timer]API Rewrite' which was a 16 part series
This half (the first half) of the original series is a simplification of the existing API designed to correct a few 'implementation errors' and prepare the U-Boot tree for the new Timer API (which is still under active discussion).
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to 68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Tweaks to some patch titles
- Changed title prefix from '[Timer]' to 'Timer:' (git eats [..])
- Introduce new #define CONFIG_SYS_LOW_RES_TIMER
- Dropping of the entire second half of the series (the new Timer API)
Graeme Russ (7):
Timer: Fix misuse of ARM *timer_masked() functions outside arch/arm
Timer: Remove calls to set_timer outside arch/
Timer: Remove set_timer completely
Timer: Allow reset_timer() only for systems with low resolution timers
Timer: Remove reset_timer() for non-Nios2 arches
Timer: Fix at91rm9200/spi.c timer usage
Timer: Remove reset_timer_masked()
arch/arm/cpu/arm1136/mx31/timer.c | 17 ----------------- arch/arm/cpu/arm1136/mx35/timer.c | 9 --------- arch/arm/cpu/arm1136/omap24xx/timer.c | 24 +++++++----------------- arch/arm/cpu/arm1176/s3c64xx/timer.c | 17 ----------------- arch/arm/cpu/arm1176/tnetv107x/timer.c | 14 -------------- arch/arm/cpu/arm720t/interrupts.c | 17 ----------------- arch/arm/cpu/arm920t/a320/timer.c | 12 ------------ arch/arm/cpu/arm920t/at91/timer.c | 19 ------------------- arch/arm/cpu/arm920t/at91rm9200/spi.c | 5 +++-- arch/arm/cpu/arm920t/at91rm9200/timer.c | 18 ------------------ arch/arm/cpu/arm920t/ep93xx/timer.c | 15 +++------------ arch/arm/cpu/arm920t/imx/timer.c | 21 +++------------------ arch/arm/cpu/arm920t/ks8695/timer.c | 25 +++++-------------------- arch/arm/cpu/arm920t/s3c24x0/timer.c | 18 ------------------ arch/arm/cpu/arm925t/timer.c | 23 +++-------------------- arch/arm/cpu/arm926ejs/armada100/timer.c | 20 ++------------------ arch/arm/cpu/arm926ejs/davinci/timer.c | 5 ----- arch/arm/cpu/arm926ejs/kirkwood/timer.c | 20 ++------------------ arch/arm/cpu/arm926ejs/mb86r0x/timer.c | 19 +++---------------- arch/arm/cpu/arm926ejs/mx25/timer.c | 19 ------------------- arch/arm/cpu/arm926ejs/mx27/timer.c | 19 ------------------- arch/arm/cpu/arm926ejs/nomadik/timer.c | 12 +++++------- arch/arm/cpu/arm926ejs/omap/timer.c | 11 ----------- arch/arm/cpu/arm926ejs/orion5x/timer.c | 20 ++------------------ arch/arm/cpu/arm926ejs/pantheon/timer.c | 20 ++------------------ arch/arm/cpu/arm926ejs/spear/timer.c | 22 +++------------------- arch/arm/cpu/arm926ejs/versatile/timer.c | 11 ----------- arch/arm/cpu/armv7/mx5/timer.c | 20 ++++---------------- arch/arm/cpu/armv7/omap-common/timer.c | 21 +++------------------ arch/arm/cpu/armv7/s5p-common/timer.c | 10 ---------- arch/arm/cpu/armv7/tegra2/timer.c | 17 ----------------- arch/arm/cpu/armv7/u8500/timer.c | 5 ----- arch/arm/cpu/ixp/timer.c | 10 ---------- arch/arm/cpu/lh7a40x/timer.c | 11 ----------- arch/arm/cpu/pxa/timer.c | 18 +----------------- arch/arm/cpu/s3c44b0/timer.c | 18 ------------------ arch/arm/cpu/sa1100/timer.c | 16 ---------------- arch/avr32/cpu/interrupts.c | 23 ----------------------- arch/blackfin/cpu/interrupts.c | 5 ----- arch/m68k/cpu/mcf547x_8x/slicetimer.c | 9 --------- arch/m68k/lib/board.c | 2 -- arch/m68k/lib/time.c | 21 ++------------------- arch/microblaze/cpu/timer.c | 12 +----------- arch/mips/cpu/mips32/time.c | 12 ------------ arch/nios2/cpu/interrupts.c | 6 ------ arch/powerpc/lib/board.c | 2 -- arch/powerpc/lib/interrupts.c | 10 ---------- arch/sh/lib/time.c | 12 ------------ arch/sh/lib/time_sh2.c | 15 +-------------- arch/sparc/lib/board.c | 2 -- arch/sparc/lib/interrupts.c | 12 +----------- arch/x86/lib/board.c | 2 -- arch/x86/lib/timer.c | 10 ---------- board/BuS/EB+MCF-EV123/flash.c | 10 ++++++---- board/armadillo/flash.c | 6 ++++-- board/armltd/integrator/timer.c | 24 ++++-------------------- board/armltd/vexpress/ca9x4_ct_vxp.c | 5 ----- board/atmel/at91rm9200dk/flash.c | 10 ++++++---- board/cerf250/flash.c | 14 ++++++-------- board/cm4008/flash.c | 10 ++++++---- board/cm41xx/flash.c | 10 ++++++---- board/cmc_pu2/flash.c | 11 ++++++----- board/cobra5272/flash.c | 10 ++++++---- board/cradle/flash.c | 10 ++++++---- board/csb226/flash.c | 10 ++++++---- board/dnp1110/flash.c | 14 ++++++-------- board/ep7312/flash.c | 10 ++++++---- board/gcplus/flash.c | 14 ++++++-------- board/idmr/flash.c | 10 ++++++---- board/impa7/flash.c | 10 ++++++---- board/innokom/flash.c | 10 ++++++---- board/lart/flash.c | 10 ++++++---- board/lpd7a40x/flash.c | 10 ++++++---- board/lubbock/flash.c | 14 ++++++-------- board/modnet50/flash.c | 14 ++++++++------ board/mx1ads/syncflash.c | 2 +- board/ns9750dev/flash.c | 15 ++++++--------- board/nvidia/common/board.c | 1 - board/pleb2/flash.c | 18 +++++++++--------- board/samsung/smdk2400/flash.c | 10 ++++++---- board/sbc2410x/flash.c | 10 ++++++---- board/scb9328/flash.c | 5 +++-- board/shannon/flash.c | 10 ++++++---- board/ti/omap1610inn/flash.c | 15 ++++++--------- board/ti/omap730p2/flash.c | 15 ++++++--------- board/xaeniax/flash.c | 14 ++++++-------- board/xm250/flash.c | 23 +++++++++++------------ board/zylonite/flash.c | 14 ++++++-------- drivers/block/mg_disk.c | 2 ++ drivers/mtd/cfi_flash.c | 4 ++++ drivers/mtd/spi/eeprom_m95xxx.c | 5 +++-- drivers/net/fec_mxc.c | 6 +++--- drivers/net/netarm_eth.c | 12 +++++++----- include/common.h | 1 - include/configs/PCI5441.h | 1 + include/configs/PK1C20.h | 1 + include/configs/nios2-generic.h | 1 + 97 files changed, 274 insertions(+), 910 deletions(-)
--
1.7.5.2.317.g391b14
v2 cover Timer: Simplify API
Hi Wolfgang,
Quoted 15 lines · Graeme Russ
This patch series is the first 'logical' half of the previous series titled '(WIP) [Timer]API Rewrite' which was a 16 part series
This half (the first half) of the original series is a simplification of the existing API designed to correct a few 'implementation errors' and prepare the U-Boot tree for the new Timer API (which is still under active discussion).
Changes since v1 ((WIP) [Timer]API Rewrite):
- Rebased to68d4230c3ccce96a72c5b99e48399bf1796fe3c6
- Tweaks to some patch titles
- Changed title prefix from '[Timer]' to 'Timer:' (git eats [..])
- Introduce new #defineCONFIG_SYS_LOW_RES_TIMER
- Dropping of the entire second half of the series (the new Timer API)
Quoted 8 lines
Graeme Russ (7):
Timer: Fix misuse of ARM*timer_masked()functions outsidearch/arm
Timer: Remove calls toset_timeroutsidearch/
Timer: Removeset_timercompletely
Timer: Allowreset_timer()only for systems with low resolution timers
Timer: Removereset_timer()for non-Nios2 arches
Timer: Fixat91rm9200/spi.ctimer usage
Timer: Removereset_timer_masked()
Oh dear, it looks like Patchwork does not honour 'in-reply-to'. It has created new patches rather than updating the existing ones :(
I've marked the old ones 'Superseded' in Patchwork
Regards,
Graeme
v2 cover Timer: Simplify API
Hi Greame,
Le 15/07/2011 15:08, Graeme Russ a ?crit :
Quoted 2 lines
Oh dear, it looks like Patchwork does not honour 'in-reply-to'. It has created new patches rather than updating the existing ones :(
I'm not sure patchwork is supposed to honor the in-reply between patch versions. BTBW, is there a rationale or other documentation on the behavior of patchwork somewhere?
Quoted 1 line
I've marked the old ones 'Superseded' in Patchwork
Thanks!
Amicalement,
Signature · 1 line
Albert.
v2 cover Timer: Simplify API
Hi Albert,
Quoted 10 lines · Albert ARIBAUD
Hi Greame,
Le 15/07/2011 15:08, Graeme Russ a ?crit :
Quoted 2 lines
Oh dear, it looks like Patchwork does not honour 'in-reply-to'. It has created new patches rather than updating the existing ones :(
I'm not sure patchwork is supposed to honor the in-reply between patch versions. BTBW, is there a rationale or other documentation on the behavior of patchwork somewhere?
I should! - The whole point of me painstakingly getting the in-reply-to correct for each individual patch was so they would track correctly everywhere (inbox, list archive, patchwork). Oh Well
Regards,
Graeme
v2 cover Timer: Simplify API
Le 16/07/2011 11:01, Graeme Russ a ?crit :
Quoted 10 lines
Hi Albert,
Quoted 7 lines · Albert ARIBAUD
Hi Greame,
Le 15/07/2011 15:08, Graeme Russ a ?crit :
Quoted 2 lines
Oh dear, it looks like Patchwork does not honour 'in-reply-to'. It has created new patches rather than updating the existing ones :(
Quoted 7 lines
Quoted 3 lines
I'm not sure patchwork is supposed to honor the in-reply between patch versions. BTBW, is there a rationale or other documentation on the behavior of patchwork somewhere?
I should! - The whole point of me painstakingly getting the in-reply-to correct for each individual patch was so they would track correctly everywhere (inbox, list archive, patchwork). Oh Well
Two out of three ain't bad. :)
Quoted 3 lines
Regards,
Graeme
Amicalement,
Signature · 1 line
Albert.
v2 cover Timer: Simplify API
In reply to Graeme RussDear Graeme Russ,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 4 lines
I'm not sure patchwork is supposed to honor the in-reply between patch versions. BTBW, is there a rationale or other documentation on the behavior of patchwork somewhere?
I should! - The whole point of me painstakingly getting the in-reply-to correct for each individual patch was so they would track correctly everywhere (inbox, list archive, patchwork). Oh Well
As far as I understand the threading is only given in the mailing list. Patchwork is not clever enough to recognize a reposting. Old, superseded patches have to be manually marked as such (as long as they are not already set to "Changes Requested").
Best regards,
Wolfgang Denk
Signature · 5 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 Disobedience: The silver lining to the cloud of servitude. - Ambrose Bierce