1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include <linux/export.h>
- #include <linux/param.h>
- #include <linux/smp.h>
- #include <linux/stringify.h>
- #include <asm/asm.h>
- #include <asm/compiler.h>
- #include <asm/war.h>
- #ifndef CONFIG_CPU_DADDI_WORKAROUNDS
- #define GCC_DADDI_IMM_ASM() "I"
- #else
- #define GCC_DADDI_IMM_ASM() "r"
- #endif
- void __delay(unsigned long loops)
- {
- __asm__ __volatile__ (
- " .set noreorder \n"
- " .align 3 \n"
- "1: bnez %0, 1b \n"
- " " __stringify(LONG_SUBU) " %0, %1 \n"
- " .set reorder \n"
- : "=r" (loops)
- : GCC_DADDI_IMM_ASM() (1), "0" (loops));
- }
- EXPORT_SYMBOL(__delay);
- void __udelay(unsigned long us)
- {
- unsigned int lpj = raw_current_cpu_data.udelay_val;
- __delay((us * 0x000010c7ull * HZ * lpj) >> 32);
- }
- EXPORT_SYMBOL(__udelay);
- void __ndelay(unsigned long ns)
- {
- unsigned int lpj = raw_current_cpu_data.udelay_val;
- __delay((ns * 0x00000005ull * HZ * lpj) >> 32);
- }
- EXPORT_SYMBOL(__ndelay);
|