From 47e801bec360e69e4b087a141d015b318e1b0212 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 4 Nov 2009 16:07:59 +0900 Subject: s3c64xx: move s3c64xx header files to asm-arm/arch-s3c64xx This patch moves the s3c64xx header files from include/ to include/asm-arm/arch-s3c64xx Signed-off-by: Minkyu Kang --- cpu/arm1176/cpu.c | 2 +- cpu/arm1176/s3c64xx/cpu_init.S | 2 +- cpu/arm1176/s3c64xx/reset.S | 2 +- cpu/arm1176/s3c64xx/speed.c | 2 +- cpu/arm1176/s3c64xx/timer.c | 2 +- cpu/arm1176/start.S | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'cpu/arm1176') diff --git a/cpu/arm1176/cpu.c b/cpu/arm1176/cpu.c index d1a332748..2c0014f2b 100644 --- a/cpu/arm1176/cpu.c +++ b/cpu/arm1176/cpu.c @@ -33,7 +33,7 @@ #include #include -#include +#include #include static void cache_flush (void); diff --git a/cpu/arm1176/s3c64xx/cpu_init.S b/cpu/arm1176/s3c64xx/cpu_init.S index 32bb467f2..df88cba34 100644 --- a/cpu/arm1176/s3c64xx/cpu_init.S +++ b/cpu/arm1176/s3c64xx/cpu_init.S @@ -24,7 +24,7 @@ */ #include -#include +#include .globl mem_ctrl_asm_init mem_ctrl_asm_init: diff --git a/cpu/arm1176/s3c64xx/reset.S b/cpu/arm1176/s3c64xx/reset.S index 315b13f8d..eae572e4f 100644 --- a/cpu/arm1176/s3c64xx/reset.S +++ b/cpu/arm1176/s3c64xx/reset.S @@ -21,7 +21,7 @@ * MA 02111-1307 USA */ -#include +#include .globl reset_cpu reset_cpu: diff --git a/cpu/arm1176/s3c64xx/speed.c b/cpu/arm1176/s3c64xx/speed.c index 5c335a55a..11962acad 100644 --- a/cpu/arm1176/s3c64xx/speed.c +++ b/cpu/arm1176/s3c64xx/speed.c @@ -31,7 +31,7 @@ */ #include -#include +#include #define APLL 0 #define MPLL 1 diff --git a/cpu/arm1176/s3c64xx/timer.c b/cpu/arm1176/s3c64xx/timer.c index 22a5b7770..85ce9cd99 100644 --- a/cpu/arm1176/s3c64xx/timer.c +++ b/cpu/arm1176/s3c64xx/timer.c @@ -40,7 +40,7 @@ #include #include -#include +#include #include static ulong timer_load_val; diff --git a/cpu/arm1176/start.S b/cpu/arm1176/start.S index cb891df17..2bb9bf208 100644 --- a/cpu/arm1176/start.S +++ b/cpu/arm1176/start.S @@ -35,7 +35,7 @@ #ifdef CONFIG_ENABLE_MMU #include #endif -#include +#include #if !defined(CONFIG_ENABLE_MMU) && !defined(CONFIG_SYS_PHY_UBOOT_BASE) #define CONFIG_SYS_PHY_UBOOT_BASE CONFIG_SYS_UBOOT_BASE -- cgit v1.2.3 From a59a23d68ae4f4a1c07d105520c93e6e289d186f Mon Sep 17 00:00:00 2001 From: Seunghyeon Rhee Date: Fri, 13 Nov 2009 16:49:41 +0900 Subject: S3C6400/SMDK6400: fix stack_setup in start.S Fix stack_setup to place the stack on the correct address in DRAM accroding to U-Boot standard and remove conditional compilation by CONFIG_MEMORY_UPPER_CODE macro that is not necessry. This macro was introduced and used only by this board for some unclear reason. The definition of this macro is also removed because it's not referenced elsewhere. Signed-off-by: Seunghyeon Rhee Tested-by: Minkyu Kang --- cpu/arm1176/start.S | 7 +------ include/configs/smdk6400.h | 2 -- 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'cpu/arm1176') diff --git a/cpu/arm1176/start.S b/cpu/arm1176/start.S index 2bb9bf208..68a356d13 100644 --- a/cpu/arm1176/start.S +++ b/cpu/arm1176/start.S @@ -241,16 +241,11 @@ mmu_enable: skip_hw_init: /* Set up the stack */ stack_setup: -#ifdef CONFIG_MEMORY_UPPER_CODE - ldr sp, =(CONFIG_SYS_UBOOT_BASE + CONFIG_SYS_UBOOT_SIZE - 0xc) -#else - ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ + ldr r0, =CONFIG_SYS_UBOOT_BASE /* base of copy in DRAM */ sub r0, r0, #CONFIG_SYS_MALLOC_LEN /* malloc area */ sub r0, r0, #CONFIG_SYS_GBL_DATA_SIZE /* bdinfo */ sub sp, r0, #12 /* leave 3 words for abort-stack */ -#endif - clear_bss: ldr r0, _bss_start /* find start of bss segment */ ldr r1, _bss_end /* stop here */ diff --git a/include/configs/smdk6400.h b/include/configs/smdk6400.h index f6e122129..f644cd2cd 100644 --- a/include/configs/smdk6400.h +++ b/include/configs/smdk6400.h @@ -49,8 +49,6 @@ #define CONFIG_ENABLE_MMU #endif -#define CONFIG_MEMORY_UPPER_CODE - #define CONFIG_SETUP_MEMORY_TAGS #define CONFIG_CMDLINE_TAG #define CONFIG_INITRD_TAG -- cgit v1.2.3 From 3eb90bad651fab39cffba750ec4421a9c01d60e7 Mon Sep 17 00:00:00 2001 From: Ingo van Lil Date: Tue, 24 Nov 2009 14:09:21 +0100 Subject: 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(). Signed-off-by: Ingo van Lil --- 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 (limited to 'cpu/arm1176') diff --git a/board/armltd/integrator/timer.c b/board/armltd/integrator/timer.c index 087cf5962..7562ffa87 100644 --- a/board/armltd/integrator/timer.c +++ b/board/armltd/integrator/timer.c @@ -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; diff --git a/board/freescale/mpc8313erdb/sdram.c b/board/freescale/mpc8313erdb/sdram.c index cb138296b..0c4fd6854 100644 --- a/board/freescale/mpc8313erdb/sdram.c +++ b/board/freescale/mpc8313erdb/sdram.c @@ -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; diff --git a/cpu/arm1136/mx31/timer.c b/cpu/arm1136/mx31/timer.c index 29b484e44..7972ba0dd 100644 --- a/cpu/arm1136/mx31/timer.c +++ b/cpu/arm1136/mx31/timer.c @@ -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; diff --git a/cpu/arm1136/omap24xx/timer.c b/cpu/arm1136/omap24xx/timer.c index 8dd8d7b00..67547490f 100644 --- a/cpu/arm1136/omap24xx/timer.c +++ b/cpu/arm1136/omap24xx/timer.c @@ -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; diff --git a/cpu/arm1176/s3c64xx/timer.c b/cpu/arm1176/s3c64xx/timer.c index 85ce9cd99..9768319ef 100644 --- a/cpu/arm1176/s3c64xx/timer.c +++ b/cpu/arm1176/s3c64xx/timer.c @@ -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; diff --git a/cpu/arm720t/interrupts.c b/cpu/arm720t/interrupts.c index 91d552cd2..eb8d42531 100644 --- a/cpu/arm720t/interrupts.c +++ b/cpu/arm720t/interrupts.c @@ -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; diff --git a/cpu/arm920t/at91rm9200/timer.c b/cpu/arm920t/at91rm9200/timer.c index 235d10738..9c54bbedb 100644 --- a/cpu/arm920t/at91rm9200/timer.c +++ b/cpu/arm920t/at91rm9200/timer.c @@ -87,7 +87,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) { udelay_masked(usec); } diff --git a/cpu/arm920t/imx/timer.c b/cpu/arm920t/imx/timer.c index 31ec588d9..b06b518f0 100644 --- a/cpu/arm920t/imx/timer.c +++ b/cpu/arm920t/imx/timer.c @@ -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); } diff --git a/cpu/arm920t/ks8695/timer.c b/cpu/arm920t/ks8695/timer.c index 22987bc48..886e37059 100644 --- a/cpu/arm920t/ks8695/timer.c +++ b/cpu/arm920t/ks8695/timer.c @@ -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; diff --git a/cpu/arm920t/s3c24x0/timer.c b/cpu/arm920t/s3c24x0/timer.c index cd06f6b58..fcc6c0cb1 100644 --- a/cpu/arm920t/s3c24x0/timer.c +++ b/cpu/arm920t/s3c24x0/timer.c @@ -99,7 +99,7 @@ void set_timer(ulong t) timestamp = t; } -void udelay(unsigned long usec) +void __udelay (unsigned long usec) { ulong tmo; ulong start = get_ticks(); diff --git a/cpu/arm925t/timer.c b/cpu/arm925t/timer.c index c16ef2577..7dfe2b564 100644 --- a/cpu/arm925t/timer.c +++ b/cpu/arm925t/timer.c @@ -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); diff --git a/cpu/arm926ejs/at91/timer.c b/cpu/arm926ejs/at91/timer.c index 811bb3c59..7352b5c33 100644 --- a/cpu/arm926ejs/at91/timer.c +++ b/cpu/arm926ejs/at91/timer.c @@ -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; diff --git a/cpu/arm926ejs/davinci/timer.c b/cpu/arm926ejs/davinci/timer.c index 7c2c20825..9da7443f3 100644 --- a/cpu/arm926ejs/davinci/timer.c +++ b/cpu/arm926ejs/davinci/timer.c @@ -112,7 +112,7 @@ void set_timer(ulong t) timestamp = t; } -void udelay(unsigned long usec) +void __udelay(unsigned long usec) { ulong tmo; ulong endtime; diff --git a/cpu/arm926ejs/kirkwood/timer.c b/cpu/arm926ejs/kirkwood/timer.c index 817ff4284..2ec6a9380 100644 --- a/cpu/arm926ejs/kirkwood/timer.c +++ b/cpu/arm926ejs/kirkwood/timer.c @@ -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; diff --git a/cpu/arm926ejs/mx27/timer.c b/cpu/arm926ejs/mx27/timer.c index 90110581e..8f1d47bba 100644 --- a/cpu/arm926ejs/mx27/timer.c +++ b/cpu/arm926ejs/mx27/timer.c @@ -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; diff --git a/cpu/arm926ejs/nomadik/timer.c b/cpu/arm926ejs/nomadik/timer.c index 16067c900..047b9e351 100644 --- a/cpu/arm926ejs/nomadik/timer.c +++ b/cpu/arm926ejs/nomadik/timer.c @@ -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; diff --git a/cpu/arm926ejs/omap/timer.c b/cpu/arm926ejs/omap/timer.c index 392b158d5..2ac38c40b 100644 --- a/cpu/arm926ejs/omap/timer.c +++ b/cpu/arm926ejs/omap/timer.c @@ -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; diff --git a/cpu/arm926ejs/versatile/timer.c b/cpu/arm926ejs/versatile/timer.c index 50c13350a..563db3654 100755 --- a/cpu/arm926ejs/versatile/timer.c +++ b/cpu/arm926ejs/versatile/timer.c @@ -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; diff --git a/cpu/arm_cortexa8/omap3/timer.c b/cpu/arm_cortexa8/omap3/timer.c index 12a16b321..401bfe6d0 100644 --- a/cpu/arm_cortexa8/omap3/timer.c +++ b/cpu/arm_cortexa8/omap3/timer.c @@ -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); diff --git a/cpu/arm_cortexa8/s5pc1xx/timer.c b/cpu/arm_cortexa8/s5pc1xx/timer.c index cdba5d934..c5df5c5ab 100644 --- a/cpu/arm_cortexa8/s5pc1xx/timer.c +++ b/cpu/arm_cortexa8/s5pc1xx/timer.c @@ -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; diff --git a/cpu/at32ap/interrupts.c b/cpu/at32ap/interrupts.c index 75cc39e94..c6d8d16e3 100644 --- a/cpu/at32ap/interrupts.c +++ b/cpu/at32ap/interrupts.c @@ -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; diff --git a/cpu/blackfin/interrupts.c b/cpu/blackfin/interrupts.c index 19456e5c1..921bfe0c0 100644 --- a/cpu/blackfin/interrupts.c +++ b/cpu/blackfin/interrupts.c @@ -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; diff --git a/cpu/i386/sc520/sc520_timer.c b/cpu/i386/sc520/sc520_timer.c index 25c9a24b7..93b5b555c 100644 --- a/cpu/i386/sc520/sc520_timer.c +++ b/cpu/i386/sc520/sc520_timer.c @@ -68,7 +68,7 @@ int timer_init(void) return 0; } -void udelay(unsigned long usec) +void __udelay(unsigned long usec) { int m = 0; long u; diff --git a/cpu/ixp/start.S b/cpu/ixp/start.S index 196ba5db2..5ebce5338 100644 --- a/cpu/ixp/start.S +++ b/cpu/ixp/start.S @@ -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 diff --git a/cpu/ixp/timer.c b/cpu/ixp/timer.c index 685614966..edf341ff9 100644 --- a/cpu/ixp/timer.c +++ b/cpu/ixp/timer.c @@ -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); } diff --git a/cpu/lh7a40x/timer.c b/cpu/lh7a40x/timer.c index f9b5be010..2691315d8 100644 --- a/cpu/lh7a40x/timer.c +++ b/cpu/lh7a40x/timer.c @@ -90,7 +90,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) { ulong tmo,tmp; diff --git a/cpu/mcf547x_8x/slicetimer.c b/cpu/mcf547x_8x/slicetimer.c index 67e81894a..8dc010a35 100644 --- a/cpu/mcf547x_8x/slicetimer.c +++ b/cpu/mcf547x_8x/slicetimer.c @@ -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; diff --git a/cpu/pxa/timer.c b/cpu/pxa/timer.c index e2df3a57f..8d0f82679 100644 --- a/cpu/pxa/timer.c +++ b/cpu/pxa/timer.c @@ -78,7 +78,7 @@ void set_timer (ulong t) /* nop */ } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) { udelay_masked (usec); } diff --git a/cpu/s3c44b0/timer.c b/cpu/s3c44b0/timer.c index 34184abb7..6f1d8f677 100644 --- a/cpu/s3c44b0/timer.c +++ b/cpu/s3c44b0/timer.c @@ -75,7 +75,7 @@ void set_timer (ulong t) timestamp = t; } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) { ulong tmo; diff --git a/cpu/sa1100/timer.c b/cpu/sa1100/timer.c index 3f77e815c..020750125 100644 --- a/cpu/sa1100/timer.c +++ b/cpu/sa1100/timer.c @@ -49,7 +49,7 @@ void set_timer (ulong t) /* nop */ } -void udelay (unsigned long usec) +void __udelay (unsigned long usec) { udelay_masked (usec); } diff --git a/examples/api/Makefile b/examples/api/Makefile index 04a270b45..d4c5ca255 100644 --- a/examples/api/Makefile +++ b/examples/api/Makefile @@ -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 diff --git a/examples/api/libgenwrap.c b/examples/api/libgenwrap.c index 2b62badfb..2b107d979 100644 --- a/examples/api/libgenwrap.c +++ b/examples/api/libgenwrap.c @@ -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); } diff --git a/include/asm-blackfin/delay.h b/include/asm-blackfin/delay.h index ea0b3664e..3af6ad3e7 100644 --- a/include/asm-blackfin/delay.h +++ b/include/asm-blackfin/delay.h @@ -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); } diff --git a/include/common.h b/include/common.h index 30a4b7aff..749d35cab 100644 --- a/include/common.h +++ b/include/common.h @@ -607,11 +607,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 diff --git a/include/exports.h b/include/exports.h index 2e8fd8b8b..c3a5d2f32 100644 --- a/include/exports.h +++ b/include/exports.h @@ -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); diff --git a/lib_generic/Makefile b/lib_generic/Makefile index 686601cc1..7291fa396 100644 --- a/lib_generic/Makefile +++ b/lib_generic/Makefile @@ -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 diff --git a/lib_generic/time.c b/lib_generic/time.c new file mode 100644 index 000000000..a309c2613 --- /dev/null +++ b/lib_generic/time.c @@ -0,0 +1,43 @@ +/* + * (C) Copyright 2000-2009 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include + +#ifndef CONFIG_WD_PERIOD +# define CONFIG_WD_PERIOD (10 * 1000 * 1000) /* 10 seconds default*/ +#endif + +/* ------------------------------------------------------------------------- */ + +void udelay(unsigned long usec) +{ + ulong kv; + + do { + WATCHDOG_RESET(); + kv = usec > CONFIG_WD_PERIOD ? CONFIG_WD_PERIOD : usec; + __udelay (kv); + usec -= kv; + } while(usec); +} diff --git a/lib_i386/pcat_timer.c b/lib_i386/pcat_timer.c index c351b23b6..1373fd125 100644 --- a/lib_i386/pcat_timer.c +++ b/lib_i386/pcat_timer.c @@ -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; diff --git a/lib_m68k/time.c b/lib_m68k/time.c index 29269f655..7eaea5e7f 100644 --- a/lib_m68k/time.c +++ b/lib_m68k/time.c @@ -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; diff --git a/lib_microblaze/time.c b/lib_microblaze/time.c index cbb43414f..da016a001 100644 --- a/lib_microblaze/time.c +++ b/lib_microblaze/time.c @@ -27,14 +27,14 @@ #include #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++); diff --git a/lib_mips/time.c b/lib_mips/time.c index 07e356d23..0e6644149 100644 --- a/lib_mips/time.c +++ b/lib_mips/time.c @@ -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; diff --git a/lib_nios/time.c b/lib_nios/time.c index 25a233ea7..d5096ee12 100644 --- a/lib_nios/time.c +++ b/lib_nios/time.c @@ -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); } diff --git a/lib_nios2/time.c b/lib_nios2/time.c index 25a233ea7..d5096ee12 100644 --- a/lib_nios2/time.c +++ b/lib_nios2/time.c @@ -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); } diff --git a/lib_ppc/time.c b/lib_ppc/time.c index 173ffab3e..29099612d 100644 --- a/lib_ppc/time.c +++ b/lib_ppc/time.c @@ -23,10 +23,6 @@ #include -#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); } /* ------------------------------------------------------------------------- */ diff --git a/lib_sh/time.c b/lib_sh/time.c index 52dbcd061..9a8f89aef 100644 --- a/lib_sh/time.c +++ b/lib_sh/time.c @@ -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; diff --git a/lib_sh/time_sh2.c b/lib_sh/time_sh2.c index 5c6c9d438..789b46f0e 100644 --- a/lib_sh/time_sh2.c +++ b/lib_sh/time_sh2.c @@ -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; diff --git a/lib_sparc/time.c b/lib_sparc/time.c index 433f3eb5a..82b2a3abc 100644 --- a/lib_sparc/time.c +++ b/lib_sparc/time.c @@ -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); -- cgit v1.2.3