Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
Paul Mundt 2008-03-06 17:23:15 +09:00
Родитель e7d7deca60
Коммит 7b9726a7a0
2 изменённых файлов: 7 добавлений и 19 удалений

Просмотреть файл

@ -21,7 +21,7 @@
* a 1GHz box, that's about 2 seconds. * a 1GHz box, that's about 2 seconds.
*/ */
void __delay(int loops) void __delay(unsigned long loops)
{ {
long long dummy; long long dummy;
__asm__ __volatile__("gettr tr0, %1\n\t" __asm__ __volatile__("gettr tr0, %1\n\t"
@ -33,24 +33,17 @@ void __delay(int loops)
:"0"(loops)); :"0"(loops));
} }
void __udelay(unsigned long long usecs, unsigned long lpj) inline void __const_udelay(unsigned long xloops)
{ {
usecs *= (((unsigned long long) HZ << 32) / 1000000) * lpj; __delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy));
__delay((long long) usecs >> 32);
} }
void __ndelay(unsigned long long nsecs, unsigned long lpj) void __udelay(unsigned long usecs)
{ {
nsecs *= (((unsigned long long) HZ << 32) / 1000000000) * lpj; __const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */
__delay((long long) nsecs >> 32);
} }
void udelay(unsigned long usecs) void __ndelay(unsigned long nsecs)
{ {
__udelay(usecs, cpu_data[raw_smp_processor_id()].loops_per_jiffy); __const_udelay(nsecs * 0x00000005);
}
void ndelay(unsigned long nsecs)
{
__ndelay(nsecs, cpu_data[raw_smp_processor_id()].loops_per_jiffy);
} }

Просмотреть файл

@ -15,7 +15,6 @@ extern void __ndelay(unsigned long nsecs);
extern void __const_udelay(unsigned long xloops); extern void __const_udelay(unsigned long xloops);
extern void __delay(unsigned long loops); extern void __delay(unsigned long loops);
#ifdef CONFIG_SUPERH32
#define udelay(n) (__builtin_constant_p(n) ? \ #define udelay(n) (__builtin_constant_p(n) ? \
((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
__udelay(n)) __udelay(n))
@ -23,9 +22,5 @@ extern void __delay(unsigned long loops);
#define ndelay(n) (__builtin_constant_p(n) ? \ #define ndelay(n) (__builtin_constant_p(n) ? \
((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
__ndelay(n)) __ndelay(n))
#else
extern void udelay(unsigned long usecs);
extern void ndelay(unsigned long nsecs);
#endif
#endif /* __ASM_SH_DELAY_H */ #endif /* __ASM_SH_DELAY_H */