diff options
Diffstat (limited to 'arch/arm/mach-pxa/poodle.c')
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 53 |
1 files changed, 8 insertions, 45 deletions
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); |