]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/mips/txx9/rbtx4927/setup.c
[MIPS] TXx9: cleanup and fix some sparse warnings
[linux-2.6-omap-h63xx.git] / arch / mips / txx9 / rbtx4927 / setup.c
index c3566c39c26cfa1845a32d4d13abe04e80ebc0f4..1657fd935da80bb99f58dc8d25d2ae39f21eaf7d 100644 (file)
@@ -50,8 +50,6 @@
 #include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/delay.h>
-
-#include <asm/bootinfo.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/reboot.h>
 #include <linux/serial_core.h>
 #endif
 
-/* These functions are used for rebooting or halting the machine*/
-extern void toshiba_rbtx4927_restart(char *command);
-extern void toshiba_rbtx4927_halt(void);
-extern void toshiba_rbtx4927_power_off(void);
-extern void toshiba_rbtx4927_irq_setup(void);
-
-char *prom_getcmdline(void);
-
 static int tx4927_ccfg_toeon = 1;
 
 #ifdef CONFIG_PCI
@@ -170,13 +160,16 @@ static void __init tx4937_pci_setup(void)
 
 static void __init rbtx4927_arch_init(void)
 {
-       if (mips_machtype == MACH_TOSHIBA_RBTX4937)
-               tx4937_pci_setup();
-       else
-               tx4927_pci_setup();
+       tx4927_pci_setup();
+}
+
+static void __init rbtx4937_arch_init(void)
+{
+       tx4937_pci_setup();
 }
 #else
 #define rbtx4927_arch_init NULL
+#define rbtx4937_arch_init NULL
 #endif /* CONFIG_PCI */
 
 static void __noreturn wait_forever(void)
@@ -186,7 +179,7 @@ static void __noreturn wait_forever(void)
                        (*cpu_wait)();
 }
 
-void toshiba_rbtx4927_restart(char *command)
+static void toshiba_rbtx4927_restart(char *command)
 {
        printk(KERN_NOTICE "System Rebooting...\n");
 
@@ -206,7 +199,7 @@ void toshiba_rbtx4927_restart(char *command)
        /* no return */
 }
 
-void toshiba_rbtx4927_halt(void)
+static void toshiba_rbtx4927_halt(void)
 {
        printk(KERN_NOTICE "System Halted\n");
        local_irq_disable();
@@ -214,7 +207,7 @@ void toshiba_rbtx4927_halt(void)
        /* no return */
 }
 
-void toshiba_rbtx4927_power_off(void)
+static void toshiba_rbtx4927_power_off(void)
 {
        toshiba_rbtx4927_halt();
        /* no return */
@@ -252,55 +245,6 @@ static void __init rbtx4927_mem_setup(void)
        set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
 #endif
 
-       /*
-          * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
-          *
-          * For TX4927:
-          * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1).
-          * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
-          * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
-          * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
-          * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
-          * i.e. S9[3]: ON (83MHz), OFF (100MHz)
-          *
-          * For TX4937:
-          * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1)
-          * PCIDIVMODE[10] is 0.
-          * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8)
-          * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4)
-          * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9)
-          * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5)
-          * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10)
-          * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5)
-          *
-        */
-       if (mips_machtype == MACH_TOSHIBA_RBTX4937)
-               switch ((unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg) &
-                       TX4938_CCFG_PCIDIVMODE_MASK) {
-               case TX4938_CCFG_PCIDIVMODE_8:
-               case TX4938_CCFG_PCIDIVMODE_4:
-                       txx9_cpu_clock = 266666666;     /* 266MHz */
-                       break;
-               case TX4938_CCFG_PCIDIVMODE_9:
-               case TX4938_CCFG_PCIDIVMODE_4_5:
-                       txx9_cpu_clock = 300000000;     /* 300MHz */
-                       break;
-               default:
-                       txx9_cpu_clock = 333333333;     /* 333MHz */
-               }
-       else
-               switch ((unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg) &
-                       TX4927_CCFG_PCIDIVMODE_MASK) {
-               case TX4927_CCFG_PCIDIVMODE_2_5:
-               case TX4927_CCFG_PCIDIVMODE_5:
-                       txx9_cpu_clock = 166666666;     /* 166MHz */
-                       break;
-               default:
-                       txx9_cpu_clock = 200000000;     /* 200MHz */
-               }
-       /* change default value to udelay/mdelay take reasonable time */
-       loops_per_jiffy = txx9_cpu_clock / HZ / 2;
-
        /* CCFG */
        /* do reset on watchdog */
        tx4927_ccfg_set(TX4927_CCFG_WR);
@@ -347,8 +291,11 @@ static void __init rbtx4927_mem_setup(void)
 #endif
 }
 
-static void __init rbtx4927_time_init(void)
+static void __init rbtx49x7_common_time_init(void)
 {
+       /* change default value to udelay/mdelay take reasonable time */
+       loops_per_jiffy = txx9_cpu_clock / HZ / 2;
+
        mips_hpt_frequency = txx9_cpu_clock / 2;
        if (____raw_readq(&tx4927_ccfgptr->ccfg) & TX4927_CCFG_TINTDIS)
                txx9_clockevent_init(TX4927_TMR_REG(0) & 0xfffffffffULL,
@@ -356,6 +303,64 @@ static void __init rbtx4927_time_init(void)
                                     50000000);
 }
 
+static void __init rbtx4927_time_init(void)
+{
+       /*
+        * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
+        *
+        * For TX4927:
+        * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1).
+        * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5)
+        * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3)
+        * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5)
+        * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6)
+        * i.e. S9[3]: ON (83MHz), OFF (100MHz)
+        */
+       switch ((unsigned long)__raw_readq(&tx4927_ccfgptr->ccfg) &
+               TX4927_CCFG_PCIDIVMODE_MASK) {
+       case TX4927_CCFG_PCIDIVMODE_2_5:
+       case TX4927_CCFG_PCIDIVMODE_5:
+               txx9_cpu_clock = 166666666;     /* 166MHz */
+               break;
+       default:
+               txx9_cpu_clock = 200000000;     /* 200MHz */
+       }
+
+       rbtx49x7_common_time_init();
+}
+
+static void __init rbtx4937_time_init(void)
+{
+       /*
+        * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz.
+        *
+        * For TX4937:
+        * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1)
+        * PCIDIVMODE[10] is 0.
+        * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8)
+        * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4)
+        * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9)
+        * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5)
+        * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10)
+        * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5)
+        */
+       switch ((unsigned long)__raw_readq(&tx4938_ccfgptr->ccfg) &
+               TX4938_CCFG_PCIDIVMODE_MASK) {
+       case TX4938_CCFG_PCIDIVMODE_8:
+       case TX4938_CCFG_PCIDIVMODE_4:
+               txx9_cpu_clock = 266666666;     /* 266MHz */
+               break;
+       case TX4938_CCFG_PCIDIVMODE_9:
+       case TX4938_CCFG_PCIDIVMODE_4_5:
+               txx9_cpu_clock = 300000000;     /* 300MHz */
+               break;
+       default:
+               txx9_cpu_clock = 333333333;     /* 333MHz */
+       }
+
+       rbtx49x7_common_time_init();
+}
+
 static int __init toshiba_rbtx4927_rtc_init(void)
 {
        static struct resource __initdata res = {
@@ -413,7 +418,6 @@ static void __init rbtx4927_device_init(void)
 }
 
 struct txx9_board_vec rbtx4927_vec __initdata = {
-       .type = MACH_TOSHIBA_RBTX4927,
        .system = "Toshiba RBTX4927",
        .prom_init = rbtx4927_prom_init,
        .mem_setup = rbtx4927_mem_setup,
@@ -426,14 +430,13 @@ struct txx9_board_vec rbtx4927_vec __initdata = {
 #endif
 };
 struct txx9_board_vec rbtx4937_vec __initdata = {
-       .type = MACH_TOSHIBA_RBTX4937,
        .system = "Toshiba RBTX4937",
        .prom_init = rbtx4927_prom_init,
        .mem_setup = rbtx4927_mem_setup,
        .irq_setup = rbtx4927_irq_setup,
-       .time_init = rbtx4927_time_init,
+       .time_init = rbtx4937_time_init,
        .device_init = rbtx4927_device_init,
-       .arch_init = rbtx4927_arch_init,
+       .arch_init = rbtx4937_arch_init,
 #ifdef CONFIG_PCI
        .pci_map_irq = rbtx4927_pci_map_irq,
 #endif