]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/mips/tx4938/toshiba_rbtx4938/setup.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[linux-2.6-omap-h63xx.git] / arch / mips / tx4938 / toshiba_rbtx4938 / setup.c
index 6ed39a5aea7262b0e9941818234e0b7cfc712771..632e5d201353ca9bf92613487f2545e75c3cf34f 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/reboot.h>
 #include <asm/irq.h>
 #include <asm/time.h>
+#include <asm/txx9tmr.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/bootinfo.h>
@@ -39,7 +40,6 @@
 #include <asm/tx4938/spi.h>
 #include <asm/gpio.h>
 
-extern void rbtx4938_time_init(void) __init;
 extern char * __init prom_getcmdline(void);
 static inline void tx4938_report_pcic_status1(struct tx4938_pcic_reg *pcicptr);
 
@@ -458,9 +458,9 @@ extern struct pci_controller tx4938_pci_controller[];
 static int __init tx4938_pcibios_init(void)
 {
        unsigned long mem_base[2];
-       unsigned long mem_size[2] = {TX4938_PCIMEM_SIZE_0,TX4938_PCIMEM_SIZE_1}; /* MAX 128M,64K */
+       unsigned long mem_size[2] = {TX4938_PCIMEM_SIZE_0, TX4938_PCIMEM_SIZE_1}; /* MAX 128M,64K */
        unsigned long io_base[2];
-       unsigned long io_size[2] = {TX4938_PCIIO_SIZE_0,TX4938_PCIIO_SIZE_1}; /* MAX 16M,64K */
+       unsigned long io_size[2] = {TX4938_PCIIO_SIZE_0, TX4938_PCIIO_SIZE_1}; /* MAX 16M,64K */
        /* TX4938 PCIC1: 64K MEM/IO is enough for ETH0,ETH1 */
        int extarb = !(tx4938_ccfgptr->ccfg & TX4938_CCFG_PCIXARB);
 
@@ -598,8 +598,8 @@ static int __init rbtx4938_ethaddr_init(void)
                        printk(KERN_WARNING "seeprom: bad checksum.\n");
        }
        for (i = 0; i < 2; i++) {
-               unsigned int slot = TX4938_PCIC_IDSEL_AD_TO_SLOT(31 - i);
-               unsigned int id = (1 << 8) | PCI_DEVFN(slot, 0); /* bus 1 */
+               unsigned int id =
+                       TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
                struct platform_device *pdev;
                if (!(tx4938_ccfgptr->pcfg &
                      (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
@@ -657,7 +657,7 @@ void __init tx4938_board_setup(void)
 
        /* clocks */
        if (txx9_master_clock) {
-               /* calculate gbus_clock and cpu_clock from master_clock */
+               /* calculate gbus_clock and cpu_clock_freq from master_clock */
                divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK;
                switch (divmode) {
                case TX4938_CCFG_DIVMODE_8:
@@ -691,7 +691,7 @@ void __init tx4938_board_setup(void)
                if (txx9_cpu_clock == 0) {
                        txx9_cpu_clock = 300000000;     /* 300MHz */
                }
-               /* calculate gbus_clock and master_clock from cpu_clock */
+               /* calculate gbus_clock and master_clock from cpu_clock_freq */
                cpuclk = txx9_cpu_clock;
                divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK;
                switch (divmode) {
@@ -773,20 +773,9 @@ void __init tx4938_board_setup(void)
                 txboard_add_phys_region(base, size);
        }
 
-       /* IRC */
-       /* disable interrupt control */
-       tx4938_ircptr->cer = 0;
-
        /* TMR */
-       /* disable all timers */
-       for (i = 0; i < TX4938_NR_TMR; i++) {
-               tx4938_tmrptr(i)->tcr  = 0x00000020;
-               tx4938_tmrptr(i)->tisr = 0;
-               tx4938_tmrptr(i)->cpra = 0xffffffff;
-               tx4938_tmrptr(i)->itmr = 0;
-               tx4938_tmrptr(i)->ccdr = 0;
-               tx4938_tmrptr(i)->pgmr = 0;
-       }
+       for (i = 0; i < TX4938_NR_TMR; i++)
+               txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL);
 
        /* enable DMA */
        TX4938_WR64(0xff1fb150, TX4938_DMA_MCR_MSTEN);
@@ -857,12 +846,13 @@ void tx4938_report_pcic_status(void)
 
 #endif /* CONFIG_PCI */
 
-/* We use onchip r4k counter or TMR timer as our system wide timer
- * interrupt running at 100HZ. */
-
-void __init rbtx4938_time_init(void)
+void __init plat_time_init(void)
 {
        mips_hpt_frequency = txx9_cpu_clock / 2;
+       if (tx4938_ccfgptr->ccfg & TX4938_CCFG_TINTDIS)
+               txx9_clockevent_init(TX4938_TMR_REG(0) & 0xfffffffffULL,
+                                    TXX9_IRQ_BASE + TX4938_IR_TMR(0),
+                                    txx9_gbus_clock / 2);
 }
 
 void __init toshiba_rbtx4938_setup(void)
@@ -875,9 +865,6 @@ void __init toshiba_rbtx4938_setup(void)
        if (txx9_master_clock == 0)
                txx9_master_clock = 25000000; /* 25MHz */
        tx4938_board_setup();
-       /* setup irq stuff */
-       TX4938_WR(TX4938_MKA(TX4938_IRC_IRDM0), 0x00000000);    /* irq trigger */
-       TX4938_WR(TX4938_MKA(TX4938_IRC_IRDM1), 0x00000000);    /* irq trigger */
        /* setup serial stuff */
        TX4938_WR(0xff1ff314, 0x00000000);      /* h/w flow control off */
        TX4938_WR(0xff1ff414, 0x00000000);      /* h/w flow control off */
@@ -897,7 +884,7 @@ void __init toshiba_rbtx4938_setup(void)
                        req.iotype = UPIO_MEM;
                        req.membase = (char *)(0xff1ff300 + i * 0x100);
                        req.mapbase = 0xff1ff300 + i * 0x100;
-                       req.irq = 32 + i;
+                       req.irq = RBTX4938_IRQ_IRC_SIO(i);
                        req.flags |= UPF_BUGGY_UART /*HAVE_CTS_LINE*/;
                        req.uartclk = 50000000;
                        early_serial_txx9_setup(&req);
@@ -1115,14 +1102,14 @@ static void __init txx9_spi_init(unsigned long base, int irq)
                        .flags  = IORESOURCE_IRQ,
                },
        };
-       platform_device_register_simple("txx9spi", 0,
+       platform_device_register_simple("spi_txx9", 0,
                                        res, ARRAY_SIZE(res));
 }
 
 static int __init rbtx4938_spi_init(void)
 {
        struct spi_board_info srtc_info = {
-               .modalias = "rs5c348",
+               .modalias = "rtc-rs5c348",
                .max_speed_hz = 1000000, /* 1.0Mbps @ Vdd 2.0V */
                .bus_num = 0,
                .chip_select = 16 + SRTC_CS,