/*1* arch/sh/lib64/udelay.c2*3* Delay routines, using a pre-computed "loops_per_jiffy" value.4*5* Copyright (C) 2000, 2001 Paolo Alberelli6* Copyright (C) 2003, 2004 Paul Mundt7*8* This file is subject to the terms and conditions of the GNU General Public9* License. See the file "COPYING" in the main directory of this archive10* for more details.11*/12#include <linux/sched.h>13#include <asm/param.h>1415/*16* Use only for very small delays (< 1 msec).17*18* The active part of our cycle counter is only 32-bits wide, and19* we're treating the difference between two marks as signed. On20* a 1GHz box, that's about 2 seconds.21*/2223void __delay(unsigned long loops)24{25long long dummy;26__asm__ __volatile__("gettr tr0, %1\n\t"27"pta $+4, tr0\n\t"28"addi %0, -1, %0\n\t"29"bne %0, r63, tr0\n\t"30"ptabs %1, tr0\n\t":"=r"(loops),31"=r"(dummy)32:"0"(loops));33}3435void __const_udelay(unsigned long xloops)36{37__delay(xloops * (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy));38}3940void __udelay(unsigned long usecs)41{42__const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */43}4445void __ndelay(unsigned long nsecs)46{47__const_udelay(nsecs * 0x00000005);48}495051