diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-pxa/cm-x270.c | 54 | ||||
-rw-r--r-- | arch/arm/mach-pxa/cm-x300.c | 71 | ||||
-rw-r--r-- | arch/arm/mach-pxa/colibri-pxa3xx.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 75 | ||||
-rw-r--r-- | arch/arm/mach-pxa/csb726.c | 54 | ||||
-rw-r--r-- | arch/arm/mach-pxa/em-x270.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-pxa/gumstix.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-pxa/idp.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-pxa/imote2.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-pxa/lubbock.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 49 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-pxa/mioa701.c | 68 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmld.c | 80 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmt5.c | 80 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmte2.c | 80 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmtx.c | 80 | ||||
-rw-r--r-- | arch/arm/mach-pxa/palmz72.c | 88 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pcm990-baseboard.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 53 | ||||
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 62 | ||||
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 82 | ||||
-rw-r--r-- | arch/arm/mach-pxa/trizeps4.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zylonite.c | 3 |
24 files changed, 143 insertions, 917 deletions
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c index 1d2cec25391d..59292181088c 100644 --- a/arch/arm/mach-pxa/cm-x270.c +++ b/arch/arm/mach-pxa/cm-x270.c | |||
@@ -271,56 +271,12 @@ static inline void cmx270_init_ohci(void) {} | |||
271 | #endif | 271 | #endif |
272 | 272 | ||
273 | #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) | 273 | #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) |
274 | static int cmx270_mci_init(struct device *dev, | ||
275 | irq_handler_t cmx270_detect_int, | ||
276 | void *data) | ||
277 | { | ||
278 | int err; | ||
279 | |||
280 | err = gpio_request(GPIO105_MMC_POWER, "MMC/SD power"); | ||
281 | if (err) { | ||
282 | dev_warn(dev, "power gpio unavailable\n"); | ||
283 | return err; | ||
284 | } | ||
285 | |||
286 | gpio_direction_output(GPIO105_MMC_POWER, 0); | ||
287 | |||
288 | err = request_irq(CMX270_MMC_IRQ, cmx270_detect_int, | ||
289 | IRQF_DISABLED | IRQF_TRIGGER_FALLING, | ||
290 | "MMC card detect", data); | ||
291 | if (err) { | ||
292 | gpio_free(GPIO105_MMC_POWER); | ||
293 | dev_err(dev, "cmx270_mci_init: MMC/SD: can't" | ||
294 | " request MMC card detect IRQ\n"); | ||
295 | } | ||
296 | |||
297 | return err; | ||
298 | } | ||
299 | |||
300 | static void cmx270_mci_setpower(struct device *dev, unsigned int vdd) | ||
301 | { | ||
302 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
303 | |||
304 | if ((1 << vdd) & p_d->ocr_mask) { | ||
305 | dev_dbg(dev, "power on\n"); | ||
306 | gpio_set_value(GPIO105_MMC_POWER, 0); | ||
307 | } else { | ||
308 | gpio_set_value(GPIO105_MMC_POWER, 1); | ||
309 | dev_dbg(dev, "power off\n"); | ||
310 | } | ||
311 | } | ||
312 | |||
313 | static void cmx270_mci_exit(struct device *dev, void *data) | ||
314 | { | ||
315 | free_irq(CMX270_MMC_IRQ, data); | ||
316 | gpio_free(GPIO105_MMC_POWER); | ||
317 | } | ||
318 | |||
319 | static struct pxamci_platform_data cmx270_mci_platform_data = { | 274 | static struct pxamci_platform_data cmx270_mci_platform_data = { |
320 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 275 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
321 | .init = cmx270_mci_init, | 276 | .gpio_card_detect = GPIO83_MMC_IRQ, |
322 | .setpower = cmx270_mci_setpower, | 277 | .gpio_card_ro = -1, |
323 | .exit = cmx270_mci_exit, | 278 | .gpio_power = GPIO105_MMC_POWER, |
279 | .gpio_power_invert = 1, | ||
324 | }; | 280 | }; |
325 | 281 | ||
326 | static void __init cmx270_init_mmc(void) | 282 | static void __init cmx270_init_mmc(void) |
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c index 465da26591bd..aac2cda60e09 100644 --- a/arch/arm/mach-pxa/cm-x300.c +++ b/arch/arm/mach-pxa/cm-x300.c | |||
@@ -306,68 +306,21 @@ static void cm_x300_mci_exit(struct device *dev, void *data) | |||
306 | } | 306 | } |
307 | 307 | ||
308 | static struct pxamci_platform_data cm_x300_mci_platform_data = { | 308 | static struct pxamci_platform_data cm_x300_mci_platform_data = { |
309 | .detect_delay = 20, | 309 | .detect_delay = 20, |
310 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 310 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
311 | .init = cm_x300_mci_init, | 311 | .init = cm_x300_mci_init, |
312 | .exit = cm_x300_mci_exit, | 312 | .exit = cm_x300_mci_exit, |
313 | .gpio_card_detect = -1, | ||
314 | .gpio_card_ro = -1, | ||
315 | .gpio_power = -1, | ||
313 | }; | 316 | }; |
314 | 317 | ||
315 | static int cm_x300_mci2_ro(struct device *dev) | ||
316 | { | ||
317 | return gpio_get_value(GPIO85_MMC2_WP); | ||
318 | } | ||
319 | |||
320 | static int cm_x300_mci2_init(struct device *dev, | ||
321 | irq_handler_t cm_x300_detect_int, | ||
322 | void *data) | ||
323 | { | ||
324 | int err; | ||
325 | |||
326 | /* | ||
327 | * setup GPIO for CM-X300 MMC controller | ||
328 | */ | ||
329 | err = gpio_request(GPIO82_MMC2_IRQ, "mmc card detect"); | ||
330 | if (err) | ||
331 | goto err_request_cd; | ||
332 | gpio_direction_input(GPIO82_MMC2_IRQ); | ||
333 | |||
334 | err = gpio_request(GPIO85_MMC2_WP, "mmc write protect"); | ||
335 | if (err) | ||
336 | goto err_request_wp; | ||
337 | gpio_direction_input(GPIO85_MMC2_WP); | ||
338 | |||
339 | err = request_irq(CM_X300_MMC2_IRQ, cm_x300_detect_int, | ||
340 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
341 | "MMC card detect", data); | ||
342 | if (err) { | ||
343 | printk(KERN_ERR "%s: MMC/SD/SDIO: " | ||
344 | "can't request card detect IRQ\n", __func__); | ||
345 | goto err_request_irq; | ||
346 | } | ||
347 | |||
348 | return 0; | ||
349 | |||
350 | err_request_irq: | ||
351 | gpio_free(GPIO85_MMC2_WP); | ||
352 | err_request_wp: | ||
353 | gpio_free(GPIO82_MMC2_IRQ); | ||
354 | err_request_cd: | ||
355 | return err; | ||
356 | } | ||
357 | |||
358 | static void cm_x300_mci2_exit(struct device *dev, void *data) | ||
359 | { | ||
360 | free_irq(CM_X300_MMC2_IRQ, data); | ||
361 | gpio_free(GPIO82_MMC2_IRQ); | ||
362 | gpio_free(GPIO85_MMC2_WP); | ||
363 | } | ||
364 | |||
365 | static struct pxamci_platform_data cm_x300_mci2_platform_data = { | 318 | static struct pxamci_platform_data cm_x300_mci2_platform_data = { |
366 | .detect_delay = 20, | 319 | .detect_delay = 20, |
367 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 320 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
368 | .init = cm_x300_mci2_init, | 321 | .gpio_card_detect = GPIO82_MMC2_IRQ, |
369 | .exit = cm_x300_mci2_exit, | 322 | .gpio_card_ro = GPIO85_MMC2_WP, |
370 | .get_ro = cm_x300_mci2_ro, | 323 | .gpio_power = -1, |
371 | }; | 324 | }; |
372 | 325 | ||
373 | static void __init cm_x300_init_mmc(void) | 326 | static void __init cm_x300_init_mmc(void) |
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c index ea34e34f8cd8..2c846bbfc435 100644 --- a/arch/arm/mach-pxa/colibri-pxa3xx.c +++ b/arch/arm/mach-pxa/colibri-pxa3xx.c | |||
@@ -95,10 +95,13 @@ static void colibri_pxa3xx_mci_exit(struct device *dev, void *data) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = { | 97 | static struct pxamci_platform_data colibri_pxa3xx_mci_platform_data = { |
98 | .detect_delay = 20, | 98 | .detect_delay = 20, |
99 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 99 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
100 | .init = colibri_pxa3xx_mci_init, | 100 | .init = colibri_pxa3xx_mci_init, |
101 | .exit = colibri_pxa3xx_mci_exit, | 101 | .exit = colibri_pxa3xx_mci_exit, |
102 | .gpio_card_detect = -1, | ||
103 | .gpio_card_ro = -1, | ||
104 | .gpio_power = -1, | ||
102 | }; | 105 | }; |
103 | 106 | ||
104 | void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin) | 107 | void __init colibri_pxa3xx_init_mmc(mfp_cfg_t *pins, int len, int detect_pin) |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 5363e1aea3fb..39a94585f97b 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -307,77 +307,11 @@ static struct platform_device corgiled_device = { | |||
307 | * The card detect interrupt isn't debounced so we delay it by 250ms | 307 | * The card detect interrupt isn't debounced so we delay it by 250ms |
308 | * to give the card a chance to fully insert/eject. | 308 | * to give the card a chance to fully insert/eject. |
309 | */ | 309 | */ |
310 | static struct pxamci_platform_data corgi_mci_platform_data; | ||
311 | |||
312 | static int corgi_mci_init(struct device *dev, irq_handler_t corgi_detect_int, void *data) | ||
313 | { | ||
314 | int err; | ||
315 | |||
316 | err = gpio_request(CORGI_GPIO_nSD_DETECT, "nSD_DETECT"); | ||
317 | if (err) | ||
318 | goto err_out; | ||
319 | |||
320 | err = gpio_request(CORGI_GPIO_nSD_WP, "nSD_WP"); | ||
321 | if (err) | ||
322 | goto err_free_1; | ||
323 | |||
324 | err = gpio_request(CORGI_GPIO_SD_PWR, "SD_PWR"); | ||
325 | if (err) | ||
326 | goto err_free_2; | ||
327 | |||
328 | gpio_direction_input(CORGI_GPIO_nSD_DETECT); | ||
329 | gpio_direction_input(CORGI_GPIO_nSD_WP); | ||
330 | gpio_direction_output(CORGI_GPIO_SD_PWR, 0); | ||
331 | |||
332 | corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
333 | |||
334 | err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int, | ||
335 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
336 | IRQF_TRIGGER_FALLING, | ||
337 | "MMC card detect", data); | ||
338 | if (err) { | ||
339 | pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n", | ||
340 | __func__); | ||
341 | goto err_free_3; | ||
342 | } | ||
343 | return 0; | ||
344 | |||
345 | err_free_3: | ||
346 | gpio_free(CORGI_GPIO_SD_PWR); | ||
347 | err_free_2: | ||
348 | gpio_free(CORGI_GPIO_nSD_WP); | ||
349 | err_free_1: | ||
350 | gpio_free(CORGI_GPIO_nSD_DETECT); | ||
351 | err_out: | ||
352 | return err; | ||
353 | } | ||
354 | |||
355 | static void corgi_mci_setpower(struct device *dev, unsigned int vdd) | ||
356 | { | ||
357 | struct pxamci_platform_data* p_d = dev->platform_data; | ||
358 | |||
359 | gpio_set_value(CORGI_GPIO_SD_PWR, ((1 << vdd) & p_d->ocr_mask)); | ||
360 | } | ||
361 | |||
362 | static int corgi_mci_get_ro(struct device *dev) | ||
363 | { | ||
364 | return gpio_get_value(CORGI_GPIO_nSD_WP); | ||
365 | } | ||
366 | |||
367 | static void corgi_mci_exit(struct device *dev, void *data) | ||
368 | { | ||
369 | free_irq(CORGI_IRQ_GPIO_nSD_DETECT, data); | ||
370 | gpio_free(CORGI_GPIO_SD_PWR); | ||
371 | gpio_free(CORGI_GPIO_nSD_WP); | ||
372 | gpio_free(CORGI_GPIO_nSD_DETECT); | ||
373 | } | ||
374 | |||
375 | static struct pxamci_platform_data corgi_mci_platform_data = { | 310 | static struct pxamci_platform_data corgi_mci_platform_data = { |
376 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 311 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
377 | .init = corgi_mci_init, | 312 | .gpio_card_detect = -1, |
378 | .get_ro = corgi_mci_get_ro, | 313 | .gpio_card_ro = CORGI_GPIO_nSD_WP, |
379 | .setpower = corgi_mci_setpower, | 314 | .gpio_power = CORGI_GPIO_SD_PWR, |
380 | .exit = corgi_mci_exit, | ||
381 | }; | 315 | }; |
382 | 316 | ||
383 | 317 | ||
@@ -636,6 +570,7 @@ static void __init corgi_init(void) | |||
636 | corgi_init_spi(); | 570 | corgi_init_spi(); |
637 | 571 | ||
638 | pxa_set_udc_info(&udc_info); | 572 | pxa_set_udc_info(&udc_info); |
573 | corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
639 | pxa_set_mci_info(&corgi_mci_platform_data); | 574 | pxa_set_mci_info(&corgi_mci_platform_data); |
640 | pxa_set_ficp_info(&corgi_ficp_platform_data); | 575 | pxa_set_ficp_info(&corgi_ficp_platform_data); |
641 | pxa_set_i2c_info(NULL); | 576 | pxa_set_i2c_info(NULL); |
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c index 7d3e1b46e550..79141f862728 100644 --- a/arch/arm/mach-pxa/csb726.c +++ b/arch/arm/mach-pxa/csb726.c | |||
@@ -130,61 +130,17 @@ static struct pxamci_platform_data csb726_mci_data; | |||
130 | static int csb726_mci_init(struct device *dev, | 130 | static int csb726_mci_init(struct device *dev, |
131 | irq_handler_t detect, void *data) | 131 | irq_handler_t detect, void *data) |
132 | { | 132 | { |
133 | int err; | ||
134 | |||
135 | csb726_mci_data.detect_delay = msecs_to_jiffies(500); | 133 | csb726_mci_data.detect_delay = msecs_to_jiffies(500); |
136 | |||
137 | err = gpio_request(CSB726_GPIO_MMC_DETECT, "MMC detect"); | ||
138 | if (err) | ||
139 | goto err_det_req; | ||
140 | |||
141 | err = gpio_direction_input(CSB726_GPIO_MMC_DETECT); | ||
142 | if (err) | ||
143 | goto err_det_dir; | ||
144 | |||
145 | err = gpio_request(CSB726_GPIO_MMC_RO, "MMC ro"); | ||
146 | if (err) | ||
147 | goto err_ro_req; | ||
148 | |||
149 | err = gpio_direction_input(CSB726_GPIO_MMC_RO); | ||
150 | if (err) | ||
151 | goto err_ro_dir; | ||
152 | |||
153 | err = request_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), detect, | ||
154 | IRQF_DISABLED, "MMC card detect", data); | ||
155 | if (err) | ||
156 | goto err_irq; | ||
157 | |||
158 | return 0; | 134 | return 0; |
159 | |||
160 | err_irq: | ||
161 | err_ro_dir: | ||
162 | gpio_free(CSB726_GPIO_MMC_RO); | ||
163 | err_ro_req: | ||
164 | err_det_dir: | ||
165 | gpio_free(CSB726_GPIO_MMC_DETECT); | ||
166 | err_det_req: | ||
167 | return err; | ||
168 | } | ||
169 | |||
170 | static int csb726_mci_get_ro(struct device *dev) | ||
171 | { | ||
172 | return gpio_get_value(CSB726_GPIO_MMC_RO); | ||
173 | } | ||
174 | |||
175 | static void csb726_mci_exit(struct device *dev, void *data) | ||
176 | { | ||
177 | free_irq(gpio_to_irq(CSB726_GPIO_MMC_DETECT), data); | ||
178 | gpio_free(CSB726_GPIO_MMC_RO); | ||
179 | gpio_free(CSB726_GPIO_MMC_DETECT); | ||
180 | } | 135 | } |
181 | 136 | ||
182 | static struct pxamci_platform_data csb726_mci = { | 137 | static struct pxamci_platform_data csb726_mci = { |
183 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 138 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
184 | .init = csb726_mci_init, | 139 | .init = csb726_mci_init, |
185 | .get_ro = csb726_mci_get_ro, | ||
186 | /* FIXME setpower */ | 140 | /* FIXME setpower */ |
187 | .exit = csb726_mci_exit, | 141 | .gpio_card_detect = CSB726_GPIO_MMC_DETECT, |
142 | .gpio_card_ro = CSB726_GPIO_MMC_RO, | ||
143 | .gpio_power = -1, | ||
188 | }; | 144 | }; |
189 | 145 | ||
190 | static struct pxaohci_platform_data csb726_ohci_platform_data = { | 146 | static struct pxaohci_platform_data csb726_ohci_platform_data = { |
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 9cd09465a0e8..e0121f4fcaf4 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -646,13 +646,16 @@ static int em_x270_mci_get_ro(struct device *dev) | |||
646 | } | 646 | } |
647 | 647 | ||
648 | static struct pxamci_platform_data em_x270_mci_platform_data = { | 648 | static struct pxamci_platform_data em_x270_mci_platform_data = { |
649 | .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23| | 649 | .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23| |
650 | MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27| | 650 | MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27| |
651 | MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30| | 651 | MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30| |
652 | MMC_VDD_30_31|MMC_VDD_31_32, | 652 | MMC_VDD_30_31|MMC_VDD_31_32, |
653 | .init = em_x270_mci_init, | 653 | .init = em_x270_mci_init, |
654 | .setpower = em_x270_mci_setpower, | 654 | .setpower = em_x270_mci_setpower, |
655 | .exit = em_x270_mci_exit, | 655 | .exit = em_x270_mci_exit, |
656 | .gpio_card_detect = -1, | ||
657 | .gpio_card_ro = -1, | ||
658 | .gpio_power = -1, | ||
656 | }; | 659 | }; |
657 | 660 | ||
658 | static void __init em_x270_init_mmc(void) | 661 | static void __init em_x270_init_mmc(void) |
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c index ca9912ea78d9..1708c0109844 100644 --- a/arch/arm/mach-pxa/gumstix.c +++ b/arch/arm/mach-pxa/gumstix.c | |||
@@ -88,7 +88,10 @@ static struct platform_device *devices[] __initdata = { | |||
88 | 88 | ||
89 | #ifdef CONFIG_MMC_PXA | 89 | #ifdef CONFIG_MMC_PXA |
90 | static struct pxamci_platform_data gumstix_mci_platform_data = { | 90 | static struct pxamci_platform_data gumstix_mci_platform_data = { |
91 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 91 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
92 | .gpio_card_detect = -1, | ||
93 | .gpio_card_ro = -1, | ||
94 | .gpio_power = -1, | ||
92 | }; | 95 | }; |
93 | 96 | ||
94 | static void __init gumstix_mmc_init(void) | 97 | static void __init gumstix_mmc_init(void) |
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c index b6243b59d9be..b6486ef20b17 100644 --- a/arch/arm/mach-pxa/idp.c +++ b/arch/arm/mach-pxa/idp.c | |||
@@ -168,7 +168,10 @@ static struct pxafb_mach_info sharp_lm8v31 = { | |||
168 | }; | 168 | }; |
169 | 169 | ||
170 | static struct pxamci_platform_data idp_mci_platform_data = { | 170 | static struct pxamci_platform_data idp_mci_platform_data = { |
171 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 171 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
172 | .gpio_card_detect = -1, | ||
173 | .gpio_card_ro = -1, | ||
174 | .gpio_power = -1, | ||
172 | }; | 175 | }; |
173 | 176 | ||
174 | static void __init idp_init(void) | 177 | static void __init idp_init(void) |
diff --git a/arch/arm/mach-pxa/imote2.c b/arch/arm/mach-pxa/imote2.c index 961807dc6467..2a4945db31c5 100644 --- a/arch/arm/mach-pxa/imote2.c +++ b/arch/arm/mach-pxa/imote2.c | |||
@@ -389,6 +389,9 @@ static int imote2_mci_get_ro(struct device *dev) | |||
389 | static struct pxamci_platform_data imote2_mci_platform_data = { | 389 | static struct pxamci_platform_data imote2_mci_platform_data = { |
390 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */ | 390 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */ |
391 | .get_ro = imote2_mci_get_ro, | 391 | .get_ro = imote2_mci_get_ro, |
392 | .gpio_card_detect = -1, | ||
393 | .gpio_card_ro = -1, | ||
394 | .gpio_power = -1, | ||
392 | }; | 395 | }; |
393 | 396 | ||
394 | static struct mtd_partition imote2flash_partitions[] = { | 397 | static struct mtd_partition imote2flash_partitions[] = { |
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index f04c8333dff7..1785cc9494d9 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -482,11 +482,14 @@ static void lubbock_mci_exit(struct device *dev, void *data) | |||
482 | } | 482 | } |
483 | 483 | ||
484 | static struct pxamci_platform_data lubbock_mci_platform_data = { | 484 | static struct pxamci_platform_data lubbock_mci_platform_data = { |
485 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 485 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
486 | .detect_delay = 1, | 486 | .detect_delay = 1, |
487 | .init = lubbock_mci_init, | 487 | .init = lubbock_mci_init, |
488 | .get_ro = lubbock_mci_get_ro, | 488 | .get_ro = lubbock_mci_get_ro, |
489 | .exit = lubbock_mci_exit, | 489 | .exit = lubbock_mci_exit, |
490 | .gpio_card_detect = -1, | ||
491 | .gpio_card_ro = -1, | ||
492 | .gpio_power = -1, | ||
490 | }; | 493 | }; |
491 | 494 | ||
492 | static void lubbock_irda_transceiver_mode(struct device *dev, int mode) | 495 | static void lubbock_irda_transceiver_mode(struct device *dev, int mode) |
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index ca39669cffc5..0daba43d7ca1 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -651,55 +651,24 @@ static struct platform_device bq24022 = { | |||
651 | static int magician_mci_init(struct device *dev, | 651 | static int magician_mci_init(struct device *dev, |
652 | irq_handler_t detect_irq, void *data) | 652 | irq_handler_t detect_irq, void *data) |
653 | { | 653 | { |
654 | int err; | 654 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, |
655 | |||
656 | err = request_irq(IRQ_MAGICIAN_SD, detect_irq, | ||
657 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, | 655 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, |
658 | "MMC card detect", data); | 656 | "mmc card detect", data); |
659 | if (err) | ||
660 | goto err_request_irq; | ||
661 | err = gpio_request(EGPIO_MAGICIAN_SD_POWER, "SD_POWER"); | ||
662 | if (err) | ||
663 | goto err_request_power; | ||
664 | err = gpio_request(EGPIO_MAGICIAN_nSD_READONLY, "nSD_READONLY"); | ||
665 | if (err) | ||
666 | goto err_request_readonly; | ||
667 | |||
668 | return 0; | ||
669 | |||
670 | err_request_readonly: | ||
671 | gpio_free(EGPIO_MAGICIAN_SD_POWER); | ||
672 | err_request_power: | ||
673 | free_irq(IRQ_MAGICIAN_SD, data); | ||
674 | err_request_irq: | ||
675 | return err; | ||
676 | } | ||
677 | |||
678 | static void magician_mci_setpower(struct device *dev, unsigned int vdd) | ||
679 | { | ||
680 | struct pxamci_platform_data *pdata = dev->platform_data; | ||
681 | |||
682 | gpio_set_value(EGPIO_MAGICIAN_SD_POWER, (1 << vdd) & pdata->ocr_mask); | ||
683 | } | ||
684 | |||
685 | static int magician_mci_get_ro(struct device *dev) | ||
686 | { | ||
687 | return (!gpio_get_value(EGPIO_MAGICIAN_nSD_READONLY)); | ||
688 | } | 657 | } |
689 | 658 | ||
690 | static void magician_mci_exit(struct device *dev, void *data) | 659 | static void magician_mci_exit(struct device *dev, void *data) |
691 | { | 660 | { |
692 | gpio_free(EGPIO_MAGICIAN_nSD_READONLY); | ||
693 | gpio_free(EGPIO_MAGICIAN_SD_POWER); | ||
694 | free_irq(IRQ_MAGICIAN_SD, data); | 661 | free_irq(IRQ_MAGICIAN_SD, data); |
695 | } | 662 | } |
696 | 663 | ||
697 | static struct pxamci_platform_data magician_mci_info = { | 664 | static struct pxamci_platform_data magician_mci_info = { |
698 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 665 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
699 | .init = magician_mci_init, | 666 | .init = magician_mci_init, |
700 | .get_ro = magician_mci_get_ro, | 667 | .exit = magician_mci_exit, |
701 | .setpower = magician_mci_setpower, | 668 | .gpio_card_detect = -1, |
702 | .exit = magician_mci_exit, | 669 | .gpio_card_ro = EGPIO_MAGICIAN_nSD_READONLY, |
670 | .gpio_card_ro_invert = 1, | ||
671 | .gpio_power = EGPIO_MAGICIAN_SD_POWER, | ||
703 | }; | 672 | }; |
704 | 673 | ||
705 | 674 | ||
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index f4dabf0273ca..f7dc23078ce3 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -450,10 +450,13 @@ static void mainstone_mci_exit(struct device *dev, void *data) | |||
450 | } | 450 | } |
451 | 451 | ||
452 | static struct pxamci_platform_data mainstone_mci_platform_data = { | 452 | static struct pxamci_platform_data mainstone_mci_platform_data = { |
453 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 453 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
454 | .init = mainstone_mci_init, | 454 | .init = mainstone_mci_init, |
455 | .setpower = mainstone_mci_setpower, | 455 | .setpower = mainstone_mci_setpower, |
456 | .exit = mainstone_mci_exit, | 456 | .exit = mainstone_mci_exit, |
457 | .gpio_card_detect = -1, | ||
458 | .gpio_card_ro = -1, | ||
459 | .gpio_power = -1, | ||
457 | }; | 460 | }; |
458 | 461 | ||
459 | static void mainstone_irda_transceiver_mode(struct device *dev, int mode) | 462 | static void mainstone_irda_transceiver_mode(struct device *dev, int mode) |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 2d28132c725b..a8122ecd2a3a 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -434,72 +434,15 @@ struct gpio_vbus_mach_info gpio_vbus_data = { | |||
434 | /* | 434 | /* |
435 | * SDIO/MMC Card controller | 435 | * SDIO/MMC Card controller |
436 | */ | 436 | */ |
437 | static void mci_setpower(struct device *dev, unsigned int vdd) | ||
438 | { | ||
439 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
440 | |||
441 | if ((1 << vdd) & p_d->ocr_mask) | ||
442 | gpio_set_value(GPIO91_SDIO_EN, 1); /* enable SDIO power */ | ||
443 | else | ||
444 | gpio_set_value(GPIO91_SDIO_EN, 0); /* disable SDIO power */ | ||
445 | } | ||
446 | |||
447 | static int mci_get_ro(struct device *dev) | ||
448 | { | ||
449 | return gpio_get_value(GPIO78_SDIO_RO); | ||
450 | } | ||
451 | |||
452 | struct gpio_ress mci_gpios[] = { | ||
453 | MIO_GPIO_IN(GPIO78_SDIO_RO, "SDIO readonly detect"), | ||
454 | MIO_GPIO_IN(GPIO15_SDIO_INSERT, "SDIO insertion detect"), | ||
455 | MIO_GPIO_OUT(GPIO91_SDIO_EN, 0, "SDIO power enable") | ||
456 | }; | ||
457 | |||
458 | static void mci_exit(struct device *dev, void *data) | ||
459 | { | ||
460 | mio_gpio_free(ARRAY_AND_SIZE(mci_gpios)); | ||
461 | free_irq(gpio_to_irq(GPIO15_SDIO_INSERT), data); | ||
462 | } | ||
463 | |||
464 | static struct pxamci_platform_data mioa701_mci_info; | ||
465 | |||
466 | /** | 437 | /** |
467 | * The card detect interrupt isn't debounced so we delay it by 250ms | 438 | * The card detect interrupt isn't debounced so we delay it by 250ms |
468 | * to give the card a chance to fully insert/eject. | 439 | * to give the card a chance to fully insert/eject. |
469 | */ | 440 | */ |
470 | static int mci_init(struct device *dev, irq_handler_t detect_int, void *data) | ||
471 | { | ||
472 | int rc; | ||
473 | int irq = gpio_to_irq(GPIO15_SDIO_INSERT); | ||
474 | |||
475 | rc = mio_gpio_request(ARRAY_AND_SIZE(mci_gpios)); | ||
476 | if (rc) | ||
477 | goto err_gpio; | ||
478 | /* enable RE/FE interrupt on card insertion and removal */ | ||
479 | rc = request_irq(irq, detect_int, | ||
480 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
481 | IRQF_TRIGGER_FALLING, | ||
482 | "MMC card detect", data); | ||
483 | if (rc) | ||
484 | goto err_irq; | ||
485 | |||
486 | mioa701_mci_info.detect_delay = msecs_to_jiffies(250); | ||
487 | return 0; | ||
488 | |||
489 | err_irq: | ||
490 | dev_err(dev, "mioa701_mci_init: MMC/SD:" | ||
491 | " can't request MMC card detect IRQ\n"); | ||
492 | mio_gpio_free(ARRAY_AND_SIZE(mci_gpios)); | ||
493 | err_gpio: | ||
494 | return rc; | ||
495 | } | ||
496 | |||
497 | static struct pxamci_platform_data mioa701_mci_info = { | 441 | static struct pxamci_platform_data mioa701_mci_info = { |
498 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 442 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
499 | .init = mci_init, | 443 | .gpio_card_detect = GPIO15_SDIO_INSERT, |
500 | .get_ro = mci_get_ro, | 444 | .gpio_card_ro = GPIO78_SDIO_RO, |
501 | .setpower = mci_setpower, | 445 | .gpio_power = GPIO91_SDIO_EN, |
502 | .exit = mci_exit, | ||
503 | }; | 446 | }; |
504 | 447 | ||
505 | /* FlashRAM */ | 448 | /* FlashRAM */ |
@@ -841,7 +784,7 @@ static void mioa701_restart(char c, const char *cmd) | |||
841 | static struct gpio_ress global_gpios[] = { | 784 | static struct gpio_ress global_gpios[] = { |
842 | MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"), | 785 | MIO_GPIO_OUT(GPIO9_CHARGE_EN, 1, "Charger enable"), |
843 | MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), | 786 | MIO_GPIO_OUT(GPIO18_POWEROFF, 0, "Power Off"), |
844 | MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power") | 787 | MIO_GPIO_OUT(GPIO87_LCD_POWER, 0, "LCD Power"), |
845 | }; | 788 | }; |
846 | 789 | ||
847 | static void __init mioa701_machine_init(void) | 790 | static void __init mioa701_machine_init(void) |
@@ -855,6 +798,7 @@ static void __init mioa701_machine_init(void) | |||
855 | mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); | 798 | mio_gpio_request(ARRAY_AND_SIZE(global_gpios)); |
856 | bootstrap_init(); | 799 | bootstrap_init(); |
857 | set_pxa_fb_info(&mioa701_pxafb_info); | 800 | set_pxa_fb_info(&mioa701_pxafb_info); |
801 | mioa701_mci_info.detect_delay = msecs_to_jiffies(250); | ||
858 | pxa_set_mci_info(&mioa701_mci_info); | 802 | pxa_set_mci_info(&mioa701_mci_info); |
859 | pxa_set_keypad_info(&mioa701_keypad_info); | 803 | pxa_set_keypad_info(&mioa701_keypad_info); |
860 | wm97xx_bat_set_pdata(&mioa701_battery_data); | 804 | wm97xx_bat_set_pdata(&mioa701_battery_data); |
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 169fcc18154e..445749198cd8 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c | |||
@@ -143,83 +143,11 @@ static unsigned long palmld_pin_config[] __initdata = { | |||
143 | /****************************************************************************** | 143 | /****************************************************************************** |
144 | * SD/MMC card controller | 144 | * SD/MMC card controller |
145 | ******************************************************************************/ | 145 | ******************************************************************************/ |
146 | static int palmld_mci_init(struct device *dev, irq_handler_t palmld_detect_int, | ||
147 | void *data) | ||
148 | { | ||
149 | int err = 0; | ||
150 | |||
151 | /* Setup an interrupt for detecting card insert/remove events */ | ||
152 | err = gpio_request(GPIO_NR_PALMLD_SD_DETECT_N, "SD IRQ"); | ||
153 | if (err) | ||
154 | goto err; | ||
155 | err = gpio_direction_input(GPIO_NR_PALMLD_SD_DETECT_N); | ||
156 | if (err) | ||
157 | goto err2; | ||
158 | err = request_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), | ||
159 | palmld_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
160 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
161 | "SD/MMC card detect", data); | ||
162 | if (err) { | ||
163 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", | ||
164 | __func__); | ||
165 | goto err2; | ||
166 | } | ||
167 | |||
168 | err = gpio_request(GPIO_NR_PALMLD_SD_POWER, "SD_POWER"); | ||
169 | if (err) | ||
170 | goto err3; | ||
171 | err = gpio_direction_output(GPIO_NR_PALMLD_SD_POWER, 0); | ||
172 | if (err) | ||
173 | goto err4; | ||
174 | |||
175 | err = gpio_request(GPIO_NR_PALMLD_SD_READONLY, "SD_READONLY"); | ||
176 | if (err) | ||
177 | goto err4; | ||
178 | err = gpio_direction_input(GPIO_NR_PALMLD_SD_READONLY); | ||
179 | if (err) | ||
180 | goto err5; | ||
181 | |||
182 | printk(KERN_DEBUG "%s: irq registered\n", __func__); | ||
183 | |||
184 | return 0; | ||
185 | |||
186 | err5: | ||
187 | gpio_free(GPIO_NR_PALMLD_SD_READONLY); | ||
188 | err4: | ||
189 | gpio_free(GPIO_NR_PALMLD_SD_POWER); | ||
190 | err3: | ||
191 | free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); | ||
192 | err2: | ||
193 | gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); | ||
194 | err: | ||
195 | return err; | ||
196 | } | ||
197 | |||
198 | static void palmld_mci_exit(struct device *dev, void *data) | ||
199 | { | ||
200 | gpio_free(GPIO_NR_PALMLD_SD_READONLY); | ||
201 | gpio_free(GPIO_NR_PALMLD_SD_POWER); | ||
202 | free_irq(gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N), data); | ||
203 | gpio_free(GPIO_NR_PALMLD_SD_DETECT_N); | ||
204 | } | ||
205 | |||
206 | static void palmld_mci_power(struct device *dev, unsigned int vdd) | ||
207 | { | ||
208 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
209 | gpio_set_value(GPIO_NR_PALMLD_SD_POWER, p_d->ocr_mask & (1 << vdd)); | ||
210 | } | ||
211 | |||
212 | static int palmld_mci_get_ro(struct device *dev) | ||
213 | { | ||
214 | return gpio_get_value(GPIO_NR_PALMLD_SD_READONLY); | ||
215 | } | ||
216 | |||
217 | static struct pxamci_platform_data palmld_mci_platform_data = { | 146 | static struct pxamci_platform_data palmld_mci_platform_data = { |
218 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 147 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
219 | .setpower = palmld_mci_power, | 148 | .gpio_card_detect = GPIO_NR_PALMLD_SD_DETECT_N, |
220 | .get_ro = palmld_mci_get_ro, | 149 | .gpio_card_ro = GPIO_NR_PALMLD_SD_READONLY, |
221 | .init = palmld_mci_init, | 150 | .gpio_power = GPIO_NR_PALMLD_SD_POWER, |
222 | .exit = palmld_mci_exit, | ||
223 | }; | 151 | }; |
224 | 152 | ||
225 | /****************************************************************************** | 153 | /****************************************************************************** |
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 33f726ff55e5..42d0528d3e9e 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -124,83 +124,11 @@ static unsigned long palmt5_pin_config[] __initdata = { | |||
124 | /****************************************************************************** | 124 | /****************************************************************************** |
125 | * SD/MMC card controller | 125 | * SD/MMC card controller |
126 | ******************************************************************************/ | 126 | ******************************************************************************/ |
127 | static int palmt5_mci_init(struct device *dev, irq_handler_t palmt5_detect_int, | ||
128 | void *data) | ||
129 | { | ||
130 | int err = 0; | ||
131 | |||
132 | /* Setup an interrupt for detecting card insert/remove events */ | ||
133 | err = gpio_request(GPIO_NR_PALMT5_SD_DETECT_N, "SD IRQ"); | ||
134 | if (err) | ||
135 | goto err; | ||
136 | err = gpio_direction_input(GPIO_NR_PALMT5_SD_DETECT_N); | ||
137 | if (err) | ||
138 | goto err2; | ||
139 | err = request_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), | ||
140 | palmt5_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
141 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
142 | "SD/MMC card detect", data); | ||
143 | if (err) { | ||
144 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", | ||
145 | __func__); | ||
146 | goto err2; | ||
147 | } | ||
148 | |||
149 | err = gpio_request(GPIO_NR_PALMT5_SD_POWER, "SD_POWER"); | ||
150 | if (err) | ||
151 | goto err3; | ||
152 | err = gpio_direction_output(GPIO_NR_PALMT5_SD_POWER, 0); | ||
153 | if (err) | ||
154 | goto err4; | ||
155 | |||
156 | err = gpio_request(GPIO_NR_PALMT5_SD_READONLY, "SD_READONLY"); | ||
157 | if (err) | ||
158 | goto err4; | ||
159 | err = gpio_direction_input(GPIO_NR_PALMT5_SD_READONLY); | ||
160 | if (err) | ||
161 | goto err5; | ||
162 | |||
163 | printk(KERN_DEBUG "%s: irq registered\n", __func__); | ||
164 | |||
165 | return 0; | ||
166 | |||
167 | err5: | ||
168 | gpio_free(GPIO_NR_PALMT5_SD_READONLY); | ||
169 | err4: | ||
170 | gpio_free(GPIO_NR_PALMT5_SD_POWER); | ||
171 | err3: | ||
172 | free_irq(gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N), data); | ||
173 | err2: | ||
174 | gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); | ||
175 | err: | ||
176 | return err; | ||
177 | } | ||
178 | |||
179 | static void palmt5_mci_exit(struct device *dev, void *data) | ||
180 | { | ||
181 | gpio_free(GPIO_NR_PALMT5_SD_READONLY); | ||
182 | gpio_free(GPIO_NR_PALMT5_SD_POWER); | ||
183 | free_irq(IRQ_GPIO_PALMT5_SD_DETECT_N, data); | ||
184 | gpio_free(GPIO_NR_PALMT5_SD_DETECT_N); | ||
185 | } | ||
186 | |||
187 | static void palmt5_mci_power(struct device *dev, unsigned int vdd) | ||
188 | { | ||
189 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
190 | gpio_set_value(GPIO_NR_PALMT5_SD_POWER, p_d->ocr_mask & (1 << vdd)); | ||
191 | } | ||
192 | |||
193 | static int palmt5_mci_get_ro(struct device *dev) | ||
194 | { | ||
195 | return gpio_get_value(GPIO_NR_PALMT5_SD_READONLY); | ||
196 | } | ||
197 | |||
198 | static struct pxamci_platform_data palmt5_mci_platform_data = { | 127 | static struct pxamci_platform_data palmt5_mci_platform_data = { |
199 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 128 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
200 | .setpower = palmt5_mci_power, | 129 | .gpio_card_detect = GPIO_NR_PALMT5_SD_DETECT_N, |
201 | .get_ro = palmt5_mci_get_ro, | 130 | .gpio_card_ro = GPIO_NR_PALMT5_SD_READONLY, |
202 | .init = palmt5_mci_init, | 131 | .gpio_power = GPIO_NR_PALMT5_SD_POWER, |
203 | .exit = palmt5_mci_exit, | ||
204 | }; | 132 | }; |
205 | 133 | ||
206 | /****************************************************************************** | 134 | /****************************************************************************** |
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c index d823b09801df..d9ef76c9278f 100644 --- a/arch/arm/mach-pxa/palmte2.c +++ b/arch/arm/mach-pxa/palmte2.c | |||
@@ -117,83 +117,11 @@ static unsigned long palmte2_pin_config[] __initdata = { | |||
117 | /****************************************************************************** | 117 | /****************************************************************************** |
118 | * SD/MMC card controller | 118 | * SD/MMC card controller |
119 | ******************************************************************************/ | 119 | ******************************************************************************/ |
120 | static int palmte2_mci_init(struct device *dev, | ||
121 | irq_handler_t palmte2_detect_int, void *data) | ||
122 | { | ||
123 | int err = 0; | ||
124 | |||
125 | /* Setup an interrupt for detecting card insert/remove events */ | ||
126 | err = gpio_request(GPIO_NR_PALMTE2_SD_DETECT_N, "SD IRQ"); | ||
127 | if (err) | ||
128 | goto err; | ||
129 | err = gpio_direction_input(GPIO_NR_PALMTE2_SD_DETECT_N); | ||
130 | if (err) | ||
131 | goto err2; | ||
132 | err = request_irq(gpio_to_irq(GPIO_NR_PALMTE2_SD_DETECT_N), | ||
133 | palmte2_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
134 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
135 | "SD/MMC card detect", data); | ||
136 | if (err) { | ||
137 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", | ||
138 | __func__); | ||
139 | goto err2; | ||
140 | } | ||
141 | |||
142 | err = gpio_request(GPIO_NR_PALMTE2_SD_POWER, "SD_POWER"); | ||
143 | if (err) | ||
144 | goto err3; | ||
145 | err = gpio_direction_output(GPIO_NR_PALMTE2_SD_POWER, 0); | ||
146 | if (err) | ||
147 | goto err4; | ||
148 | |||
149 | err = gpio_request(GPIO_NR_PALMTE2_SD_READONLY, "SD_READONLY"); | ||
150 | if (err) | ||
151 | goto err4; | ||
152 | err = gpio_direction_input(GPIO_NR_PALMTE2_SD_READONLY); | ||
153 | if (err) | ||
154 | goto err5; | ||
155 | |||
156 | printk(KERN_DEBUG "%s: irq registered\n", __func__); | ||
157 | |||
158 | return 0; | ||
159 | |||
160 | err5: | ||
161 | gpio_free(GPIO_NR_PALMTE2_SD_READONLY); | ||
162 | err4: | ||
163 | gpio_free(GPIO_NR_PALMTE2_SD_POWER); | ||
164 | err3: | ||
165 | free_irq(gpio_to_irq(GPIO_NR_PALMTE2_SD_DETECT_N), data); | ||
166 | err2: | ||
167 | gpio_free(GPIO_NR_PALMTE2_SD_DETECT_N); | ||
168 | err: | ||
169 | return err; | ||
170 | } | ||
171 | |||
172 | static void palmte2_mci_exit(struct device *dev, void *data) | ||
173 | { | ||
174 | gpio_free(GPIO_NR_PALMTE2_SD_READONLY); | ||
175 | gpio_free(GPIO_NR_PALMTE2_SD_POWER); | ||
176 | free_irq(gpio_to_irq(GPIO_NR_PALMTE2_SD_DETECT_N), data); | ||
177 | gpio_free(GPIO_NR_PALMTE2_SD_DETECT_N); | ||
178 | } | ||
179 | |||
180 | static void palmte2_mci_power(struct device *dev, unsigned int vdd) | ||
181 | { | ||
182 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
183 | gpio_set_value(GPIO_NR_PALMTE2_SD_POWER, p_d->ocr_mask & (1 << vdd)); | ||
184 | } | ||
185 | |||
186 | static int palmte2_mci_get_ro(struct device *dev) | ||
187 | { | ||
188 | return gpio_get_value(GPIO_NR_PALMTE2_SD_READONLY); | ||
189 | } | ||
190 | |||
191 | static struct pxamci_platform_data palmte2_mci_platform_data = { | 120 | static struct pxamci_platform_data palmte2_mci_platform_data = { |
192 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 121 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
193 | .setpower = palmte2_mci_power, | 122 | .gpio_card_detect = GPIO_NR_PALMTE2_SD_DETECT_N, |
194 | .get_ro = palmte2_mci_get_ro, | 123 | .gpio_card_ro = GPIO_NR_PALMTE2_SD_READONLY, |
195 | .init = palmte2_mci_init, | 124 | .gpio_power = GPIO_NR_PALMTE2_SD_POWER, |
196 | .exit = palmte2_mci_exit, | ||
197 | }; | 125 | }; |
198 | 126 | ||
199 | /****************************************************************************** | 127 | /****************************************************************************** |
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index 83d020879581..4a9ca718962f 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c | |||
@@ -140,83 +140,11 @@ static unsigned long palmtx_pin_config[] __initdata = { | |||
140 | /****************************************************************************** | 140 | /****************************************************************************** |
141 | * SD/MMC card controller | 141 | * SD/MMC card controller |
142 | ******************************************************************************/ | 142 | ******************************************************************************/ |
143 | static int palmtx_mci_init(struct device *dev, irq_handler_t palmtx_detect_int, | ||
144 | void *data) | ||
145 | { | ||
146 | int err = 0; | ||
147 | |||
148 | /* Setup an interrupt for detecting card insert/remove events */ | ||
149 | err = gpio_request(GPIO_NR_PALMTX_SD_DETECT_N, "SD IRQ"); | ||
150 | if (err) | ||
151 | goto err; | ||
152 | err = gpio_direction_input(GPIO_NR_PALMTX_SD_DETECT_N); | ||
153 | if (err) | ||
154 | goto err2; | ||
155 | err = request_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), | ||
156 | palmtx_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
157 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
158 | "SD/MMC card detect", data); | ||
159 | if (err) { | ||
160 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", | ||
161 | __func__); | ||
162 | goto err2; | ||
163 | } | ||
164 | |||
165 | err = gpio_request(GPIO_NR_PALMTX_SD_POWER, "SD_POWER"); | ||
166 | if (err) | ||
167 | goto err3; | ||
168 | err = gpio_direction_output(GPIO_NR_PALMTX_SD_POWER, 0); | ||
169 | if (err) | ||
170 | goto err4; | ||
171 | |||
172 | err = gpio_request(GPIO_NR_PALMTX_SD_READONLY, "SD_READONLY"); | ||
173 | if (err) | ||
174 | goto err4; | ||
175 | err = gpio_direction_input(GPIO_NR_PALMTX_SD_READONLY); | ||
176 | if (err) | ||
177 | goto err5; | ||
178 | |||
179 | printk(KERN_DEBUG "%s: irq registered\n", __func__); | ||
180 | |||
181 | return 0; | ||
182 | |||
183 | err5: | ||
184 | gpio_free(GPIO_NR_PALMTX_SD_READONLY); | ||
185 | err4: | ||
186 | gpio_free(GPIO_NR_PALMTX_SD_POWER); | ||
187 | err3: | ||
188 | free_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), data); | ||
189 | err2: | ||
190 | gpio_free(GPIO_NR_PALMTX_SD_DETECT_N); | ||
191 | err: | ||
192 | return err; | ||
193 | } | ||
194 | |||
195 | static void palmtx_mci_exit(struct device *dev, void *data) | ||
196 | { | ||
197 | gpio_free(GPIO_NR_PALMTX_SD_READONLY); | ||
198 | gpio_free(GPIO_NR_PALMTX_SD_POWER); | ||
199 | free_irq(gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N), data); | ||
200 | gpio_free(GPIO_NR_PALMTX_SD_DETECT_N); | ||
201 | } | ||
202 | |||
203 | static void palmtx_mci_power(struct device *dev, unsigned int vdd) | ||
204 | { | ||
205 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
206 | gpio_set_value(GPIO_NR_PALMTX_SD_POWER, p_d->ocr_mask & (1 << vdd)); | ||
207 | } | ||
208 | |||
209 | static int palmtx_mci_get_ro(struct device *dev) | ||
210 | { | ||
211 | return gpio_get_value(GPIO_NR_PALMTX_SD_READONLY); | ||
212 | } | ||
213 | |||
214 | static struct pxamci_platform_data palmtx_mci_platform_data = { | 143 | static struct pxamci_platform_data palmtx_mci_platform_data = { |
215 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 144 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
216 | .setpower = palmtx_mci_power, | 145 | .gpio_card_detect = GPIO_NR_PALMTX_SD_DETECT_N, |
217 | .get_ro = palmtx_mci_get_ro, | 146 | .gpio_card_ro = GPIO_NR_PALMTX_SD_READONLY, |
218 | .init = palmtx_mci_init, | 147 | .gpio_power = GPIO_NR_PALMTX_SD_POWER, |
219 | .exit = palmtx_mci_exit, | ||
220 | }; | 148 | }; |
221 | 149 | ||
222 | /****************************************************************************** | 150 | /****************************************************************************** |
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c index c3645aa3fa3d..d8fa53c19178 100644 --- a/arch/arm/mach-pxa/palmz72.c +++ b/arch/arm/mach-pxa/palmz72.c | |||
@@ -129,88 +129,14 @@ static unsigned long palmz72_pin_config[] __initdata = { | |||
129 | /****************************************************************************** | 129 | /****************************************************************************** |
130 | * SD/MMC card controller | 130 | * SD/MMC card controller |
131 | ******************************************************************************/ | 131 | ******************************************************************************/ |
132 | static int palmz72_mci_init(struct device *dev, | 132 | /* SD_POWER is not actually power, but it is more like chip |
133 | irq_handler_t palmz72_detect_int, void *data) | 133 | * select, i.e. it is inverted */ |
134 | { | ||
135 | int err = 0; | ||
136 | |||
137 | /* Setup an interrupt for detecting card insert/remove events */ | ||
138 | err = gpio_request(GPIO_NR_PALMZ72_SD_DETECT_N, "SD IRQ"); | ||
139 | if (err) | ||
140 | goto err; | ||
141 | err = gpio_direction_input(GPIO_NR_PALMZ72_SD_DETECT_N); | ||
142 | if (err) | ||
143 | goto err2; | ||
144 | err = request_irq(gpio_to_irq(GPIO_NR_PALMZ72_SD_DETECT_N), | ||
145 | palmz72_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
146 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
147 | "SD/MMC card detect", data); | ||
148 | if (err) { | ||
149 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", | ||
150 | __func__); | ||
151 | goto err2; | ||
152 | } | ||
153 | |||
154 | /* SD_POWER is not actually power, but it is more like chip | ||
155 | * select, i.e. it is inverted */ | ||
156 | |||
157 | err = gpio_request(GPIO_NR_PALMZ72_SD_POWER_N, "SD_POWER"); | ||
158 | if (err) | ||
159 | goto err3; | ||
160 | err = gpio_direction_output(GPIO_NR_PALMZ72_SD_POWER_N, 0); | ||
161 | if (err) | ||
162 | goto err4; | ||
163 | err = gpio_request(GPIO_NR_PALMZ72_SD_RO, "SD_RO"); | ||
164 | if (err) | ||
165 | goto err4; | ||
166 | err = gpio_direction_input(GPIO_NR_PALMZ72_SD_RO); | ||
167 | if (err) | ||
168 | goto err5; | ||
169 | |||
170 | printk(KERN_DEBUG "%s: irq registered\n", __func__); | ||
171 | |||
172 | return 0; | ||
173 | |||
174 | err5: | ||
175 | gpio_free(GPIO_NR_PALMZ72_SD_RO); | ||
176 | err4: | ||
177 | gpio_free(GPIO_NR_PALMZ72_SD_POWER_N); | ||
178 | err3: | ||
179 | free_irq(gpio_to_irq(GPIO_NR_PALMZ72_SD_DETECT_N), data); | ||
180 | err2: | ||
181 | gpio_free(GPIO_NR_PALMZ72_SD_DETECT_N); | ||
182 | err: | ||
183 | return err; | ||
184 | } | ||
185 | |||
186 | static void palmz72_mci_exit(struct device *dev, void *data) | ||
187 | { | ||
188 | gpio_free(GPIO_NR_PALMZ72_SD_POWER_N); | ||
189 | free_irq(gpio_to_irq(GPIO_NR_PALMZ72_SD_DETECT_N), data); | ||
190 | gpio_free(GPIO_NR_PALMZ72_SD_DETECT_N); | ||
191 | gpio_free(GPIO_NR_PALMZ72_SD_RO); | ||
192 | } | ||
193 | |||
194 | static void palmz72_mci_power(struct device *dev, unsigned int vdd) | ||
195 | { | ||
196 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
197 | if (p_d->ocr_mask & (1 << vdd)) | ||
198 | gpio_set_value(GPIO_NR_PALMZ72_SD_POWER_N, 0); | ||
199 | else | ||
200 | gpio_set_value(GPIO_NR_PALMZ72_SD_POWER_N, 1); | ||
201 | } | ||
202 | |||
203 | static int palmz72_mci_ro(struct device *dev) | ||
204 | { | ||
205 | return gpio_get_value(GPIO_NR_PALMZ72_SD_RO); | ||
206 | } | ||
207 | |||
208 | static struct pxamci_platform_data palmz72_mci_platform_data = { | 134 | static struct pxamci_platform_data palmz72_mci_platform_data = { |
209 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 135 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
210 | .setpower = palmz72_mci_power, | 136 | .gpio_card_detect = GPIO_NR_PALMZ72_SD_DETECT_N, |
211 | .get_ro = palmz72_mci_ro, | 137 | .gpio_card_ro = GPIO_NR_PALMZ72_SD_RO, |
212 | .init = palmz72_mci_init, | 138 | .gpio_power = GPIO_NR_PALMZ72_SD_POWER_N, |
213 | .exit = palmz72_mci_exit, | 139 | .gpio_power_invert = 1, |
214 | }; | 140 | }; |
215 | 141 | ||
216 | /****************************************************************************** | 142 | /****************************************************************************** |
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index 01791d74e08e..e211633471f7 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -321,11 +321,14 @@ static void pcm990_mci_exit(struct device *dev, void *data) | |||
321 | #define MSECS_PER_JIFFY (1000/HZ) | 321 | #define MSECS_PER_JIFFY (1000/HZ) |
322 | 322 | ||
323 | static struct pxamci_platform_data pcm990_mci_platform_data = { | 323 | static struct pxamci_platform_data pcm990_mci_platform_data = { |
324 | .detect_delay = 250 / MSECS_PER_JIFFY, | 324 | .detect_delay = 250 / MSECS_PER_JIFFY, |
325 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 325 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
326 | .init = pcm990_mci_init, | 326 | .init = pcm990_mci_init, |
327 | .setpower = pcm990_mci_setpower, | 327 | .setpower = pcm990_mci_setpower, |
328 | .exit = pcm990_mci_exit, | 328 | .exit = pcm990_mci_exit, |
329 | .gpio_card_detect = -1, | ||
330 | .gpio_card_ro = -1, | ||
331 | .gpio_power = -1, | ||
329 | }; | 332 | }; |
330 | 333 | ||
331 | static struct pxaohci_platform_data pcm990_ohci_platform_data = { | 334 | static struct pxaohci_platform_data pcm990_ohci_platform_data = { |
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 9352d4a34837..333b1dc2dd3e 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -245,20 +245,10 @@ static inline void poodle_init_spi(void) {} | |||
245 | * The card detect interrupt isn't debounced so we delay it by 250ms | 245 | * The card detect interrupt isn't debounced so we delay it by 250ms |
246 | * to give the card a chance to fully insert/eject. | 246 | * to give the card a chance to fully insert/eject. |
247 | */ | 247 | */ |
248 | static struct pxamci_platform_data poodle_mci_platform_data; | ||
249 | |||
250 | static int poodle_mci_init(struct device *dev, irq_handler_t poodle_detect_int, void *data) | 248 | static int poodle_mci_init(struct device *dev, irq_handler_t poodle_detect_int, void *data) |
251 | { | 249 | { |
252 | int err; | 250 | int err; |
253 | 251 | ||
254 | err = gpio_request(POODLE_GPIO_nSD_DETECT, "nSD_DETECT"); | ||
255 | if (err) | ||
256 | goto err_out; | ||
257 | |||
258 | err = gpio_request(POODLE_GPIO_nSD_WP, "nSD_WP"); | ||
259 | if (err) | ||
260 | goto err_free_1; | ||
261 | |||
262 | err = gpio_request(POODLE_GPIO_SD_PWR, "SD_PWR"); | 252 | err = gpio_request(POODLE_GPIO_SD_PWR, "SD_PWR"); |
263 | if (err) | 253 | if (err) |
264 | goto err_free_2; | 254 | goto err_free_2; |
@@ -267,34 +257,14 @@ static int poodle_mci_init(struct device *dev, irq_handler_t poodle_detect_int, | |||
267 | if (err) | 257 | if (err) |
268 | goto err_free_3; | 258 | goto err_free_3; |
269 | 259 | ||
270 | gpio_direction_input(POODLE_GPIO_nSD_DETECT); | ||
271 | gpio_direction_input(POODLE_GPIO_nSD_WP); | ||
272 | |||
273 | gpio_direction_output(POODLE_GPIO_SD_PWR, 0); | 260 | gpio_direction_output(POODLE_GPIO_SD_PWR, 0); |
274 | gpio_direction_output(POODLE_GPIO_SD_PWR1, 0); | 261 | gpio_direction_output(POODLE_GPIO_SD_PWR1, 0); |
275 | 262 | ||
276 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
277 | |||
278 | err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int, | ||
279 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
280 | "MMC card detect", data); | ||
281 | if (err) { | ||
282 | pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n", | ||
283 | __func__); | ||
284 | goto err_free_4; | ||
285 | } | ||
286 | |||
287 | return 0; | 263 | return 0; |
288 | 264 | ||
289 | err_free_4: | ||
290 | gpio_free(POODLE_GPIO_SD_PWR1); | ||
291 | err_free_3: | 265 | err_free_3: |
292 | gpio_free(POODLE_GPIO_SD_PWR); | 266 | gpio_free(POODLE_GPIO_SD_PWR); |
293 | err_free_2: | 267 | err_free_2: |
294 | gpio_free(POODLE_GPIO_nSD_WP); | ||
295 | err_free_1: | ||
296 | gpio_free(POODLE_GPIO_nSD_DETECT); | ||
297 | err_out: | ||
298 | return err; | 268 | return err; |
299 | } | 269 | } |
300 | 270 | ||
@@ -312,28 +282,20 @@ static void poodle_mci_setpower(struct device *dev, unsigned int vdd) | |||
312 | } | 282 | } |
313 | } | 283 | } |
314 | 284 | ||
315 | static int poodle_mci_get_ro(struct device *dev) | ||
316 | { | ||
317 | return !!gpio_get_value(POODLE_GPIO_nSD_WP); | ||
318 | return GPLR(POODLE_GPIO_nSD_WP) & GPIO_bit(POODLE_GPIO_nSD_WP); | ||
319 | } | ||
320 | |||
321 | |||
322 | static void poodle_mci_exit(struct device *dev, void *data) | 285 | static void poodle_mci_exit(struct device *dev, void *data) |
323 | { | 286 | { |
324 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); | ||
325 | gpio_free(POODLE_GPIO_SD_PWR1); | 287 | gpio_free(POODLE_GPIO_SD_PWR1); |
326 | gpio_free(POODLE_GPIO_SD_PWR); | 288 | gpio_free(POODLE_GPIO_SD_PWR); |
327 | gpio_free(POODLE_GPIO_nSD_WP); | ||
328 | gpio_free(POODLE_GPIO_nSD_DETECT); | ||
329 | } | 289 | } |
330 | 290 | ||
331 | static struct pxamci_platform_data poodle_mci_platform_data = { | 291 | static struct pxamci_platform_data poodle_mci_platform_data = { |
332 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 292 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
333 | .init = poodle_mci_init, | 293 | .init = poodle_mci_init, |
334 | .get_ro = poodle_mci_get_ro, | 294 | .setpower = poodle_mci_setpower, |
335 | .setpower = poodle_mci_setpower, | 295 | .exit = poodle_mci_exit, |
336 | .exit = poodle_mci_exit, | 296 | .gpio_card_detect = POODLE_IRQ_GPIO_nSD_DETECT, |
297 | .gpio_card_ro = POODLE_GPIO_nSD_WP, | ||
298 | .gpio_power = -1, | ||
337 | }; | 299 | }; |
338 | 300 | ||
339 | 301 | ||
@@ -521,6 +483,7 @@ static void __init poodle_init(void) | |||
521 | set_pxa_fb_parent(&poodle_locomo_device.dev); | 483 | set_pxa_fb_parent(&poodle_locomo_device.dev); |
522 | set_pxa_fb_info(&poodle_fb_info); | 484 | set_pxa_fb_info(&poodle_fb_info); |
523 | pxa_set_udc_info(&udc_info); | 485 | pxa_set_udc_info(&udc_info); |
486 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
524 | pxa_set_mci_info(&poodle_mci_platform_data); | 487 | pxa_set_mci_info(&poodle_mci_platform_data); |
525 | pxa_set_ficp_info(&poodle_ficp_platform_data); | 488 | pxa_set_ficp_info(&poodle_ficp_platform_data); |
526 | pxa_set_i2c_info(NULL); | 489 | pxa_set_i2c_info(NULL); |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index dda310fe71c8..da85327e630c 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -378,45 +378,6 @@ static inline void spitz_init_spi(void) {} | |||
378 | * The card detect interrupt isn't debounced so we delay it by 250ms | 378 | * The card detect interrupt isn't debounced so we delay it by 250ms |
379 | * to give the card a chance to fully insert/eject. | 379 | * to give the card a chance to fully insert/eject. |
380 | */ | 380 | */ |
381 | |||
382 | static struct pxamci_platform_data spitz_mci_platform_data; | ||
383 | |||
384 | static int spitz_mci_init(struct device *dev, irq_handler_t spitz_detect_int, void *data) | ||
385 | { | ||
386 | int err; | ||
387 | |||
388 | err = gpio_request(SPITZ_GPIO_nSD_DETECT, "nSD_DETECT"); | ||
389 | if (err) | ||
390 | goto err_out; | ||
391 | |||
392 | err = gpio_request(SPITZ_GPIO_nSD_WP, "nSD_WP"); | ||
393 | if (err) | ||
394 | goto err_free_1; | ||
395 | |||
396 | gpio_direction_input(SPITZ_GPIO_nSD_DETECT); | ||
397 | gpio_direction_input(SPITZ_GPIO_nSD_WP); | ||
398 | |||
399 | spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
400 | |||
401 | err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, | ||
402 | IRQF_DISABLED | IRQF_TRIGGER_RISING | | ||
403 | IRQF_TRIGGER_FALLING, | ||
404 | "MMC card detect", data); | ||
405 | if (err) { | ||
406 | pr_err("%s: MMC/SD: can't request MMC card detect IRQ\n", | ||
407 | __func__); | ||
408 | goto err_free_2; | ||
409 | } | ||
410 | return 0; | ||
411 | |||
412 | err_free_2: | ||
413 | gpio_free(SPITZ_GPIO_nSD_WP); | ||
414 | err_free_1: | ||
415 | gpio_free(SPITZ_GPIO_nSD_DETECT); | ||
416 | err_out: | ||
417 | return err; | ||
418 | } | ||
419 | |||
420 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) | 381 | static void spitz_mci_setpower(struct device *dev, unsigned int vdd) |
421 | { | 382 | { |
422 | struct pxamci_platform_data* p_d = dev->platform_data; | 383 | struct pxamci_platform_data* p_d = dev->platform_data; |
@@ -427,24 +388,12 @@ static void spitz_mci_setpower(struct device *dev, unsigned int vdd) | |||
427 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); | 388 | spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000); |
428 | } | 389 | } |
429 | 390 | ||
430 | static int spitz_mci_get_ro(struct device *dev) | ||
431 | { | ||
432 | return gpio_get_value(SPITZ_GPIO_nSD_WP); | ||
433 | } | ||
434 | |||
435 | static void spitz_mci_exit(struct device *dev, void *data) | ||
436 | { | ||
437 | free_irq(SPITZ_IRQ_GPIO_nSD_DETECT, data); | ||
438 | gpio_free(SPITZ_GPIO_nSD_WP); | ||
439 | gpio_free(SPITZ_GPIO_nSD_DETECT); | ||
440 | } | ||
441 | |||
442 | static struct pxamci_platform_data spitz_mci_platform_data = { | 391 | static struct pxamci_platform_data spitz_mci_platform_data = { |
443 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 392 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
444 | .init = spitz_mci_init, | 393 | .setpower = spitz_mci_setpower, |
445 | .get_ro = spitz_mci_get_ro, | 394 | .gpio_card_detect = SPITZ_GPIO_nSD_DETECT, |
446 | .setpower = spitz_mci_setpower, | 395 | .gpio_card_ro = SPITZ_GPIO_nSD_WP, |
447 | .exit = spitz_mci_exit, | 396 | .gpio_power = -1, |
448 | }; | 397 | }; |
449 | 398 | ||
450 | 399 | ||
@@ -695,6 +644,7 @@ static void __init common_init(void) | |||
695 | spitz_init_spi(); | 644 | spitz_init_spi(); |
696 | 645 | ||
697 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 646 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
647 | spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
698 | pxa_set_mci_info(&spitz_mci_platform_data); | 648 | pxa_set_mci_info(&spitz_mci_platform_data); |
699 | pxa_set_ohci_info(&spitz_ohci_platform_data); | 649 | pxa_set_ohci_info(&spitz_ohci_platform_data); |
700 | pxa_set_ficp_info(&spitz_ficp_platform_data); | 650 | pxa_set_ficp_info(&spitz_ficp_platform_data); |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 117ad5920e53..b56cc5667bb4 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -247,49 +247,10 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = { | |||
247 | /* | 247 | /* |
248 | * MMC/SD Device | 248 | * MMC/SD Device |
249 | */ | 249 | */ |
250 | static struct pxamci_platform_data tosa_mci_platform_data; | ||
251 | |||
252 | static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data) | 250 | static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data) |
253 | { | 251 | { |
254 | int err; | 252 | int err; |
255 | 253 | ||
256 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
257 | |||
258 | err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect"); | ||
259 | if (err) { | ||
260 | printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n"); | ||
261 | goto err_gpio_detect; | ||
262 | } | ||
263 | err = gpio_direction_input(TOSA_GPIO_nSD_DETECT); | ||
264 | if (err) | ||
265 | goto err_gpio_detect_dir; | ||
266 | |||
267 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, | ||
268 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
269 | "MMC/SD card detect", data); | ||
270 | if (err) { | ||
271 | printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); | ||
272 | goto err_irq; | ||
273 | } | ||
274 | |||
275 | err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect"); | ||
276 | if (err) { | ||
277 | printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n"); | ||
278 | goto err_gpio_wp; | ||
279 | } | ||
280 | err = gpio_direction_input(TOSA_GPIO_SD_WP); | ||
281 | if (err) | ||
282 | goto err_gpio_wp_dir; | ||
283 | |||
284 | err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power"); | ||
285 | if (err) { | ||
286 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); | ||
287 | goto err_gpio_pwr; | ||
288 | } | ||
289 | err = gpio_direction_output(TOSA_GPIO_PWR_ON, 0); | ||
290 | if (err) | ||
291 | goto err_gpio_pwr_dir; | ||
292 | |||
293 | err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int"); | 254 | err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int"); |
294 | if (err) { | 255 | if (err) { |
295 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); | 256 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); |
@@ -304,51 +265,21 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void | |||
304 | err_gpio_int_dir: | 265 | err_gpio_int_dir: |
305 | gpio_free(TOSA_GPIO_nSD_INT); | 266 | gpio_free(TOSA_GPIO_nSD_INT); |
306 | err_gpio_int: | 267 | err_gpio_int: |
307 | err_gpio_pwr_dir: | ||
308 | gpio_free(TOSA_GPIO_PWR_ON); | ||
309 | err_gpio_pwr: | ||
310 | err_gpio_wp_dir: | ||
311 | gpio_free(TOSA_GPIO_SD_WP); | ||
312 | err_gpio_wp: | ||
313 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | ||
314 | err_irq: | ||
315 | err_gpio_detect_dir: | ||
316 | gpio_free(TOSA_GPIO_nSD_DETECT); | ||
317 | err_gpio_detect: | ||
318 | return err; | 268 | return err; |
319 | } | 269 | } |
320 | 270 | ||
321 | static void tosa_mci_setpower(struct device *dev, unsigned int vdd) | ||
322 | { | ||
323 | struct pxamci_platform_data* p_d = dev->platform_data; | ||
324 | |||
325 | if (( 1 << vdd) & p_d->ocr_mask) { | ||
326 | gpio_set_value(TOSA_GPIO_PWR_ON, 1); | ||
327 | } else { | ||
328 | gpio_set_value(TOSA_GPIO_PWR_ON, 0); | ||
329 | } | ||
330 | } | ||
331 | |||
332 | static int tosa_mci_get_ro(struct device *dev) | ||
333 | { | ||
334 | return gpio_get_value(TOSA_GPIO_SD_WP); | ||
335 | } | ||
336 | |||
337 | static void tosa_mci_exit(struct device *dev, void *data) | 271 | static void tosa_mci_exit(struct device *dev, void *data) |
338 | { | 272 | { |
339 | gpio_free(TOSA_GPIO_nSD_INT); | 273 | gpio_free(TOSA_GPIO_nSD_INT); |
340 | gpio_free(TOSA_GPIO_PWR_ON); | ||
341 | gpio_free(TOSA_GPIO_SD_WP); | ||
342 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | ||
343 | gpio_free(TOSA_GPIO_nSD_DETECT); | ||
344 | } | 274 | } |
345 | 275 | ||
346 | static struct pxamci_platform_data tosa_mci_platform_data = { | 276 | static struct pxamci_platform_data tosa_mci_platform_data = { |
347 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 277 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
348 | .init = tosa_mci_init, | 278 | .init = tosa_mci_init, |
349 | .get_ro = tosa_mci_get_ro, | 279 | .exit = tosa_mci_exit, |
350 | .setpower = tosa_mci_setpower, | 280 | .gpio_card_detect = TOSA_GPIO_nSD_DETECT, |
351 | .exit = tosa_mci_exit, | 281 | .gpio_card_ro = TOSA_GPIO_SD_WP, |
282 | .gpio_power = TOSA_GPIO_PWR_ON, | ||
352 | }; | 283 | }; |
353 | 284 | ||
354 | /* | 285 | /* |
@@ -910,6 +841,7 @@ static void __init tosa_init(void) | |||
910 | dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12); | 841 | dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12); |
911 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); | 842 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); |
912 | 843 | ||
844 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
913 | pxa_set_mci_info(&tosa_mci_platform_data); | 845 | pxa_set_mci_info(&tosa_mci_platform_data); |
914 | pxa_set_udc_info(&udc_info); | 846 | pxa_set_udc_info(&udc_info); |
915 | pxa_set_ficp_info(&tosa_ficp_platform_data); | 847 | pxa_set_ficp_info(&tosa_ficp_platform_data); |
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c index 825f540176d2..32299869b352 100644 --- a/arch/arm/mach-pxa/trizeps4.c +++ b/arch/arm/mach-pxa/trizeps4.c | |||
@@ -367,6 +367,9 @@ static struct pxamci_platform_data trizeps4_mci_platform_data = { | |||
367 | .exit = trizeps4_mci_exit, | 367 | .exit = trizeps4_mci_exit, |
368 | .get_ro = NULL, /* write-protection not supported */ | 368 | .get_ro = NULL, /* write-protection not supported */ |
369 | .setpower = NULL, /* power-switching not supported */ | 369 | .setpower = NULL, /* power-switching not supported */ |
370 | .gpio_card_detect = -1, | ||
371 | .gpio_card_ro = -1, | ||
372 | .gpio_power = -1, | ||
370 | }; | 373 | }; |
371 | 374 | ||
372 | /**************************************************************************** | 375 | /**************************************************************************** |
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index 218d2001f1df..09784d3954e4 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -290,6 +290,9 @@ static struct pxamci_platform_data zylonite_mci_platform_data = { | |||
290 | .init = zylonite_mci_init, | 290 | .init = zylonite_mci_init, |
291 | .exit = zylonite_mci_exit, | 291 | .exit = zylonite_mci_exit, |
292 | .get_ro = zylonite_mci_ro, | 292 | .get_ro = zylonite_mci_ro, |
293 | .gpio_card_detect = -1, | ||
294 | .gpio_card_ro = -1, | ||
295 | .gpio_power = -1, | ||
293 | }; | 296 | }; |
294 | 297 | ||
295 | static struct pxamci_platform_data zylonite_mci2_platform_data = { | 298 | static struct pxamci_platform_data zylonite_mci2_platform_data = { |