Disable the USB clock for now, will be used later for the AR7-HCD driver, which is...
[openwrt-10.03/.git] / target / linux / ar7-2.6 / files / arch / mips / ar7 / clock.c
index f51c641a3da1aaa75d87b70653f7b3134a4ef0ad..9bdc8f4076c0aaac338162ad5a9f83c178eab6a6 100644 (file)
@@ -99,16 +99,20 @@ EXPORT_SYMBOL(ar7_bus_clock);
 int ar7_dsp_clock = 0;
 EXPORT_SYMBOL(ar7_dsp_clock);
 
-static int gcd(int x, int y)
+static int gcd(int a, int b)
 {
-       if (x > y)
-               return (x % y) ? gcd(y, x % y) : y;
-       return (y % x) ? gcd(x, y % x) : x;
-}
+       int c;
 
-static inline int ABS(int x)
-{
-       return (x >= 0) ? x : -x;
+       if (a < b) {
+               c = a;
+               a = b;
+               b = c;
+       }
+       while ((c = (a % b))) {
+               a = b;
+               b = c;
+       }
+       return b;
 }
 
 static void approximate(int base, int target, int *prediv,
@@ -118,7 +122,7 @@ static void approximate(int base, int target, int *prediv,
        for (i = 1; i <= 16; i++) {
                for (j = 1; j <= 32; j++) {
                        for (k = 1; k <= 32; k++) {
-                               freq = ABS(base / j * i / k - target);
+                               freq = abs(base / j * i / k - target);
                                if (freq < res) {
                                        res = freq;
                                        *mul = i;
@@ -268,10 +272,10 @@ static void __init tnetd7300_init_clocks(void)
        } else {
                ar7_cpu_clock = ar7_bus_clock;
        }
-
+#if 0
        tnetd7300_set_clock(USB_PLL_SOURCE_SHIFT, &clocks->usb,
                bootcr, 48000000);
-
+#endif
        if (ar7_dsp_clock == 250000000)
                tnetd7300_set_clock(DSP_PLL_SOURCE_SHIFT, &clocks->dsp,
                        bootcr, ar7_dsp_clock);