[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[microblaze-uclinux] [PATCH] Xilinx Microblaze: Implement udelay



udelay() wasn't implemented.  Now it is.  The implementation is quite
naive.  Someone with a bit more style should figure out how to write
it using the MULHU assembly instruction, which implicitly does the
right shift.

This is necessary to get the ll_temac driver to work.  I doubt this
will apply cleanly in the Petalinux tree, but it should be easy to
apply by hand.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xxxxxxxxxx>

---
 include/asm-microblaze/delay.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/include/asm-microblaze/delay.h b/include/asm-microblaze/delay.h
index fa2c980..c0e2107 100644
--- a/include/asm-microblaze/delay.h
+++ b/include/asm-microblaze/delay.h
@@ -11,7 +11,9 @@
 #ifndef _ASM_DELAY_H
 #define _ASM_DELAY_H
 
-extern inline void __delay(unsigned long loops)
+#include <asm/param.h>
+
+static inline void __delay(unsigned long loops)
 {
 	asm volatile ("# __delay		\n\t"		\
 		      "1: addi	%0, %0, -1	\t\n"		\
@@ -23,6 +25,9 @@ extern inline void __delay(unsigned long loops)
 
 static inline void udelay(unsigned long usec)
 {
+	unsigned long long tmp = usec;
+	unsigned long loops = (tmp * 4295 * HZ * loops_per_jiffy) >> 32;
+	__delay(loops);
 }
 
 #endif /* _ASM_DELAY_H */
-- 
1.5.3.4-dirty



___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/