aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorSudhakar Rajashekhara <sudhakar.raj@ti.com>2009-08-13 15:16:23 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-08-26 04:55:55 -0400
commit700691f27ed9b0891cece9032e4de8c0b482c625 (patch)
treee4f7cefe7307679799383ad58ead918d415f7bab /arch/arm/mach-davinci
parent5cbdf276bd9d9cd3cb9616f8253390096c1a237f (diff)
davinci: Add MMC/SD support for da850/omap-l138
There are two instances of MMC/SD on da850/omap-l138. Connector for the first instance is available on the EVM. This patch adds support for this instance. This patch also adds support for card detect and write protect switches on da850/omap-l138 EVM. Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c42
-rw-r--r--arch/arm/mach-davinci/da850.c23
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c36
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h4
-rw-r--r--arch/arm/mach-davinci/include/mach/mux.h10
5 files changed, 115 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index b1df784ed702..eb998ce6d465 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -33,6 +33,9 @@
33#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) 33#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
34#define DA850_LCD_PWR_PIN GPIO_TO_PIN(8, 10) 34#define DA850_LCD_PWR_PIN GPIO_TO_PIN(8, 10)
35 35
36#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
37#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
38
36static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { 39static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
37 .bus_freq = 100, /* kHz */ 40 .bus_freq = 100, /* kHz */
38 .bus_delay = 0, /* usec */ 41 .bus_delay = 0, /* usec */
@@ -63,6 +66,23 @@ static struct snd_platform_data da850_evm_snd_data = {
63 .rxnumevt = 1, 66 .rxnumevt = 1,
64}; 67};
65 68
69static int da850_evm_mmc_get_ro(int index)
70{
71 return gpio_get_value(DA850_MMCSD_WP_PIN);
72}
73
74static int da850_evm_mmc_get_cd(int index)
75{
76 return !gpio_get_value(DA850_MMCSD_CD_PIN);
77}
78
79static struct davinci_mmc_config da850_mmc_config = {
80 .get_ro = da850_evm_mmc_get_ro,
81 .get_cd = da850_evm_mmc_get_cd,
82 .wires = 4,
83 .version = MMC_CTLR_VERSION_2,
84};
85
66static int da850_lcd_hw_init(void) 86static int da850_lcd_hw_init(void)
67{ 87{
68 int status; 88 int status;
@@ -134,6 +154,28 @@ static __init void da850_evm_init(void)
134 pr_warning("da830_evm_init: watchdog registration failed: %d\n", 154 pr_warning("da830_evm_init: watchdog registration failed: %d\n",
135 ret); 155 ret);
136 156
157 ret = da8xx_pinmux_setup(da850_mmcsd0_pins);
158 if (ret)
159 pr_warning("da850_evm_init: mmcsd0 mux setup failed: %d\n",
160 ret);
161
162 ret = gpio_request(DA850_MMCSD_CD_PIN, "MMC CD\n");
163 if (ret)
164 pr_warning("da850_evm_init: can not open GPIO %d\n",
165 DA850_MMCSD_CD_PIN);
166 gpio_direction_input(DA850_MMCSD_CD_PIN);
167
168 ret = gpio_request(DA850_MMCSD_WP_PIN, "MMC WP\n");
169 if (ret)
170 pr_warning("da850_evm_init: can not open GPIO %d\n",
171 DA850_MMCSD_WP_PIN);
172 gpio_direction_input(DA850_MMCSD_WP_PIN);
173
174 ret = da8xx_register_mmcsd0(&da850_mmc_config);
175 if (ret)
176 pr_warning("da850_evm_init: mmcsd0 registration failed: %d\n",
177 ret);
178
137 davinci_serial_init(&da850_evm_uart_config); 179 davinci_serial_init(&da850_evm_uart_config);
138 180
139 /* 181 /*
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index e6e605bf1516..9debd57deb71 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -304,6 +304,12 @@ static struct clk lcdc_clk = {
304 .psc_ctlr = 1, 304 .psc_ctlr = 1,
305}; 305};
306 306
307static struct clk mmcsd_clk = {
308 .name = "mmcsd",
309 .parent = &pll0_sysclk2,
310 .lpsc = DA8XX_LPSC0_MMC_SD,
311};
312
307static struct davinci_clk da850_clks[] = { 313static struct davinci_clk da850_clks[] = {
308 CLK(NULL, "ref", &ref_clk), 314 CLK(NULL, "ref", &ref_clk),
309 CLK(NULL, "pll0", &pll0_clk), 315 CLK(NULL, "pll0", &pll0_clk),
@@ -343,6 +349,7 @@ static struct davinci_clk da850_clks[] = {
343 CLK("davinci_emac.1", NULL, &emac_clk), 349 CLK("davinci_emac.1", NULL, &emac_clk),
344 CLK("davinci-mcasp.0", NULL, &mcasp_clk), 350 CLK("davinci-mcasp.0", NULL, &mcasp_clk),
345 CLK("da8xx_lcdc.0", NULL, &lcdc_clk), 351 CLK("da8xx_lcdc.0", NULL, &lcdc_clk),
352 CLK("davinci_mmc.0", NULL, &mmcsd_clk),
346 CLK(NULL, NULL, NULL), 353 CLK(NULL, NULL, NULL),
347}; 354};
348 355
@@ -434,9 +441,18 @@ static const struct mux_config da850_pins[] = {
434 MUX_CFG(DA850, LCD_HSYNC, 19, 0, 15, 2, false) 441 MUX_CFG(DA850, LCD_HSYNC, 19, 0, 15, 2, false)
435 MUX_CFG(DA850, LCD_VSYNC, 19, 4, 15, 2, false) 442 MUX_CFG(DA850, LCD_VSYNC, 19, 4, 15, 2, false)
436 MUX_CFG(DA850, NLCD_AC_ENB_CS, 19, 24, 15, 2, false) 443 MUX_CFG(DA850, NLCD_AC_ENB_CS, 19, 24, 15, 2, false)
444 /* MMC/SD0 function */
445 MUX_CFG(DA850, MMCSD0_DAT_0, 10, 8, 15, 2, false)
446 MUX_CFG(DA850, MMCSD0_DAT_1, 10, 12, 15, 2, false)
447 MUX_CFG(DA850, MMCSD0_DAT_2, 10, 16, 15, 2, false)
448 MUX_CFG(DA850, MMCSD0_DAT_3, 10, 20, 15, 2, false)
449 MUX_CFG(DA850, MMCSD0_CLK, 10, 0, 15, 2, false)
450 MUX_CFG(DA850, MMCSD0_CMD, 10, 4, 15, 2, false)
437 /* GPIO function */ 451 /* GPIO function */
438 MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) 452 MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false)
439 MUX_CFG(DA850, GPIO8_10, 18, 28, 15, 8, false) 453 MUX_CFG(DA850, GPIO8_10, 18, 28, 15, 8, false)
454 MUX_CFG(DA850, GPIO4_0, 10, 28, 15, 8, false)
455 MUX_CFG(DA850, GPIO4_1, 10, 24, 15, 8, false)
440#endif 456#endif
441}; 457};
442 458
@@ -491,6 +507,13 @@ const short da850_lcdcntl_pins[] __initdata = {
491 -1 507 -1
492}; 508};
493 509
510const short da850_mmcsd0_pins[] __initdata = {
511 DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
512 DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
513 DA850_GPIO4_0, DA850_GPIO4_1,
514 -1
515};
516
494/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ 517/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */
495static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = { 518static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = {
496 [IRQ_DA8XX_COMMTX] = 7, 519 [IRQ_DA8XX_COMMTX] = 7,
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 094eb8ed8e76..58ad5b66fd60 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -412,3 +412,39 @@ int __init da8xx_register_lcdc(void)
412{ 412{
413 return platform_device_register(&da850_lcdc_device); 413 return platform_device_register(&da850_lcdc_device);
414} 414}
415
416static struct resource da8xx_mmcsd0_resources[] = {
417 { /* registers */
418 .start = DA8XX_MMCSD0_BASE,
419 .end = DA8XX_MMCSD0_BASE + SZ_4K - 1,
420 .flags = IORESOURCE_MEM,
421 },
422 { /* interrupt */
423 .start = IRQ_DA8XX_MMCSDINT0,
424 .end = IRQ_DA8XX_MMCSDINT0,
425 .flags = IORESOURCE_IRQ,
426 },
427 { /* DMA RX */
428 .start = EDMA_CTLR_CHAN(0, 16),
429 .end = EDMA_CTLR_CHAN(0, 16),
430 .flags = IORESOURCE_DMA,
431 },
432 { /* DMA TX */
433 .start = EDMA_CTLR_CHAN(0, 17),
434 .end = EDMA_CTLR_CHAN(0, 17),
435 .flags = IORESOURCE_DMA,
436 },
437};
438
439static struct platform_device da8xx_mmcsd0_device = {
440 .name = "davinci_mmc",
441 .id = 0,
442 .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources),
443 .resource = da8xx_mmcsd0_resources,
444};
445
446int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config)
447{
448 da8xx_mmcsd0_device.dev.platform_data = config;
449 return platform_device_register(&da8xx_mmcsd0_device);
450}
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 0af3fb6077a3..0af141ffc3b4 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -16,6 +16,7 @@
16#include <mach/i2c.h> 16#include <mach/i2c.h>
17#include <mach/emac.h> 17#include <mach/emac.h>
18#include <mach/asp.h> 18#include <mach/asp.h>
19#include <mach/mmc.h>
19 20
20/* 21/*
21 * The cp_intc interrupt controller for the da8xx isn't in the same 22 * The cp_intc interrupt controller for the da8xx isn't in the same
@@ -38,6 +39,7 @@
38#define DA8XX_GPIO_BASE 0x01e26000 39#define DA8XX_GPIO_BASE 0x01e26000
39#define DA8XX_PSC1_BASE 0x01e27000 40#define DA8XX_PSC1_BASE 0x01e27000
40#define DA8XX_LCD_CNTRL_BASE 0x01e13000 41#define DA8XX_LCD_CNTRL_BASE 0x01e13000
42#define DA8XX_MMCSD0_BASE 0x01c40000
41 43
42#define PINMUX0 0x00 44#define PINMUX0 0x00
43#define PINMUX1 0x04 45#define PINMUX1 0x04
@@ -68,6 +70,7 @@ int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
68int da8xx_register_watchdog(void); 70int da8xx_register_watchdog(void);
69int da8xx_register_emac(void); 71int da8xx_register_emac(void);
70int da8xx_register_lcdc(void); 72int da8xx_register_lcdc(void);
73int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
71void __init da8xx_init_mcasp(int id, struct snd_platform_data *pdata); 74void __init da8xx_init_mcasp(int id, struct snd_platform_data *pdata);
72 75
73extern struct platform_device da8xx_serial_device; 76extern struct platform_device da8xx_serial_device;
@@ -106,6 +109,7 @@ extern const short da850_i2c1_pins[];
106extern const short da850_cpgmac_pins[]; 109extern const short da850_cpgmac_pins[];
107extern const short da850_mcasp_pins[]; 110extern const short da850_mcasp_pins[];
108extern const short da850_lcdcntl_pins[]; 111extern const short da850_lcdcntl_pins[];
112extern const short da850_mmcsd0_pins[];
109 113
110int da8xx_pinmux_setup(const short pins[]); 114int da8xx_pinmux_setup(const short pins[]);
111 115
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index 30bf329d5373..b2335640c222 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -798,9 +798,19 @@ enum davinci_da850_index {
798 DA850_LCD_VSYNC, 798 DA850_LCD_VSYNC,
799 DA850_NLCD_AC_ENB_CS, 799 DA850_NLCD_AC_ENB_CS,
800 800
801 /* MMC/SD0 function */
802 DA850_MMCSD0_DAT_0,
803 DA850_MMCSD0_DAT_1,
804 DA850_MMCSD0_DAT_2,
805 DA850_MMCSD0_DAT_3,
806 DA850_MMCSD0_CLK,
807 DA850_MMCSD0_CMD,
808
801 /* GPIO function */ 809 /* GPIO function */
802 DA850_GPIO2_15, 810 DA850_GPIO2_15,
803 DA850_GPIO8_10, 811 DA850_GPIO8_10,
812 DA850_GPIO4_0,
813 DA850_GPIO4_1,
804}; 814};
805 815
806#ifdef CONFIG_DAVINCI_MUX 816#ifdef CONFIG_DAVINCI_MUX