Commit 4c40db62 authored by Linus Walleij's avatar Linus Walleij

ARM: omap1: Remove reliance on GPIO numbers from PalmTE

It appears this happens because the OMAP driver now
allocates GPIO numbers dynamically, so all that is
references by number is a bit up in the air.

Utilize the NULL device to define some board-specific
GPIO lookups and use these to immediately look up the
same GPIOs, convert to IRQ numbers and pass as resources
to the devices. This is ugly but should work.

Fixes: 92bf78b3 ("gpio: omap: use dynamic allocation of base")
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent fa1ae0cd
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
* *
* Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org> * Copyright (c) 2006 Andrzej Zaborowski <balrog@zabor.org>
*/ */
#include <linux/gpio.h> #include <linux/gpio/machine.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/input.h> #include <linux/input.h>
...@@ -187,23 +188,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = { ...@@ -187,23 +188,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = {
}, },
}; };
static void __init palmte_misc_gpio_setup(void)
{
/* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
return;
}
gpio_direction_input(PALMTE_PINTDAV_GPIO);
/* Set USB-or-DC-IN pin as input (unused) */
if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
return;
}
gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
}
#if IS_ENABLED(CONFIG_MMC_OMAP) #if IS_ENABLED(CONFIG_MMC_OMAP)
static struct omap_mmc_platform_data _palmte_mmc_config = { static struct omap_mmc_platform_data _palmte_mmc_config = {
...@@ -231,8 +215,23 @@ static void palmte_mmc_init(void) ...@@ -231,8 +215,23 @@ static void palmte_mmc_init(void)
#endif /* CONFIG_MMC_OMAP */ #endif /* CONFIG_MMC_OMAP */
static struct gpiod_lookup_table palmte_irq_gpio_table = {
.dev_id = NULL,
.table = {
/* GPIO used for TSC2102 PINTDAV IRQ */
GPIO_LOOKUP("gpio-0-15", PALMTE_PINTDAV_GPIO, "tsc2102_irq",
GPIO_ACTIVE_HIGH),
/* GPIO used for USB or DC input detection */
GPIO_LOOKUP("gpio-0-15", PALMTE_USB_OR_DC_GPIO, "usb_dc_irq",
GPIO_ACTIVE_HIGH),
{ }
},
};
static void __init omap_palmte_init(void) static void __init omap_palmte_init(void)
{ {
struct gpio_desc *d;
/* mux pins for uarts */ /* mux pins for uarts */
omap_cfg_reg(UART1_TX); omap_cfg_reg(UART1_TX);
omap_cfg_reg(UART1_RTS); omap_cfg_reg(UART1_RTS);
...@@ -243,9 +242,21 @@ static void __init omap_palmte_init(void) ...@@ -243,9 +242,21 @@ static void __init omap_palmte_init(void)
platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices)); platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
palmte_spi_info[0].irq = gpio_to_irq(PALMTE_PINTDAV_GPIO); gpiod_add_lookup_table(&palmte_irq_gpio_table);
d = gpiod_get(NULL, "tsc2102_irq", GPIOD_IN);
if (IS_ERR(d))
pr_err("Unable to get TSC2102 IRQ GPIO descriptor\n");
else
palmte_spi_info[0].irq = gpiod_to_irq(d);
spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
palmte_misc_gpio_setup();
/* We are getting this just to set it up as input */
d = gpiod_get(NULL, "usb_dc_irq", GPIOD_IN);
if (IS_ERR(d))
pr_err("Unable to get USB/DC IRQ GPIO descriptor\n");
else
gpiod_put(d);
omap_serial_init(); omap_serial_init();
omap1_usb_init(&palmte_usb_config); omap1_usb_init(&palmte_usb_config);
omap_register_i2c_bus(1, 100, NULL, 0); omap_register_i2c_bus(1, 100, NULL, 0);
......
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