2 * arch/ubicom32/include/asm/delay.h
3 * Definition of delay routines for Ubicom32 architecture.
5 * (C) Copyright 2009, Ubicom, Inc.
7 * This file is part of the Ubicom32 Linux Kernel Port.
9 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
14 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port. If not,
21 * see <http://www.gnu.org/licenses/>.
23 * Ubicom32 implementation derived from (with many thanks):
28 #ifndef _ASM_UBICOM32_DELAY_H
29 #define _ASM_UBICOM32_DELAY_H
31 #include <asm/param.h>
32 #include <asm/ip5000.h>
34 static inline void __delay(unsigned long loops
)
41 "1: add.4 %0, #-1, %0 \n\t"
48 * Ubicom32 processor uses fixed 12MHz external OSC.
49 * So we use that as reference to count 12 cycles/us
52 extern unsigned long loops_per_jiffy
;
54 static inline void _udelay(unsigned long usecs
)
56 #if defined(CONFIG_UBICOM32_V4) || defined(CONFIG_UBICOM32_V3)
58 " add.4 d15, 0(%0), %1 \n\t"
59 " sub.4 #0, 0(%0), d15 \n\t"
62 : "a"(TIMER_BASE
+ TIMER_MPTVAL
), "d"(usecs
* (12000000/1000000))
71 * Moved the udelay() function into library code, no longer inlined.
73 extern void udelay(unsigned long usecs
);
75 #endif /* _ASM_UBICOM32_DELAY_H */