Commit 32d15448 authored by Linus Walleij's avatar Linus Walleij Committed by Ulf Hansson

ARM: pxa: Add gpio descriptor lookup tables for MMC CD/WP

This adds GPIO descriptor look-up tables for a whole bunch
of PXA boards with MMC card detect (CD) and write protect (WP)
GPIO lines, so we can move away from the hard-coded GPIO
numberspace.

In some cases the platforms were compulsively including the
<linux/gpio.h> header even if they weren't actually using
it, and in these cases I simply replaced that inclusion with
the more appropriate <linux/gpio/machine.h> which is what
board files should be including most of the time.

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 5128f8d4
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/platform_data/rtc-v3020.h> #include <linux/platform_data/rtc-v3020.h>
...@@ -294,8 +295,18 @@ static struct pxamci_platform_data cmx270_mci_platform_data = { ...@@ -294,8 +295,18 @@ static struct pxamci_platform_data cmx270_mci_platform_data = {
.gpio_power_invert = 1, .gpio_power_invert = 1,
}; };
static struct gpiod_lookup_table cmx270_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on GPIO 83 */
GPIO_LOOKUP("gpio-pxa", GPIO83_MMC_IRQ, "cd", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init cmx270_init_mmc(void) static void __init cmx270_init_mmc(void)
{ {
gpiod_add_lookup_table(&cmx270_mci_gpio_table);
pxa_set_mci_info(&cmx270_mci_platform_data); pxa_set_mci_info(&cmx270_mci_platform_data);
} }
#else #else
......
...@@ -464,6 +464,17 @@ static struct pxamci_platform_data cm_x300_mci_platform_data = { ...@@ -464,6 +464,17 @@ static struct pxamci_platform_data cm_x300_mci_platform_data = {
.gpio_power = -1, .gpio_power = -1,
}; };
static struct gpiod_lookup_table cm_x300_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on GPIO 82 */
GPIO_LOOKUP("gpio-pxa", GPIO82_MMC_IRQ, "cd", GPIO_ACTIVE_LOW),
/* Write protect on GPIO 85 */
GPIO_LOOKUP("gpio-pxa", GPIO85_MMC_WP, "wp", GPIO_ACTIVE_LOW),
{ },
},
};
/* The second MMC slot of CM-X300 is hardwired to Libertas card and has /* The second MMC slot of CM-X300 is hardwired to Libertas card and has
no detection/ro pins */ no detection/ro pins */
static int cm_x300_mci2_init(struct device *dev, static int cm_x300_mci2_init(struct device *dev,
...@@ -489,6 +500,7 @@ static struct pxamci_platform_data cm_x300_mci2_platform_data = { ...@@ -489,6 +500,7 @@ static struct pxamci_platform_data cm_x300_mci2_platform_data = {
static void __init cm_x300_init_mmc(void) static void __init cm_x300_init_mmc(void)
{ {
gpiod_add_lookup_table(&cm_x300_mci_gpio_table);
pxa_set_mci_info(&cm_x300_mci_platform_data); pxa_set_mci_info(&cm_x300_mci_platform_data);
pxa3xx_set_mci2_info(&cm_x300_mci2_platform_data); pxa3xx_set_mci2_info(&cm_x300_mci2_platform_data);
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -42,17 +42,50 @@ static struct pxamci_platform_data colibri_mci_platform_data = { ...@@ -42,17 +42,50 @@ static struct pxamci_platform_data colibri_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
static struct gpiod_lookup_table colibri_pxa270_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO0_COLIBRI_PXA270_SD_DETECT,
"cd", GPIO_ACTIVE_LOW),
{ },
},
};
static struct gpiod_lookup_table colibri_pxa300_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO13_COLIBRI_PXA300_SD_DETECT,
"cd", GPIO_ACTIVE_LOW),
{ },
},
};
static struct gpiod_lookup_table colibri_pxa320_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO28_COLIBRI_PXA320_SD_DETECT,
"cd", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init colibri_mmc_init(void) static void __init colibri_mmc_init(void)
{ {
if (machine_is_colibri()) /* PXA270 Colibri */ if (machine_is_colibri()) { /* PXA270 Colibri */
colibri_mci_platform_data.gpio_card_detect = colibri_mci_platform_data.gpio_card_detect =
GPIO0_COLIBRI_PXA270_SD_DETECT; GPIO0_COLIBRI_PXA270_SD_DETECT;
if (machine_is_colibri300()) /* PXA300 Colibri */ gpiod_add_lookup_table(&colibri_pxa270_mci_gpio_table);
}
if (machine_is_colibri300()) { /* PXA300 Colibri */
colibri_mci_platform_data.gpio_card_detect = colibri_mci_platform_data.gpio_card_detect =
GPIO13_COLIBRI_PXA300_SD_DETECT; GPIO13_COLIBRI_PXA300_SD_DETECT;
else /* PXA320 Colibri */ gpiod_add_lookup_table(&colibri_pxa300_mci_gpio_table);
}
else { /* PXA320 Colibri */
colibri_mci_platform_data.gpio_card_detect = colibri_mci_platform_data.gpio_card_detect =
GPIO28_COLIBRI_PXA320_SD_DETECT; GPIO28_COLIBRI_PXA320_SD_DETECT;
gpiod_add_lookup_table(&colibri_pxa320_mci_gpio_table);
}
pxa_set_mci_info(&colibri_mci_platform_data); pxa_set_mci_info(&colibri_mci_platform_data);
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/leds.h> #include <linux/leds.h>
...@@ -57,8 +57,22 @@ static struct pxamci_platform_data income_mci_platform_data = { ...@@ -57,8 +57,22 @@ static struct pxamci_platform_data income_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
static struct gpiod_lookup_table income_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on GPIO 0 */
GPIO_LOOKUP("gpio-pxa", GPIO0_INCOME_SD_DETECT,
"cd", GPIO_ACTIVE_LOW),
/* Write protect on GPIO 1 */
GPIO_LOOKUP("gpio-pxa", GPIO0_INCOME_SD_RO,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init income_mmc_init(void) static void __init income_mmc_init(void)
{ {
gpiod_add_lookup_table(&income_mci_gpio_table);
pxa_set_mci_info(&income_mci_platform_data); pxa_set_mci_info(&income_mci_platform_data);
} }
#else #else
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/backlight.h> #include <linux/backlight.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/platform_data/i2c-pxa.h> #include <linux/platform_data/i2c-pxa.h>
...@@ -498,6 +499,18 @@ static struct pxamci_platform_data corgi_mci_platform_data = { ...@@ -498,6 +499,18 @@ static struct pxamci_platform_data corgi_mci_platform_data = {
.gpio_power = CORGI_GPIO_SD_PWR, .gpio_power = CORGI_GPIO_SD_PWR,
}; };
static struct gpiod_lookup_table corgi_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on GPIO 9 */
GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_nSD_DETECT,
"cd", GPIO_ACTIVE_LOW),
/* Write protect on GPIO 7 */
GPIO_LOOKUP("gpio-pxa", CORGI_GPIO_nSD_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
/* /*
* Irda * Irda
...@@ -731,6 +744,7 @@ static void __init corgi_init(void) ...@@ -731,6 +744,7 @@ static void __init corgi_init(void)
corgi_init_spi(); corgi_init_spi();
pxa_set_udc_info(&udc_info); pxa_set_udc_info(&udc_info);
gpiod_add_lookup_table(&corgi_mci_gpio_table);
pxa_set_mci_info(&corgi_mci_platform_data); pxa_set_mci_info(&corgi_mci_platform_data);
pxa_set_ficp_info(&corgi_ficp_platform_data); pxa_set_ficp_info(&corgi_ficp_platform_data);
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
...@@ -134,6 +134,19 @@ static struct pxamci_platform_data csb726_mci = { ...@@ -134,6 +134,19 @@ static struct pxamci_platform_data csb726_mci = {
.gpio_power = -1, .gpio_power = -1,
}; };
static struct gpiod_lookup_table csb726_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on GPIO 100 */
GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_DETECT,
"cd", GPIO_ACTIVE_LOW),
/* Write protect on GPIO 101 */
GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_RO,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static struct pxaohci_platform_data csb726_ohci_platform_data = { static struct pxaohci_platform_data csb726_ohci_platform_data = {
.port_mode = PMM_NPS_MODE, .port_mode = PMM_NPS_MODE,
.flags = ENABLE_PORT1 | NO_OC_PROTECTION, .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
...@@ -264,6 +277,7 @@ static void __init csb726_init(void) ...@@ -264,6 +277,7 @@ static void __init csb726_init(void)
pxa_set_stuart_info(NULL); pxa_set_stuart_info(NULL);
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
pxa27x_set_i2c_power_info(NULL); pxa27x_set_i2c_power_info(NULL);
gpiod_add_lookup_table(&csb726_mci_gpio_table);
pxa_set_mci_info(&csb726_mci); pxa_set_mci_info(&csb726_mci);
pxa_set_ohci_info(&csb726_ohci_platform_data); pxa_set_ohci_info(&csb726_ohci_platform_data);
pxa_set_ac97_info(NULL); pxa_set_ac97_info(NULL);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/mfd/da903x.h> #include <linux/mfd/da903x.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h> #include <linux/regulator/fixed.h>
...@@ -546,6 +547,15 @@ static inline void em_x270_init_ohci(void) {} ...@@ -546,6 +547,15 @@ static inline void em_x270_init_ohci(void) {}
#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) #if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
static struct regulator *em_x270_sdio_ldo; static struct regulator *em_x270_sdio_ldo;
static struct gpiod_lookup_table em_x270_mci_wp_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Write protect on GPIO 95 */
GPIO_LOOKUP("gpio-pxa", GPIO95_MMC_WP, "wp", GPIO_ACTIVE_LOW),
{ },
},
};
static int em_x270_mci_init(struct device *dev, static int em_x270_mci_init(struct device *dev,
irq_handler_t em_x270_detect_int, irq_handler_t em_x270_detect_int,
void *data) void *data)
...@@ -642,8 +652,10 @@ static struct pxamci_platform_data em_x270_mci_platform_data = { ...@@ -642,8 +652,10 @@ static struct pxamci_platform_data em_x270_mci_platform_data = {
static void __init em_x270_init_mmc(void) static void __init em_x270_init_mmc(void)
{ {
if (machine_is_em_x270()) if (machine_is_em_x270()) {
em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro; em_x270_mci_platform_data.get_ro = em_x270_mci_get_ro;
gpiod_add_lookup_table(&em_x270_mci_wp_gpio_table);
}
pxa_set_mci_info(&em_x270_mci_platform_data); pxa_set_mci_info(&em_x270_mci_platform_data);
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/pxa2xx_spi.h> #include <linux/spi/pxa2xx_spi.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
...@@ -283,8 +283,19 @@ static struct pxamci_platform_data littleton_mci_platform_data = { ...@@ -283,8 +283,19 @@ static struct pxamci_platform_data littleton_mci_platform_data = {
.gpio_power = -1, .gpio_power = -1,
}; };
static struct gpiod_lookup_table littleton_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on MFP (gpio-pxa) GPIO 15 */
GPIO_LOOKUP("gpio-pxa", MFP_PIN_GPIO15,
"cd", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init littleton_init_mmc(void) static void __init littleton_init_mmc(void)
{ {
gpiod_add_lookup_table(&littleton_mci_gpio_table);
pxa_set_mci_info(&littleton_mci_platform_data); pxa_set_mci_info(&littleton_mci_platform_data);
} }
#else #else
......
...@@ -781,6 +781,21 @@ static struct pxamci_platform_data magician_mci_info = { ...@@ -781,6 +781,21 @@ static struct pxamci_platform_data magician_mci_info = {
.gpio_power = EGPIO_MAGICIAN_SD_POWER, .gpio_power = EGPIO_MAGICIAN_SD_POWER,
}; };
/*
* Write protect on EGPIO register 5 index 4, this is on the second HTC
* EGPIO chip which starts at register 4, so we need offset 8+4=12 on that
* particular chip.
*/
#define EGPIO_MAGICIAN_nSD_READONLY_OFFSET 12
static struct gpiod_lookup_table magician_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("htc-egpio-1", EGPIO_MAGICIAN_nSD_READONLY_OFFSET,
"wp", GPIO_ACTIVE_HIGH),
{ },
},
};
/* /*
* USB OHCI * USB OHCI
...@@ -979,6 +994,7 @@ static void __init magician_init(void) ...@@ -979,6 +994,7 @@ static void __init magician_init(void)
i2c_register_board_info(1, i2c_register_board_info(1,
ARRAY_AND_SIZE(magician_pwr_i2c_board_info)); ARRAY_AND_SIZE(magician_pwr_i2c_board_info));
gpiod_add_lookup_table(&magician_mci_gpio_table);
pxa_set_mci_info(&magician_mci_info); pxa_set_mci_info(&magician_mci_info);
pxa_set_ohci_info(&magician_ohci_info); pxa_set_ohci_info(&magician_ohci_info);
pxa_set_udc_info(&magician_udc_info); pxa_set_udc_info(&magician_udc_info);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/pda_power.h> #include <linux/pda_power.h>
...@@ -402,6 +403,19 @@ static struct pxamci_platform_data mioa701_mci_info = { ...@@ -402,6 +403,19 @@ static struct pxamci_platform_data mioa701_mci_info = {
.gpio_power = GPIO91_SDIO_EN, .gpio_power = GPIO91_SDIO_EN,
}; };
static struct gpiod_lookup_table mioa701_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on GPIO 15 */
GPIO_LOOKUP("gpio-pxa", GPIO15_SDIO_INSERT,
"cd", GPIO_ACTIVE_LOW),
/* Write protect on GPIO 78 */
GPIO_LOOKUP("gpio-pxa", GPIO78_SDIO_RO,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
/* FlashRAM */ /* FlashRAM */
static struct resource docg3_resource = { static struct resource docg3_resource = {
.start = PXA_CS0_PHYS, .start = PXA_CS0_PHYS,
...@@ -743,6 +757,7 @@ static void __init mioa701_machine_init(void) ...@@ -743,6 +757,7 @@ static void __init mioa701_machine_init(void)
pr_err("MioA701: Failed to request GPIOs: %d", rc); pr_err("MioA701: Failed to request GPIOs: %d", rc);
bootstrap_init(); bootstrap_init();
pxa_set_fb_info(NULL, &mioa701_pxafb_info); pxa_set_fb_info(NULL, &mioa701_pxafb_info);
gpiod_add_lookup_table(&mioa701_mci_gpio_table);
pxa_set_mci_info(&mioa701_mci_info); pxa_set_mci_info(&mioa701_mci_info);
pxa_set_keypad_info(&mioa701_keypad_info); pxa_set_keypad_info(&mioa701_keypad_info);
pxa_set_udc_info(&mioa701_udc_info); pxa_set_udc_info(&mioa701_udc_info);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/dm9000.h> #include <linux/dm9000.h>
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <linux/platform_data/i2c-pxa.h> #include <linux/platform_data/i2c-pxa.h>
#include <linux/platform_data/mtd-nand-pxa3xx.h> #include <linux/platform_data/mtd-nand-pxa3xx.h>
...@@ -331,8 +331,22 @@ static struct pxamci_platform_data mxm_8x10_mci_platform_data = { ...@@ -331,8 +331,22 @@ static struct pxamci_platform_data mxm_8x10_mci_platform_data = {
.gpio_power = -1 .gpio_power = -1
}; };
static struct gpiod_lookup_table mxm_8x10_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
/* Card detect on GPIO 72 */
GPIO_LOOKUP("gpio-pxa", MXM_8X10_SD_nCD,
"cd", GPIO_ACTIVE_LOW),
/* Write protect on GPIO 84 */
GPIO_LOOKUP("gpio-pxa", MXM_8X10_SD_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
void __init mxm_8x10_mmc_init(void) void __init mxm_8x10_mmc_init(void)
{ {
gpiod_add_lookup_table(&mxm_8x10_mci_gpio_table);
pxa_set_mci_info(&mxm_8x10_mci_platform_data); pxa_set_mci_info(&mxm_8x10_mci_platform_data);
} }
#endif #endif
......
...@@ -126,8 +126,20 @@ static struct pxamci_platform_data palmtc_mci_platform_data = { ...@@ -126,8 +126,20 @@ static struct pxamci_platform_data palmtc_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
static struct gpiod_lookup_table palmtc_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTC_SD_READONLY,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init palmtc_mmc_init(void) static void __init palmtc_mmc_init(void)
{ {
gpiod_add_lookup_table(&palmtc_mci_gpio_table);
pxa_set_mci_info(&palmtc_mci_platform_data); pxa_set_mci_info(&palmtc_mci_platform_data);
} }
#else #else
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/gpio/machine.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/pda_power.h> #include <linux/pda_power.h>
#include <linux/pwm.h> #include <linux/pwm.h>
...@@ -106,6 +107,17 @@ static struct pxamci_platform_data palmte2_mci_platform_data = { ...@@ -106,6 +107,17 @@ static struct pxamci_platform_data palmte2_mci_platform_data = {
.gpio_power = GPIO_NR_PALMTE2_SD_POWER, .gpio_power = GPIO_NR_PALMTE2_SD_POWER,
}; };
static struct gpiod_lookup_table palmte2_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_READONLY,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
/****************************************************************************** /******************************************************************************
* GPIO keys * GPIO keys
...@@ -354,6 +366,7 @@ static void __init palmte2_init(void) ...@@ -354,6 +366,7 @@ static void __init palmte2_init(void)
pxa_set_stuart_info(NULL); pxa_set_stuart_info(NULL);
pxa_set_fb_info(NULL, &palmte2_lcd_screen); pxa_set_fb_info(NULL, &palmte2_lcd_screen);
gpiod_add_lookup_table(&palmte2_mci_gpio_table);
pxa_set_mci_info(&palmte2_mci_platform_data); pxa_set_mci_info(&palmte2_mci_platform_data);
palmte2_udc_init(); palmte2_udc_init();
pxa_set_ac97_info(&palmte2_ac97_pdata); pxa_set_ac97_info(&palmte2_ac97_pdata);
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/platform_data/i2c-pxa.h> #include <linux/platform_data/i2c-pxa.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
...@@ -293,6 +294,16 @@ static struct pxamci_platform_data poodle_mci_platform_data = { ...@@ -293,6 +294,16 @@ static struct pxamci_platform_data poodle_mci_platform_data = {
.gpio_power = -1, .gpio_power = -1,
}; };
static struct gpiod_lookup_table poodle_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", POODLE_GPIO_nSD_DETECT,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", POODLE_GPIO_nSD_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
/* /*
* Irda * Irda
...@@ -439,6 +450,7 @@ static void __init poodle_init(void) ...@@ -439,6 +450,7 @@ static void __init poodle_init(void)
pxa_set_fb_info(&poodle_locomo_device.dev, &poodle_fb_info); pxa_set_fb_info(&poodle_locomo_device.dev, &poodle_fb_info);
pxa_set_udc_info(&udc_info); pxa_set_udc_info(&udc_info);
gpiod_add_lookup_table(&poodle_mci_gpio_table);
pxa_set_mci_info(&poodle_mci_platform_data); pxa_set_mci_info(&poodle_mci_platform_data);
pxa_set_ficp_info(&poodle_ficp_platform_data); pxa_set_ficp_info(&poodle_ficp_platform_data);
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/platform_data/i2c-pxa.h> #include <linux/platform_data/i2c-pxa.h>
...@@ -620,8 +621,20 @@ static struct pxamci_platform_data spitz_mci_platform_data = { ...@@ -620,8 +621,20 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
.gpio_power = -1, .gpio_power = -1,
}; };
static struct gpiod_lookup_table spitz_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init spitz_mmc_init(void) static void __init spitz_mmc_init(void)
{ {
gpiod_add_lookup_table(&spitz_mci_gpio_table);
pxa_set_mci_info(&spitz_mci_platform_data); pxa_set_mci_info(&spitz_mci_platform_data);
} }
#else #else
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/power/gpio-charger.h> #include <linux/power/gpio-charger.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/pxa2xx_spi.h> #include <linux/spi/pxa2xx_spi.h>
...@@ -296,6 +297,17 @@ static struct pxamci_platform_data tosa_mci_platform_data = { ...@@ -296,6 +297,17 @@ static struct pxamci_platform_data tosa_mci_platform_data = {
.gpio_power = TOSA_GPIO_PWR_ON, .gpio_power = TOSA_GPIO_PWR_ON,
}; };
static struct gpiod_lookup_table tosa_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_nSD_DETECT,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_SD_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
/* /*
* Irda * Irda
*/ */
...@@ -908,6 +920,7 @@ static void __init tosa_init(void) ...@@ -908,6 +920,7 @@ static void __init tosa_init(void)
/* enable batt_fault */ /* enable batt_fault */
PMCR = 0x01; PMCR = 0x01;
gpiod_add_lookup_table(&tosa_mci_gpio_table);
pxa_set_mci_info(&tosa_mci_platform_data); pxa_set_mci_info(&tosa_mci_platform_data);
pxa_set_ficp_info(&tosa_ficp_platform_data); pxa_set_ficp_info(&tosa_ficp_platform_data);
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/usb/gpio_vbus.h> #include <linux/usb/gpio_vbus.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
...@@ -246,8 +247,20 @@ static struct pxamci_platform_data vpac270_mci_platform_data = { ...@@ -246,8 +247,20 @@ static struct pxamci_platform_data vpac270_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
static struct gpiod_lookup_table vpac270_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO53_VPAC270_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO52_VPAC270_SD_READONLY,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init vpac270_mmc_init(void) static void __init vpac270_mmc_init(void)
{ {
gpiod_add_lookup_table(&vpac270_mci_gpio_table);
pxa_set_mci_info(&vpac270_mci_platform_data); pxa_set_mci_info(&vpac270_mci_platform_data);
} }
#else #else
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/gpio_keys.h> #include <linux/gpio_keys.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
...@@ -296,8 +297,18 @@ static struct pxamci_platform_data z2_mci_platform_data = { ...@@ -296,8 +297,18 @@ static struct pxamci_platform_data z2_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
static struct gpiod_lookup_table z2_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO96_ZIPITZ2_SD_DETECT,
"cd", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init z2_mmc_init(void) static void __init z2_mmc_init(void)
{ {
gpiod_add_lookup_table(&z2_mci_gpio_table);
pxa_set_mci_info(&z2_mci_platform_data); pxa_set_mci_info(&z2_mci_platform_data);
} }
#else #else
......
...@@ -669,6 +669,17 @@ static struct pxamci_platform_data zeus_mci_platform_data = { ...@@ -669,6 +669,17 @@ static struct pxamci_platform_data zeus_mci_platform_data = {
.gpio_power = -1 .gpio_power = -1
}; };
static struct gpiod_lookup_table zeus_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", ZEUS_MMC_CD_GPIO,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", ZEUS_MMC_WP_GPIO,
"wp", GPIO_ACTIVE_HIGH),
{ },
},
};
/* /*
* USB Device Controller * USB Device Controller
*/ */
...@@ -883,6 +894,7 @@ static void __init zeus_init(void) ...@@ -883,6 +894,7 @@ static void __init zeus_init(void)
else else
pxa_set_fb_info(NULL, &zeus_fb_info); pxa_set_fb_info(NULL, &zeus_fb_info);
gpiod_add_lookup_table(&zeus_mci_gpio_table);
pxa_set_mci_info(&zeus_mci_platform_data); pxa_set_mci_info(&zeus_mci_platform_data);
pxa_set_udc_info(&zeus_udc_info); pxa_set_udc_info(&zeus_udc_info);
pxa_set_ac97_info(&zeus_ac97_info); pxa_set_ac97_info(&zeus_ac97_info);
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <linux/pwm.h> #include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
...@@ -232,6 +232,24 @@ static struct pxamci_platform_data zylonite_mci_platform_data = { ...@@ -232,6 +232,24 @@ static struct pxamci_platform_data zylonite_mci_platform_data = {
.gpio_power = -1, .gpio_power = -1,
}; };
#define PCA9539A_MCI_CD 0
#define PCA9539A_MCI1_CD 1
#define PCA9539A_MCI_WP 2
#define PCA9539A_MCI1_WP 3
#define PCA9539A_MCI3_CD 30
#define PCA9539A_MCI3_WP 31
static struct gpiod_lookup_table zylonite_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_CD,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
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,
...@@ -240,6 +258,17 @@ static struct pxamci_platform_data zylonite_mci2_platform_data = { ...@@ -240,6 +258,17 @@ static struct pxamci_platform_data zylonite_mci2_platform_data = {
.gpio_power = -1, .gpio_power = -1,
}; };
static struct gpiod_lookup_table zylonite_mci2_gpio_table = {
.dev_id = "pxa2xx-mci.1",
.table = {
GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_CD,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
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,
...@@ -248,12 +277,27 @@ static struct pxamci_platform_data zylonite_mci3_platform_data = { ...@@ -248,12 +277,27 @@ static struct pxamci_platform_data zylonite_mci3_platform_data = {
.gpio_power = -1, .gpio_power = -1,
}; };
static struct gpiod_lookup_table zylonite_mci3_gpio_table = {
.dev_id = "pxa2xx-mci.2",
.table = {
GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_CD,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init zylonite_init_mmc(void) static void __init zylonite_init_mmc(void)
{ {
gpiod_add_lookup_table(&zylonite_mci_gpio_table);
pxa_set_mci_info(&zylonite_mci_platform_data); pxa_set_mci_info(&zylonite_mci_platform_data);
gpiod_add_lookup_table(&zylonite_mci2_gpio_table);
pxa3xx_set_mci2_info(&zylonite_mci2_platform_data); pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
if (cpu_is_pxa310()) if (cpu_is_pxa310()) {
gpiod_add_lookup_table(&zylonite_mci3_gpio_table);
pxa3xx_set_mci3_info(&zylonite_mci3_platform_data); pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
}
} }
#else #else
static inline void zylonite_init_mmc(void) {} static inline void zylonite_init_mmc(void) {}
......
...@@ -230,11 +230,13 @@ static struct pca953x_platform_data gpio_exp[] = { ...@@ -230,11 +230,13 @@ static struct pca953x_platform_data gpio_exp[] = {
static struct i2c_board_info zylonite_i2c_board_info[] = { static struct i2c_board_info zylonite_i2c_board_info[] = {
{ {
.type = "pca9539", .type = "pca9539",
.dev_name = "pca9539-a",
.addr = 0x74, .addr = 0x74,
.platform_data = &gpio_exp[0], .platform_data = &gpio_exp[0],
.irq = PXA_GPIO_TO_IRQ(18), .irq = PXA_GPIO_TO_IRQ(18),
}, { }, {
.type = "pca9539", .type = "pca9539",
.dev_name = "pca9539-b",
.addr = 0x75, .addr = 0x75,
.platform_data = &gpio_exp[1], .platform_data = &gpio_exp[1],
.irq = PXA_GPIO_TO_IRQ(19), .irq = PXA_GPIO_TO_IRQ(19),
......
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