Merge branch 'i2c/for-4.15' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / blackfin / mach-bf533 / boards / stamp.c
index 23eada79439c7abe2734ffdb0945ec66318dff9f..27cbf2fa2c6267e8e1a004d969ffbf6817989a75 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/gpio.h>
 #include <linux/irq.h>
 #include <linux/i2c.h>
+#include <linux/gpio/machine.h>
 #include <asm/dma.h>
 #include <asm/bfin5xx_spi.h>
 #include <asm/reboot.h>
@@ -512,11 +513,17 @@ static struct platform_device bfin_device_gpiokeys = {
 #if IS_ENABLED(CONFIG_I2C_GPIO)
 #include <linux/i2c-gpio.h>
 
+static struct gpiod_lookup_table bfin_i2c_gpiod_table = {
+       .dev_id = "i2c-gpio",
+       .table = {
+               GPIO_LOOKUP_IDX("BFIN-GPIO", GPIO_PF2, NULL, 0,
+                               GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+               GPIO_LOOKUP_IDX("BFIN-GPIO", GPIO_PF3, NULL, 1,
+                               GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+       },
+};
+
 static struct i2c_gpio_platform_data i2c_gpio_data = {
-       .sda_pin                = GPIO_PF2,
-       .scl_pin                = GPIO_PF3,
-       .sda_is_open_drain      = 0,
-       .scl_is_open_drain      = 0,
        .udelay                 = 10,
 };
 
@@ -848,6 +855,9 @@ static int __init stamp_init(void)
 
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
+#if IS_ENABLED(CONFIG_I2C_GPIO)
+       gpiod_add_lookup_table(&bfin_i2c_gpiod_table);
+#endif
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));