Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
[pandora-kernel.git] / arch / mips / txx9 / rbtx4938 / setup.c
index 6c2b99b..9ab48de 100644 (file)
@@ -13,9 +13,6 @@
 #include <linux/types.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/console.h>
-#include <linux/pm.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 
 #include <asm/txx9/spi.h>
 #include <asm/txx9pio.h>
 
-static void rbtx4938_machine_halt(void)
-{
-        printk(KERN_NOTICE "System Halted\n");
-       local_irq_disable();
-
-       while (1)
-               __asm__(".set\tmips3\n\t"
-                       "wait\n\t"
-                       ".set\tmips0");
-}
-
-static void rbtx4938_machine_power_off(void)
-{
-        rbtx4938_machine_halt();
-        /* no return */
-}
-
 static void rbtx4938_machine_restart(char *command)
 {
        local_irq_disable();
-
-       printk("Rebooting...");
        writeb(1, rbtx4938_softresetlock_addr);
        writeb(1, rbtx4938_sfvol_addr);
        writeb(1, rbtx4938_softreset_addr);
-       while(1)
-               ;
+       /* fallback */
+       (*_machine_halt)();
 }
 
 static void __init rbtx4938_pci_setup(void)
@@ -121,6 +99,7 @@ static void __init rbtx4938_pci_setup(void)
                register_pci_controller(c);
                tx4927_pcic_setup(tx4938_pcic1ptr, c, 0);
        }
+       tx4938_setup_pcierr_irq();
 #endif /* CONFIG_PCI */
 }
 
@@ -151,19 +130,7 @@ static int __init rbtx4938_ethaddr_init(void)
                if (sum)
                        printk(KERN_WARNING "seeprom: bad checksum.\n");
        }
-       for (i = 0; i < 2; i++) {
-               unsigned int id =
-                       TXX9_IRQ_BASE + (i ? TX4938_IR_ETH1 : TX4938_IR_ETH0);
-               struct platform_device *pdev;
-               if (!(__raw_readq(&tx4938_ccfgptr->pcfg) &
-                     (i ? TX4938_PCFG_ETH1_SEL : TX4938_PCFG_ETH0_SEL)))
-                       continue;
-               pdev = platform_device_alloc("tc35815-mac", id);
-               if (!pdev ||
-                   platform_device_add_data(pdev, &dat[4 + 6 * i], 6) ||
-                   platform_device_add(pdev))
-                       platform_device_put(pdev);
-       }
+       tx4938_ethaddr_init(&dat[4], &dat[4 + 6]);
 #endif /* CONFIG_PCI */
        return 0;
 }
@@ -193,51 +160,36 @@ static void __init rbtx4938_mem_setup(void)
 
 #ifdef CONFIG_PCI
        txx9_alloc_pci_controller(&txx9_primary_pcic, 0, 0, 0, 0);
+       txx9_board_pcibios_setup = tx4927_pcibios_setup;
 #else
        set_io_port_base(RBTX4938_ETHER_BASE);
 #endif
 
-       tx4938_setup_serial();
+       tx4938_sio_init(7372800, 0);
 #ifdef CONFIG_SERIAL_TXX9_CONSOLE
-        argptr = prom_getcmdline();
-        if (strstr(argptr, "console=") == NULL) {
-                strcat(argptr, " console=ttyS0,38400");
-        }
+       argptr = prom_getcmdline();
+       if (!strstr(argptr, "console="))
+               strcat(argptr, " console=ttyS0,38400");
 #endif
 
 #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_PIO58_61
-       printk("PIOSEL: disabling both ata and nand selection\n");
-       local_irq_disable();
+       printk(KERN_INFO "PIOSEL: disabling both ata and nand selection\n");
        txx9_clear64(&tx4938_ccfgptr->pcfg,
                     TX4938_PCFG_NDF_SEL | TX4938_PCFG_ATA_SEL);
 #endif
 
 #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_NAND
-       printk("PIOSEL: enabling nand selection\n");
+       printk(KERN_INFO "PIOSEL: enabling nand selection\n");
        txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
        txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
 #endif
 
 #ifdef CONFIG_TOSHIBA_RBTX4938_MPLEX_ATA
-       printk("PIOSEL: enabling ata selection\n");
+       printk(KERN_INFO "PIOSEL: enabling ata selection\n");
        txx9_set64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_ATA_SEL);
        txx9_clear64(&tx4938_ccfgptr->pcfg, TX4938_PCFG_NDF_SEL);
 #endif
 
-#ifdef CONFIG_IP_PNP
-       argptr = prom_getcmdline();
-       if (strstr(argptr, "ip=") == NULL) {
-               strcat(argptr, " ip=any");
-       }
-#endif
-
-
-#ifdef CONFIG_FB
-       {
-               conswitchp = &dummy_con;
-       }
-#endif
-
        rbtx4938_spi_setup();
        pcfg = ____raw_readq(&tx4938_ccfgptr->pcfg);    /* updated */
        /* fixup piosel */
@@ -258,11 +210,9 @@ static void __init rbtx4938_mem_setup(void)
        rbtx4938_fpga_resource.end = CPHYSADDR(RBTX4938_FPGA_REG_ADDR) + 0xffff;
        rbtx4938_fpga_resource.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
        if (request_resource(&txx9_ce_res[2], &rbtx4938_fpga_resource))
-               printk("request resource for fpga failed\n");
+               printk(KERN_ERR "request resource for fpga failed\n");
 
        _machine_restart = rbtx4938_machine_restart;
-       _machine_halt = rbtx4938_machine_halt;
-       pm_power_off = rbtx4938_machine_power_off;
 
        writeb(0xff, rbtx4938_led_addr);
        printk(KERN_INFO "RBTX4938 --- FPGA(Rev %02x) DIPSW:%02x,%02x\n",
@@ -270,7 +220,7 @@ static void __init rbtx4938_mem_setup(void)
               readb(rbtx4938_dipsw_addr), readb(rbtx4938_bdipsw_addr));
 }
 
-static int __init rbtx4938_ne_init(void)
+static void __init rbtx4938_ne_init(void)
 {
        struct resource res[] = {
                {
@@ -282,10 +232,7 @@ static int __init rbtx4938_ne_init(void)
                        .flags  = IORESOURCE_IRQ,
                }
        };
-       struct platform_device *dev =
-               platform_device_register_simple("ne", -1,
-                                               res, ARRAY_SIZE(res));
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
+       platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res));
 }
 
 static DEFINE_SPINLOCK(rbtx4938_spi_gpio_lock);
@@ -321,24 +268,6 @@ static struct gpio_chip rbtx4938_spi_gpio_chip = {
        .ngpio = 3,
 };
 
-/* SPI support */
-
-static void __init txx9_spi_init(unsigned long base, int irq)
-{
-       struct resource res[] = {
-               {
-                       .start  = base,
-                       .end    = base + 0x20 - 1,
-                       .flags  = IORESOURCE_MEM,
-               }, {
-                       .start  = irq,
-                       .flags  = IORESOURCE_IRQ,
-               },
-       };
-       platform_device_register_simple("spi_txx9", 0,
-                                       res, ARRAY_SIZE(res));
-}
-
 static int __init rbtx4938_spi_init(void)
 {
        struct spi_board_info srtc_info = {
@@ -361,7 +290,7 @@ static int __init rbtx4938_spi_init(void)
        gpio_direction_output(16 + SEEPROM2_CS, 1);
        gpio_request(16 + SEEPROM3_CS, "seeprom3");
        gpio_direction_output(16 + SEEPROM3_CS, 1);
-       txx9_spi_init(TX4938_SPI_REG & 0xfffffffffULL, RBTX4938_IRQ_IRC_SPI);
+       tx4938_spi_init(0);
        return 0;
 }
 
@@ -372,30 +301,11 @@ static void __init rbtx4938_arch_init(void)
        rbtx4938_spi_init();
 }
 
-/* Watchdog support */
-
-static int __init txx9_wdt_init(unsigned long base)
-{
-       struct resource res = {
-               .start  = base,
-               .end    = base + 0x100 - 1,
-               .flags  = IORESOURCE_MEM,
-       };
-       struct platform_device *dev =
-               platform_device_register_simple("txx9wdt", -1, &res, 1);
-       return IS_ERR(dev) ? PTR_ERR(dev) : 0;
-}
-
-static int __init rbtx4938_wdt_init(void)
-{
-       return txx9_wdt_init(TX4938_TMR_REG(2) & 0xfffffffffULL);
-}
-
 static void __init rbtx4938_device_init(void)
 {
        rbtx4938_ethaddr_init();
        rbtx4938_ne_init();
-       rbtx4938_wdt_init();
+       tx4938_wdt_init();
 }
 
 struct txx9_board_vec rbtx4938_vec __initdata = {