GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / mn10300 / lib / delay.c
blobfdf6f710f94ec388f8c230afc8bff6139cc6295b
1 /* MN10300 Short delay interpolation routines
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #include <linux/module.h>
12 #include <linux/sched.h>
13 #include <linux/delay.h>
14 #include <asm/div64.h>
17 * basic delay loop
19 void __delay(unsigned long loops)
21 int d0;
23 asm volatile(
24 " bra 1f \n"
25 " .align 4 \n"
26 "1: bra 2f \n"
27 " .align 4 \n"
28 "2: add -1,%0 \n"
29 " bne 2b \n"
30 : "=&d" (d0)
31 : "0" (loops)
32 : "cc");
34 EXPORT_SYMBOL(__delay);
37 * handle a delay specified in terms of microseconds
39 void __udelay(unsigned long usecs)
41 signed long ioclk, stop;
43 /* usecs * CLK / 1E6 */
44 stop = __muldiv64u(usecs, MN10300_TSCCLK, 1000000);
45 stop = TMTSCBC - stop;
47 do {
48 ioclk = TMTSCBC;
49 } while (stop < ioclk);
51 EXPORT_SYMBOL(__udelay);