aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-03-13 11:37:10 -0400
committerEric Miao <eric.miao@marvell.com>2009-03-22 21:57:54 -0400
commitebc046c2a3544ba4f55512a218a4084522473bcd (patch)
tree61998c22978f32be74a050ea997fa4ce6b2ef7c0
parent5fc9f9a1deefc9999af721fba249cd58ee7e273b (diff)
[ARM] pxa: add MMC support for Colibri PXA300
Added MMC support for Toradex' Colibri PXA300 module. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Eric Miao <eric.miao@marvell.com>
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
index b271e028da35..7cc4249c7701 100644
--- a/arch/arm/mach-pxa/colibri-pxa300.c
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -21,6 +21,7 @@
21 21
22#include <mach/pxa300.h> 22#include <mach/pxa300.h>
23#include <mach/colibri.h> 23#include <mach/colibri.h>
24#include <mach/mmc.h>
24 25
25#include "generic.h" 26#include "generic.h"
26#include "devices.h" 27#include "devices.h"
@@ -31,6 +32,15 @@
31static mfp_cfg_t colibri_pxa300_pin_config[] __initdata = { 32static mfp_cfg_t colibri_pxa300_pin_config[] __initdata = {
32 GPIO1_nCS2, /* AX88796 chip select */ 33 GPIO1_nCS2, /* AX88796 chip select */
33 GPIO26_GPIO | MFP_PULL_HIGH, /* AX88796 IRQ */ 34 GPIO26_GPIO | MFP_PULL_HIGH, /* AX88796 IRQ */
35
36#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
37 GPIO7_MMC1_CLK,
38 GPIO14_MMC1_CMD,
39 GPIO3_MMC1_DAT0,
40 GPIO4_MMC1_DAT1,
41 GPIO5_MMC1_DAT2,
42 GPIO6_MMC1_DAT3,
43#endif
34}; 44};
35 45
36#if defined(CONFIG_AX88796) 46#if defined(CONFIG_AX88796)
@@ -80,11 +90,59 @@ static struct platform_device *colibri_pxa300_devices[] __initdata = {
80#endif 90#endif
81}; 91};
82 92
93#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
94#define MMC_DETECT_PIN mfp_to_gpio(MFP_PIN_GPIO13)
95
96static int colibri_pxa300_mci_init(struct device *dev,
97 irq_handler_t colibri_mmc_detect_int,
98 void *data)
99{
100 int ret;
101
102 ret = gpio_request(MMC_DETECT_PIN, "mmc card detect");
103 if (ret)
104 return ret;
105
106 gpio_direction_input(MMC_DETECT_PIN);
107 ret = request_irq(gpio_to_irq(MMC_DETECT_PIN), colibri_mmc_detect_int,
108 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
109 "MMC card detect", data);
110 if (ret) {
111 gpio_free(MMC_DETECT_PIN);
112 return ret;
113 }
114
115 return 0;
116}
117
118static void colibri_pxa300_mci_exit(struct device *dev, void *data)
119{
120 free_irq(MMC_DETECT_PIN, data);
121 gpio_free(gpio_to_irq(MMC_DETECT_PIN));
122}
123
124static struct pxamci_platform_data colibri_pxa300_mci_platform_data = {
125 .detect_delay = 20,
126 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
127 .init = colibri_pxa300_mci_init,
128 .exit = colibri_pxa300_mci_exit,
129};
130
131static void __init colibri_pxa300_init_mmc(void)
132{
133 pxa_set_mci_info(&colibri_pxa300_mci_platform_data);
134}
135
136#else
137static inline void colibri_pxa300_init_mmc(void) {}
138#endif /* CONFIG_MMC_PXA */
139
83static void __init colibri_pxa300_init(void) 140static void __init colibri_pxa300_init(void)
84{ 141{
85 set_irq_type(COLIBRI_PXA300_ETH_IRQ, IRQ_TYPE_EDGE_FALLING); 142 set_irq_type(COLIBRI_PXA300_ETH_IRQ, IRQ_TYPE_EDGE_FALLING);
86 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_pin_config)); 143 pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_pin_config));
87 platform_add_devices(ARRAY_AND_SIZE(colibri_pxa300_devices)); 144 platform_add_devices(ARRAY_AND_SIZE(colibri_pxa300_devices));
145 colibri_pxa300_init_mmc();
88} 146}
89 147
90MACHINE_START(COLIBRI300, "Toradex Colibri PXA300") 148MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")