From 8235ee009cd839265f5dc2dace2758471a823e68 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Sat, 14 Feb 2009 03:15:55 -0500 Subject: [ARM] Kirkwood: SDIO driver registration for DB6281 and RD6281 Signed-off-by: Nicolas Pitre --- arch/arm/mach-kirkwood/common.c | 45 ++++++++++++++++++++++++++ arch/arm/mach-kirkwood/common.h | 2 ++ arch/arm/mach-kirkwood/db88f6281-bp-setup.c | 15 +++++++++ arch/arm/mach-kirkwood/include/mach/kirkwood.h | 2 ++ arch/arm/mach-kirkwood/rd88f6281-setup.c | 13 ++++++++ 5 files changed, 77 insertions(+) (limited to 'arch/arm/mach-kirkwood') diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index b3404b7775b3..e5076aae1c6b 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -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 ****************************************************************************/ diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index fe367c18e722..58279400cf7c 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h @@ -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); diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c index a14c2948c62a..5c3b40d6e093 100644 --- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c +++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c @@ -22,7 +22,9 @@ #include #include #include +#include #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) diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h index ada480c0e197..d3db30fe763b 100644 --- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h +++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h @@ -116,5 +116,7 @@ #define SATA_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x80000) +#define SDIO_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x90000) + #endif diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c index a1ef8a91848e..a8b88a5570bd 100644 --- a/arch/arm/mach-kirkwood/rd88f6281-setup.c +++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c @@ -24,8 +24,10 @@ #include #include #include +#include #include #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(); -- cgit v1.2.3