Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / arch / arm / mach-kirkwood / sheevaplug-setup.c
index c7319ee..a00879d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/ata_platform.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
@@ -42,10 +43,19 @@ static struct mv643xx_eth_platform_data sheevaplug_ge00_data = {
        .phy_addr       = MV643XX_ETH_PHY_ADDR(0),
 };
 
+static struct mv_sata_platform_data sheeva_esata_sata_data = {
+       .n_ports        = 2,
+};
+
 static struct mvsdio_platform_data sheevaplug_mvsdio_data = {
        /* unfortunately the CD signal has not been connected */
 };
 
+static struct mvsdio_platform_data sheeva_esata_mvsdio_data = {
+       .gpio_write_protect = 44, /* MPP44 used as SD write protect */
+       .gpio_card_detect = 47,   /* MPP47 used as SD card detect */
+};
+
 static struct gpio_led sheevaplug_led_pins[] = {
        {
                .name                   = "plug:green:health",
@@ -74,13 +84,26 @@ static unsigned int sheevaplug_mpp_config[] __initdata = {
        0
 };
 
+static unsigned int sheeva_esata_mpp_config[] __initdata = {
+       MPP29_GPIO,     /* USB Power Enable */
+       MPP44_GPIO,     /* SD Write Protect */
+       MPP47_GPIO,     /* SD Card Detect */
+       MPP49_GPIO,     /* LED Green */
+       0
+};
+
 static void __init sheevaplug_init(void)
 {
        /*
         * Basic setup. Needs to be called early.
         */
        kirkwood_init();
-       kirkwood_mpp_conf(sheevaplug_mpp_config);
+
+       /* setup gpio pin select */
+       if (machine_is_sheeva_esata())
+               kirkwood_mpp_conf(sheeva_esata_mpp_config);
+       else
+               kirkwood_mpp_conf(sheevaplug_mpp_config);
 
        kirkwood_uart0_init();
        kirkwood_nand_init(ARRAY_AND_SIZE(sheevaplug_nand_parts), 25);
@@ -91,11 +114,21 @@ static void __init sheevaplug_init(void)
        kirkwood_ehci_init();
 
        kirkwood_ge00_init(&sheevaplug_ge00_data);
-       kirkwood_sdio_init(&sheevaplug_mvsdio_data);
+
+       /* honor lower power consumption for plugs with out eSATA */
+       if (machine_is_sheeva_esata())
+               kirkwood_sata_init(&sheeva_esata_sata_data);
+
+       /* enable sd wp and sd cd on plugs with esata */
+       if (machine_is_sheeva_esata())
+               kirkwood_sdio_init(&sheeva_esata_mvsdio_data);
+       else
+               kirkwood_sdio_init(&sheevaplug_mvsdio_data);
 
        platform_device_register(&sheevaplug_leds);
 }
 
+#ifdef CONFIG_MACH_SHEEVAPLUG
 MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
        /* Maintainer: shadi Ammouri <shadi@marvell.com> */
        .phys_io        = KIRKWOOD_REGS_PHYS_BASE,
@@ -106,3 +139,16 @@ MACHINE_START(SHEEVAPLUG, "Marvell SheevaPlug Reference Board")
        .init_irq       = kirkwood_init_irq,
        .timer          = &kirkwood_timer,
 MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_ESATA_SHEEVAPLUG
+MACHINE_START(ESATA_SHEEVAPLUG, "Marvell eSATA SheevaPlug Reference Board")
+       .phys_io        = KIRKWOOD_REGS_PHYS_BASE,
+       .io_pg_offst    = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
+       .boot_params    = 0x00000100,
+       .init_machine   = sheevaplug_init,
+       .map_io         = kirkwood_map_io,
+       .init_irq       = kirkwood_init_irq,
+       .timer          = &kirkwood_timer,
+MACHINE_END
+#endif