diff options
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 91 |
1 files changed, 12 insertions, 79 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 117ad5920e53..e81a52673d49 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 | /* |
@@ -406,10 +337,11 @@ static void tosa_irda_shutdown(struct device *dev) | |||
406 | } | 337 | } |
407 | 338 | ||
408 | static struct pxaficp_platform_data tosa_ficp_platform_data = { | 339 | static struct pxaficp_platform_data tosa_ficp_platform_data = { |
409 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 340 | .gpio_pwdown = -1, |
410 | .transceiver_mode = tosa_irda_transceiver_mode, | 341 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
411 | .startup = tosa_irda_startup, | 342 | .transceiver_mode = tosa_irda_transceiver_mode, |
412 | .shutdown = tosa_irda_shutdown, | 343 | .startup = tosa_irda_startup, |
344 | .shutdown = tosa_irda_shutdown, | ||
413 | }; | 345 | }; |
414 | 346 | ||
415 | /* | 347 | /* |
@@ -910,6 +842,7 @@ static void __init tosa_init(void) | |||
910 | dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12); | 842 | dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12); |
911 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); | 843 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); |
912 | 844 | ||
845 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); | ||
913 | pxa_set_mci_info(&tosa_mci_platform_data); | 846 | pxa_set_mci_info(&tosa_mci_platform_data); |
914 | pxa_set_udc_info(&udc_info); | 847 | pxa_set_udc_info(&udc_info); |
915 | pxa_set_ficp_info(&tosa_ficp_platform_data); | 848 | pxa_set_ficp_info(&tosa_ficp_platform_data); |