Commit f54005b5 authored by Linus Walleij's avatar Linus Walleij Committed by Ulf Hansson

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 80a68f38
...@@ -290,7 +290,6 @@ static unsigned long balloon3_mmc_pin_config[] __initdata = { ...@@ -290,7 +290,6 @@ static unsigned long balloon3_mmc_pin_config[] __initdata = {
static struct pxamci_platform_data balloon3_mci_platform_data = { static struct pxamci_platform_data balloon3_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = -1,
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
......
...@@ -289,8 +289,6 @@ static inline void cmx270_init_ohci(void) {} ...@@ -289,8 +289,6 @@ static inline void cmx270_init_ohci(void) {}
#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
static struct pxamci_platform_data cmx270_mci_platform_data = { static struct pxamci_platform_data cmx270_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = GPIO105_MMC_POWER,
.gpio_power_invert = 1,
}; };
static struct gpiod_lookup_table cmx270_mci_gpio_table = { static struct gpiod_lookup_table cmx270_mci_gpio_table = {
...@@ -298,6 +296,9 @@ static struct gpiod_lookup_table cmx270_mci_gpio_table = { ...@@ -298,6 +296,9 @@ static struct gpiod_lookup_table cmx270_mci_gpio_table = {
.table = { .table = {
/* Card detect on GPIO 83 */ /* Card detect on GPIO 83 */
GPIO_LOOKUP("gpio-pxa", GPIO83_MMC_IRQ, "cd", GPIO_ACTIVE_LOW), GPIO_LOOKUP("gpio-pxa", GPIO83_MMC_IRQ, "cd", GPIO_ACTIVE_LOW),
/* Power on GPIO 105 */
GPIO_LOOKUP("gpio-pxa", GPIO105_MMC_POWER,
"power", GPIO_ACTIVE_LOW),
{ }, { },
}, },
}; };
......
...@@ -459,7 +459,6 @@ static inline void cm_x300_init_nand(void) {} ...@@ -459,7 +459,6 @@ static inline void cm_x300_init_nand(void) {}
static struct pxamci_platform_data cm_x300_mci_platform_data = { static struct pxamci_platform_data cm_x300_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = -1,
}; };
static struct gpiod_lookup_table cm_x300_mci_gpio_table = { static struct gpiod_lookup_table cm_x300_mci_gpio_table = {
...@@ -491,7 +490,6 @@ static struct pxamci_platform_data cm_x300_mci2_platform_data = { ...@@ -491,7 +490,6 @@ static struct pxamci_platform_data cm_x300_mci2_platform_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.init = cm_x300_mci2_init, .init = cm_x300_mci2_init,
.exit = cm_x300_mci2_exit, .exit = cm_x300_mci2_exit,
.gpio_power = -1,
}; };
static void __init cm_x300_init_mmc(void) static void __init cm_x300_init_mmc(void)
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
static struct pxamci_platform_data income_mci_platform_data = { static struct pxamci_platform_data income_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = -1,
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
......
...@@ -494,7 +494,6 @@ static struct platform_device corgi_audio_device = { ...@@ -494,7 +494,6 @@ static struct platform_device corgi_audio_device = {
static struct pxamci_platform_data corgi_mci_platform_data = { static struct pxamci_platform_data corgi_mci_platform_data = {
.detect_delay_ms = 250, .detect_delay_ms = 250,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = CORGI_GPIO_SD_PWR,
}; };
static struct gpiod_lookup_table corgi_mci_gpio_table = { static struct gpiod_lookup_table corgi_mci_gpio_table = {
...@@ -506,6 +505,9 @@ static struct gpiod_lookup_table corgi_mci_gpio_table = { ...@@ -506,6 +505,9 @@ static struct gpiod_lookup_table corgi_mci_gpio_table = {
/* Write protect on GPIO 7 */ /* Write protect on GPIO 7 */
GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_nSD_WP, GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_nSD_WP,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
/* Power on GPIO 33 */
GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_SD_PWR,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
......
...@@ -129,7 +129,6 @@ static struct pxamci_platform_data csb726_mci = { ...@@ -129,7 +129,6 @@ static struct pxamci_platform_data csb726_mci = {
.detect_delay_ms = 500, .detect_delay_ms = 500,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
/* FIXME setpower */ /* FIXME setpower */
.gpio_power = -1,
}; };
static struct gpiod_lookup_table csb726_mci_gpio_table = { static struct gpiod_lookup_table csb726_mci_gpio_table = {
......
...@@ -630,7 +630,6 @@ static struct pxamci_platform_data em_x270_mci_platform_data = { ...@@ -630,7 +630,6 @@ static struct pxamci_platform_data em_x270_mci_platform_data = {
.init = em_x270_mci_init, .init = em_x270_mci_init,
.setpower = em_x270_mci_setpower, .setpower = em_x270_mci_setpower,
.exit = em_x270_mci_exit, .exit = em_x270_mci_exit,
.gpio_power = -1,
}; };
static void __init em_x270_init_mmc(void) static void __init em_x270_init_mmc(void)
......
...@@ -90,7 +90,6 @@ static struct platform_device *devices[] __initdata = { ...@@ -90,7 +90,6 @@ static struct platform_device *devices[] __initdata = {
#ifdef CONFIG_MMC_PXA #ifdef CONFIG_MMC_PXA
static struct pxamci_platform_data gumstix_mci_platform_data = { static struct pxamci_platform_data gumstix_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = -1,
}; };
static void __init gumstix_mmc_init(void) static void __init gumstix_mmc_init(void)
......
...@@ -160,7 +160,6 @@ static struct pxafb_mach_info sharp_lm8v31 = { ...@@ -160,7 +160,6 @@ static struct pxafb_mach_info sharp_lm8v31 = {
static struct pxamci_platform_data idp_mci_platform_data = { static struct pxamci_platform_data idp_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = -1,
}; };
static void __init idp_init(void) static void __init idp_init(void)
......
...@@ -276,7 +276,6 @@ static inline void littleton_init_keypad(void) {} ...@@ -276,7 +276,6 @@ static inline void littleton_init_keypad(void) {}
static struct pxamci_platform_data littleton_mci_platform_data = { static struct pxamci_platform_data littleton_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = -1,
}; };
static struct gpiod_lookup_table littleton_mci_gpio_table = { static struct gpiod_lookup_table littleton_mci_gpio_table = {
......
...@@ -440,7 +440,6 @@ static struct pxamci_platform_data lubbock_mci_platform_data = { ...@@ -440,7 +440,6 @@ static struct pxamci_platform_data lubbock_mci_platform_data = {
.init = lubbock_mci_init, .init = lubbock_mci_init,
.get_ro = lubbock_mci_get_ro, .get_ro = lubbock_mci_get_ro,
.exit = lubbock_mci_exit, .exit = lubbock_mci_exit,
.gpio_power = -1,
}; };
static void lubbock_irda_transceiver_mode(struct device *dev, int mode) static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
......
...@@ -776,7 +776,6 @@ static struct pxamci_platform_data magician_mci_info = { ...@@ -776,7 +776,6 @@ static struct pxamci_platform_data magician_mci_info = {
.init = magician_mci_init, .init = magician_mci_init,
.exit = magician_mci_exit, .exit = magician_mci_exit,
.gpio_card_ro_invert = 1, .gpio_card_ro_invert = 1,
.gpio_power = EGPIO_MAGICIAN_SD_POWER,
}; };
/* /*
...@@ -785,12 +784,19 @@ static struct pxamci_platform_data magician_mci_info = { ...@@ -785,12 +784,19 @@ static struct pxamci_platform_data magician_mci_info = {
* particular chip. * particular chip.
*/ */
#define EGPIO_MAGICIAN_nSD_READONLY_OFFSET 12 #define EGPIO_MAGICIAN_nSD_READONLY_OFFSET 12
/*
* Power on EGPIO register 2 index 0, so this is on the first HTC EGPIO chip
* starting at register 0 so we need offset 2*8+0 = 16 on that chip.
*/
#define EGPIO_MAGICIAN_nSD_POWER_OFFSET 16
static struct gpiod_lookup_table magician_mci_gpio_table = { static struct gpiod_lookup_table magician_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0", .dev_id = "pxa2xx-mci.0",
.table = { .table = {
GPIO_LOOKUP("htc-egpio-1", EGPIO_MAGICIAN_nSD_READONLY_OFFSET, GPIO_LOOKUP("htc-egpio-1", EGPIO_MAGICIAN_nSD_READONLY_OFFSET,
"wp", GPIO_ACTIVE_HIGH), "wp", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("htc-egpio-0", EGPIO_MAGICIAN_nSD_POWER_OFFSET,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
......
...@@ -361,7 +361,6 @@ static struct pxamci_platform_data mainstone_mci_platform_data = { ...@@ -361,7 +361,6 @@ static struct pxamci_platform_data mainstone_mci_platform_data = {
.init = mainstone_mci_init, .init = mainstone_mci_init,
.setpower = mainstone_mci_setpower, .setpower = mainstone_mci_setpower,
.exit = mainstone_mci_exit, .exit = mainstone_mci_exit,
.gpio_power = -1,
}; };
static void mainstone_irda_transceiver_mode(struct device *dev, int mode) static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
......
...@@ -398,7 +398,6 @@ struct gpio_vbus_mach_info gpio_vbus_data = { ...@@ -398,7 +398,6 @@ struct gpio_vbus_mach_info gpio_vbus_data = {
static struct pxamci_platform_data mioa701_mci_info = { static struct pxamci_platform_data mioa701_mci_info = {
.detect_delay_ms = 250, .detect_delay_ms = 250,
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = GPIO91_SDIO_EN,
}; };
static struct gpiod_lookup_table mioa701_mci_gpio_table = { static struct gpiod_lookup_table mioa701_mci_gpio_table = {
...@@ -410,6 +409,9 @@ static struct gpiod_lookup_table mioa701_mci_gpio_table = { ...@@ -410,6 +409,9 @@ static struct gpiod_lookup_table mioa701_mci_gpio_table = {
/* Write protect on GPIO 78 */ /* Write protect on GPIO 78 */
GPIO_LOOKUP("gpio-pxa", GPIO78_SDIO_RO, GPIO_LOOKUP("gpio-pxa", GPIO78_SDIO_RO,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
/* Power on GPIO 91 */
GPIO_LOOKUP("gpio-pxa", GPIO91_SDIO_EN,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
......
...@@ -326,7 +326,6 @@ static mfp_cfg_t mfp_cfg[] __initdata = { ...@@ -326,7 +326,6 @@ static mfp_cfg_t mfp_cfg[] __initdata = {
static struct pxamci_platform_data mxm_8x10_mci_platform_data = { static struct pxamci_platform_data mxm_8x10_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.detect_delay_ms = 10, .detect_delay_ms = 10,
.gpio_power = -1
}; };
static struct gpiod_lookup_table mxm_8x10_mci_gpio_table = { static struct gpiod_lookup_table mxm_8x10_mci_gpio_table = {
......
...@@ -49,13 +49,8 @@ static struct pxamci_platform_data palm27x_mci_platform_data = { ...@@ -49,13 +49,8 @@ static struct pxamci_platform_data palm27x_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable, void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable)
int power,
int power_inverted)
{ {
palm27x_mci_platform_data.gpio_power = power;
palm27x_mci_platform_data.gpio_power_invert = power_inverted;
if (gtable) if (gtable)
gpiod_add_lookup_table(gtable); gpiod_add_lookup_table(gtable);
pxa_set_mci_info(&palm27x_mci_platform_data); pxa_set_mci_info(&palm27x_mci_platform_data);
......
...@@ -15,13 +15,9 @@ ...@@ -15,13 +15,9 @@
#include <linux/gpio/machine.h> #include <linux/gpio/machine.h>
#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
extern void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable, extern void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable);
int power,
int power_inverted);
#else #else
static inline void palm27x_mmc_init(struct gpiod_lookup_table *gtable, static inline void palm27x_mmc_init(struct gpiod_lookup_table *gtable)
int power,
int power_inverted)
{} {}
#endif #endif
......
...@@ -327,6 +327,8 @@ static struct gpiod_lookup_table palmld_mci_gpio_table = { ...@@ -327,6 +327,8 @@ static struct gpiod_lookup_table palmld_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY, GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_POWER,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
...@@ -338,8 +340,7 @@ static void __init palmld_init(void) ...@@ -338,8 +340,7 @@ static void __init palmld_init(void)
pxa_set_btuart_info(NULL); pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL); pxa_set_stuart_info(NULL);
palm27x_mmc_init(&palmld_mci_gpio_table, palm27x_mmc_init(&palmld_mci_gpio_table);
GPIO_NR_PALMLD_SD_POWER, 0);
palm27x_pm_init(PALMLD_STR_BASE); palm27x_pm_init(PALMLD_STR_BASE);
palm27x_lcd_init(-1, &palm_320x480_lcd_mode); palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE); palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
......
...@@ -189,6 +189,8 @@ static struct gpiod_lookup_table palmt5_mci_gpio_table = { ...@@ -189,6 +189,8 @@ static struct gpiod_lookup_table palmt5_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY, GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_POWER,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
...@@ -200,8 +202,7 @@ static void __init palmt5_init(void) ...@@ -200,8 +202,7 @@ static void __init palmt5_init(void)
pxa_set_btuart_info(NULL); pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL); pxa_set_stuart_info(NULL);
palm27x_mmc_init(&palmt5_mci_gpio_table, palm27x_mmc_init(&palmt5_mci_gpio_table);
GPIO_NR_PALMT5_SD_POWER, 0);
palm27x_pm_init(PALMT5_STR_BASE); palm27x_pm_init(PALMT5_STR_BASE);
palm27x_lcd_init(-1, &palm_320x480_lcd_mode); palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N, palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
......
...@@ -120,7 +120,6 @@ static unsigned long palmtc_pin_config[] __initdata = { ...@@ -120,7 +120,6 @@ static unsigned long palmtc_pin_config[] __initdata = {
#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
static struct pxamci_platform_data palmtc_mci_platform_data = { static struct pxamci_platform_data palmtc_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = GPIO_NR_PALMTC_SD_POWER,
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
...@@ -131,6 +130,8 @@ static struct gpiod_lookup_table palmtc_mci_gpio_table = { ...@@ -131,6 +130,8 @@ static struct gpiod_lookup_table palmtc_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_READONLY, GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_READONLY,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_POWER,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
......
...@@ -102,7 +102,6 @@ static unsigned long palmte2_pin_config[] __initdata = { ...@@ -102,7 +102,6 @@ static unsigned long palmte2_pin_config[] __initdata = {
******************************************************************************/ ******************************************************************************/
static struct pxamci_platform_data palmte2_mci_platform_data = { static struct pxamci_platform_data palmte2_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = GPIO_NR_PALMTE2_SD_POWER,
}; };
static struct gpiod_lookup_table palmte2_mci_gpio_table = { static struct gpiod_lookup_table palmte2_mci_gpio_table = {
...@@ -112,6 +111,8 @@ static struct gpiod_lookup_table palmte2_mci_gpio_table = { ...@@ -112,6 +111,8 @@ static struct gpiod_lookup_table palmte2_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_READONLY, GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_READONLY,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_POWER,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
......
...@@ -487,6 +487,8 @@ static struct gpiod_lookup_table treo680_mci_gpio_table = { ...@@ -487,6 +487,8 @@ static struct gpiod_lookup_table treo680_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO680_SD_READONLY, GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO680_SD_READONLY,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO680_SD_POWER,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
...@@ -496,8 +498,7 @@ static void __init treo680_init(void) ...@@ -496,8 +498,7 @@ static void __init treo680_init(void)
pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
palmphone_common_init(); palmphone_common_init();
treo680_gpio_init(); treo680_gpio_init();
palm27x_mmc_init(&treo680_mci_gpio_table, palm27x_mmc_init(&treo680_mci_gpio_table);
GPIO_NR_TREO680_SD_POWER, 0);
} }
#endif #endif
...@@ -508,6 +509,8 @@ static struct gpiod_lookup_table centro685_mci_gpio_table = { ...@@ -508,6 +509,8 @@ static struct gpiod_lookup_table centro685_mci_gpio_table = {
.table = { .table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO_SD_DETECT_N, GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_CENTRO_SD_POWER,
"power", GPIO_ACTIVE_LOW),
{ }, { },
}, },
}; };
...@@ -516,8 +519,7 @@ static void __init centro_init(void) ...@@ -516,8 +519,7 @@ static void __init centro_init(void)
{ {
pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
palmphone_common_init(); palmphone_common_init();
palm27x_mmc_init(&centro685_mci_gpio_table, palm27x_mmc_init(&centro685_mci_gpio_table);
GPIO_NR_CENTRO_SD_POWER, 1);
} }
#endif #endif
......
...@@ -344,6 +344,8 @@ static struct gpiod_lookup_table palmtx_mci_gpio_table = { ...@@ -344,6 +344,8 @@ static struct gpiod_lookup_table palmtx_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_READONLY, GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_READONLY,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_POWER,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
...@@ -355,8 +357,7 @@ static void __init palmtx_init(void) ...@@ -355,8 +357,7 @@ static void __init palmtx_init(void)
pxa_set_btuart_info(NULL); pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL); pxa_set_stuart_info(NULL);
palm27x_mmc_init(&palmtx_mci_gpio_table, palm27x_mmc_init(&palmtx_mci_gpio_table);
GPIO_NR_PALMTX_SD_POWER, 0);
palm27x_pm_init(PALMTX_STR_BASE); palm27x_pm_init(PALMTX_STR_BASE);
palm27x_lcd_init(-1, &palm_320x480_lcd_mode); palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N, palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
......
...@@ -393,6 +393,8 @@ static struct gpiod_lookup_table palmz72_mci_gpio_table = { ...@@ -393,6 +393,8 @@ static struct gpiod_lookup_table palmz72_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO, GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_POWER_N,
"power", GPIO_ACTIVE_LOW),
{ }, { },
}, },
}; };
...@@ -407,8 +409,7 @@ static void __init palmz72_init(void) ...@@ -407,8 +409,7 @@ static void __init palmz72_init(void)
pxa_set_btuart_info(NULL); pxa_set_btuart_info(NULL);
pxa_set_stuart_info(NULL); pxa_set_stuart_info(NULL);
palm27x_mmc_init(&palmz72_mci_gpio_table, palm27x_mmc_init(&palmz72_mci_gpio_table);
GPIO_NR_PALMZ72_SD_POWER_N, 1);
palm27x_lcd_init(-1, &palm_320x320_lcd_mode); palm27x_lcd_init(-1, &palm_320x320_lcd_mode);
palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N, palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N,
GPIO_NR_PALMZ72_USB_PULLUP, 0); GPIO_NR_PALMZ72_USB_PULLUP, 0);
......
...@@ -370,7 +370,6 @@ static struct pxamci_platform_data pcm990_mci_platform_data = { ...@@ -370,7 +370,6 @@ static struct pxamci_platform_data pcm990_mci_platform_data = {
.init = pcm990_mci_init, .init = pcm990_mci_init,
.setpower = pcm990_mci_setpower, .setpower = pcm990_mci_setpower,
.exit = pcm990_mci_exit, .exit = pcm990_mci_exit,
.gpio_power = -1,
}; };
static struct pxaohci_platform_data pcm990_ohci_platform_data = { static struct pxaohci_platform_data pcm990_ohci_platform_data = {
......
...@@ -289,7 +289,6 @@ static struct pxamci_platform_data poodle_mci_platform_data = { ...@@ -289,7 +289,6 @@ static struct pxamci_platform_data poodle_mci_platform_data = {
.init = poodle_mci_init, .init = poodle_mci_init,
.setpower = poodle_mci_setpower, .setpower = poodle_mci_setpower,
.exit = poodle_mci_exit, .exit = poodle_mci_exit,
.gpio_power = -1,
}; };
static struct gpiod_lookup_table poodle_mci_gpio_table = { static struct gpiod_lookup_table poodle_mci_gpio_table = {
......
...@@ -749,7 +749,6 @@ static struct pxamci_platform_data raumfeld_mci_platform_data = { ...@@ -749,7 +749,6 @@ static struct pxamci_platform_data raumfeld_mci_platform_data = {
.init = raumfeld_mci_init, .init = raumfeld_mci_init,
.exit = raumfeld_mci_exit, .exit = raumfeld_mci_exit,
.detect_delay_ms = 200, .detect_delay_ms = 200,
.gpio_power = -1,
}; };
/* /*
......
...@@ -616,7 +616,6 @@ static struct pxamci_platform_data spitz_mci_platform_data = { ...@@ -616,7 +616,6 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
.detect_delay_ms = 250, .detect_delay_ms = 250,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.setpower = spitz_mci_setpower, .setpower = spitz_mci_setpower,
.gpio_power = -1,
}; };
static struct gpiod_lookup_table spitz_mci_gpio_table = { static struct gpiod_lookup_table spitz_mci_gpio_table = {
......
...@@ -436,7 +436,6 @@ static int imote2_mci_get_ro(struct device *dev) ...@@ -436,7 +436,6 @@ static int imote2_mci_get_ro(struct device *dev)
static struct pxamci_platform_data imote2_mci_platform_data = { static struct pxamci_platform_data imote2_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */ .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* default anyway */
.get_ro = imote2_mci_get_ro, .get_ro = imote2_mci_get_ro,
.gpio_power = -1,
}; };
static struct gpio_led imote2_led_pins[] = { static struct gpio_led imote2_led_pins[] = {
......
...@@ -292,7 +292,6 @@ static struct pxamci_platform_data tosa_mci_platform_data = { ...@@ -292,7 +292,6 @@ static struct pxamci_platform_data tosa_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.init = tosa_mci_init, .init = tosa_mci_init,
.exit = tosa_mci_exit, .exit = tosa_mci_exit,
.gpio_power = TOSA_GPIO_PWR_ON,
}; };
static struct gpiod_lookup_table tosa_mci_gpio_table = { static struct gpiod_lookup_table tosa_mci_gpio_table = {
...@@ -302,6 +301,8 @@ static struct gpiod_lookup_table tosa_mci_gpio_table = { ...@@ -302,6 +301,8 @@ static struct gpiod_lookup_table tosa_mci_gpio_table = {
"cd", GPIO_ACTIVE_LOW), "cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_SD_WP, GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_SD_WP,
"wp", GPIO_ACTIVE_LOW), "wp", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_PWR_ON,
"power", GPIO_ACTIVE_HIGH),
{ }, { },
}, },
}; };
......
...@@ -355,7 +355,6 @@ static struct pxamci_platform_data trizeps4_mci_platform_data = { ...@@ -355,7 +355,6 @@ static struct pxamci_platform_data trizeps4_mci_platform_data = {
.exit = trizeps4_mci_exit, .exit = trizeps4_mci_exit,
.get_ro = NULL, /* write-protection not supported */ .get_ro = NULL, /* write-protection not supported */
.setpower = NULL, /* power-switching not supported */ .setpower = NULL, /* power-switching not supported */
.gpio_power = -1,
}; };
/**************************************************************************** /****************************************************************************
......
...@@ -241,7 +241,6 @@ static void __init vpac270_onenand_init(void) {} ...@@ -241,7 +241,6 @@ static void __init vpac270_onenand_init(void) {}
#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
static struct pxamci_platform_data vpac270_mci_platform_data = { static struct pxamci_platform_data vpac270_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = -1,
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
......
...@@ -291,7 +291,6 @@ static inline void z2_lcd_init(void) {} ...@@ -291,7 +291,6 @@ static inline void z2_lcd_init(void) {}
#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
static struct pxamci_platform_data z2_mci_platform_data = { static struct pxamci_platform_data z2_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
.gpio_power = -1,
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
......
...@@ -664,7 +664,6 @@ static struct pxamci_platform_data zeus_mci_platform_data = { ...@@ -664,7 +664,6 @@ static struct pxamci_platform_data zeus_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.detect_delay_ms = 250, .detect_delay_ms = 250,
.gpio_card_ro_invert = 1, .gpio_card_ro_invert = 1,
.gpio_power = -1
}; };
static struct gpiod_lookup_table zeus_mci_gpio_table = { static struct gpiod_lookup_table zeus_mci_gpio_table = {
......
...@@ -227,7 +227,6 @@ static inline void zylonite_init_lcd(void) {} ...@@ -227,7 +227,6 @@ static inline void zylonite_init_lcd(void) {}
static struct pxamci_platform_data zylonite_mci_platform_data = { static struct pxamci_platform_data zylonite_mci_platform_data = {
.detect_delay_ms= 200, .detect_delay_ms= 200,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = -1,
}; };
#define PCA9539A_MCI_CD 0 #define PCA9539A_MCI_CD 0
...@@ -251,7 +250,6 @@ static struct gpiod_lookup_table zylonite_mci_gpio_table = { ...@@ -251,7 +250,6 @@ static struct gpiod_lookup_table zylonite_mci_gpio_table = {
static struct pxamci_platform_data zylonite_mci2_platform_data = { static struct pxamci_platform_data zylonite_mci2_platform_data = {
.detect_delay_ms= 200, .detect_delay_ms= 200,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = -1,
}; };
static struct gpiod_lookup_table zylonite_mci2_gpio_table = { static struct gpiod_lookup_table zylonite_mci2_gpio_table = {
...@@ -268,7 +266,6 @@ static struct gpiod_lookup_table zylonite_mci2_gpio_table = { ...@@ -268,7 +266,6 @@ static struct gpiod_lookup_table zylonite_mci2_gpio_table = {
static struct pxamci_platform_data zylonite_mci3_platform_data = { static struct pxamci_platform_data zylonite_mci3_platform_data = {
.detect_delay_ms= 200, .detect_delay_ms= 200,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_power = -1,
}; };
static struct gpiod_lookup_table zylonite_mci3_gpio_table = { static struct gpiod_lookup_table zylonite_mci3_gpio_table = {
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <linux/mmc/slot-gpio.h> #include <linux/mmc/slot-gpio.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/gpio.h> #include <linux/gpio/consumer.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
...@@ -63,6 +63,7 @@ struct pxamci_host { ...@@ -63,6 +63,7 @@ struct pxamci_host {
unsigned int power_mode; unsigned int power_mode;
unsigned long detect_delay_ms; unsigned long detect_delay_ms;
bool use_ro_gpio; bool use_ro_gpio;
struct gpio_desc *power;
struct pxamci_platform_data *pdata; struct pxamci_platform_data *pdata;
struct mmc_request *mrq; struct mmc_request *mrq;
...@@ -101,16 +102,13 @@ static inline int pxamci_set_power(struct pxamci_host *host, ...@@ -101,16 +102,13 @@ static inline int pxamci_set_power(struct pxamci_host *host,
{ {
struct mmc_host *mmc = host->mmc; struct mmc_host *mmc = host->mmc;
struct regulator *supply = mmc->supply.vmmc; struct regulator *supply = mmc->supply.vmmc;
int on;
if (!IS_ERR(supply)) if (!IS_ERR(supply))
return mmc_regulator_set_ocr(mmc, supply, vdd); return mmc_regulator_set_ocr(mmc, supply, vdd);
if (host->pdata && if (host->power) {
gpio_is_valid(host->pdata->gpio_power)) { bool on = !!((1 << vdd) & host->pdata->ocr_mask);
on = ((1 << vdd) & host->pdata->ocr_mask); gpiod_set_value(host->power, on);
gpio_set_value(host->pdata->gpio_power,
!!on ^ host->pdata->gpio_power_invert);
} }
if (host->pdata && host->pdata->setpower) if (host->pdata && host->pdata->setpower)
...@@ -730,21 +728,12 @@ static int pxamci_probe(struct platform_device *pdev) ...@@ -730,21 +728,12 @@ static int pxamci_probe(struct platform_device *pdev)
} }
if (host->pdata) { if (host->pdata) {
int gpio_power = host->pdata->gpio_power;
host->detect_delay_ms = host->pdata->detect_delay_ms; host->detect_delay_ms = host->pdata->detect_delay_ms;
if (gpio_is_valid(gpio_power)) { host->power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
ret = devm_gpio_request(dev, gpio_power, if (IS_ERR(host->power)) {
"mmc card power"); dev_err(dev, "Failed requesting gpio_power\n");
if (ret) { goto out;
dev_err(dev,
"Failed requesting gpio_power %d\n",
gpio_power);
goto out;
}
gpio_direction_output(gpio_power,
host->pdata->gpio_power_invert);
} }
/* FIXME: should we pass detection delay to debounce? */ /* FIXME: should we pass detection delay to debounce? */
...@@ -768,7 +757,7 @@ static int pxamci_probe(struct platform_device *pdev) ...@@ -768,7 +757,7 @@ static int pxamci_probe(struct platform_device *pdev)
if (host->pdata->init) if (host->pdata->init)
host->pdata->init(dev, pxamci_detect_irq, mmc); host->pdata->init(dev, pxamci_detect_irq, mmc);
if (gpio_is_valid(gpio_power) && host->pdata->setpower) if (host->power && host->pdata->setpower)
dev_warn(dev, "gpio_power and setpower() both defined\n"); dev_warn(dev, "gpio_power and setpower() both defined\n");
if (host->use_ro_gpio && host->pdata->get_ro) if (host->use_ro_gpio && host->pdata->get_ro)
dev_warn(dev, "gpio_ro and get_ro() both defined\n"); dev_warn(dev, "gpio_ro and get_ro() both defined\n");
......
...@@ -16,8 +16,6 @@ struct pxamci_platform_data { ...@@ -16,8 +16,6 @@ struct pxamci_platform_data {
int (*setpower)(struct device *, unsigned int); int (*setpower)(struct device *, unsigned int);
void (*exit)(struct device *, void *); void (*exit)(struct device *, void *);
bool gpio_card_ro_invert; /* gpio ro is inverted */ bool gpio_card_ro_invert; /* gpio ro is inverted */
int gpio_power; /* gpio powering up MMC bus */
bool gpio_power_invert; /* gpio power is inverted */
}; };
extern void pxa_set_mci_info(struct pxamci_platform_data *info); extern void pxa_set_mci_info(struct pxamci_platform_data *info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment