Skip to content

Commit 752451f

Browse files
committed
Merge branch 'i2c-embedded/for-next' of git://git.pengutronix.de/git/wsa/linux
Pull i2c-embedded changes from Wolfram Sang: - CBUS driver (an I2C variant) - continued rework of the omap driver - s3c2410 gets lots of fixes and gains pinctrl support - at91 gains DMA support - the GPIO muxer gains devicetree probing - typical fixes and additions all over * 'i2c-embedded/for-next' of git://git.pengutronix.de/git/wsa/linux: (45 commits) i2c: omap: Remove the OMAP_I2C_FLAG_RESET_REGS_POSTIDLE flag i2c: at91: add dma support i2c: at91: change struct members indentation i2c: at91: fix compilation warning i2c: mxs: Do not disable the I2C SMBus quick mode i2c: mxs: Handle i2c DMA failure properly i2c: s3c2410: Remove recently introduced performance overheads i2c: ocores: Move grlib set/get functions into #ifdef CONFIG_OF block i2c: s3c2410: Add fix for i2c suspend/resume i2c: s3c2410: Fix code to free gpios i2c: i2c-cbus-gpio: introduce driver i2c: ocores: Add support for the GRLIB port of the controller and use function pointers for getreg and setreg functions i2c: ocores: Add irq support for sparc i2c: omap: Move the remove constraint ARM: dts: cfa10049: Add the i2c muxer buses to the CFA-10049 i2c: s3c2410: do not special case HDMIPHY stuck bus detection i2c: s3c2410: use exponential back off while polling for bus idle i2c: s3c2410: do not generate STOP for QUIRK_HDMIPHY i2c: s3c2410: grab adapter lock while changing i2c clock i2c: s3c2410: Add support for pinctrl ...
2 parents 673ab87 + 972deb4 commit 752451f

27 files changed

+1480
-359
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Device tree bindings for i2c-cbus-gpio driver
2+
3+
Required properties:
4+
- compatible = "i2c-cbus-gpio";
5+
- gpios: clk, dat, sel
6+
- #address-cells = <1>;
7+
- #size-cells = <0>;
8+
9+
Optional properties:
10+
- child nodes conforming to i2c bus binding
11+
12+
Example:
13+
14+
i2c@0 {
15+
compatible = "i2c-cbus-gpio";
16+
gpios = <&gpio 66 0 /* clk */
17+
&gpio 65 0 /* dat */
18+
&gpio 64 0 /* sel */
19+
>;
20+
#address-cells = <1>;
21+
#size-cells = <0>;
22+
23+
retu-mfd: retu@1 {
24+
compatible = "retu-mfd";
25+
reg = <0x1>;
26+
};
27+
};
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
GPIO-based I2C Bus Mux
2+
3+
This binding describes an I2C bus multiplexer that uses GPIOs to
4+
route the I2C signals.
5+
6+
+-----+ +-----+
7+
| dev | | dev |
8+
+------------+ +-----+ +-----+
9+
| SoC | | |
10+
| | /--------+--------+
11+
| +------+ | +------+ child bus A, on GPIO value set to 0
12+
| | I2C |-|--| Mux |
13+
| +------+ | +--+---+ child bus B, on GPIO value set to 1
14+
| | | \----------+--------+--------+
15+
| +------+ | | | | |
16+
| | GPIO |-|-----+ +-----+ +-----+ +-----+
17+
| +------+ | | dev | | dev | | dev |
18+
+------------+ +-----+ +-----+ +-----+
19+
20+
Required properties:
21+
- compatible: i2c-mux-gpio
22+
- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
23+
port is connected to.
24+
- mux-gpios: list of gpios used to control the muxer
25+
* Standard I2C mux properties. See mux.txt in this directory.
26+
* I2C child bus nodes. See mux.txt in this directory.
27+
28+
Optional properties:
29+
- idle-state: value to set the muxer to when idle. When no value is
30+
given, it defaults to the last value used.
31+
32+
For each i2c child node, an I2C child bus will be created. They will
33+
be numbered based on their order in the device tree.
34+
35+
Whenever an access is made to a device on a child bus, the value set
36+
in the revelant node's reg property will be output using the list of
37+
GPIOs, the first in the list holding the least-significant value.
38+
39+
If an idle state is defined, using the idle-state (optional) property,
40+
whenever an access is not being made to a device on a child bus, the
41+
GPIOs will be set according to the idle value.
42+
43+
If an idle state is not defined, the most recently used value will be
44+
left programmed into hardware whenever no access is being made to a
45+
device on a child bus.
46+
47+
Example:
48+
i2cmux {
49+
compatible = "i2c-mux-gpio";
50+
#address-cells = <1>;
51+
#size-cells = <0>;
52+
mux-gpios = <&gpio1 22 0 &gpio1 23 0>;
53+
i2c-parent = <&i2c1>;
54+
55+
i2c@1 {
56+
reg = <1>;
57+
#address-cells = <1>;
58+
#size-cells = <0>;
59+
60+
ssd1307: oled@3c {
61+
compatible = "solomon,ssd1307fb-i2c";
62+
reg = <0x3c>;
63+
pwms = <&pwm 4 3000>;
64+
reset-gpios = <&gpio2 7 1>;
65+
reset-active-low;
66+
};
67+
};
68+
69+
i2c@3 {
70+
reg = <3>;
71+
#address-cells = <1>;
72+
#size-cells = <0>;
73+
74+
pca9555: pca9555@20 {
75+
compatible = "nxp,pca9555";
76+
gpio-controller;
77+
#gpio-cells = <2>;
78+
reg = <0x20>;
79+
};
80+
};
81+
};

Documentation/devicetree/bindings/i2c/i2c-ocores.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Device tree configuration for i2c-ocores
22

33
Required properties:
4-
- compatible : "opencores,i2c-ocores"
4+
- compatible : "opencores,i2c-ocores" or "aeroflexgaisler,i2cmst"
55
- reg : bus address start and address range size of device
66
- interrupts : interrupt number
77
- clock-frequency : frequency of bus clock in Hz

Documentation/devicetree/bindings/i2c/i2c-s3c2410.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ Required properties:
1313
- interrupts: interrupt number to the cpu.
1414
- samsung,i2c-sda-delay: Delay (in ns) applied to data line (SDA) edges.
1515

16+
Required for all cases except "samsung,s3c2440-hdmiphy-i2c":
17+
- Samsung GPIO variant (deprecated):
18+
- gpios: The order of the gpios should be the following: <SDA, SCL>.
19+
The gpio specifier depends on the gpio controller. Required in all
20+
cases except for "samsung,s3c2440-hdmiphy-i2c" whose input/output
21+
lines are permanently wired to the respective clienta
22+
- Pinctrl variant (preferred, if available):
23+
- pinctrl-0: Pin control group to be used for this controller.
24+
- pinctrl-names: Should contain only one value - "default".
25+
1626
Optional properties:
17-
- gpios: The order of the gpios should be the following: <SDA, SCL>.
18-
The gpio specifier depends on the gpio controller. Required in all
19-
cases except for "samsung,s3c2440-hdmiphy-i2c" whose input/output
20-
lines are permanently wired to the respective client
2127
- samsung,i2c-slave-addr: Slave address in multi-master enviroment. If not
2228
specified, default value is 0.
2329
- samsung,i2c-max-bus-freq: Desired frequency in Hz of the bus. If not
@@ -31,8 +37,14 @@ Example:
3137
interrupts = <345>;
3238
samsung,i2c-sda-delay = <100>;
3339
samsung,i2c-max-bus-freq = <100000>;
40+
/* Samsung GPIO variant begins here */
3441
gpios = <&gpd1 2 0 /* SDA */
3542
&gpd1 3 0 /* SCL */>;
43+
/* Samsung GPIO variant ends here */
44+
/* Pinctrl variant begins here */
45+
pinctrl-0 = <&i2c3_bus>;
46+
pinctrl-names = "default";
47+
/* Pinctrl variant ends here */
3648
#address-cells = <1>;
3749
#size-cells = <0>;
3850

arch/arm/boot/dts/imx28-cfa10049.dts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,30 @@
9292
status = "okay";
9393
};
9494

95+
i2cmux {
96+
compatible = "i2c-mux-gpio";
97+
#address-cells = <1>;
98+
#size-cells = <0>;
99+
mux-gpios = <&gpio1 22 0 &gpio1 23 0>;
100+
i2c-parent = <&i2c1>;
101+
102+
i2c@0 {
103+
reg = <0>;
104+
};
105+
106+
i2c@1 {
107+
reg = <1>;
108+
};
109+
110+
i2c@2 {
111+
reg = <2>;
112+
};
113+
114+
i2c@3 {
115+
reg = <3>;
116+
};
117+
};
118+
95119
usbphy1: usbphy@8007e000 {
96120
status = "okay";
97121
};

arch/arm/mach-omap2/board-n8x0.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
#include <linux/gpio.h>
1717
#include <linux/init.h>
1818
#include <linux/io.h>
19+
#include <linux/irq.h>
1920
#include <linux/stddef.h>
2021
#include <linux/i2c.h>
2122
#include <linux/spi/spi.h>
2223
#include <linux/usb/musb.h>
24+
#include <linux/platform_data/i2c-cbus-gpio.h>
2325
#include <linux/platform_data/spi-omap2-mcspi.h>
2426
#include <linux/platform_data/mtd-onenand-omap2.h>
2527
#include <linux/mfd/menelaus.h>
@@ -40,6 +42,45 @@
4042
#define TUSB6010_GPIO_ENABLE 0
4143
#define TUSB6010_DMACHAN 0x3f
4244

45+
#if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE)
46+
static struct i2c_cbus_platform_data n8x0_cbus_data = {
47+
.clk_gpio = 66,
48+
.dat_gpio = 65,
49+
.sel_gpio = 64,
50+
};
51+
52+
static struct platform_device n8x0_cbus_device = {
53+
.name = "i2c-cbus-gpio",
54+
.id = 3,
55+
.dev = {
56+
.platform_data = &n8x0_cbus_data,
57+
},
58+
};
59+
60+
static struct i2c_board_info n8x0_i2c_board_info_3[] __initdata = {
61+
{
62+
I2C_BOARD_INFO("retu-mfd", 0x01),
63+
},
64+
};
65+
66+
static void __init n8x0_cbus_init(void)
67+
{
68+
const int retu_irq_gpio = 108;
69+
70+
if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ"))
71+
return;
72+
irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING);
73+
n8x0_i2c_board_info_3[0].irq = gpio_to_irq(retu_irq_gpio);
74+
i2c_register_board_info(3, n8x0_i2c_board_info_3,
75+
ARRAY_SIZE(n8x0_i2c_board_info_3));
76+
platform_device_register(&n8x0_cbus_device);
77+
}
78+
#else /* CONFIG_I2C_CBUS_GPIO */
79+
static void __init n8x0_cbus_init(void)
80+
{
81+
}
82+
#endif /* CONFIG_I2C_CBUS_GPIO */
83+
4384
#if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE)
4485
/*
4586
* Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
@@ -678,6 +719,7 @@ static void __init n8x0_init_machine(void)
678719
gpmc_onenand_init(board_onenand_data);
679720
n8x0_mmc_init();
680721
n8x0_usb_init();
722+
n8x0_cbus_init();
681723
}
682724

683725
MACHINE_START(NOKIA_N800, "Nokia N800")

arch/arm/mach-omap2/i2c.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ static int __init omap_i2c_nr_ports(void)
120120
return ports;
121121
}
122122

123+
/*
124+
* XXX This function is a temporary compatibility wrapper - only
125+
* needed until the I2C driver can be converted to call
126+
* omap_pm_set_max_dev_wakeup_lat() and handle a return code.
127+
*/
128+
static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, long t)
129+
{
130+
omap_pm_set_max_mpu_wakeup_lat(dev, t);
131+
}
132+
123133
static const char name[] = "omap_i2c";
124134

125135
int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
@@ -157,6 +167,15 @@ int __init omap_i2c_add_bus(struct omap_i2c_bus_platform_data *i2c_pdata,
157167
dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr;
158168
pdata->flags = dev_attr->flags;
159169

170+
/*
171+
* When waiting for completion of a i2c transfer, we need to
172+
* set a wake up latency constraint for the MPU. This is to
173+
* ensure quick enough wakeup from idle, when transfer
174+
* completes.
175+
* Only omap3 has support for constraints
176+
*/
177+
if (cpu_is_omap34xx())
178+
pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
160179
pdev = omap_device_build(name, bus_id, oh, pdata,
161180
sizeof(struct omap_i2c_bus_platform_data),
162181
NULL, 0, 0);

arch/arm/mach-omap2/omap_hwmod_2430_data.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ static struct omap_hwmod_class i2c_class = {
7777

7878
static struct omap_i2c_dev_attr i2c_dev_attr = {
7979
.fifo_depth = 8, /* bytes */
80-
.flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
81-
OMAP_I2C_FLAG_BUS_SHIFT_2 |
80+
.flags = OMAP_I2C_FLAG_BUS_SHIFT_2 |
8281
OMAP_I2C_FLAG_FORCE_19200_INT_CLK,
8382
};
8483

arch/arm/mach-omap2/omap_hwmod_33xx_data.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,8 +1118,7 @@ static struct omap_hwmod_class i2c_class = {
11181118
};
11191119

11201120
static struct omap_i2c_dev_attr i2c_dev_attr = {
1121-
.flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE |
1122-
OMAP_I2C_FLAG_RESET_REGS_POSTIDLE,
1121+
.flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
11231122
};
11241123

11251124
/* i2c1 */

arch/arm/mach-omap2/omap_hwmod_3xxx_data.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,7 @@ static struct omap_hwmod omap3xxx_dss_venc_hwmod = {
794794
/* I2C1 */
795795
static struct omap_i2c_dev_attr i2c1_dev_attr = {
796796
.fifo_depth = 8, /* bytes */
797-
.flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
798-
OMAP_I2C_FLAG_RESET_REGS_POSTIDLE |
799-
OMAP_I2C_FLAG_BUS_SHIFT_2,
797+
.flags = OMAP_I2C_FLAG_BUS_SHIFT_2,
800798
};
801799

802800
static struct omap_hwmod omap3xxx_i2c1_hwmod = {
@@ -821,9 +819,7 @@ static struct omap_hwmod omap3xxx_i2c1_hwmod = {
821819
/* I2C2 */
822820
static struct omap_i2c_dev_attr i2c2_dev_attr = {
823821
.fifo_depth = 8, /* bytes */
824-
.flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
825-
OMAP_I2C_FLAG_RESET_REGS_POSTIDLE |
826-
OMAP_I2C_FLAG_BUS_SHIFT_2,
822+
.flags = OMAP_I2C_FLAG_BUS_SHIFT_2,
827823
};
828824

829825
static struct omap_hwmod omap3xxx_i2c2_hwmod = {
@@ -848,9 +844,7 @@ static struct omap_hwmod omap3xxx_i2c2_hwmod = {
848844
/* I2C3 */
849845
static struct omap_i2c_dev_attr i2c3_dev_attr = {
850846
.fifo_depth = 64, /* bytes */
851-
.flags = OMAP_I2C_FLAG_APPLY_ERRATA_I207 |
852-
OMAP_I2C_FLAG_RESET_REGS_POSTIDLE |
853-
OMAP_I2C_FLAG_BUS_SHIFT_2,
847+
.flags = OMAP_I2C_FLAG_BUS_SHIFT_2,
854848
};
855849

856850
static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = {

arch/arm/mach-omap2/omap_hwmod_44xx_data.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,8 +1529,7 @@ static struct omap_hwmod_class omap44xx_i2c_hwmod_class = {
15291529
};
15301530

15311531
static struct omap_i2c_dev_attr i2c_dev_attr = {
1532-
.flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE |
1533-
OMAP_I2C_FLAG_RESET_REGS_POSTIDLE,
1532+
.flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
15341533
};
15351534

15361535
/* i2c1 */

drivers/i2c/busses/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,16 @@ config I2C_BLACKFIN_TWI_CLK_KHZ
337337
help
338338
The unit of the TWI clock is kHz.
339339

340+
config I2C_CBUS_GPIO
341+
tristate "CBUS I2C driver"
342+
depends on GENERIC_GPIO
343+
help
344+
Support for CBUS access using I2C API. Mostly relevant for Nokia
345+
Internet Tablets (770, N800 and N810).
346+
347+
This driver can also be built as a module. If so, the module
348+
will be called i2c-cbus-gpio.
349+
340350
config I2C_CPM
341351
tristate "Freescale CPM1 or CPM2 (MPC8xx/826x)"
342352
depends on (CPM1 || CPM2) && OF_I2C

drivers/i2c/busses/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o
3131
obj-$(CONFIG_I2C_AT91) += i2c-at91.o
3232
obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
3333
obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
34+
obj-$(CONFIG_I2C_CBUS_GPIO) += i2c-cbus-gpio.o
3435
obj-$(CONFIG_I2C_CPM) += i2c-cpm.o
3536
obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
3637
obj-$(CONFIG_I2C_DESIGNWARE_CORE) += i2c-designware-core.o

0 commit comments

Comments
 (0)