Skip to content

Commit 235b84f

Browse files
committed
Merge branch 'i2c/for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang: "This pull request contains: - i2c core reorganization. One source file became too monolithic. It is now split up, yet we still have the same named object as the final output. This should ease maintenance. - new drivers: ZTE ZX2967 family, ASPEED 24XX/25XX - designware driver gained slave mode support - xgene-slimpro driver gained ACPI support - bigger overhaul for pca-platform driver - the algo-bit module now supports messages with enforced STOP - slightly bigger than usual set of driver updates and improvements and with much appreciated quality assurance from Andy Shevchenko" * 'i2c/for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (51 commits) i2c: Provide a stub for i2c_detect_slave_mode() i2c: designware: Let slave adapter support be optional i2c: designware: Make HW init functions static i2c: designware: fix spelling mistakes i2c: pca-platform: propagate error from i2c_pca_add_numbered_bus i2c: pca-platform: correctly set algo_data.reset_chip i2c: acpi: Do not create i2c-clients for LNXVIDEO ACPI devices i2c: designware: enable SLAVE in platform module i2c: designware: add SLAVE mode functions i2c: zx2967: drop COMPILE_TEST dependency i2c: zx2967: always use the same device when printing errors i2c: pca-platform: use dev_warn/dev_info instead of printk i2c: pca-platform: use device managed allocations i2c: pca-platform: add devicetree awareness i2c: pca-platform: switch to struct gpio_desc dt-bindings: add bindings for i2c-pca-platform i2c: cadance: fix ctrl/addr reg write order i2c: zx2967: add i2c controller driver for ZTE's zx2967 family dt: bindings: add documentation for zx2967 family i2c controller i2c: algo-bit: add support for I2C_M_STOP ...
2 parents fb4e3be + 8f1a357 commit 235b84f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4969
-2508
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Device tree configuration for the I2C busses on the AST24XX and AST25XX SoCs.
2+
3+
Required Properties:
4+
- #address-cells : should be 1
5+
- #size-cells : should be 0
6+
- reg : address offset and range of bus
7+
- compatible : should be "aspeed,ast2400-i2c-bus"
8+
or "aspeed,ast2500-i2c-bus"
9+
- clocks : root clock of bus, should reference the APB
10+
clock
11+
- interrupts : interrupt number
12+
- interrupt-parent : interrupt controller for bus, should reference a
13+
aspeed,ast2400-i2c-ic or aspeed,ast2500-i2c-ic
14+
interrupt controller
15+
16+
Optional Properties:
17+
- bus-frequency : frequency of the bus clock in Hz defaults to 100 kHz when not
18+
specified
19+
- multi-master : states that there is another master active on this bus.
20+
21+
Example:
22+
23+
i2c {
24+
compatible = "simple-bus";
25+
#address-cells = <1>;
26+
#size-cells = <1>;
27+
ranges = <0 0x1e78a000 0x1000>;
28+
29+
i2c_ic: interrupt-controller@0 {
30+
#interrupt-cells = <1>;
31+
compatible = "aspeed,ast2400-i2c-ic";
32+
reg = <0x0 0x40>;
33+
interrupts = <12>;
34+
interrupt-controller;
35+
};
36+
37+
i2c0: i2c-bus@40 {
38+
#address-cells = <1>;
39+
#size-cells = <0>;
40+
#interrupt-cells = <1>;
41+
reg = <0x40 0x40>;
42+
compatible = "aspeed,ast2400-i2c-bus";
43+
clocks = <&clk_apb>;
44+
bus-frequency = <100000>;
45+
interrupts = <0>;
46+
interrupt-parent = <&i2c_ic>;
47+
};
48+
};

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Optional properties :
2020
- i2c-sda-falling-time-ns : should contain the SDA falling time in nanoseconds.
2121
This value which is by default 300ns is used to compute the tHIGH period.
2222

23-
Example :
23+
Examples :
2424

2525
i2c@f0000 {
2626
#address-cells = <1>;
@@ -43,3 +43,17 @@ Example :
4343
i2c-sda-falling-time-ns = <300>;
4444
i2c-scl-falling-time-ns = <300>;
4545
};
46+
47+
i2c@1120000 {
48+
#address-cells = <1>;
49+
#size-cells = <0>;
50+
reg = <0x2000 0x100>;
51+
clock-frequency = <400000>;
52+
clocks = <&i2cclk>;
53+
interrupts = <0>;
54+
55+
eeprom@64 {
56+
compatible = "linux,slave-24c02";
57+
reg = <0x40000064>;
58+
};
59+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
* NXP PCA PCA9564/PCA9665 I2C controller
2+
3+
The PCA9564/PCA9665 serves as an interface between most standard
4+
parallel-bus microcontrollers/microprocessors and the serial I2C-bus
5+
and allows the parallel bus system to communicate bi-directionally
6+
with the I2C-bus.
7+
8+
Required properties :
9+
10+
- reg : Offset and length of the register set for the device
11+
- compatible : one of "nxp,pca9564" or "nxp,pca9665"
12+
13+
Optional properties
14+
- interrupts : the interrupt number
15+
- interrupt-parent : the phandle for the interrupt controller.
16+
If an interrupt is not specified polling will be used.
17+
- reset-gpios : gpio specifier for gpio connected to RESET_N pin. As the line
18+
is active low, it should be marked GPIO_ACTIVE_LOW.
19+
- clock-frequency : I2C bus frequency.
20+
21+
Example:
22+
i2c0: i2c@80000 {
23+
compatible = "nxp,pca9564";
24+
#address-cells = <1>;
25+
#size-cells = <0>;
26+
reg = <0x80000 0x4>;
27+
reset-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
28+
clock-frequency = <100000>;
29+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ZTE zx2967 I2C controller
2+
3+
Required properties:
4+
- compatible: must be "zte,zx296718-i2c"
5+
- reg: physical address and length of the device registers
6+
- interrupts: a single interrupt specifier
7+
- clocks: clock for the device
8+
- #address-cells: should be <1>
9+
- #size-cells: should be <0>
10+
- clock-frequency: the desired I2C bus clock frequency.
11+
12+
Examples:
13+
14+
i2c@112000 {
15+
compatible = "zte,zx296718-i2c";
16+
reg = <0x00112000 0x1000>;
17+
interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
18+
clocks = <&osc24m>;
19+
#address-cells = <1>
20+
#size-cells = <0>;
21+
clock-frequency = <1600000>;
22+
};

Documentation/driver-api/i2c.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,8 @@ i2c_adapter devices which don't support those I2C operations.
4141
.. kernel-doc:: drivers/i2c/i2c-boardinfo.c
4242
:functions: i2c_register_board_info
4343

44-
.. kernel-doc:: drivers/i2c/i2c-core.c
44+
.. kernel-doc:: drivers/i2c/i2c-core-base.c
45+
:export:
46+
47+
.. kernel-doc:: drivers/i2c/i2c-core-smbus.c
4548
:export:

Documentation/i2c/busses/i2c-i801

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Supported adapters:
3434
* Intel Broxton (SOC)
3535
* Intel Lewisburg (PCH)
3636
* Intel Gemini Lake (SOC)
37+
* Intel Cannon Lake-H (PCH)
38+
* Intel Cannon Lake-LP (PCH)
3739
Datasheets: Publicly available at the Intel website
3840

3941
On Intel Patsburg and later chipsets, both the normal host SMBus controller

Documentation/i2c/dev-interface

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ checking on future transactions.)
191191
4* Other ioctl() calls are converted to in-kernel function calls by
192192
i2c-dev. Examples include I2C_FUNCS, which queries the I2C adapter
193193
functionality using i2c.h:i2c_get_functionality(), and I2C_SMBUS, which
194-
performs an SMBus transaction using i2c-core.c:i2c_smbus_xfer().
194+
performs an SMBus transaction using i2c-core-smbus.c:i2c_smbus_xfer().
195195

196196
The i2c-dev driver is responsible for checking all the parameters that
197197
come from user-space for validity. After this point, there is no
@@ -200,13 +200,13 @@ and calls that would have been performed by kernel I2C chip drivers
200200
directly. This means that I2C bus drivers don't need to implement
201201
anything special to support access from user-space.
202202

203-
5* These i2c-core.c/i2c.h functions are wrappers to the actual
204-
implementation of your I2C bus driver. Each adapter must declare
205-
callback functions implementing these standard calls.
206-
i2c.h:i2c_get_functionality() calls i2c_adapter.algo->functionality(),
207-
while i2c-core.c:i2c_smbus_xfer() calls either
203+
5* These i2c.h functions are wrappers to the actual implementation of
204+
your I2C bus driver. Each adapter must declare callback functions
205+
implementing these standard calls. i2c.h:i2c_get_functionality() calls
206+
i2c_adapter.algo->functionality(), while
207+
i2c-core-smbus.c:i2c_smbus_xfer() calls either
208208
adapter.algo->smbus_xfer() if it is implemented, or if not,
209-
i2c-core.c:i2c_smbus_xfer_emulated() which in turn calls
209+
i2c-core-smbus.c:i2c_smbus_xfer_emulated() which in turn calls
210210
i2c_adapter.algo->master_xfer().
211211

212212
After your I2C bus driver has processed these requests, execution runs

MAINTAINERS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,18 @@ F: arch/arm/mach-aspeed/
11391139
F: arch/arm/boot/dts/aspeed-*
11401140
F: drivers/*/*aspeed*
11411141

1142+
ARM/ASPEED I2C DRIVER
1143+
M: Brendan Higgins <[email protected]>
1144+
R: Benjamin Herrenschmidt <[email protected]>
1145+
R: Joel Stanley <[email protected]>
1146+
1147+
1148+
S: Maintained
1149+
F: drivers/irqchip/irq-aspeed-i2c-ic.c
1150+
F: drivers/i2c/busses/i2c-aspeed.c
1151+
F: Documentation/devicetree/bindings/interrupt-controller/aspeed,ast2400-i2c-ic.txt
1152+
F: Documentation/devicetree/bindings/i2c/i2c-aspeed.txt
1153+
11421154
ARM/ATMEL AT91RM9200, AT91SAM9 AND SAMA5 SOC SUPPORT
11431155
M: Nicolas Ferre <[email protected]>
11441156
M: Alexandre Belloni <[email protected]>
@@ -6382,6 +6394,7 @@ M: Mika Westerberg <[email protected]>
63826394
63836395
63846396
S: Maintained
6397+
F: drivers/i2c/i2c-core-acpi.c
63856398

63866399
I2C-TAOS-EVM DRIVER
63876400
M: Jean Delvare <[email protected]>

drivers/i2c/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o
66
obj-$(CONFIG_I2C) += i2c-core.o
7+
i2c-core-objs := i2c-core-base.o i2c-core-smbus.o
8+
i2c-core-$(CONFIG_ACPI) += i2c-core-acpi.o
9+
i2c-core-$(CONFIG_I2C_SLAVE) += i2c-core-slave.o
10+
i2c-core-$(CONFIG_OF) += i2c-core-of.o
11+
712
obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o
813
obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
914
obj-$(CONFIG_I2C_MUX) += i2c-mux.o
@@ -12,4 +17,4 @@ obj-$(CONFIG_I2C_STUB) += i2c-stub.o
1217
obj-$(CONFIG_I2C_SLAVE_EEPROM) += i2c-slave-eeprom.o
1318

1419
ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG
15-
CFLAGS_i2c-core.o := -Wno-deprecated-declarations
20+
CFLAGS_i2c-core-base.o := -Wno-deprecated-declarations

drivers/i2c/algos/i2c-algo-bit.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,16 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
553553
nak_ok = pmsg->flags & I2C_M_IGNORE_NAK;
554554
if (!(pmsg->flags & I2C_M_NOSTART)) {
555555
if (i) {
556-
bit_dbg(3, &i2c_adap->dev, "emitting "
557-
"repeated start condition\n");
558-
i2c_repstart(adap);
556+
if (msgs[i - 1].flags & I2C_M_STOP) {
557+
bit_dbg(3, &i2c_adap->dev,
558+
"emitting enforced stop/start condition\n");
559+
i2c_stop(adap);
560+
i2c_start(adap);
561+
} else {
562+
bit_dbg(3, &i2c_adap->dev,
563+
"emitting repeated start condition\n");
564+
i2c_repstart(adap);
565+
}
559566
}
560567
ret = bit_doAddress(i2c_adap, pmsg);
561568
if ((ret != 0) && !nak_ok) {

drivers/i2c/busses/Kconfig

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ config I2C_I801
129129
Broxton (SOC)
130130
Lewisburg (PCH)
131131
Gemini Lake (SOC)
132+
Cannon Lake-H (PCH)
133+
Cannon Lake-LP (PCH)
132134

133135
This driver can also be built as a module. If so, the module
134136
will be called i2c-i801.
@@ -326,6 +328,16 @@ config I2C_POWERMAC
326328

327329
comment "I2C system bus drivers (mostly embedded / system-on-chip)"
328330

331+
config I2C_ASPEED
332+
tristate "Aspeed I2C Controller"
333+
depends on ARCH_ASPEED || COMPILE_TEST
334+
help
335+
If you say yes to this option, support will be included for the
336+
Aspeed I2C controller.
337+
338+
This driver can also be built as a module. If so, the module
339+
will be called i2c-aspeed.
340+
329341
config I2C_AT91
330342
tristate "Atmel AT91 I2C Two-Wire interface (TWI)"
331343
depends on ARCH_AT91
@@ -474,11 +486,22 @@ config I2C_DESIGNWARE_PLATFORM
474486
depends on (ACPI && COMMON_CLK) || !ACPI
475487
help
476488
If you say yes to this option, support will be included for the
477-
Synopsys DesignWare I2C adapter. Only master mode is supported.
489+
Synopsys DesignWare I2C adapter.
478490

479491
This driver can also be built as a module. If so, the module
480492
will be called i2c-designware-platform.
481493

494+
config I2C_DESIGNWARE_SLAVE
495+
bool "Synopsys DesignWare Slave"
496+
select I2C_SLAVE
497+
depends on I2C_DESIGNWARE_PLATFORM
498+
help
499+
If you say yes to this option, support will be included for the
500+
Synopsys DesignWare I2C slave adapter.
501+
502+
This is not a standalone module, this module compiles together with
503+
i2c-designware-core.
504+
482505
config I2C_DESIGNWARE_PCI
483506
tristate "Synopsys DesignWare PCI"
484507
depends on PCI
@@ -1258,4 +1281,13 @@ config I2C_OPAL
12581281
This driver can also be built as a module. If so, the module will be
12591282
called as i2c-opal.
12601283

1284+
config I2C_ZX2967
1285+
tristate "ZTE ZX2967 I2C support"
1286+
depends on ARCH_ZX
1287+
default y
1288+
help
1289+
Selecting this option will add ZX2967 I2C driver.
1290+
This driver can also be built as a module. If so, the module will be
1291+
called i2c-zx2967.
1292+
12611293
endmenu

drivers/i2c/busses/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o
2929
obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o
3030

3131
# Embedded system I2C/SMBus host controller drivers
32+
obj-$(CONFIG_I2C_ASPEED) += i2c-aspeed.o
3233
obj-$(CONFIG_I2C_AT91) += i2c-at91.o
3334
obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
3435
obj-$(CONFIG_I2C_AXXIA) += i2c-axxia.o
@@ -40,6 +41,10 @@ obj-$(CONFIG_I2C_CBUS_GPIO) += i2c-cbus-gpio.o
4041
obj-$(CONFIG_I2C_CPM) += i2c-cpm.o
4142
obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
4243
obj-$(CONFIG_I2C_DESIGNWARE_CORE) += i2c-designware-core.o
44+
i2c-designware-core-objs := i2c-designware-common.o i2c-designware-master.o
45+
ifeq ($(CONFIG_I2C_DESIGNWARE_SLAVE),y)
46+
i2c-designware-core-objs += i2c-designware-slave.o
47+
endif
4348
obj-$(CONFIG_I2C_DESIGNWARE_PLATFORM) += i2c-designware-platform.o
4449
i2c-designware-platform-objs := i2c-designware-platdrv.o
4550
i2c-designware-platform-$(CONFIG_I2C_DESIGNWARE_BAYTRAIL) += i2c-designware-baytrail.o
@@ -102,6 +107,7 @@ obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
102107
obj-$(CONFIG_I2C_XLR) += i2c-xlr.o
103108
obj-$(CONFIG_I2C_XLP9XX) += i2c-xlp9xx.o
104109
obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
110+
obj-$(CONFIG_I2C_ZX2967) += i2c-zx2967.o
105111

106112
# External I2C/SMBus adapter drivers
107113
obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o

0 commit comments

Comments
 (0)