ARM: pxa: Add GPIO descriptors for Palm27x
authorLinus Walleij <linus.walleij@linaro.org>
Sun, 2 Dec 2018 08:43:23 +0000 (09:43 +0100)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 17 Dec 2018 07:26:24 +0000 (08:26 +0100)
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: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
arch/arm/mach-pxa/palm27x.c
arch/arm/mach-pxa/palm27x.h
arch/arm/mach-pxa/palmld.c
arch/arm/mach-pxa/palmt5.c
arch/arm/mach-pxa/palmtc.c
arch/arm/mach-pxa/palmtreo.c
arch/arm/mach-pxa/palmtx.c
arch/arm/mach-pxa/palmz72.c

index 1efe9bcf07faa1cdc98373468cb201414b584b05..d854a8a2dd59920bb4eda988eca43e3b56512027 100644 (file)
@@ -49,14 +49,19 @@ static struct pxamci_platform_data palm27x_mci_platform_data = {
        .detect_delay_ms        = 200,
 };
 
-void __init palm27x_mmc_init(int detect, int ro, int power,
-                                       int power_inverted)
+void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable,
+                            int detect,
+                            int ro,
+                            int power,
+                            int power_inverted)
 {
        palm27x_mci_platform_data.gpio_card_detect      = detect;
        palm27x_mci_platform_data.gpio_card_ro          = ro;
        palm27x_mci_platform_data.gpio_power            = power;
        palm27x_mci_platform_data.gpio_power_invert     = power_inverted;
 
+       if (gtable)
+               gpiod_add_lookup_table(gtable);
        pxa_set_mci_info(&palm27x_mci_platform_data);
 }
 #endif
index d4eac3d6ffb5ecd04df4abeb0ed45b32a2882705..7ca02d0f45aeb7bb3ba396b8e55587a95c8ab45f 100644 (file)
 #ifndef        __INCLUDE_MACH_PALM27X__
 #define        __INCLUDE_MACH_PALM27X__
 
+#include <linux/gpio/machine.h>
+
 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
-extern void __init palm27x_mmc_init(int detect, int ro, int power,
-                                       int power_inverted);
+extern void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable,
+                                   int detect,
+                                   int ro,
+                                   int power,
+                                   int power_inverted);
 #else
-static inline void palm27x_mmc_init(int detect, int ro, int power,
-                                       int power_inverted)
+static inline void palm27x_mmc_init(struct gpiod_lookup_table *gtable,
+                                   int detect,
+                                   int ro,
+                                   int power,
+                                   int power_inverted)
 {}
 #endif
 
index 980f2847f5b5251d2199f3821d144c61c6226e48..aefb65eb4f0958da5182ea985ff88675deb79843 100644 (file)
@@ -320,6 +320,17 @@ static void __init palmld_map_io(void)
        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)
 {
        pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config));
@@ -327,8 +338,10 @@ static void __init palmld_init(void)
        pxa_set_btuart_info(NULL);
        pxa_set_stuart_info(NULL);
 
-       palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY,
-                       GPIO_NR_PALMLD_SD_POWER, 0);
+       palm27x_mmc_init(&palmld_mci_gpio_table,
+                        GPIO_NR_PALMLD_SD_DETECT_N,
+                        GPIO_NR_PALMLD_SD_READONLY,
+                        GPIO_NR_PALMLD_SD_POWER, 0);
        palm27x_pm_init(PALMLD_STR_BASE);
        palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
        palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE);
index 876144aa35648d56d889eee5a696a6e6278a2be7..86634a48aec73274eaa85bb63a8089d1424cab11 100644 (file)
@@ -182,6 +182,17 @@ static void __init palmt5_reserve(void)
        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)
 {
        pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
@@ -189,8 +200,10 @@ static void __init palmt5_init(void)
        pxa_set_btuart_info(NULL);
        pxa_set_stuart_info(NULL);
 
-       palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY,
-                       GPIO_NR_PALMT5_SD_POWER, 0);
+       palm27x_mmc_init(&palmt5_mci_gpio_table,
+                        GPIO_NR_PALMT5_SD_DETECT_N,
+                        GPIO_NR_PALMT5_SD_READONLY,
+                        GPIO_NR_PALMT5_SD_POWER, 0);
        palm27x_pm_init(PALMT5_STR_BASE);
        palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
        palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N,
index 4b04973c9bae19dd49efc2bc17e61156e7aaebf4..504cdefbf5ac887a0d63271ebf1481031644dfae 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/input.h>
 #include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
-#include <linux/gpio.h>
+#include <linux/gpio/machine.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/ucb1400.h>
 #include <linux/power_supply.h>
index b66b0b11d7172f4ad0e3db9e4a3fc80f0775f04d..250e8e27cab93099218349dfa6462b3e2a942f1d 100644 (file)
@@ -480,23 +480,47 @@ void __init treo680_gpio_init(void)
        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)
 {
        pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
        palmphone_common_init();
        treo680_gpio_init();
-       palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY,
-                       GPIO_NR_TREO680_SD_POWER, 0);
+       palm27x_mmc_init(&treo680_mci_gpio_table,
+                        GPIO_NR_TREO_SD_DETECT_N,
+                        GPIO_NR_TREO680_SD_READONLY,
+                        GPIO_NR_TREO680_SD_POWER, 0);
 }
 #endif
 
 #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)
 {
        pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
        palmphone_common_init();
-       palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, -1,
-                       GPIO_NR_CENTRO_SD_POWER, 1);
+       palm27x_mmc_init(&centro685_mci_gpio_table,
+                        GPIO_NR_TREO_SD_DETECT_N, -1,
+                        GPIO_NR_CENTRO_SD_POWER, 1);
 }
 #endif
 
index 1d06a8e91d8f9376b4a88a93b8dc4f58c9e4911b..5bb4ffeb4ba59db6efc231e240446c307cf03745 100644 (file)
@@ -337,6 +337,17 @@ static void __init palmtx_map_io(void)
        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)
 {
        pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config));
@@ -344,8 +355,10 @@ static void __init palmtx_init(void)
        pxa_set_btuart_info(NULL);
        pxa_set_stuart_info(NULL);
 
-       palm27x_mmc_init(GPIO_NR_PALMTX_SD_DETECT_N, GPIO_NR_PALMTX_SD_READONLY,
-                       GPIO_NR_PALMTX_SD_POWER, 0);
+       palm27x_mmc_init(&palmtx_mci_gpio_table,
+                        GPIO_NR_PALMTX_SD_DETECT_N,
+                        GPIO_NR_PALMTX_SD_READONLY,
+                        GPIO_NR_PALMTX_SD_POWER, 0);
        palm27x_pm_init(PALMTX_STR_BASE);
        palm27x_lcd_init(-1, &palm_320x480_lcd_mode);
        palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N,
index 4d475f6f4a777081d2e0c9c695ad7ceb26ab399f..274f691d68644b19aeef78a6c0ab4f1cdac84f59 100644 (file)
@@ -386,6 +386,17 @@ static void __init palmz72_camera_init(void)
 static inline void palmz72_camera_init(void) {}
 #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
  ******************************************************************************/
@@ -396,8 +407,10 @@ static void __init palmz72_init(void)
        pxa_set_btuart_info(NULL);
        pxa_set_stuart_info(NULL);
 
-       palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO,
-                       GPIO_NR_PALMZ72_SD_POWER_N, 1);
+       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);
        palm27x_lcd_init(-1, &palm_320x320_lcd_mode);
        palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N,
                        GPIO_NR_PALMZ72_USB_PULLUP, 0);