[ARM] Kirkwood: SDIO driver registration for DB6281 and RD6281
authorNicolas Pitre <nico@cam.org>
Sat, 14 Feb 2009 08:15:55 +0000 (03:15 -0500)
committerNicolas Pitre <nico@cam.org>
Fri, 27 Feb 2009 01:22:26 +0000 (20:22 -0500)
Signed-off-by: Nicolas Pitre <nico@marvell.com>
arch/arm/mach-kirkwood/common.c
arch/arm/mach-kirkwood/common.h
arch/arm/mach-kirkwood/db88f6281-bp-setup.c
arch/arm/mach-kirkwood/include/mach/kirkwood.h
arch/arm/mach-kirkwood/rd88f6281-setup.c
arch/arm/plat-orion/include/plat/mvsdio.h [new file with mode: 0644]

index b3404b7775b318d9beef5e617d9b3ac5e1cd405f..e5076aae1c6bc0d484cd0f351b993897b518ebbd 100644 (file)
@@ -24,6 +24,7 @@
 #include <mach/kirkwood.h>
 #include <plat/cache-feroceon-l2.h>
 #include <plat/ehci-orion.h>
+#include <plat/mvsdio.h>
 #include <plat/mv_xor.h>
 #include <plat/orion_nand.h>
 #include <plat/time.h>
@@ -295,6 +296,50 @@ void __init kirkwood_sata_init(struct mv_sata_platform_data *sata_data)
 }
 
 
+/*****************************************************************************
+ * SD/SDIO/MMC
+ ****************************************************************************/
+static struct resource mvsdio_resources[] = {
+       [0] = {
+               .start  = SDIO_PHYS_BASE,
+               .end    = SDIO_PHYS_BASE + SZ_1K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = IRQ_KIRKWOOD_SDIO,
+               .end    = IRQ_KIRKWOOD_SDIO,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static u64 mvsdio_dmamask = 0xffffffffUL;
+
+static struct platform_device kirkwood_sdio = {
+       .name           = "mvsdio",
+       .id             = -1,
+       .dev            = {
+               .dma_mask = &mvsdio_dmamask,
+               .coherent_dma_mask = 0xffffffff,
+       },
+       .num_resources  = ARRAY_SIZE(mvsdio_resources),
+       .resource       = mvsdio_resources,
+};
+
+void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
+{
+       u32 dev, rev;
+
+       kirkwood_pcie_id(&dev, &rev);
+       if (rev == 0)  /* catch all Kirkwood Z0's */
+               mvsdio_data->clock = 100000000;
+       else
+               mvsdio_data->clock = 200000000;
+       mvsdio_data->dram = &kirkwood_mbus_dram_info;
+       kirkwood_sdio.dev.platform_data = mvsdio_data;
+       platform_device_register(&kirkwood_sdio);
+}
+
+
 /*****************************************************************************
  * SPI
  ****************************************************************************/
index fe367c18e722f6d598a27f0f9772415c281e4589..58279400cf7c59c1bc5bbf014f795a582743309e 100644 (file)
@@ -14,6 +14,7 @@
 struct dsa_platform_data;
 struct mv643xx_eth_platform_data;
 struct mv_sata_platform_data;
+struct mvsdio_platform_data;
 
 /*
  * Basic Kirkwood init functions used early by machine-setup.
@@ -35,6 +36,7 @@ void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq);
 void kirkwood_pcie_init(void);
 void kirkwood_rtc_init(void);
 void kirkwood_sata_init(struct mv_sata_platform_data *sata_data);
+void kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data);
 void kirkwood_spi_init(void);
 void kirkwood_uart0_init(void);
 void kirkwood_uart1_init(void);
index a14c2948c62aa6a257f40d400c642e5f1cc91b8d..5c3b40d6e093a4b5fa02b1972bb3c655814bcef9 100644 (file)
@@ -22,7 +22,9 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/kirkwood.h>
+#include <plat/mvsdio.h>
 #include "common.h"
+#include "mpp.h"
 
 static struct mv643xx_eth_platform_data db88f6281_ge00_data = {
        .phy_addr       = MV643XX_ETH_PHY_ADDR(8),
@@ -32,18 +34,31 @@ static struct mv_sata_platform_data db88f6281_sata_data = {
        .n_ports        = 2,
 };
 
+static struct mvsdio_platform_data db88f6281_mvsdio_data = {
+       .gpio_write_protect     = 37,
+       .gpio_card_detect       = 38,
+};
+
+static unsigned int db88f6281_mpp_config[] __initdata = {
+       MPP37_GPIO,
+       MPP38_GPIO,
+       0
+};
+
 static void __init db88f6281_init(void)
 {
        /*
         * Basic setup. Needs to be called early.
         */
        kirkwood_init();
+       kirkwood_mpp_conf(db88f6281_mpp_config);
 
        kirkwood_ehci_init();
        kirkwood_ge00_init(&db88f6281_ge00_data);
        kirkwood_rtc_init();
        kirkwood_sata_init(&db88f6281_sata_data);
        kirkwood_uart0_init();
+       kirkwood_sdio_init(&db88f6281_mvsdio_data);
 }
 
 static int __init db88f6281_pci_init(void)
index ada480c0e1975d73c55ebc67d94a7df8356a7b68..d3db30fe763b937e61b57e01cf32860cd3a34ebf 100644 (file)
 
 #define SATA_PHYS_BASE         (KIRKWOOD_REGS_PHYS_BASE | 0x80000)
 
+#define SDIO_PHYS_BASE         (KIRKWOOD_REGS_PHYS_BASE | 0x90000)
+
 
 #endif
index a1ef8a91848edb9affc074b06cd7a49bdb64eeb3..a8b88a5570bdde356468edd8fddb6c6fbbe2e8c7 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/pci.h>
 #include <mach/kirkwood.h>
+#include <plat/mvsdio.h>
 #include <plat/orion_nand.h>
 #include "common.h"
+#include "mpp.h"
 
 static struct mtd_partition rd88f6281_nand_parts[] = {
        {
@@ -91,6 +93,15 @@ static struct mv_sata_platform_data rd88f6281_sata_data = {
        .n_ports        = 2,
 };
 
+static struct mvsdio_platform_data rd88f6281_mvsdio_data = {
+       .gpio_card_detect = 28,
+};
+
+static unsigned int rd88f6281_mpp_config[] __initdata = {
+       MPP28_GPIO,
+       0
+};
+
 static void __init rd88f6281_init(void)
 {
        u32 dev, rev;
@@ -99,6 +110,7 @@ static void __init rd88f6281_init(void)
         * Basic setup. Needs to be called early.
         */
        kirkwood_init();
+       kirkwood_mpp_conf(rd88f6281_mpp_config);
 
        kirkwood_ehci_init();
 
@@ -114,6 +126,7 @@ static void __init rd88f6281_init(void)
 
        kirkwood_rtc_init();
        kirkwood_sata_init(&rd88f6281_sata_data);
+       kirkwood_sdio_init(&rd88f6281_mvsdio_data);
        kirkwood_uart0_init();
        kirkwood_xor0_init();
        kirkwood_xor1_init();
diff --git a/arch/arm/plat-orion/include/plat/mvsdio.h b/arch/arm/plat-orion/include/plat/mvsdio.h
new file mode 100644 (file)
index 0000000..14ca886
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * arch/arm/plat-orion/include/plat/mvsdio.h
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __MACH_MVSDIO_H
+#define __MACH_MVSDIO_H
+
+#include <linux/mbus.h>
+
+struct mvsdio_platform_data {
+       struct mbus_dram_target_info *dram;
+       unsigned int clock;
+       int gpio_card_detect;
+       int gpio_write_protect;
+};
+
+#endif