diff options
Diffstat (limited to 'arch/arm/mach-pxa/zylonite.c')
-rw-r--r-- | arch/arm/mach-pxa/zylonite.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index 743a87b2faa1..f72f37f6ff0c 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -25,9 +25,13 @@ | |||
25 | #include <asm/arch/gpio.h> | 25 | #include <asm/arch/gpio.h> |
26 | #include <asm/arch/pxafb.h> | 26 | #include <asm/arch/pxafb.h> |
27 | #include <asm/arch/zylonite.h> | 27 | #include <asm/arch/zylonite.h> |
28 | #include <asm/arch/mmc.h> | ||
28 | 29 | ||
29 | #include "generic.h" | 30 | #include "generic.h" |
30 | 31 | ||
32 | #define MAX_SLOTS 2 | ||
33 | struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; | ||
34 | |||
31 | int gpio_backlight; | 35 | int gpio_backlight; |
32 | int gpio_eth_irq; | 36 | int gpio_eth_irq; |
33 | 37 | ||
@@ -156,6 +160,87 @@ static void __init zylonite_init_lcd(void) | |||
156 | static inline void zylonite_init_lcd(void) {} | 160 | static inline void zylonite_init_lcd(void) {} |
157 | #endif | 161 | #endif |
158 | 162 | ||
163 | #if defined(CONFIG_MMC) | ||
164 | static int zylonite_mci_ro(struct device *dev) | ||
165 | { | ||
166 | struct platform_device *pdev = to_platform_device(dev); | ||
167 | |||
168 | return gpio_get_value(zylonite_mmc_slot[pdev->id].gpio_wp); | ||
169 | } | ||
170 | |||
171 | static int zylonite_mci_init(struct device *dev, | ||
172 | irq_handler_t zylonite_detect_int, | ||
173 | void *data) | ||
174 | { | ||
175 | struct platform_device *pdev = to_platform_device(dev); | ||
176 | int err, cd_irq, gpio_cd, gpio_wp; | ||
177 | |||
178 | cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd); | ||
179 | gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd; | ||
180 | gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp; | ||
181 | |||
182 | /* | ||
183 | * setup GPIO for Zylonite MMC controller | ||
184 | */ | ||
185 | err = gpio_request(gpio_cd, "mmc card detect"); | ||
186 | if (err) | ||
187 | goto err_request_cd; | ||
188 | gpio_direction_input(gpio_cd); | ||
189 | |||
190 | err = gpio_request(gpio_wp, "mmc write protect"); | ||
191 | if (err) | ||
192 | goto err_request_wp; | ||
193 | gpio_direction_input(gpio_wp); | ||
194 | |||
195 | err = request_irq(cd_irq, zylonite_detect_int, | ||
196 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
197 | "MMC card detect", data); | ||
198 | if (err) { | ||
199 | printk(KERN_ERR "%s: MMC/SD/SDIO: " | ||
200 | "can't request card detect IRQ\n", __func__); | ||
201 | goto err_request_irq; | ||
202 | } | ||
203 | |||
204 | return 0; | ||
205 | |||
206 | err_request_irq: | ||
207 | gpio_free(gpio_wp); | ||
208 | err_request_wp: | ||
209 | gpio_free(gpio_cd); | ||
210 | err_request_cd: | ||
211 | return err; | ||
212 | } | ||
213 | |||
214 | static void zylonite_mci_exit(struct device *dev, void *data) | ||
215 | { | ||
216 | struct platform_device *pdev = to_platform_device(dev); | ||
217 | int cd_irq, gpio_cd, gpio_wp; | ||
218 | |||
219 | cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd); | ||
220 | gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd; | ||
221 | gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp; | ||
222 | |||
223 | free_irq(cd_irq, data); | ||
224 | gpio_free(gpio_cd); | ||
225 | gpio_free(gpio_wp); | ||
226 | } | ||
227 | |||
228 | static struct pxamci_platform_data zylonite_mci_platform_data = { | ||
229 | .detect_delay = 20, | ||
230 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
231 | .init = zylonite_mci_init, | ||
232 | .exit = zylonite_mci_exit, | ||
233 | .get_ro = zylonite_mci_ro, | ||
234 | }; | ||
235 | |||
236 | static void __init zylonite_init_mmc(void) | ||
237 | { | ||
238 | pxa_set_mci_info(&zylonite_mci_platform_data); | ||
239 | } | ||
240 | #else | ||
241 | static inline void zylonite_init_mmc(void) {} | ||
242 | #endif | ||
243 | |||
159 | static void __init zylonite_init(void) | 244 | static void __init zylonite_init(void) |
160 | { | 245 | { |
161 | /* board-processor specific initialization */ | 246 | /* board-processor specific initialization */ |
@@ -171,6 +256,7 @@ static void __init zylonite_init(void) | |||
171 | platform_device_register(&smc91x_device); | 256 | platform_device_register(&smc91x_device); |
172 | 257 | ||
173 | zylonite_init_lcd(); | 258 | zylonite_init_lcd(); |
259 | zylonite_init_mmc(); | ||
174 | } | 260 | } |
175 | 261 | ||
176 | MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") | 262 | MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") |