Merge branch 'i2c/for-4.15' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / arm / mach-ixp4xx / avila-setup.c
index 186df64ceae733de395f141e467935d96321cd91..77def6169f506a0134e2fd337b396b93747cccad 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/serial.h>
 #include <linux/tty.h>
 #include <linux/serial_8250.h>
-#include <linux/i2c-gpio.h>
+#include <linux/gpio/machine.h>
 #include <asm/types.h>
 #include <asm/setup.h>
 #include <asm/memory.h>
@@ -50,16 +50,21 @@ static struct platform_device avila_flash = {
        .resource       = &avila_flash_resource,
 };
 
-static struct i2c_gpio_platform_data avila_i2c_gpio_data = {
-       .sda_pin        = AVILA_SDA_PIN,
-       .scl_pin        = AVILA_SCL_PIN,
+static struct gpiod_lookup_table avila_i2c_gpiod_table = {
+       .dev_id         = "i2c-gpio",
+       .table          = {
+               GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SDA_PIN,
+                               NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+               GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", AVILA_SCL_PIN,
+                               NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+       },
 };
 
 static struct platform_device avila_i2c_gpio = {
        .name           = "i2c-gpio",
        .id             = 0,
        .dev     = {
-               .platform_data  = &avila_i2c_gpio_data,
+               .platform_data  = NULL,
        },
 };
 
@@ -148,6 +153,8 @@ static void __init avila_init(void)
        avila_flash_resource.end =
                IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
 
+       gpiod_add_lookup_table(&avila_i2c_gpiod_table);
+
        platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
 
        avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);