Commit 58e2d877 authored by Linus Walleij's avatar Linus Walleij Committed by Ulf Hansson

ARM: pxa: Add GPIO descriptors for Palm27x

The Palm27x devices set up the MMC card detect and
write protect lines with a special helper function.
Augment this helper function to also accept an optional
GPIO descriptor table and pass and register this for
all the Palm27x devices in that family.

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>
Acked-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 32d15448
...@@ -49,7 +49,10 @@ static struct pxamci_platform_data palm27x_mci_platform_data = { ...@@ -49,7 +49,10 @@ static struct pxamci_platform_data palm27x_mci_platform_data = {
.detect_delay_ms = 200, .detect_delay_ms = 200,
}; };
void __init palm27x_mmc_init(int detect, int ro, int power, void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable,
int detect,
int ro,
int power,
int power_inverted) int power_inverted)
{ {
palm27x_mci_platform_data.gpio_card_detect = detect; palm27x_mci_platform_data.gpio_card_detect = detect;
...@@ -57,6 +60,8 @@ void __init palm27x_mmc_init(int detect, int ro, int power, ...@@ -57,6 +60,8 @@ void __init palm27x_mmc_init(int detect, int ro, int power,
palm27x_mci_platform_data.gpio_power = power; palm27x_mci_platform_data.gpio_power = power;
palm27x_mci_platform_data.gpio_power_invert = power_inverted; palm27x_mci_platform_data.gpio_power_invert = power_inverted;
if (gtable)
gpiod_add_lookup_table(gtable);
pxa_set_mci_info(&palm27x_mci_platform_data); pxa_set_mci_info(&palm27x_mci_platform_data);
} }
#endif #endif
......
...@@ -12,11 +12,19 @@ ...@@ -12,11 +12,19 @@
#ifndef __INCLUDE_MACH_PALM27X__ #ifndef __INCLUDE_MACH_PALM27X__
#define __INCLUDE_MACH_PALM27X__ #define __INCLUDE_MACH_PALM27X__
#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(int detect, int ro, int power, extern void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable,
int detect,
int ro,
int power,
int power_inverted); int power_inverted);
#else #else
static inline void palm27x_mmc_init(int detect, int ro, int power, static inline void palm27x_mmc_init(struct gpiod_lookup_table *gtable,
int detect,
int ro,
int power,
int power_inverted) int power_inverted)
{} {}
#endif #endif
......
...@@ -320,6 +320,17 @@ static void __init palmld_map_io(void) ...@@ -320,6 +320,17 @@ static void __init palmld_map_io(void)
iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc)); iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc));
} }
static struct gpiod_lookup_table palmld_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init palmld_init(void) static void __init palmld_init(void)
{ {
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
...@@ -327,7 +338,9 @@ static void __init palmld_init(void) ...@@ -327,7 +338,9 @@ 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(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY, palm27x_mmc_init(&palmld_mci_gpio_table,
GPIO_NR_PALMLD_SD_DETECT_N,
GPIO_NR_PALMLD_SD_READONLY,
GPIO_NR_PALMLD_SD_POWER, 0); 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);
......
...@@ -182,6 +182,17 @@ static void __init palmt5_reserve(void) ...@@ -182,6 +182,17 @@ static void __init palmt5_reserve(void)
memblock_reserve(0xa0200000, 0x1000); memblock_reserve(0xa0200000, 0x1000);
} }
static struct gpiod_lookup_table palmt5_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init palmt5_init(void) static void __init palmt5_init(void)
{ {
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
...@@ -189,7 +200,9 @@ static void __init palmt5_init(void) ...@@ -189,7 +200,9 @@ 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(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY, palm27x_mmc_init(&palmt5_mci_gpio_table,
GPIO_NR_PALMT5_SD_DETECT_N,
GPIO_NR_PALMT5_SD_READONLY,
GPIO_NR_PALMT5_SD_POWER, 0); 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);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/pwm.h> #include <linux/pwm.h>
#include <linux/pwm_backlight.h> #include <linux/pwm_backlight.h>
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <linux/input/matrix_keypad.h> #include <linux/input/matrix_keypad.h>
#include <linux/ucb1400.h> #include <linux/ucb1400.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
......
...@@ -480,22 +480,46 @@ void __init treo680_gpio_init(void) ...@@ -480,22 +480,46 @@ void __init treo680_gpio_init(void)
gpio_free(GPIO_NR_TREO680_LCD_EN_N); gpio_free(GPIO_NR_TREO680_LCD_EN_N);
} }
static struct gpiod_lookup_table treo680_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO680_SD_READONLY,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init treo680_init(void) 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(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY, palm27x_mmc_init(&treo680_mci_gpio_table,
GPIO_NR_TREO_SD_DETECT_N,
GPIO_NR_TREO680_SD_READONLY,
GPIO_NR_TREO680_SD_POWER, 0); GPIO_NR_TREO680_SD_POWER, 0);
} }
#endif #endif
#ifdef CONFIG_MACH_CENTRO #ifdef CONFIG_MACH_CENTRO
static struct gpiod_lookup_table centro685_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init centro_init(void) 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(GPIO_NR_TREO_SD_DETECT_N, -1, palm27x_mmc_init(&centro685_mci_gpio_table,
GPIO_NR_TREO_SD_DETECT_N, -1,
GPIO_NR_CENTRO_SD_POWER, 1); GPIO_NR_CENTRO_SD_POWER, 1);
} }
#endif #endif
......
...@@ -337,6 +337,17 @@ static void __init palmtx_map_io(void) ...@@ -337,6 +337,17 @@ static void __init palmtx_map_io(void)
iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc)); iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc));
} }
static struct gpiod_lookup_table palmtx_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_READONLY,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
static void __init palmtx_init(void) static void __init palmtx_init(void)
{ {
pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
...@@ -344,7 +355,9 @@ static void __init palmtx_init(void) ...@@ -344,7 +355,9 @@ 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(GPIO_NR_PALMTX_SD_DETECT_N, GPIO_NR_PALMTX_SD_READONLY, palm27x_mmc_init(&palmtx_mci_gpio_table,
GPIO_NR_PALMTX_SD_DETECT_N,
GPIO_NR_PALMTX_SD_READONLY,
GPIO_NR_PALMTX_SD_POWER, 0); 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);
......
...@@ -386,6 +386,17 @@ static void __init palmz72_camera_init(void) ...@@ -386,6 +386,17 @@ static void __init palmz72_camera_init(void)
static inline void palmz72_camera_init(void) {} static inline void palmz72_camera_init(void) {}
#endif #endif
static struct gpiod_lookup_table palmz72_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_DETECT_N,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO,
"wp", GPIO_ACTIVE_LOW),
{ },
},
};
/****************************************************************************** /******************************************************************************
* Machine init * Machine init
******************************************************************************/ ******************************************************************************/
...@@ -396,7 +407,9 @@ static void __init palmz72_init(void) ...@@ -396,7 +407,9 @@ 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(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO, palm27x_mmc_init(&palmz72_mci_gpio_table,
GPIO_NR_PALMZ72_SD_DETECT_N,
GPIO_NR_PALMZ72_SD_RO,
GPIO_NR_PALMZ72_SD_POWER_N, 1); 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,
......
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