Generic udelay() with watchdog support
PATCH 1/1 Generic udelay() with watchdog support
According to the PPC reference implementation the udelay() function is responsible for resetting the watchdog timer as frequently as needed. Most other architectures do not meet that requirement, so long-running operations might result in a watchdog reset.
This patch adds a generic udelay() function which takes care of resetting the watchdog before calling an architecture-specific __udelay().
--- board/armltd/integrator/timer.c | 2 +- cpu/arm1136/mx31/timer.c | 2 +- cpu/arm1136/omap24xx/timer.c | 2 +- cpu/arm1176/s3c64xx/timer.c | 2 +- cpu/arm720t/interrupts.c | 4 +- cpu/arm920t/at91rm9200/timer.c | 2 +- cpu/arm920t/imx/timer.c | 2 +- cpu/arm920t/ks8695/timer.c | 2 +- cpu/arm920t/s3c24x0/timer.c | 2 +- cpu/arm925t/timer.c | 2 +- cpu/arm926ejs/at91/timer.c | 2 +- cpu/arm926ejs/davinci/timer.c | 2 +- cpu/arm926ejs/kirkwood/timer.c | 2 +- cpu/arm926ejs/mx27/timer.c | 2 +- cpu/arm926ejs/nomadik/timer.c | 2 +- cpu/arm926ejs/omap/timer.c | 2 +- cpu/arm926ejs/versatile/timer.c | 2 +- cpu/arm_cortexa8/omap3/timer.c | 2 +- cpu/at32ap/interrupts.c | 2 +- cpu/blackfin/interrupts.c | 2 +- cpu/i386/sc520/sc520_timer.c | 2 +- cpu/ixp/start.S | 4 +- cpu/ixp/timer.c | 2 +- cpu/lh7a40x/timer.c | 2 +- cpu/mcf547x_8x/slicetimer.c | 2 +- cpu/pxa/timer.c | 2 +- cpu/s3c44b0/timer.c | 2 +- cpu/sa1100/timer.c | 2 +- examples/api/libgenwrap.c | 2 +- include/asm-blackfin/delay.h | 2 +- include/exports.h | 2 +- lib_generic/Makefile | 1 + lib_generic/time.c | 43 +++++++++++++++++++++++++++++++++++++++ lib_i386/pcat_timer.c | 2 +- lib_m68k/time.c | 4 +- lib_microblaze/time.c | 4 +- lib_mips/time.c | 2 +- lib_nios/time.c | 3 +- lib_nios2/time.c | 3 +- lib_ppc/time.c | 16 ++----------- lib_sh/time.c | 2 +- lib_sh/time_sh2.c | 2 +- lib_sparc/time.c | 2 +- 43 files changed, 91 insertions(+), 59 deletions(-) create mode 100644 lib_generic/time.c
board/armltd/integrator/timer.c +1 -1
@@ -124,7 +124,7 @@ void set_timer (ulong ticks) }/* delay usec useconds */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
cpu/arm1136/mx31/timer.c +1 -1
@@ -152,7 +152,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm1136/omap24xx/timer.c +1 -1
@@ -74,7 +74,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
cpu/arm1176/s3c64xx/timer.c +1 -1
@@ -164,7 +164,7 @@ void set_timer(ulong t) timestamp = t * (timer_load_val / (100 *CONFIG_SYS_HZ )); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm720t/interrupts.c +2 -2
@@ -224,7 +224,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;
@@ -296,7 +296,7 @@ ulong get_timer (ulong base)return timestamp - base; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {u32 ticks;
cpu/arm920t/at91rm9200/timer.c +1 -1
@@ -87,7 +87,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
cpu/arm920t/imx/timer.c +1 -1
@@ -89,7 +89,7 @@ void udelay_masked (unsigned long usec) }while (diff >=0 ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
cpu/arm920t/ks8695/timer.c +1 -1
@@ -81,7 +81,7 @@ void set_timer(ulong t) timer_ticks = t; } -void udelay (ulong usec) +void __udelay (ulong usec) {ulong start =get_timer_masked ();ulong end;
cpu/arm920t/s3c24x0/timer.c +1 -1
@@ -97,7 +97,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;ulong start =get_timer (0 );
cpu/arm925t/timer.c +1 -1
@@ -81,7 +81,7 @@ void set_timer (ulong t) }/* delay x useconds AND preserve advance timestamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int32_t tmo = usec * (TIMER_CLOCK /1000 ) /1000 ;uint32_t now, last =__raw_readl (CONFIG_SYS_TIMERBASE +READ_TIM );
cpu/arm926ejs/at91/timer.c +1 -1
@@ -105,7 +105,7 @@ ulong get_timer_masked(void)return tick_to_time (get_ticks ()); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm926ejs/davinci/timer.c +1 -1
@@ -110,7 +110,7 @@ void set_timer(ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;ulong endtime;
cpu/arm926ejs/kirkwood/timer.c +1 -1
@@ -125,7 +125,7 @@ void set_timer(ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {uint current;ulong delayticks;
cpu/arm926ejs/mx27/timer.c +1 -1
@@ -177,7 +177,7 @@ void set_timer (ulong t) }/* delay x useconds AND preserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm926ejs/nomadik/timer.c +1 -1
@@ -59,7 +59,7 @@ ulong get_timer(ulong base) }/* Delay x useconds */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong ini, end;
cpu/arm926ejs/omap/timer.c +1 -1
@@ -80,7 +80,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
cpu/arm926ejs/versatile/timer.c +1 -1
@@ -109,7 +109,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
cpu/arm_cortexa8/omap3/timer.c +1 -1
@@ -82,7 +82,7 @@ void set_timer(ulong t) }/* delay x useconds */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {long tmo = usec * (TIMER_CLOCK /1000 ) /1000 ;unsigned long now, last =readl (&timer_base->tcrr);
cpu/at32ap/interrupts.c +1 -1
@@ -96,7 +96,7 @@ void set_timer(unsigned long t)/* * For short delays only. It will overflow after a few seconds. */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long cycles;unsigned long base;
cpu/blackfin/interrupts.c +1 -1
@@ -63,7 +63,7 @@ int disable_interrupts(void)return 1 ; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long delay, start, stop;unsigned long cclk;
cpu/i386/sc520/sc520_timer.c +1 -1
@@ -67,7 +67,7 @@ int timer_init(void)return 0 ; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int m =0 ;long u;
cpu/ixp/start.S +2 -2
@@ -505,8 +505,8 @@ reset_endless: /* * 0 <= r0 <= 2000 */ -.globl udelay -udelay: +.globl __udelay +__udelay: mov r2, #0x6800 orr r2, r2, #0x00db mul r0, r2, r0
cpu/ixp/timer.c +1 -1
@@ -99,7 +99,7 @@ void ixp425_udelay(unsigned long usec)while (!(*IXP425_OSST &IXP425_OSST_TIMER_1_PEND )); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {while (usec--)ixp425_udelay (1 ); }
cpu/lh7a40x/timer.c +1 -1
@@ -90,7 +90,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo,tmp;
cpu/mcf547x_8x/slicetimer.c +1 -1
@@ -40,7 +40,7 @@ static ulong timestamp;#endif extern void dtimer_intr_setup (void ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_UDELAY_BASE );u32 now, freq;
cpu/pxa/timer.c +1 -1
@@ -78,7 +78,7 @@ void set_timer (ulong t)/* nop */ } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
cpu/s3c44b0/timer.c +1 -1
@@ -75,7 +75,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;
cpu/sa1100/timer.c +1 -1
@@ -49,7 +49,7 @@ void set_timer (ulong t)/* nop */ } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
examples/api/libgenwrap.c +1 -1
@@ -74,7 +74,7 @@ void putc (const char c)ub_putc (c); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ub_udelay (usec); }
include/asm-blackfin/delay.h +1 -1
@@ -47,7 +47,7 @@ extern __inline__ void __delay(unsigned long loops)* first constant multiplications gets optimized away if the delay is * a constant) */ -extern __inline__void udelay (unsigned long usecs) +extern __inline__void __udelay (unsigned long usecs) {__delay (usecs); }
include/exports.h +1 -1
@@ -16,7 +16,7 @@ void install_hdlr(int, interrupt_handler_t*, void*);void free_hdlr (int );void *malloc (size_t );void free (void *); -void udelay (unsigned long ); +void __udelay (unsigned long );unsigned long get_timer (unsigned long );void vprintf (const char *,va_list );void do_reset (void );
lib_generic/Makefile +1 -0
@@ -44,6 +44,7 @@ COBJS-y += sha1.o COBJS-$(CONFIG_SHA256) += sha256.o COBJS-y += string.o COBJS-y += strmhz.o +COBJS-y += time.o COBJS-y += vsprintf.o COBJS-y += zlib.o COBJS-$(CONFIG_RBTREE) += rbtree.o
lib_generic/time.c new file +43 -0
43 lines not on this page · raw message
lib_i386/pcat_timer.c +1 -1
@@ -71,7 +71,7 @@ static u16 read_pit(void) }/* this is not very exact */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int counter;int wraps;
lib_m68k/time.c +2 -2
@@ -47,7 +47,7 @@ static volatile ulong timestamp = 0;#endif extern void dtimer_intr_setup (void ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {volatile dtmr_t *timerp = (dtmr_t *) (CONFIG_SYS_UDELAY_BASE );uint start, now, tmp;
@@ -139,7 +139,7 @@ void set_timer(ulong t)static unsigned short lastinc; -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_UDELAY_BASE );uint tmp;
lib_microblaze/time.c +2 -2
@@ -27,14 +27,14 @@#include <common.h> #ifdef CONFIG_SYS_TIMER_0 -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int i; i =get_timer (0 );while ((get_timer (0 ) - i) < (usec /1000 )) ; }#else -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned int i;for (i =0 ; i < (usec *CONFIG_XILINX_CLOCK_FREQ /10000000 ); i++);
lib_mips/time.c +1 -1
@@ -70,7 +70,7 @@ void set_timer(ulong t)write_c0_compare (read_c0_count () +CYCLES_PER_JIFFY ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned int tmo;
lib_nios/time.c +1 -2
@@ -27,13 +27,12 @@extern void dly_clks (unsigned long ticks ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {/* The Nios core doesn't have a timebase, so we do our * best for now and call a low-level loop that counts * cpu clocks. */ unsigned long cnt = (CONFIG_SYS_CLK_FREQ /1000000 ) * usec; -WATCHDOG_RESET ();/* trigger watchdog if needed */ dly_clks (cnt); }
lib_nios2/time.c +1 -2
@@ -27,13 +27,12 @@extern void dly_clks (unsigned long ticks ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {/* The Nios core doesn't have a timebase, so we do our * best for now and call a low-level loop that counts * cpu clocks. */ unsigned long cnt = (CONFIG_SYS_CLK_FREQ /1000000 ) * usec; -WATCHDOG_RESET ();/* trigger watchdog if needed */ dly_clks (cnt); }
lib_ppc/time.c +3 -13
@@ -23,10 +23,6 @@#include <common.h> -#ifndef CONFIG_WD_PERIOD -# define CONFIG_WD_PERIOD (10 * 1000 * 1000)/* 10 seconds default*/ -#endif -/* ------------------------------------------------------------------------- */ /*
@@ -54,16 +50,10 @@ unsigned long usec2ticks(unsigned long usec)* microseconds to wait) into a number of time base ticks; then we * watch the time base until it has incremented by that amount. */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) { -ulong ticks, kv; - -do { - kv = usec >CONFIG_WD_PERIOD ?CONFIG_WD_PERIOD : usec; - ticks =usec2ticks (kv); -wait_ticks (ticks); - usec -= kv; - }while (usec); +ulong ticks =usec2ticks (usec); +wait_ticks (ticks); }/* ------------------------------------------------------------------------- */
lib_sh/time.c +1 -1
@@ -105,7 +105,7 @@ unsigned long long get_ticks (void)return 0 -readl (TCNT0 ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
lib_sh/time_sh2.c +1 -1
@@ -103,7 +103,7 @@ void reset_timer(void)cmt_timer_start (0 ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long end =get_usec () + usec;
lib_sparc/time.c +1 -1
@@ -53,7 +53,7 @@ unsigned long usec2ticks(unsigned long usec)* microseconds to wait) into a number of time base ticks; then we * watch the time base until it has incremented by that amount. */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong ticks =usec2ticks (usec);
Signature · 1 line
1.6.2.5
PATCH 1/1 Generic udelay() with watchdog support
Dear Ingo van Lil,
Quoted 8 lines · In message <[email protected]> you wrote:
According to the PPC reference implementation the
udelay()function is responsible for resetting the watchdog timer as frequently as needed. Most other architectures do not meet that requirement, so long-running operations might result in a watchdog reset.This patch adds a generic
udelay()function which takes care of resetting the watchdog before calling an architecture-specific__udelay().
This patch does not apply:
Applying: Generic udelay() with watchdog support
error: patch failed: cpu/arm920t/s3c24x0/timer.c:97
error: cpu/arm920t/s3c24x0/timer.c: patch does not apply Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge... Auto-merging cpu/arm920t/s3c24x0/timer.c
CONFLICT (content): Merge conflict in cpu/arm920t/s3c24x0/timer.c Auto-merging cpu/blackfin/interrupts.c
Auto-merging include/exports.h
Failed to merge in the changes.
Patch failed at 0001 Generic udelay() with watchdog support
Could you please rebase it against the "next" branch and resubmit it?
Thanks in advance.
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
A Chairman was as necessary to a Board planet as the zero was in
mathematics, but being a zero had big disadvantages...
- Terry Pratchett, _The Dark Side of the Sun_PATCH 1/1 Generic udelay() with watchdog support
According to the PPC reference implementation the udelay() function is responsible for resetting the watchdog timer as frequently as needed. Most other architectures do not meet that requirement, so long-running operations might result in a watchdog reset.
This patch adds a generic udelay() function which takes care of resetting the watchdog before calling an architecture-specific __udelay().
--- board/armltd/integrator/timer.c | 2 +- board/freescale/mpc8313erdb/sdram.c | 2 +- cpu/arm1136/mx31/timer.c | 2 +- cpu/arm1136/omap24xx/timer.c | 2 +- cpu/arm1176/s3c64xx/timer.c | 2 +- cpu/arm720t/interrupts.c | 4 +- cpu/arm920t/at91rm9200/timer.c | 2 +- cpu/arm920t/imx/timer.c | 2 +- cpu/arm920t/ks8695/timer.c | 2 +- cpu/arm920t/s3c24x0/timer.c | 2 +- cpu/arm925t/timer.c | 2 +- cpu/arm926ejs/at91/timer.c | 2 +- cpu/arm926ejs/davinci/timer.c | 2 +- cpu/arm926ejs/kirkwood/timer.c | 2 +- cpu/arm926ejs/mx27/timer.c | 2 +- cpu/arm926ejs/nomadik/timer.c | 2 +- cpu/arm926ejs/omap/timer.c | 2 +- cpu/arm926ejs/versatile/timer.c | 2 +- cpu/arm_cortexa8/omap3/timer.c | 2 +- cpu/arm_cortexa8/s5pc1xx/timer.c | 2 +- cpu/at32ap/interrupts.c | 2 +- cpu/blackfin/interrupts.c | 2 +- cpu/i386/sc520/sc520_timer.c | 2 +- cpu/ixp/start.S | 4 +- cpu/ixp/timer.c | 2 +- cpu/lh7a40x/timer.c | 2 +- cpu/mcf547x_8x/slicetimer.c | 2 +- cpu/pxa/timer.c | 2 +- cpu/s3c44b0/timer.c | 2 +- cpu/sa1100/timer.c | 2 +- examples/api/Makefile | 1 + examples/api/libgenwrap.c | 2 +- include/asm-blackfin/delay.h | 2 +- include/common.h | 5 +++- include/exports.h | 2 +- lib_generic/Makefile | 1 + lib_generic/time.c | 43 +++++++++++++++++++++++++++++++++++ lib_i386/pcat_timer.c | 2 +- lib_m68k/time.c | 4 +- lib_microblaze/time.c | 4 +- lib_mips/time.c | 2 +- lib_nios/time.c | 3 +- lib_nios2/time.c | 3 +- lib_ppc/time.c | 16 ++---------- lib_sh/time.c | 2 +- lib_sh/time_sh2.c | 2 +- lib_sparc/time.c | 2 +- 47 files changed, 98 insertions(+), 62 deletions(-) create mode 100644 lib_generic/time.c
board/armltd/integrator/timer.c +1 -1
@@ -124,7 +124,7 @@ void set_timer (ulong ticks) }/* delay usec useconds */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
board/freescale/mpc8313erdb/sdram.c +1 -1
@@ -72,7 +72,7 @@ static long fixed_sdram(void)* Erratum DDR3 requires a 50ms delay after clearing DDRCDR[DDR_cfg], * or the DDR2 controller may fail to initialize correctly. */ -udelay (50000 ); +__udelay (50000 ); im->ddr.csbnds[0 ].csbnds = (msize -1 ) >>24 ; im->ddr.cs_config[0 ] =CONFIG_SYS_DDR_CONFIG ;
cpu/arm1136/mx31/timer.c +1 -1
@@ -152,7 +152,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm1136/omap24xx/timer.c +1 -1
@@ -74,7 +74,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
cpu/arm1176/s3c64xx/timer.c +1 -1
@@ -164,7 +164,7 @@ void set_timer(ulong t) timestamp = t * (timer_load_val / (100 *CONFIG_SYS_HZ )); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm720t/interrupts.c +2 -2
@@ -224,7 +224,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;
@@ -296,7 +296,7 @@ ulong get_timer (ulong base)return timestamp - base; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {u32 ticks;
cpu/arm920t/at91rm9200/timer.c +1 -1
@@ -87,7 +87,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
cpu/arm920t/imx/timer.c +1 -1
@@ -89,7 +89,7 @@ void udelay_masked (unsigned long usec) }while (diff >=0 ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
cpu/arm920t/ks8695/timer.c +1 -1
@@ -81,7 +81,7 @@ void set_timer(ulong t) timer_ticks = t; } -void udelay (ulong usec) +void __udelay (ulong usec) {ulong start =get_timer_masked ();ulong end;
cpu/arm920t/s3c24x0/timer.c +1 -1
@@ -106,7 +106,7 @@ void set_timer(ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;ulong start =get_ticks ();
cpu/arm925t/timer.c +1 -1
@@ -81,7 +81,7 @@ void set_timer (ulong t) }/* delay x useconds AND preserve advance timestamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int32_t tmo = usec * (TIMER_CLOCK /1000 ) /1000 ;uint32_t now, last =__raw_readl (CONFIG_SYS_TIMERBASE +READ_TIM );
cpu/arm926ejs/at91/timer.c +1 -1
@@ -105,7 +105,7 @@ ulong get_timer_masked(void)return tick_to_time (get_ticks ()); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm926ejs/davinci/timer.c +1 -1
@@ -110,7 +110,7 @@ void set_timer(ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;ulong endtime;
cpu/arm926ejs/kirkwood/timer.c +1 -1
@@ -125,7 +125,7 @@ void set_timer(ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {uint current;ulong delayticks;
cpu/arm926ejs/mx27/timer.c +1 -1
@@ -177,7 +177,7 @@ void set_timer (ulong t) }/* delay x useconds AND preserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
cpu/arm926ejs/nomadik/timer.c +1 -1
@@ -59,7 +59,7 @@ ulong get_timer(ulong base) }/* Delay x useconds */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong ini, end;
cpu/arm926ejs/omap/timer.c +1 -1
@@ -80,7 +80,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
cpu/arm926ejs/versatile/timer.c +1 -1
@@ -109,7 +109,7 @@ void set_timer (ulong t) }/* delay x useconds AND perserve advance timstamp value */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo, tmp;
cpu/arm_cortexa8/omap3/timer.c +1 -1
@@ -82,7 +82,7 @@ void set_timer(ulong t) }/* delay x useconds */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {long tmo = usec * (TIMER_CLOCK /1000 ) /1000 ;unsigned long now, last =readl (&timer_base->tcrr);
cpu/arm_cortexa8/s5pc1xx/timer.c +1 -1
@@ -115,7 +115,7 @@ void set_timer(unsigned long t) }/* delay x useconds */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long tmo, tmp;
cpu/at32ap/interrupts.c +1 -1
@@ -96,7 +96,7 @@ void set_timer(unsigned long t)/* * For short delays only. It will overflow after a few seconds. */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long cycles;unsigned long base;
cpu/blackfin/interrupts.c +1 -1
@@ -64,7 +64,7 @@ int disable_interrupts(void)return 1 ; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long delay, start, stop;unsigned long cclk;
cpu/i386/sc520/sc520_timer.c +1 -1
@@ -67,7 +67,7 @@ int timer_init(void)return 0 ; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int m =0 ;long u;
cpu/ixp/start.S +2 -2
@@ -505,8 +505,8 @@ reset_endless: /* * 0 <= r0 <= 2000 */ -.globl udelay -udelay: +.globl __udelay +__udelay: mov r2, #0x6800 orr r2, r2, #0x00db mul r0, r2, r0
cpu/ixp/timer.c +1 -1
@@ -99,7 +99,7 @@ void ixp425_udelay(unsigned long usec)while (!(*IXP425_OSST &IXP425_OSST_TIMER_1_PEND )); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {while (usec--)ixp425_udelay (1 ); }
cpu/lh7a40x/timer.c +1 -1
@@ -90,7 +90,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo,tmp;
cpu/mcf547x_8x/slicetimer.c +1 -1
@@ -40,7 +40,7 @@ static ulong timestamp;#endif extern void dtimer_intr_setup (void ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {volatile slt_t *timerp = (slt_t *) (CONFIG_SYS_UDELAY_BASE );u32 now, freq;
cpu/pxa/timer.c +1 -1
@@ -78,7 +78,7 @@ void set_timer (ulong t)/* nop */ } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
cpu/s3c44b0/timer.c +1 -1
@@ -75,7 +75,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong tmo;
cpu/sa1100/timer.c +1 -1
@@ -49,7 +49,7 @@ void set_timer (ulong t)/* nop */ } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {udelay_masked (usec); }
examples/api/Makefile +1 -0
@@ -44,6 +44,7 @@ EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/crc32.o EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/ctype.o EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/div64.o EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/string.o +EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/time.o EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/vsprintf.o ifeq ($(ARCH),ppc) EXT_SOBJ_FILES-$(CONFIG_API) += lib_ppc/ppcstring.o
examples/api/libgenwrap.c +1 -1
@@ -74,7 +74,7 @@ void putc (const char c)ub_putc (c); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ub_udelay (usec); }
include/asm-blackfin/delay.h +1 -1
@@ -47,7 +47,7 @@ extern __inline__ void __delay(unsigned long loops)* first constant multiplications gets optimized away if the delay is * a constant) */ -extern __inline__void udelay (unsigned long usecs) +extern __inline__void __udelay (unsigned long usecs) {__delay (usecs); }
include/common.h +4 -1
@@ -603,11 +603,14 @@ unsigned long long get_ticks(void);void wait_ticks (unsigned long );/* lib_$(ARCH)/time.c */ -void udelay (unsigned long ); +void __udelay (unsigned long );ulong usec2ticks (unsigned long usec);ulong ticks2usec (unsigned long ticks);int init_timebase (void ); +/* lib_generic/time.c */ +void udelay (unsigned long ); +/* lib_generic/vsprintf.c */ ulong simple_strtoul (const char *cp,char **endp,unsigned int base);#ifdef CONFIG_SYS_64BIT_VSPRINTF
include/exports.h +1 -1
@@ -16,7 +16,7 @@ void install_hdlr(int, interrupt_handler_t*, void*);void free_hdlr (int );void *malloc (size_t );void free (void *); -void udelay (unsigned long ); +void __udelay (unsigned long );unsigned long get_timer (unsigned long );void vprintf (const char *,va_list );void do_reset (void );
lib_generic/Makefile +1 -0
@@ -44,6 +44,7 @@ COBJS-y += sha1.o COBJS-$(CONFIG_SHA256) += sha256.o COBJS-y += string.o COBJS-y += strmhz.o +COBJS-y += time.o COBJS-y += vsprintf.o COBJS-y += zlib.o COBJS-$(CONFIG_RBTREE) += rbtree.o
lib_generic/time.c new file +43 -0
43 lines not on this page · raw message
lib_i386/pcat_timer.c +1 -1
@@ -71,7 +71,7 @@ static u16 read_pit(void) }/* this is not very exact */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int counter;int wraps;
lib_m68k/time.c +2 -2
@@ -47,7 +47,7 @@ static volatile ulong timestamp = 0;#endif extern void dtimer_intr_setup (void ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {volatile dtmr_t *timerp = (dtmr_t *) (CONFIG_SYS_UDELAY_BASE );uint start, now, tmp;
@@ -139,7 +139,7 @@ void set_timer(ulong t)static unsigned short lastinc; -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_UDELAY_BASE );uint tmp;
lib_microblaze/time.c +2 -2
@@ -27,14 +27,14 @@#include <common.h> #ifdef CONFIG_SYS_TIMER_0 -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {int i; i =get_timer (0 );while ((get_timer (0 ) - i) < (usec /1000 )) ; }#else -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned int i;for (i =0 ; i < (usec *CONFIG_XILINX_CLOCK_FREQ /10000000 ); i++);
lib_mips/time.c +1 -1
@@ -70,7 +70,7 @@ void set_timer(ulong t)write_c0_compare (read_c0_count () +CYCLES_PER_JIFFY ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned int tmo;
lib_nios/time.c +1 -2
@@ -27,13 +27,12 @@extern void dly_clks (unsigned long ticks ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {/* The Nios core doesn't have a timebase, so we do our * best for now and call a low-level loop that counts * cpu clocks. */ unsigned long cnt = (CONFIG_SYS_CLK_FREQ /1000000 ) * usec; -WATCHDOG_RESET ();/* trigger watchdog if needed */ dly_clks (cnt); }
lib_nios2/time.c +1 -2
@@ -27,13 +27,12 @@extern void dly_clks (unsigned long ticks ); -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {/* The Nios core doesn't have a timebase, so we do our * best for now and call a low-level loop that counts * cpu clocks. */ unsigned long cnt = (CONFIG_SYS_CLK_FREQ /1000000 ) * usec; -WATCHDOG_RESET ();/* trigger watchdog if needed */ dly_clks (cnt); }
lib_ppc/time.c +3 -13
@@ -23,10 +23,6 @@#include <common.h> -#ifndef CONFIG_WD_PERIOD -# define CONFIG_WD_PERIOD (10 * 1000 * 1000)/* 10 seconds default*/ -#endif -/* ------------------------------------------------------------------------- */ /*
@@ -54,16 +50,10 @@ unsigned long usec2ticks(unsigned long usec)* microseconds to wait) into a number of time base ticks; then we * watch the time base until it has incremented by that amount. */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) { -ulong ticks, kv; - -do { - kv = usec >CONFIG_WD_PERIOD ?CONFIG_WD_PERIOD : usec; - ticks =usec2ticks (kv); -wait_ticks (ticks); - usec -= kv; - }while (usec); +ulong ticks =usec2ticks (usec); +wait_ticks (ticks); }/* ------------------------------------------------------------------------- */
lib_sh/time.c +1 -1
@@ -105,7 +105,7 @@ unsigned long long get_ticks (void)return 0 -readl (TCNT0 ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long long tmp;ulong tmo;
lib_sh/time_sh2.c +1 -1
@@ -103,7 +103,7 @@ void reset_timer(void)cmt_timer_start (0 ); } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {unsigned long end =get_usec () + usec;
lib_sparc/time.c +1 -1
@@ -53,7 +53,7 @@ unsigned long usec2ticks(unsigned long usec)* microseconds to wait) into a number of time base ticks; then we * watch the time base until it has incremented by that amount. */ -void udelay (unsigned long usec) +void __udelay (unsigned long usec) {ulong ticks =usec2ticks (usec);
Signature · 1 line
1.6.2.5
Wolfgang Denk
AppliedPATCH 1/1 Generic udelay() with watchdog support
Dear Ingo van Lil,
Quoted 52 lines · In message <[email protected]> you wrote:
According to the PPC reference implementation the
udelay()function is responsible for resetting the watchdog timer as frequently as needed. Most other architectures do not meet that requirement, so long-running operations might result in a watchdog reset.This patch adds a generic
udelay()function which takes care of resetting the watchdog before calling an architecture-specific__udelay().Signed-off-by Ingo van Lil <[email protected]>--- board/armltd/integrator/timer.c | 2 +- board/freescale/mpc8313erdb/sdram.c | 2 +- cpu/arm1136/mx31/timer.c | 2 +- cpu/arm1136/omap24xx/timer.c | 2 +- cpu/arm1176/s3c64xx/timer.c | 2 +- cpu/arm720t/interrupts.c | 4 +- cpu/arm920t/at91rm9200/timer.c | 2 +- cpu/arm920t/imx/timer.c | 2 +- cpu/arm920t/ks8695/timer.c | 2 +- cpu/arm920t/s3c24x0/timer.c | 2 +- cpu/arm925t/timer.c | 2 +- cpu/arm926ejs/at91/timer.c | 2 +- cpu/arm926ejs/davinci/timer.c | 2 +- cpu/arm926ejs/kirkwood/timer.c | 2 +- cpu/arm926ejs/mx27/timer.c | 2 +- cpu/arm926ejs/nomadik/timer.c | 2 +- cpu/arm926ejs/omap/timer.c | 2 +- cpu/arm926ejs/versatile/timer.c | 2 +- cpu/arm_cortexa8/omap3/timer.c | 2 +- cpu/arm_cortexa8/s5pc1xx/timer.c | 2 +- cpu/at32ap/interrupts.c | 2 +- cpu/blackfin/interrupts.c | 2 +- cpu/i386/sc520/sc520_timer.c | 2 +- cpu/ixp/start.S | 4 +- cpu/ixp/timer.c | 2 +- cpu/lh7a40x/timer.c | 2 +- cpu/mcf547x_8x/slicetimer.c | 2 +- cpu/pxa/timer.c | 2 +- cpu/s3c44b0/timer.c | 2 +- cpu/sa1100/timer.c | 2 +- examples/api/Makefile | 1 + examples/api/libgenwrap.c | 2 +- include/asm-blackfin/delay.h | 2 +- include/common.h | 5 +++- include/exports.h | 2 +- lib_generic/Makefile | 1 + lib_generic/time.c | 43 +++++++++++++++++++++++++++++++++++ lib_i386/pcat_timer.c | 2 +- lib_m68k/time.c | 4 +- lib_microblaze/time.c | 4 +- lib_mips/time.c | 2 +-
Quoted 8 lines
lib_nios/time.c | 3 +- lib_nios2/time.c | 3 +- lib_ppc/time.c | 16 ++---------- lib_sh/time.c | 2 +- lib_sh/time_sh2.c | 2 +- lib_sparc/time.c | 2 +- 47 files changed, 98 insertions(+), 62 deletions(-) create mode 100644 lib_generic/time.c
Applied to "next", thanks.
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
You get a wonderful view from the point of no return.
- Terry Pratchett, _Making_Money_PATCH 1/1 Generic udelay() with watchdog support
In reply to Wolfgang DenkQuoted 1 line · Wolfgang Denk
Could you please rebase it against the "next" branch and resubmit it?
There you are. This time I compile-tested it (MAKEALL) for ppc and arm. Some boards did not build (several PPC builds died with "Error:
Unrecognized opcode: `mullhw'", several ARM builds missed CONFIG_ENV_ADDR_FLEX, but all that doesn't seem to be my fault.
The only point I'm uncertain about is the nand_spl image for "MPC8313ERDB_NAND_66": The board/freescale/mpc8313erdb/sdram.c called udelay, but u-boot-spl doesn't link lib_generic. I decided to call __udelay() instead, but another solution might be to include lib_generic/time.c in the nand_spl build (like in examples/api/Makefile).
Regards,
Ingo
PATCH 1/1 Generic udelay() with watchdog support
Dear Kim,
Quoted 9 lines · In message <[email protected]> Ingo van Lil wrote:
Quoted 1 line · Wolfgang Denk
Could you please rebase it against the "next" branch and resubmit it?
There you are. This time I compile-tested it (MAKEALL) for ppc and arm. Some boards did not build (several PPC builds died with "Error:
Unrecognized opcode: `mullhw'", several ARM builds missedCONFIG_ENV_ADDR_FLEX, but all that doesn't seem to be my fault.
Quoted 5 lines
The only point I'm uncertain about is the
nand_splimage for "MPC8313ERDB_NAND_66": Theboard/freescale/mpc8313erdb/sdram.ccalled udelay, but u-boot-spl doesn't linklib_generic. I decided to call__udelay()instead, but another solution might be to includelib_generic/time.cin thenand_splbuild (like in examples/api/Makefile).
Could you please comment if using __udelay() here is OK with you?
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de We're all sorry for the other guy when he loses his job to a machine. But when it comes to your job -- that's different. And it always will be different. -- McCoy, "The Ultimate Computer", stardate 4729.4