/* delay.h: FRV delay code1*2* Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#ifndef _ASM_DELAY_H12#define _ASM_DELAY_H1314#include <asm/param.h>15#include <asm/timer-regs.h>1617/*18* delay loop - runs at __core_clock_speed_HZ / 2 [there are 2 insns in the loop]19*/20extern unsigned long __delay_loops_MHz;2122static inline void __delay(unsigned long loops)23{24asm volatile("1: subicc %0,#1,%0,icc0 \n"25" bnc icc0,#2,1b \n"26: "=r" (loops)27: "0" (loops)28: "icc0"29);30}3132/*33* Use only for very small delays ( < 1 msec). Should probably use a34* lookup table, really, as the multiplications take much too long with35* short delays. This is a "reasonable" implementation, though (and the36* first constant multiplications gets optimized away if the delay is37* a constant)38*/3940extern unsigned long loops_per_jiffy;4142static inline void udelay(unsigned long usecs)43{44__delay(usecs * __delay_loops_MHz);45}4647#define ndelay(n) udelay((n) * 5)4849#endif /* _ASM_DELAY_H */505152