[U-Boot-Users] [PATCH] adds ndelay function (just like udelay)

Though most cpu's do not support delay of such resolution it is prudent to insert this delay where the hardware specs demands it.
Signed-off-by: Eran Liberty eran.liberty@gmail.com
Index: lib_ppc/time.c =================================================================== --- lib_ppc/time.c (.../tags/trunk/20070620_2_merge_to_exsw6000) (revision 69) +++ lib_ppc/time.c (.../branches/exsw6000) (revision 69) @@ -53,8 +53,17 @@ */ void udelay(unsigned long usec) { - ulong ticks = usec2ticks (usec); + ulong ticks = usec2ticks(usec);
+ wait_ticks(ticks); +} + +/* ------------------------------------------------------------------------- */ + +void ndelay (unsigned long nsec) +{ + ulong ticks = usec2ticks (1) * nsec / 1000 + 1; + wait_ticks (ticks); }
Index: include/exports.h =================================================================== --- include/exports.h (.../tags/trunk/20070620_2_merge_to_exsw6000) (revision 69) +++ include/exports.h (.../branches/exsw6000) (revision 69) @@ -17,6 +17,7 @@ void *malloc(size_t); void free(void*); void udelay(unsigned long); +void ndelay(unsigned long); unsigned long get_timer(unsigned long); void vprintf(const char *, va_list); void do_reset (void); Index: include/common.h =================================================================== --- include/common.h (.../tags/trunk/20070620_2_merge_to_exsw6000) (revision 69) +++ include/common.h (.../branches/exsw6000) (revision 69) @@ -559,6 +559,7 @@
/* lib_$(ARCH)/time.c */ void udelay (unsigned long); +void ndelay(unsigned long); ulong usec2ticks (unsigned long usec); ulong ticks2usec (unsigned long ticks); int init_timebase (void);

On 7/3/07, eran.liberty@gmail.com eran.liberty@gmail.com wrote:
Though most cpu's do not support delay of such resolution it is prudent to insert this delay where the hardware specs demands it.
Signed-off-by: Eran Liberty eran.liberty@gmail.com
Yeah, okay. Looks pretty benign, but could cause confusion when high resolution delays are not available.
Acked-by: Grant Likely grant.likely@secretlab.ca
Cheers, g.
participants (2)
-
eran.liberty@gmail.com
-
Grant Likely