Skip to content
Snippets Groups Projects
Commit 4ee045f4 authored by Wolfram Sang's avatar Wolfram Sang
Browse files

Merge branch 'for-wolfram' of...

Merge branch 'for-wolfram' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio into i2c/for-4.15

Refactor i2c-gpio and its users to use gpiod. Done by GPIO maintainer
LinusW.
parents 93367bfc 05c74778
No related branches found
No related tags found
No related merge requests found
Showing
with 212 additions and 139 deletions
...@@ -2,25 +2,39 @@ Device-Tree bindings for i2c gpio driver ...@@ -2,25 +2,39 @@ Device-Tree bindings for i2c gpio driver
Required properties: Required properties:
- compatible = "i2c-gpio"; - compatible = "i2c-gpio";
- gpios: sda and scl gpio - sda-gpios: gpio used for the sda signal, this should be flagged as
active high using open drain with (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)
from <dt-bindings/gpio/gpio.h> since the signal is by definition
open drain.
- scl-gpios: gpio used for the scl signal, this should be flagged as
active high using open drain with (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)
from <dt-bindings/gpio/gpio.h> since the signal is by definition
open drain.
Optional properties: Optional properties:
- i2c-gpio,sda-open-drain: sda as open drain
- i2c-gpio,scl-open-drain: scl as open drain
- i2c-gpio,scl-output-only: scl as output only - i2c-gpio,scl-output-only: scl as output only
- i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform) - i2c-gpio,delay-us: delay between GPIO operations (may depend on each platform)
- i2c-gpio,timeout-ms: timeout to get data - i2c-gpio,timeout-ms: timeout to get data
Deprecated properties, do not use in new device tree sources:
- gpios: sda and scl gpio, alternative for {sda,scl}-gpios
- i2c-gpio,sda-open-drain: this means that something outside of our
control has put the GPIO line used for SDA into open drain mode, and
that something is not the GPIO chip. It is essentially an
inconsistency flag.
- i2c-gpio,scl-open-drain: this means that something outside of our
control has put the GPIO line used for SCL into open drain mode, and
that something is not the GPIO chip. It is essentially an
inconsistency flag.
Example nodes: Example nodes:
#include <dt-bindings/gpio/gpio.h>
i2c@0 { i2c@0 {
compatible = "i2c-gpio"; compatible = "i2c-gpio";
gpios = <&pioA 23 0 /* sda */ sda-gpios = <&pioA 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
&pioA 24 0 /* scl */ scl-gpios = <&pioA 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
>;
i2c-gpio,sda-open-drain;
i2c-gpio,scl-open-drain;
i2c-gpio,delay-us = <2>; /* ~100 kHz */ i2c-gpio,delay-us = <2>; /* ~100 kHz */
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <linux/amba/serial.h> #include <linux/amba/serial.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h> #include <linux/gpio/machine.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/irqchip/arm-vic.h> #include <linux/irqchip/arm-vic.h>
...@@ -320,42 +320,47 @@ void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr) ...@@ -320,42 +320,47 @@ void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr)
/************************************************************************* /*************************************************************************
* EP93xx i2c peripheral handling * EP93xx i2c peripheral handling
*************************************************************************/ *************************************************************************/
static struct i2c_gpio_platform_data ep93xx_i2c_data;
/* All EP93xx devices use the same two GPIO pins for I2C bit-banging */
static struct gpiod_lookup_table ep93xx_i2c_gpiod_table = {
.dev_id = "i2c-gpio",
.table = {
/* Use local offsets on gpiochip/port "G" */
GPIO_LOOKUP_IDX("G", 1, NULL, 0,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("G", 0, NULL, 1,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static struct platform_device ep93xx_i2c_device = { static struct platform_device ep93xx_i2c_device = {
.name = "i2c-gpio", .name = "i2c-gpio",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &ep93xx_i2c_data, .platform_data = NULL,
}, },
}; };
/** /**
* ep93xx_register_i2c - Register the i2c platform device. * ep93xx_register_i2c - Register the i2c platform device.
* @data: platform specific i2c-gpio configuration (__initdata)
* @devices: platform specific i2c bus device information (__initdata) * @devices: platform specific i2c bus device information (__initdata)
* @num: the number of devices on the i2c bus * @num: the number of devices on the i2c bus
*/ */
void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data, void __init ep93xx_register_i2c(struct i2c_board_info *devices, int num)
struct i2c_board_info *devices, int num)
{ {
/* /*
* Set the EEPROM interface pin drive type control. * FIXME: this just sets the two pins as non-opendrain, as no
* Defines the driver type for the EECLK and EEDAT pins as either * platforms tries to do that anyway. Flag the applicable lines
* open drain, which will require an external pull-up, or a normal * as open drain in the GPIO_LOOKUP above and the driver or
* CMOS driver. * gpiolib will handle open drain/open drain emulation as need
* be. Right now i2c-gpio emulates open drain which is not
* optimal.
*/ */
if (data->sda_is_open_drain && data->sda_pin != EP93XX_GPIO_LINE_EEDAT) __raw_writel((0 << 1) | (0 << 0),
pr_warning("sda != EEDAT, open drain has no effect\n");
if (data->scl_is_open_drain && data->scl_pin != EP93XX_GPIO_LINE_EECLK)
pr_warning("scl != EECLK, open drain has no effect\n");
__raw_writel((data->sda_is_open_drain << 1) |
(data->scl_is_open_drain << 0),
EP93XX_GPIO_EEDRIVE); EP93XX_GPIO_EEDRIVE);
ep93xx_i2c_data = *data;
i2c_register_board_info(0, devices, num); i2c_register_board_info(0, devices, num);
gpiod_add_lookup_table(&ep93xx_i2c_gpiod_table);
platform_device_register(&ep93xx_i2c_device); platform_device_register(&ep93xx_i2c_device);
} }
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <sound/cs4271.h> #include <sound/cs4271.h>
...@@ -61,14 +60,6 @@ static struct ep93xx_eth_data __initdata edb93xx_eth_data = { ...@@ -61,14 +60,6 @@ static struct ep93xx_eth_data __initdata edb93xx_eth_data = {
/************************************************************************* /*************************************************************************
* EDB93xx i2c peripheral handling * EDB93xx i2c peripheral handling
*************************************************************************/ *************************************************************************/
static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = {
.sda_pin = EP93XX_GPIO_LINE_EEDAT,
.sda_is_open_drain = 0,
.scl_pin = EP93XX_GPIO_LINE_EECLK,
.scl_is_open_drain = 0,
.udelay = 0, /* default to 100 kHz */
.timeout = 0, /* default to 100 ms */
};
static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = { static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = {
{ {
...@@ -86,13 +77,11 @@ static void __init edb93xx_register_i2c(void) ...@@ -86,13 +77,11 @@ static void __init edb93xx_register_i2c(void)
{ {
if (machine_is_edb9302a() || machine_is_edb9307a() || if (machine_is_edb9302a() || machine_is_edb9307a() ||
machine_is_edb9315a()) { machine_is_edb9315a()) {
ep93xx_register_i2c(&edb93xx_i2c_gpio_data, ep93xx_register_i2c(edb93xxa_i2c_board_info,
edb93xxa_i2c_board_info,
ARRAY_SIZE(edb93xxa_i2c_board_info)); ARRAY_SIZE(edb93xxa_i2c_board_info));
} else if (machine_is_edb9302() || machine_is_edb9307() } else if (machine_is_edb9302() || machine_is_edb9307()
|| machine_is_edb9312() || machine_is_edb9315()) { || machine_is_edb9312() || machine_is_edb9315()) {
ep93xx_register_i2c(&edb93xx_i2c_gpio_data, ep93xx_register_i2c(edb93xx_i2c_board_info,
edb93xx_i2c_board_info,
ARRAY_SIZE(edb93xx_i2c_board_info)); ARRAY_SIZE(edb93xx_i2c_board_info));
} }
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include <linux/reboot.h> #include <linux/reboot.h>
struct device; struct device;
struct i2c_gpio_platform_data;
struct i2c_board_info; struct i2c_board_info;
struct spi_board_info; struct spi_board_info;
struct platform_device; struct platform_device;
...@@ -36,8 +35,7 @@ void ep93xx_register_flash(unsigned int width, ...@@ -36,8 +35,7 @@ void ep93xx_register_flash(unsigned int width,
resource_size_t start, resource_size_t size); resource_size_t start, resource_size_t size);
void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, void ep93xx_register_i2c(struct i2c_board_info *devices, int num);
struct i2c_board_info *devices, int num);
void ep93xx_register_spi(struct ep93xx_spi_info *info, void ep93xx_register_spi(struct ep93xx_spi_info *info,
struct spi_board_info *devices, int num); struct spi_board_info *devices, int num);
void ep93xx_register_fb(struct ep93xxfb_mach_info *data); void ep93xx_register_fb(struct ep93xxfb_mach_info *data);
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/mmc_spi.h> #include <linux/spi/mmc_spi.h>
...@@ -129,15 +128,6 @@ static struct ep93xx_spi_info simone_spi_info __initdata = { ...@@ -129,15 +128,6 @@ static struct ep93xx_spi_info simone_spi_info __initdata = {
.use_dma = 1, .use_dma = 1,
}; };
static struct i2c_gpio_platform_data __initdata simone_i2c_gpio_data = {
.sda_pin = EP93XX_GPIO_LINE_EEDAT,
.sda_is_open_drain = 0,
.scl_pin = EP93XX_GPIO_LINE_EECLK,
.scl_is_open_drain = 0,
.udelay = 0,
.timeout = 0,
};
static struct i2c_board_info __initdata simone_i2c_board_info[] = { static struct i2c_board_info __initdata simone_i2c_board_info[] = {
{ {
I2C_BOARD_INFO("ds1337", 0x68), I2C_BOARD_INFO("ds1337", 0x68),
...@@ -161,7 +151,7 @@ static void __init simone_init_machine(void) ...@@ -161,7 +151,7 @@ static void __init simone_init_machine(void)
ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M); ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M);
ep93xx_register_eth(&simone_eth_data, 1); ep93xx_register_eth(&simone_eth_data, 1);
ep93xx_register_fb(&simone_fb_info); ep93xx_register_fb(&simone_fb_info);
ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info, ep93xx_register_i2c(simone_i2c_board_info,
ARRAY_SIZE(simone_i2c_board_info)); ARRAY_SIZE(simone_i2c_board_info));
ep93xx_register_spi(&simone_spi_info, simone_spi_devices, ep93xx_register_spi(&simone_spi_info, simone_spi_devices,
ARRAY_SIZE(simone_spi_devices)); ARRAY_SIZE(simone_spi_devices));
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
...@@ -127,15 +126,6 @@ static struct ep93xx_eth_data __initdata snappercl15_eth_data = { ...@@ -127,15 +126,6 @@ static struct ep93xx_eth_data __initdata snappercl15_eth_data = {
.phy_id = 1, .phy_id = 1,
}; };
static struct i2c_gpio_platform_data __initdata snappercl15_i2c_gpio_data = {
.sda_pin = EP93XX_GPIO_LINE_EEDAT,
.sda_is_open_drain = 0,
.scl_pin = EP93XX_GPIO_LINE_EECLK,
.scl_is_open_drain = 0,
.udelay = 0,
.timeout = 0,
};
static struct i2c_board_info __initdata snappercl15_i2c_data[] = { static struct i2c_board_info __initdata snappercl15_i2c_data[] = {
{ {
/* Audio codec */ /* Audio codec */
...@@ -161,7 +151,7 @@ static void __init snappercl15_init_machine(void) ...@@ -161,7 +151,7 @@ static void __init snappercl15_init_machine(void)
{ {
ep93xx_init_devices(); ep93xx_init_devices();
ep93xx_register_eth(&snappercl15_eth_data, 1); ep93xx_register_eth(&snappercl15_eth_data, 1);
ep93xx_register_i2c(&snappercl15_i2c_gpio_data, snappercl15_i2c_data, ep93xx_register_i2c(snappercl15_i2c_data,
ARRAY_SIZE(snappercl15_i2c_data)); ARRAY_SIZE(snappercl15_i2c_data));
ep93xx_register_fb(&snappercl15_fb_info); ep93xx_register_fb(&snappercl15_fb_info);
snappercl15_register_audio(); snappercl15_register_audio();
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/platform_data/pca953x.h> #include <linux/platform_data/pca953x.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/flash.h> #include <linux/spi/flash.h>
...@@ -144,10 +143,6 @@ static struct pca953x_platform_data pca953x_77_gpio_data = { ...@@ -144,10 +143,6 @@ static struct pca953x_platform_data pca953x_77_gpio_data = {
/************************************************************************* /*************************************************************************
* I2C Bus * I2C Bus
*************************************************************************/ *************************************************************************/
static struct i2c_gpio_platform_data vision_i2c_gpio_data __initdata = {
.sda_pin = EP93XX_GPIO_LINE_EEDAT,
.scl_pin = EP93XX_GPIO_LINE_EECLK,
};
static struct i2c_board_info vision_i2c_info[] __initdata = { static struct i2c_board_info vision_i2c_info[] __initdata = {
{ {
...@@ -289,7 +284,7 @@ static void __init vision_init_machine(void) ...@@ -289,7 +284,7 @@ static void __init vision_init_machine(void)
vision_i2c_info[1].irq = gpio_to_irq(EP93XX_GPIO_LINE_F(7)); vision_i2c_info[1].irq = gpio_to_irq(EP93XX_GPIO_LINE_F(7));
ep93xx_register_i2c(&vision_i2c_gpio_data, vision_i2c_info, ep93xx_register_i2c(vision_i2c_info,
ARRAY_SIZE(vision_i2c_info)); ARRAY_SIZE(vision_i2c_info));
ep93xx_register_spi(&vision_spi_master, vision_spi_board_info, ep93xx_register_spi(&vision_spi_master, vision_spi_board_info,
ARRAY_SIZE(vision_spi_board_info)); ARRAY_SIZE(vision_spi_board_info));
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/i2c-gpio.h> #include <linux/gpio/machine.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/memory.h> #include <asm/memory.h>
...@@ -49,16 +49,21 @@ static struct platform_device avila_flash = { ...@@ -49,16 +49,21 @@ static struct platform_device avila_flash = {
.resource = &avila_flash_resource, .resource = &avila_flash_resource,
}; };
static struct i2c_gpio_platform_data avila_i2c_gpio_data = { static struct gpiod_lookup_table avila_i2c_gpiod_table = {
.sda_pin = AVILA_SDA_PIN, .dev_id = "i2c-gpio",
.scl_pin = AVILA_SCL_PIN, .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 = { static struct platform_device avila_i2c_gpio = {
.name = "i2c-gpio", .name = "i2c-gpio",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &avila_i2c_gpio_data, .platform_data = NULL,
}, },
}; };
...@@ -147,6 +152,8 @@ static void __init avila_init(void) ...@@ -147,6 +152,8 @@ static void __init avila_init(void)
avila_flash_resource.end = avila_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; 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)); platform_add_devices(avila_devices, ARRAY_SIZE(avila_devices));
avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1); avila_pata_resources[0].start = IXP4XX_EXP_BUS_BASE(1);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h> #include <linux/gpio/machine.h>
#include <mach/hardware.h> #include <mach/hardware.h>
...@@ -68,16 +68,21 @@ static struct platform_device dsmg600_flash = { ...@@ -68,16 +68,21 @@ static struct platform_device dsmg600_flash = {
.resource = &dsmg600_flash_resource, .resource = &dsmg600_flash_resource,
}; };
static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data = { static struct gpiod_lookup_table dsmg600_i2c_gpiod_table = {
.sda_pin = DSMG600_SDA_PIN, .dev_id = "i2c-gpio",
.scl_pin = DSMG600_SCL_PIN, .table = {
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", DSMG600_SDA_PIN,
NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", DSMG600_SCL_PIN,
NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
}; };
static struct platform_device dsmg600_i2c_gpio = { static struct platform_device dsmg600_i2c_gpio = {
.name = "i2c-gpio", .name = "i2c-gpio",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &dsmg600_i2c_gpio_data, .platform_data = NULL,
}, },
}; };
...@@ -269,6 +274,7 @@ static void __init dsmg600_init(void) ...@@ -269,6 +274,7 @@ static void __init dsmg600_init(void)
dsmg600_flash_resource.end = dsmg600_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
gpiod_add_lookup_table(&dsmg600_i2c_gpiod_table);
i2c_register_board_info(0, dsmg600_i2c_board_info, i2c_register_board_info(0, dsmg600_i2c_board_info,
ARRAY_SIZE(dsmg600_i2c_board_info)); ARRAY_SIZE(dsmg600_i2c_board_info));
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h> #include <linux/gpio/machine.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -54,16 +54,21 @@ static struct platform_device fsg_flash = { ...@@ -54,16 +54,21 @@ static struct platform_device fsg_flash = {
.resource = &fsg_flash_resource, .resource = &fsg_flash_resource,
}; };
static struct i2c_gpio_platform_data fsg_i2c_gpio_data = { static struct gpiod_lookup_table fsg_i2c_gpiod_table = {
.sda_pin = FSG_SDA_PIN, .dev_id = "i2c-gpio",
.scl_pin = FSG_SCL_PIN, .table = {
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", FSG_SDA_PIN,
NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", FSG_SCL_PIN,
NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
}; };
static struct platform_device fsg_i2c_gpio = { static struct platform_device fsg_i2c_gpio = {
.name = "i2c-gpio", .name = "i2c-gpio",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &fsg_i2c_gpio_data, .platform_data = NULL,
}, },
}; };
...@@ -196,6 +201,7 @@ static void __init fsg_init(void) ...@@ -196,6 +201,7 @@ static void __init fsg_init(void)
/* Configure CS2 for operation, 8bit and writable */ /* Configure CS2 for operation, 8bit and writable */
*IXP4XX_EXP_CS2 = 0xbfff0002; *IXP4XX_EXP_CS2 = 0xbfff0002;
gpiod_add_lookup_table(&fsg_i2c_gpiod_table);
i2c_register_board_info(0, fsg_i2c_board_info, i2c_register_board_info(0, fsg_i2c_board_info,
ARRAY_SIZE(fsg_i2c_board_info)); ARRAY_SIZE(fsg_i2c_board_info));
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/hdlc.h> #include <linux/hdlc.h>
#include <linux/i2c-gpio.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -78,6 +77,12 @@ ...@@ -78,6 +77,12 @@
static u32 hw_bits = 0xFFFFFFFD; /* assume all hardware present */; static u32 hw_bits = 0xFFFFFFFD; /* assume all hardware present */;
static u8 control_value; static u8 control_value;
/*
* FIXME: this is reimplementing I2C bit-bangining. Move this
* over to using driver/i2c/busses/i2c-gpio.c like all other boards
* and register proper I2C device(s) on the bus for this. (See
* other IXP4xx boards for examples.)
*/
static void set_scl(u8 value) static void set_scl(u8 value)
{ {
gpio_set_value(GPIO_SCL, !!value); gpio_set_value(GPIO_SCL, !!value);
...@@ -216,20 +221,6 @@ static struct platform_device device_flash = { ...@@ -216,20 +221,6 @@ static struct platform_device device_flash = {
.resource = &flash_resource, .resource = &flash_resource,
}; };
/* I^2C interface */
static struct i2c_gpio_platform_data i2c_data = {
.sda_pin = GPIO_SDA,
.scl_pin = GPIO_SCL,
};
static struct platform_device device_i2c = {
.name = "i2c-gpio",
.id = 0,
.dev = { .platform_data = &i2c_data },
};
/* IXP425 2 UART ports */ /* IXP425 2 UART ports */
static struct resource uart_resources[] = { static struct resource uart_resources[] = {
{ {
...@@ -411,9 +402,6 @@ static void __init gmlr_init(void) ...@@ -411,9 +402,6 @@ static void __init gmlr_init(void)
if (hw_bits & CFG_HW_HAS_HSS1) if (hw_bits & CFG_HW_HAS_HSS1)
device_tab[devices++] = &device_hss_tab[1]; /* max index 5 */ device_tab[devices++] = &device_hss_tab[1]; /* max index 5 */
if (hw_bits & CFG_HW_HAS_EEPROM)
device_tab[devices++] = &device_i2c; /* max index 6 */
gpio_request(GPIO_SCL, "SCL/clock"); gpio_request(GPIO_SCL, "SCL/clock");
gpio_request(GPIO_SDA, "SDA/data"); gpio_request(GPIO_SDA, "SDA/data");
gpio_request(GPIO_STR, "strobe"); gpio_request(GPIO_STR, "strobe");
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/i2c-gpio.h> #include <linux/gpio/machine.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h> #include <linux/mtd/rawnand.h>
...@@ -122,16 +122,21 @@ static struct platform_device ixdp425_flash_nand = { ...@@ -122,16 +122,21 @@ static struct platform_device ixdp425_flash_nand = {
}; };
#endif /* CONFIG_MTD_NAND_PLATFORM */ #endif /* CONFIG_MTD_NAND_PLATFORM */
static struct i2c_gpio_platform_data ixdp425_i2c_gpio_data = { static struct gpiod_lookup_table ixdp425_i2c_gpiod_table = {
.sda_pin = IXDP425_SDA_PIN, .dev_id = "i2c-gpio",
.scl_pin = IXDP425_SCL_PIN, .table = {
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", IXDP425_SDA_PIN,
NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", IXDP425_SCL_PIN,
NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
}; };
static struct platform_device ixdp425_i2c_gpio = { static struct platform_device ixdp425_i2c_gpio = {
.name = "i2c-gpio", .name = "i2c-gpio",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &ixdp425_i2c_gpio_data, .platform_data = NULL,
}, },
}; };
...@@ -245,6 +250,7 @@ static void __init ixdp425_init(void) ...@@ -245,6 +250,7 @@ static void __init ixdp425_init(void)
ixdp425_uart_data[1].flags = 0; ixdp425_uart_data[1].flags = 0;
} }
gpiod_add_lookup_table(&ixdp425_i2c_gpiod_table);
platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h> #include <linux/gpio/machine.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -100,16 +100,21 @@ static struct platform_device nas100d_leds = { ...@@ -100,16 +100,21 @@ static struct platform_device nas100d_leds = {
.dev.platform_data = &nas100d_led_data, .dev.platform_data = &nas100d_led_data,
}; };
static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = { static struct gpiod_lookup_table nas100d_i2c_gpiod_table = {
.sda_pin = NAS100D_SDA_PIN, .dev_id = "i2c-gpio",
.scl_pin = NAS100D_SCL_PIN, .table = {
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", NAS100D_SDA_PIN,
NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", NAS100D_SCL_PIN,
NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
}; };
static struct platform_device nas100d_i2c_gpio = { static struct platform_device nas100d_i2c_gpio = {
.name = "i2c-gpio", .name = "i2c-gpio",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &nas100d_i2c_gpio_data, .platform_data = NULL,
}, },
}; };
...@@ -280,6 +285,7 @@ static void __init nas100d_init(void) ...@@ -280,6 +285,7 @@ static void __init nas100d_init(void)
nas100d_flash_resource.end = nas100d_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
gpiod_add_lookup_table(&nas100d_i2c_gpiod_table);
i2c_register_board_info(0, nas100d_i2c_board_info, i2c_register_board_info(0, nas100d_i2c_board_info,
ARRAY_SIZE(nas100d_i2c_board_info)); ARRAY_SIZE(nas100d_i2c_board_info));
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-gpio.h> #include <linux/gpio/machine.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
...@@ -68,9 +68,14 @@ static struct platform_device nslu2_flash = { ...@@ -68,9 +68,14 @@ static struct platform_device nslu2_flash = {
.resource = &nslu2_flash_resource, .resource = &nslu2_flash_resource,
}; };
static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = { static struct gpiod_lookup_table nslu2_i2c_gpiod_table = {
.sda_pin = NSLU2_SDA_PIN, .dev_id = "i2c-gpio",
.scl_pin = NSLU2_SCL_PIN, .table = {
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", NSLU2_SDA_PIN,
NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("IXP4XX_GPIO_CHIP", NSLU2_SCL_PIN,
NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
}; };
static struct i2c_board_info __initdata nslu2_i2c_board_info [] = { static struct i2c_board_info __initdata nslu2_i2c_board_info [] = {
...@@ -115,7 +120,7 @@ static struct platform_device nslu2_i2c_gpio = { ...@@ -115,7 +120,7 @@ static struct platform_device nslu2_i2c_gpio = {
.name = "i2c-gpio", .name = "i2c-gpio",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &nslu2_i2c_gpio_data, .platform_data = NULL,
}, },
}; };
...@@ -250,6 +255,7 @@ static void __init nslu2_init(void) ...@@ -250,6 +255,7 @@ static void __init nslu2_init(void)
nslu2_flash_resource.end = nslu2_flash_resource.end =
IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1; IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
gpiod_add_lookup_table(&nslu2_i2c_gpiod_table);
i2c_register_board_info(0, nslu2_i2c_board_info, i2c_register_board_info(0, nslu2_i2c_board_info,
ARRAY_SIZE(nslu2_i2c_board_info)); ARRAY_SIZE(nslu2_i2c_board_info));
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio/machine.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
...@@ -38,9 +38,17 @@ ...@@ -38,9 +38,17 @@
#include "generic.h" #include "generic.h"
static struct gpiod_lookup_table acs5k_i2c_gpiod_table = {
.dev_id = "i2c-gpio",
.table = {
GPIO_LOOKUP_IDX("KS8695", 4, NULL, 0,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("KS8695", 5, NULL, 1,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static struct i2c_gpio_platform_data acs5k_i2c_device_platdata = { static struct i2c_gpio_platform_data acs5k_i2c_device_platdata = {
.sda_pin = 4,
.scl_pin = 5,
.udelay = 10, .udelay = 10,
}; };
...@@ -95,6 +103,7 @@ static struct i2c_board_info acs5k_i2c_devs[] __initdata = { ...@@ -95,6 +103,7 @@ static struct i2c_board_info acs5k_i2c_devs[] __initdata = {
static void acs5k_i2c_init(void) static void acs5k_i2c_init(void)
{ {
/* The gpio interface */ /* The gpio interface */
gpiod_add_lookup_table(&acs5k_i2c_gpiod_table);
platform_device_register(&acs5k_i2c_device); platform_device_register(&acs5k_i2c_device);
/* I2C devices */ /* I2C devices */
i2c_register_board_info(0, acs5k_i2c_devs, i2c_register_board_info(0, acs5k_i2c_devs,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/usb/gpio_vbus.h> #include <linux/usb/gpio_vbus.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <linux/gpio/machine.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/suspend.h> #include <asm/suspend.h>
...@@ -320,9 +321,17 @@ static struct soc_camera_link palmz72_iclink = { ...@@ -320,9 +321,17 @@ static struct soc_camera_link palmz72_iclink = {
.flags = SOCAM_DATAWIDTH_8, .flags = SOCAM_DATAWIDTH_8,
}; };
static struct gpiod_lookup_table palmz72_i2c_gpiod_table = {
.dev_id = "i2c-gpio",
.table = {
GPIO_LOOKUP_IDX("gpio-pxa", 118, NULL, 0,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("gpio-pxa", 117, NULL, 1,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static struct i2c_gpio_platform_data palmz72_i2c_bus_data = { static struct i2c_gpio_platform_data palmz72_i2c_bus_data = {
.sda_pin = 118,
.scl_pin = 117,
.udelay = 10, .udelay = 10,
.timeout = 100, .timeout = 100,
}; };
...@@ -369,6 +378,7 @@ static void __init palmz72_camera_init(void) ...@@ -369,6 +378,7 @@ static void __init palmz72_camera_init(void)
{ {
palmz72_cam_gpio_init(); palmz72_cam_gpio_init();
pxa_set_camera_info(&palmz72_pxacamera_platform_data); pxa_set_camera_info(&palmz72_pxacamera_platform_data);
gpiod_add_lookup_table(&palmz72_i2c_gpiod_table);
platform_device_register(&palmz72_i2c_bus_device); platform_device_register(&palmz72_i2c_bus_device);
platform_device_register(&palmz72_camera); platform_device_register(&palmz72_camera);
} }
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/i2c-gpio.h> #include <linux/i2c-gpio.h>
#include <linux/gpio/machine.h>
#include <linux/i2c/pxa-i2c.h> #include <linux/i2c/pxa-i2c.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>
#include <linux/smc91x.h> #include <linux/smc91x.h>
...@@ -458,9 +459,17 @@ static struct platform_device smc91x_device = { ...@@ -458,9 +459,17 @@ static struct platform_device smc91x_device = {
}; };
/* i2c */ /* i2c */
static struct gpiod_lookup_table viper_i2c_gpiod_table = {
.dev_id = "i2c-gpio",
.table = {
GPIO_LOOKUP_IDX("gpio-pxa", VIPER_RTC_I2C_SDA_GPIO,
NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("gpio-pxa", VIPER_RTC_I2C_SCL_GPIO,
NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static struct i2c_gpio_platform_data i2c_bus_data = { static struct i2c_gpio_platform_data i2c_bus_data = {
.sda_pin = VIPER_RTC_I2C_SDA_GPIO,
.scl_pin = VIPER_RTC_I2C_SCL_GPIO,
.udelay = 10, .udelay = 10,
.timeout = HZ, .timeout = HZ,
}; };
...@@ -779,12 +788,20 @@ static int __init viper_tpm_setup(char *str) ...@@ -779,12 +788,20 @@ static int __init viper_tpm_setup(char *str)
__setup("tpm=", viper_tpm_setup); __setup("tpm=", viper_tpm_setup);
struct gpiod_lookup_table viper_tpm_i2c_gpiod_table = {
.dev_id = "i2c-gpio",
.table = {
GPIO_LOOKUP_IDX("gpio-pxa", VIPER_TPM_I2C_SDA_GPIO,
NULL, 0, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("gpio-pxa", VIPER_TPM_I2C_SCL_GPIO,
NULL, 1, GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static void __init viper_tpm_init(void) static void __init viper_tpm_init(void)
{ {
struct platform_device *tpm_device; struct platform_device *tpm_device;
struct i2c_gpio_platform_data i2c_tpm_data = { struct i2c_gpio_platform_data i2c_tpm_data = {
.sda_pin = VIPER_TPM_I2C_SDA_GPIO,
.scl_pin = VIPER_TPM_I2C_SCL_GPIO,
.udelay = 10, .udelay = 10,
.timeout = HZ, .timeout = HZ,
}; };
...@@ -794,6 +811,7 @@ static void __init viper_tpm_init(void) ...@@ -794,6 +811,7 @@ static void __init viper_tpm_init(void)
if (!viper_tpm) if (!viper_tpm)
return; return;
gpiod_add_lookup_table(&viper_tpm_i2c_gpiod_table);
tpm_device = platform_device_alloc("i2c-gpio", 2); tpm_device = platform_device_alloc("i2c-gpio", 2);
if (tpm_device) { if (tpm_device) {
if (!platform_device_add_data(tpm_device, if (!platform_device_add_data(tpm_device,
...@@ -943,6 +961,7 @@ static void __init viper_init(void) ...@@ -943,6 +961,7 @@ static void __init viper_init(void)
smc91x_device.num_resources--; smc91x_device.num_resources--;
pxa_set_i2c_info(NULL); pxa_set_i2c_info(NULL);
gpiod_add_lookup_table(&viper_i2c_gpiod_table);
pwm_add_table(viper_pwm_lookup, ARRAY_SIZE(viper_pwm_lookup)); pwm_add_table(viper_pwm_lookup, ARRAY_SIZE(viper_pwm_lookup));
platform_add_devices(viper_devs, ARRAY_SIZE(viper_devs)); platform_add_devices(viper_devs, ARRAY_SIZE(viper_devs));
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio/driver.h> #include <linux/gpio/driver.h>
#include <linux/gpio/machine.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <asm/setup.h> #include <asm/setup.h>
...@@ -323,9 +324,17 @@ static struct platform_device simpad_gpio_leds = { ...@@ -323,9 +324,17 @@ static struct platform_device simpad_gpio_leds = {
/* /*
* i2c * i2c
*/ */
static struct gpiod_lookup_table simpad_i2c_gpiod_table = {
.dev_id = "i2c-gpio",
.table = {
GPIO_LOOKUP_IDX("gpio", GPIO_GPIO21, NULL, 0,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("gpio", GPIO_GPIO25, NULL, 1,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static struct i2c_gpio_platform_data simpad_i2c_data = { static struct i2c_gpio_platform_data simpad_i2c_data = {
.sda_pin = GPIO_GPIO21,
.scl_pin = GPIO_GPIO25,
.udelay = 10, .udelay = 10,
.timeout = HZ, .timeout = HZ,
}; };
...@@ -380,6 +389,7 @@ static int __init simpad_init(void) ...@@ -380,6 +389,7 @@ static int __init simpad_init(void)
ARRAY_SIZE(simpad_flash_resources)); ARRAY_SIZE(simpad_flash_resources));
sa11x0_register_mcp(&simpad_mcp_data); sa11x0_register_mcp(&simpad_mcp_data);
gpiod_add_lookup_table(&simpad_i2c_gpiod_table);
ret = platform_add_devices(devices, ARRAY_SIZE(devices)); ret = platform_add_devices(devices, ARRAY_SIZE(devices));
if(ret) if(ret)
printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device"); printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device");
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/gpio/machine.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/bfin5xx_spi.h> #include <asm/bfin5xx_spi.h>
#include <asm/portmux.h> #include <asm/portmux.h>
...@@ -362,11 +363,17 @@ static struct platform_device bfin_device_gpiokeys = { ...@@ -362,11 +363,17 @@ static struct platform_device bfin_device_gpiokeys = {
#if IS_ENABLED(CONFIG_I2C_GPIO) #if IS_ENABLED(CONFIG_I2C_GPIO)
#include <linux/i2c-gpio.h> #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_PF8, NULL, 0,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("BFIN-GPIO", GPIO_PF9, NULL, 1,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static struct i2c_gpio_platform_data i2c_gpio_data = { static struct i2c_gpio_platform_data i2c_gpio_data = {
.sda_pin = GPIO_PF8,
.scl_pin = GPIO_PF9,
.sda_is_open_drain = 0,
.scl_is_open_drain = 0,
.udelay = 40, .udelay = 40,
}; /* This hasn't actually been used these pins }; /* This hasn't actually been used these pins
* are (currently) free pins on the expansion connector */ * are (currently) free pins on the expansion connector */
...@@ -462,7 +469,9 @@ static int __init blackstamp_init(void) ...@@ -462,7 +469,9 @@ static int __init blackstamp_init(void)
int ret; int ret;
printk(KERN_INFO "%s(): registering device resources\n", __func__); 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, i2c_register_board_info(0, bfin_i2c_board_info,
ARRAY_SIZE(bfin_i2c_board_info)); ARRAY_SIZE(bfin_i2c_board_info));
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#endif #endif
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/gpio/machine.h>
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/bfin5xx_spi.h> #include <asm/bfin5xx_spi.h>
#include <asm/portmux.h> #include <asm/portmux.h>
...@@ -390,11 +391,17 @@ static struct platform_device bfin_device_gpiokeys = { ...@@ -390,11 +391,17 @@ static struct platform_device bfin_device_gpiokeys = {
#if IS_ENABLED(CONFIG_I2C_GPIO) #if IS_ENABLED(CONFIG_I2C_GPIO)
#include <linux/i2c-gpio.h> #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_PF1, NULL, 0,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
GPIO_LOOKUP_IDX("BFIN-GPIO", GPIO_PF0, NULL, 1,
GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
},
};
static struct i2c_gpio_platform_data i2c_gpio_data = { static struct i2c_gpio_platform_data i2c_gpio_data = {
.sda_pin = GPIO_PF1,
.scl_pin = GPIO_PF0,
.sda_is_open_drain = 0,
.scl_is_open_drain = 0,
.udelay = 40, .udelay = 40,
}; };
...@@ -516,6 +523,9 @@ static struct platform_device *ezkit_devices[] __initdata = { ...@@ -516,6 +523,9 @@ static struct platform_device *ezkit_devices[] __initdata = {
static int __init ezkit_init(void) static int __init ezkit_init(void)
{ {
printk(KERN_INFO "%s(): registering device resources\n", __func__); printk(KERN_INFO "%s(): registering device resources\n", __func__);
#if IS_ENABLED(CONFIG_I2C_GPIO)
gpiod_add_lookup_table(&bfin_i2c_gpiod_table);
#endif
platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices)); platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
i2c_register_board_info(0, bfin_i2c_board_info, i2c_register_board_info(0, bfin_i2c_board_info,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment