Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: pxa: Use GPIO descriptor for power

After converting the PXA driver to use GPIO descriptors for
card detect and write protect it is relatively simple to
convert it to also use a descriptor for getting the optional
power control GPIO.

The polarity inversion flag can also go away from the platform
data since this is indicated in the GPIO machine descriptor
table.

Cc: Daniel Mack <daniel@zonque.org>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Linus Walleij and committed by
Ulf Hansson
f54005b5 80a68f38

+53 -79
-1
arch/arm/mach-pxa/balloon3.c
··· 290 290 291 291 static struct pxamci_platform_data balloon3_mci_platform_data = { 292 292 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 293 - .gpio_power = -1, 294 293 .detect_delay_ms = 200, 295 294 }; 296 295
+3 -2
arch/arm/mach-pxa/cm-x270.c
··· 289 289 #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) 290 290 static struct pxamci_platform_data cmx270_mci_platform_data = { 291 291 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 292 - .gpio_power = GPIO105_MMC_POWER, 293 - .gpio_power_invert = 1, 294 292 }; 295 293 296 294 static struct gpiod_lookup_table cmx270_mci_gpio_table = { ··· 296 298 .table = { 297 299 /* Card detect on GPIO 83 */ 298 300 GPIO_LOOKUP("gpio-pxa", GPIO83_MMC_IRQ, "cd", GPIO_ACTIVE_LOW), 301 + /* Power on GPIO 105 */ 302 + GPIO_LOOKUP("gpio-pxa", GPIO105_MMC_POWER, 303 + "power", GPIO_ACTIVE_LOW), 299 304 { }, 300 305 }, 301 306 };
-2
arch/arm/mach-pxa/cm-x300.c
··· 459 459 static struct pxamci_platform_data cm_x300_mci_platform_data = { 460 460 .detect_delay_ms = 200, 461 461 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 462 - .gpio_power = -1, 463 462 }; 464 463 465 464 static struct gpiod_lookup_table cm_x300_mci_gpio_table = { ··· 490 491 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 491 492 .init = cm_x300_mci2_init, 492 493 .exit = cm_x300_mci2_exit, 493 - .gpio_power = -1, 494 494 }; 495 495 496 496 static void __init cm_x300_init_mmc(void)
-1
arch/arm/mach-pxa/colibri-pxa270-income.c
··· 51 51 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) 52 52 static struct pxamci_platform_data income_mci_platform_data = { 53 53 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 54 - .gpio_power = -1, 55 54 .detect_delay_ms = 200, 56 55 }; 57 56
+3 -1
arch/arm/mach-pxa/corgi.c
··· 494 494 static struct pxamci_platform_data corgi_mci_platform_data = { 495 495 .detect_delay_ms = 250, 496 496 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 497 - .gpio_power = CORGI_GPIO_SD_PWR, 498 497 }; 499 498 500 499 static struct gpiod_lookup_table corgi_mci_gpio_table = { ··· 505 506 /* Write protect on GPIO 7 */ 506 507 GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_nSD_WP, 507 508 "wp", GPIO_ACTIVE_LOW), 509 + /* Power on GPIO 33 */ 510 + GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_SD_PWR, 511 + "power", GPIO_ACTIVE_HIGH), 508 512 { }, 509 513 }, 510 514 };
-1
arch/arm/mach-pxa/csb726.c
··· 129 129 .detect_delay_ms = 500, 130 130 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 131 131 /* FIXME setpower */ 132 - .gpio_power = -1, 133 132 }; 134 133 135 134 static struct gpiod_lookup_table csb726_mci_gpio_table = {
-1
arch/arm/mach-pxa/em-x270.c
··· 630 630 .init = em_x270_mci_init, 631 631 .setpower = em_x270_mci_setpower, 632 632 .exit = em_x270_mci_exit, 633 - .gpio_power = -1, 634 633 }; 635 634 636 635 static void __init em_x270_init_mmc(void)
-1
arch/arm/mach-pxa/gumstix.c
··· 90 90 #ifdef CONFIG_MMC_PXA 91 91 static struct pxamci_platform_data gumstix_mci_platform_data = { 92 92 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 93 - .gpio_power = -1, 94 93 }; 95 94 96 95 static void __init gumstix_mmc_init(void)
-1
arch/arm/mach-pxa/idp.c
··· 160 160 161 161 static struct pxamci_platform_data idp_mci_platform_data = { 162 162 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 163 - .gpio_power = -1, 164 163 }; 165 164 166 165 static void __init idp_init(void)
-1
arch/arm/mach-pxa/littleton.c
··· 276 276 static struct pxamci_platform_data littleton_mci_platform_data = { 277 277 .detect_delay_ms = 200, 278 278 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 279 - .gpio_power = -1, 280 279 }; 281 280 282 281 static struct gpiod_lookup_table littleton_mci_gpio_table = {
-1
arch/arm/mach-pxa/lubbock.c
··· 440 440 .init = lubbock_mci_init, 441 441 .get_ro = lubbock_mci_get_ro, 442 442 .exit = lubbock_mci_exit, 443 - .gpio_power = -1, 444 443 }; 445 444 446 445 static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
+7 -1
arch/arm/mach-pxa/magician.c
··· 776 776 .init = magician_mci_init, 777 777 .exit = magician_mci_exit, 778 778 .gpio_card_ro_invert = 1, 779 - .gpio_power = EGPIO_MAGICIAN_SD_POWER, 780 779 }; 781 780 782 781 /* ··· 784 785 * particular chip. 785 786 */ 786 787 #define EGPIO_MAGICIAN_nSD_READONLY_OFFSET 12 788 + /* 789 + * Power on EGPIO register 2 index 0, so this is on the first HTC EGPIO chip 790 + * starting at register 0 so we need offset 2*8+0 = 16 on that chip. 791 + */ 792 + #define EGPIO_MAGICIAN_nSD_POWER_OFFSET 16 787 793 788 794 static struct gpiod_lookup_table magician_mci_gpio_table = { 789 795 .dev_id = "pxa2xx-mci.0", 790 796 .table = { 791 797 GPIO_LOOKUP("htc-egpio-1", EGPIO_MAGICIAN_nSD_READONLY_OFFSET, 792 798 "wp", GPIO_ACTIVE_HIGH), 799 + GPIO_LOOKUP("htc-egpio-0", EGPIO_MAGICIAN_nSD_POWER_OFFSET, 800 + "power", GPIO_ACTIVE_HIGH), 793 801 { }, 794 802 }, 795 803 };
-1
arch/arm/mach-pxa/mainstone.c
··· 361 361 .init = mainstone_mci_init, 362 362 .setpower = mainstone_mci_setpower, 363 363 .exit = mainstone_mci_exit, 364 - .gpio_power = -1, 365 364 }; 366 365 367 366 static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
+3 -1
arch/arm/mach-pxa/mioa701.c
··· 398 398 static struct pxamci_platform_data mioa701_mci_info = { 399 399 .detect_delay_ms = 250, 400 400 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 401 - .gpio_power = GPIO91_SDIO_EN, 402 401 }; 403 402 404 403 static struct gpiod_lookup_table mioa701_mci_gpio_table = { ··· 409 410 /* Write protect on GPIO 78 */ 410 411 GPIO_LOOKUP("gpio-pxa", GPIO78_SDIO_RO, 411 412 "wp", GPIO_ACTIVE_LOW), 413 + /* Power on GPIO 91 */ 414 + GPIO_LOOKUP("gpio-pxa", GPIO91_SDIO_EN, 415 + "power", GPIO_ACTIVE_HIGH), 412 416 { }, 413 417 }, 414 418 };
-1
arch/arm/mach-pxa/mxm8x10.c
··· 326 326 static struct pxamci_platform_data mxm_8x10_mci_platform_data = { 327 327 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 328 328 .detect_delay_ms = 10, 329 - .gpio_power = -1 330 329 }; 331 330 332 331 static struct gpiod_lookup_table mxm_8x10_mci_gpio_table = {
+1 -6
arch/arm/mach-pxa/palm27x.c
··· 49 49 .detect_delay_ms = 200, 50 50 }; 51 51 52 - void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable, 53 - int power, 54 - int power_inverted) 52 + void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable) 55 53 { 56 - palm27x_mci_platform_data.gpio_power = power; 57 - palm27x_mci_platform_data.gpio_power_invert = power_inverted; 58 - 59 54 if (gtable) 60 55 gpiod_add_lookup_table(gtable); 61 56 pxa_set_mci_info(&palm27x_mci_platform_data);
+2 -6
arch/arm/mach-pxa/palm27x.h
··· 15 15 #include <linux/gpio/machine.h> 16 16 17 17 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) 18 - extern void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable, 19 - int power, 20 - int power_inverted); 18 + extern void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable); 21 19 #else 22 - static inline void palm27x_mmc_init(struct gpiod_lookup_table *gtable, 23 - int power, 24 - int power_inverted) 20 + static inline void palm27x_mmc_init(struct gpiod_lookup_table *gtable) 25 21 {} 26 22 #endif 27 23
+3 -2
arch/arm/mach-pxa/palmld.c
··· 327 327 "cd", GPIO_ACTIVE_LOW), 328 328 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY, 329 329 "wp", GPIO_ACTIVE_LOW), 330 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_POWER, 331 + "power", GPIO_ACTIVE_HIGH), 330 332 { }, 331 333 }, 332 334 }; ··· 340 338 pxa_set_btuart_info(NULL); 341 339 pxa_set_stuart_info(NULL); 342 340 343 - palm27x_mmc_init(&palmld_mci_gpio_table, 344 - GPIO_NR_PALMLD_SD_POWER, 0); 341 + palm27x_mmc_init(&palmld_mci_gpio_table); 345 342 palm27x_pm_init(PALMLD_STR_BASE); 346 343 palm27x_lcd_init(-1, &palm_320x480_lcd_mode); 347 344 palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
+3 -2
arch/arm/mach-pxa/palmt5.c
··· 189 189 "cd", GPIO_ACTIVE_LOW), 190 190 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY, 191 191 "wp", GPIO_ACTIVE_LOW), 192 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_POWER, 193 + "power", GPIO_ACTIVE_HIGH), 192 194 { }, 193 195 }, 194 196 }; ··· 202 200 pxa_set_btuart_info(NULL); 203 201 pxa_set_stuart_info(NULL); 204 202 205 - palm27x_mmc_init(&palmt5_mci_gpio_table, 206 - GPIO_NR_PALMT5_SD_POWER, 0); 203 + palm27x_mmc_init(&palmt5_mci_gpio_table); 207 204 palm27x_pm_init(PALMT5_STR_BASE); 208 205 palm27x_lcd_init(-1, &palm_320x480_lcd_mode); 209 206 palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
+2 -1
arch/arm/mach-pxa/palmtc.c
··· 120 120 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) 121 121 static struct pxamci_platform_data palmtc_mci_platform_data = { 122 122 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 123 - .gpio_power = GPIO_NR_PALMTC_SD_POWER, 124 123 .detect_delay_ms = 200, 125 124 }; 126 125 ··· 130 131 "cd", GPIO_ACTIVE_LOW), 131 132 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_READONLY, 132 133 "wp", GPIO_ACTIVE_LOW), 134 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_POWER, 135 + "power", GPIO_ACTIVE_HIGH), 133 136 { }, 134 137 }, 135 138 };
+2 -1
arch/arm/mach-pxa/palmte2.c
··· 102 102 ******************************************************************************/ 103 103 static struct pxamci_platform_data palmte2_mci_platform_data = { 104 104 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 105 - .gpio_power = GPIO_NR_PALMTE2_SD_POWER, 106 105 }; 107 106 108 107 static struct gpiod_lookup_table palmte2_mci_gpio_table = { ··· 111 112 "cd", GPIO_ACTIVE_LOW), 112 113 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_READONLY, 113 114 "wp", GPIO_ACTIVE_LOW), 115 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_POWER, 116 + "power", GPIO_ACTIVE_HIGH), 114 117 { }, 115 118 }, 116 119 };
+6 -4
arch/arm/mach-pxa/palmtreo.c
··· 487 487 "cd", GPIO_ACTIVE_LOW), 488 488 GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO680_SD_READONLY, 489 489 "wp", GPIO_ACTIVE_LOW), 490 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO680_SD_POWER, 491 + "power", GPIO_ACTIVE_HIGH), 490 492 { }, 491 493 }, 492 494 }; ··· 498 496 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); 499 497 palmphone_common_init(); 500 498 treo680_gpio_init(); 501 - palm27x_mmc_init(&treo680_mci_gpio_table, 502 - GPIO_NR_TREO680_SD_POWER, 0); 499 + palm27x_mmc_init(&treo680_mci_gpio_table); 503 500 } 504 501 #endif 505 502 ··· 509 508 .table = { 510 509 GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO_SD_DETECT_N, 511 510 "cd", GPIO_ACTIVE_LOW), 511 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_CENTRO_SD_POWER, 512 + "power", GPIO_ACTIVE_LOW), 512 513 { }, 513 514 }, 514 515 }; ··· 519 516 { 520 517 pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config)); 521 518 palmphone_common_init(); 522 - palm27x_mmc_init(&centro685_mci_gpio_table, 523 - GPIO_NR_CENTRO_SD_POWER, 1); 519 + palm27x_mmc_init(&centro685_mci_gpio_table); 524 520 } 525 521 #endif 526 522
+3 -2
arch/arm/mach-pxa/palmtx.c
··· 344 344 "cd", GPIO_ACTIVE_LOW), 345 345 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_READONLY, 346 346 "wp", GPIO_ACTIVE_LOW), 347 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_POWER, 348 + "power", GPIO_ACTIVE_HIGH), 347 349 { }, 348 350 }, 349 351 }; ··· 357 355 pxa_set_btuart_info(NULL); 358 356 pxa_set_stuart_info(NULL); 359 357 360 - palm27x_mmc_init(&palmtx_mci_gpio_table, 361 - GPIO_NR_PALMTX_SD_POWER, 0); 358 + palm27x_mmc_init(&palmtx_mci_gpio_table); 362 359 palm27x_pm_init(PALMTX_STR_BASE); 363 360 palm27x_lcd_init(-1, &palm_320x480_lcd_mode); 364 361 palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
+3 -2
arch/arm/mach-pxa/palmz72.c
··· 393 393 "cd", GPIO_ACTIVE_LOW), 394 394 GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO, 395 395 "wp", GPIO_ACTIVE_LOW), 396 + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_POWER_N, 397 + "power", GPIO_ACTIVE_LOW), 396 398 { }, 397 399 }, 398 400 }; ··· 409 407 pxa_set_btuart_info(NULL); 410 408 pxa_set_stuart_info(NULL); 411 409 412 - palm27x_mmc_init(&palmz72_mci_gpio_table, 413 - GPIO_NR_PALMZ72_SD_POWER_N, 1); 410 + palm27x_mmc_init(&palmz72_mci_gpio_table); 414 411 palm27x_lcd_init(-1, &palm_320x320_lcd_mode); 415 412 palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N, 416 413 GPIO_NR_PALMZ72_USB_PULLUP, 0);
-1
arch/arm/mach-pxa/pcm990-baseboard.c
··· 370 370 .init = pcm990_mci_init, 371 371 .setpower = pcm990_mci_setpower, 372 372 .exit = pcm990_mci_exit, 373 - .gpio_power = -1, 374 373 }; 375 374 376 375 static struct pxaohci_platform_data pcm990_ohci_platform_data = {
-1
arch/arm/mach-pxa/poodle.c
··· 289 289 .init = poodle_mci_init, 290 290 .setpower = poodle_mci_setpower, 291 291 .exit = poodle_mci_exit, 292 - .gpio_power = -1, 293 292 }; 294 293 295 294 static struct gpiod_lookup_table poodle_mci_gpio_table = {
-1
arch/arm/mach-pxa/raumfeld.c
··· 749 749 .init = raumfeld_mci_init, 750 750 .exit = raumfeld_mci_exit, 751 751 .detect_delay_ms = 200, 752 - .gpio_power = -1, 753 752 }; 754 753 755 754 /*
-1
arch/arm/mach-pxa/spitz.c
··· 616 616 .detect_delay_ms = 250, 617 617 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 618 618 .setpower = spitz_mci_setpower, 619 - .gpio_power = -1, 620 619 }; 621 620 622 621 static struct gpiod_lookup_table spitz_mci_gpio_table = {
-1
arch/arm/mach-pxa/stargate2.c
··· 436 436 static struct pxamci_platform_data imote2_mci_platform_data = { 437 437 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */ 438 438 .get_ro = imote2_mci_get_ro, 439 - .gpio_power = -1, 440 439 }; 441 440 442 441 static struct gpio_led imote2_led_pins[] = {
+2 -1
arch/arm/mach-pxa/tosa.c
··· 292 292 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 293 293 .init = tosa_mci_init, 294 294 .exit = tosa_mci_exit, 295 - .gpio_power = TOSA_GPIO_PWR_ON, 296 295 }; 297 296 298 297 static struct gpiod_lookup_table tosa_mci_gpio_table = { ··· 301 302 "cd", GPIO_ACTIVE_LOW), 302 303 GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_SD_WP, 303 304 "wp", GPIO_ACTIVE_LOW), 305 + GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_PWR_ON, 306 + "power", GPIO_ACTIVE_HIGH), 304 307 { }, 305 308 }, 306 309 };
-1
arch/arm/mach-pxa/trizeps4.c
··· 355 355 .exit = trizeps4_mci_exit, 356 356 .get_ro = NULL, /* write-protection not supported */ 357 357 .setpower = NULL, /* power-switching not supported */ 358 - .gpio_power = -1, 359 358 }; 360 359 361 360 /****************************************************************************
-1
arch/arm/mach-pxa/vpac270.c
··· 241 241 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) 242 242 static struct pxamci_platform_data vpac270_mci_platform_data = { 243 243 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 244 - .gpio_power = -1, 245 244 .detect_delay_ms = 200, 246 245 }; 247 246
-1
arch/arm/mach-pxa/z2.c
··· 291 291 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) 292 292 static struct pxamci_platform_data z2_mci_platform_data = { 293 293 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, 294 - .gpio_power = -1, 295 294 .detect_delay_ms = 200, 296 295 }; 297 296
-1
arch/arm/mach-pxa/zeus.c
··· 664 664 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 665 665 .detect_delay_ms = 250, 666 666 .gpio_card_ro_invert = 1, 667 - .gpio_power = -1 668 667 }; 669 668 670 669 static struct gpiod_lookup_table zeus_mci_gpio_table = {
-3
arch/arm/mach-pxa/zylonite.c
··· 227 227 static struct pxamci_platform_data zylonite_mci_platform_data = { 228 228 .detect_delay_ms= 200, 229 229 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 230 - .gpio_power = -1, 231 230 }; 232 231 233 232 #define PCA9539A_MCI_CD 0 ··· 250 251 static struct pxamci_platform_data zylonite_mci2_platform_data = { 251 252 .detect_delay_ms= 200, 252 253 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 253 - .gpio_power = -1, 254 254 }; 255 255 256 256 static struct gpiod_lookup_table zylonite_mci2_gpio_table = { ··· 266 268 static struct pxamci_platform_data zylonite_mci3_platform_data = { 267 269 .detect_delay_ms= 200, 268 270 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 269 - .gpio_power = -1, 270 271 }; 271 272 272 273 static struct gpiod_lookup_table zylonite_mci3_gpio_table = {
+10 -21
drivers/mmc/host/pxamci.c
··· 30 30 #include <linux/mmc/slot-gpio.h> 31 31 #include <linux/io.h> 32 32 #include <linux/regulator/consumer.h> 33 - #include <linux/gpio.h> 33 + #include <linux/gpio/consumer.h> 34 34 #include <linux/gfp.h> 35 35 #include <linux/of.h> 36 36 #include <linux/of_device.h> ··· 63 63 unsigned int power_mode; 64 64 unsigned long detect_delay_ms; 65 65 bool use_ro_gpio; 66 + struct gpio_desc *power; 66 67 struct pxamci_platform_data *pdata; 67 68 68 69 struct mmc_request *mrq; ··· 102 101 { 103 102 struct mmc_host *mmc = host->mmc; 104 103 struct regulator *supply = mmc->supply.vmmc; 105 - int on; 106 104 107 105 if (!IS_ERR(supply)) 108 106 return mmc_regulator_set_ocr(mmc, supply, vdd); 109 107 110 - if (host->pdata && 111 - gpio_is_valid(host->pdata->gpio_power)) { 112 - on = ((1 << vdd) & host->pdata->ocr_mask); 113 - gpio_set_value(host->pdata->gpio_power, 114 - !!on ^ host->pdata->gpio_power_invert); 108 + if (host->power) { 109 + bool on = !!((1 << vdd) & host->pdata->ocr_mask); 110 + gpiod_set_value(host->power, on); 115 111 } 116 112 117 113 if (host->pdata && host->pdata->setpower) ··· 728 730 } 729 731 730 732 if (host->pdata) { 731 - int gpio_power = host->pdata->gpio_power; 732 - 733 733 host->detect_delay_ms = host->pdata->detect_delay_ms; 734 734 735 - if (gpio_is_valid(gpio_power)) { 736 - ret = devm_gpio_request(dev, gpio_power, 737 - "mmc card power"); 738 - if (ret) { 739 - dev_err(dev, 740 - "Failed requesting gpio_power %d\n", 741 - gpio_power); 742 - goto out; 743 - } 744 - gpio_direction_output(gpio_power, 745 - host->pdata->gpio_power_invert); 735 + host->power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); 736 + if (IS_ERR(host->power)) { 737 + dev_err(dev, "Failed requesting gpio_power\n"); 738 + goto out; 746 739 } 747 740 748 741 /* FIXME: should we pass detection delay to debounce? */ ··· 757 768 if (host->pdata->init) 758 769 host->pdata->init(dev, pxamci_detect_irq, mmc); 759 770 760 - if (gpio_is_valid(gpio_power) && host->pdata->setpower) 771 + if (host->power && host->pdata->setpower) 761 772 dev_warn(dev, "gpio_power and setpower() both defined\n"); 762 773 if (host->use_ro_gpio && host->pdata->get_ro) 763 774 dev_warn(dev, "gpio_ro and get_ro() both defined\n");
-2
include/linux/platform_data/mmc-pxamci.h
··· 16 16 int (*setpower)(struct device *, unsigned int); 17 17 void (*exit)(struct device *, void *); 18 18 bool gpio_card_ro_invert; /* gpio ro is inverted */ 19 - int gpio_power; /* gpio powering up MMC bus */ 20 - bool gpio_power_invert; /* gpio power is inverted */ 21 19 }; 22 20 23 21 extern void pxa_set_mci_info(struct pxamci_platform_data *info);