Skip to content

Commit 87840a2

Browse files
committed
Merge branch 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang: "Here is the 4.9 pull request from I2C including: - centralized error messages when registering to the core - improved lockdep annotations to prevent false positives - DT support for muxes, gates, and arbitrators - bus speeds can now be obtained from ACPI - i2c-octeon got refactored and now supports ThunderX SoCs, too - i2c-tegra and i2c-designware got a bigger bunch of updates - a couple of standard driver fixes and improvements" * 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (71 commits) i2c: axxia: disable clks in case of failure in probe i2c: octeon: thunderx: Limit register access retries i2c: uniphier-f: fix misdetection of incomplete STOP condition gpio: pca953x: variable 'id' was used twice i2c: i801: Add support for Kaby Lake PCH-H gpio: pca953x: fix an incorrect lockdep warning i2c: add a warning to i2c_adapter_depth() lockdep: make MAX_LOCKDEP_SUBCLASSES unconditionally visible i2c: export i2c_adapter_depth() i2c: rk3x: Fix variable 'min_total_ns' unused warning i2c: rk3x: Fix sparse warning i2c / ACPI: Do not touch an I2C device if it belongs to another adapter i2c: octeon: Fix high-level controller status check i2c: octeon: Avoid sending STOP during recovery i2c: octeon: Fix set SCL recovery function i2c: rcar: add support for r8a7796 (R-Car M3-W) i2c: imx: make bus recovery through pinctrl optional i2c: meson: add gxbb compatible string i2c: uniphier-f: set the adapter to master mode when probing i2c: uniphier-f: avoid WARN_ON() of clk_disable() in failure path ...
2 parents 2ab704a + 662786a commit 87840a2

Some content is hidden

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

82 files changed

+2121
-1332
lines changed

Documentation/devicetree/bindings/i2c/i2c-arb-gpio-challenge.txt

+2-6
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ Required properties:
4444
- our-claim-gpio: The GPIO that we use to claim the bus.
4545
- their-claim-gpios: The GPIOs that the other sides use to claim the bus.
4646
Note that some implementations may only support a single other master.
47-
- Standard I2C mux properties. See i2c-mux.txt in this directory.
48-
- Single I2C child bus node at reg 0. See i2c-mux.txt in this directory.
47+
- I2C arbitration bus node. See i2c-arb.txt in this directory.
4948

5049
Optional properties:
5150
- slew-delay-us: microseconds to wait for a GPIO to go high. Default is 10 us.
@@ -63,8 +62,6 @@ Example:
6362

6463
i2c-arbitrator {
6564
compatible = "i2c-arb-gpio-challenge";
66-
#address-cells = <1>;
67-
#size-cells = <0>;
6865

6966
i2c-parent = <&{/i2c@12CA0000}>;
7067

@@ -74,8 +71,7 @@ Example:
7471
wait-retry-us = <3000>;
7572
wait-free-us = <50000>;
7673

77-
i2c@0 {
78-
reg = <0>;
74+
i2c-arb {
7975
#address-cells = <1>;
8076
#size-cells = <0>;
8177

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Common i2c arbitration bus properties.
2+
3+
- i2c-arb child node
4+
5+
Required properties for the i2c-arb child node:
6+
- #address-cells = <1>;
7+
- #size-cells = <0>;
8+
9+
Optional properties for i2c-arb child node:
10+
- Child nodes conforming to i2c bus binding
11+
12+
13+
Example :
14+
15+
/*
16+
An NXP pca9541 I2C bus master selector at address 0x74
17+
with a NXP pca8574 GPIO expander attached.
18+
*/
19+
20+
arb@74 {
21+
compatible = "nxp,pca9541";
22+
reg = <0x74>;
23+
24+
i2c-arb {
25+
#address-cells = <1>;
26+
#size-cells = <0>;
27+
28+
gpio@38 {
29+
compatible = "nxp,pca8574";
30+
reg = <0x38>;
31+
#gpio-cells = <2>;
32+
gpio-controller;
33+
};
34+
};
35+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
An i2c gate is useful to e.g. reduce the digital noise for RF tuners connected
2+
to the i2c bus. Gates are similar to arbitrators in that you need to perform
3+
some kind of operation to access the i2c bus past the arbitrator/gate, but
4+
there are no competing masters to consider for gates and therefore there is
5+
no arbitration happening for gates.
6+
7+
Common i2c gate properties.
8+
9+
- i2c-gate child node
10+
11+
Required properties for the i2c-gate child node:
12+
- #address-cells = <1>;
13+
- #size-cells = <0>;
14+
15+
Optional properties for i2c-gate child node:
16+
- Child nodes conforming to i2c bus binding
17+
18+
19+
Example :
20+
21+
/*
22+
An Invensense mpu9150 at address 0x68 featuring an on-chip Asahi
23+
Kasei ak8975 compass behind a gate.
24+
*/
25+
26+
mpu9150@68 {
27+
compatible = "invensense,mpu9150";
28+
reg = <0x68>;
29+
interrupt-parent = <&gpio1>;
30+
interrupts = <18 1>;
31+
32+
i2c-gate {
33+
#address-cells = <1>;
34+
#size-cells = <0>;
35+
36+
ax8975@c {
37+
compatible = "ak,ak8975";
38+
reg = <0x0c>;
39+
};
40+
};
41+
};

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Amlogic Meson I2C controller
22

33
Required properties:
4-
- compatible: must be "amlogic,meson6-i2c"
4+
- compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
55
- reg: physical address and length of the device registers
66
- interrupts: a single interrupt specifier
77
- clocks: clock for the device

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

+18-5
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,32 @@ Common i2c bus multiplexer/switch properties.
22

33
An i2c bus multiplexer/switch will have several child busses that are
44
numbered uniquely in a device dependent manner. The nodes for an i2c bus
5-
multiplexer/switch will have one child node for each child
6-
bus.
5+
multiplexer/switch will have one child node for each child bus.
76

8-
Required properties:
7+
Optional properties:
8+
- #address-cells = <1>;
9+
This property is required is the i2c-mux child node does not exist.
10+
11+
- #size-cells = <0>;
12+
This property is required is the i2c-mux child node does not exist.
13+
14+
- i2c-mux
15+
For i2c multiplexers/switches that have child nodes that are a mixture
16+
of both i2c child busses and other child nodes, the 'i2c-mux' subnode
17+
can be used for populating the i2c child busses. If an 'i2c-mux'
18+
subnode is present, only subnodes of this will be considered as i2c
19+
child busses.
20+
21+
Required properties for the i2c-mux child node:
922
- #address-cells = <1>;
1023
- #size-cells = <0>;
1124

12-
Required properties for child nodes:
25+
Required properties for i2c child bus nodes:
1326
- #address-cells = <1>;
1427
- #size-cells = <0>;
1528
- reg : The sub-bus number.
1629

17-
Optional properties for child nodes:
30+
Optional properties for i2c child bus nodes:
1831
- Other properties specific to the multiplexer/switch hardware.
1932
- Child nodes conforming to i2c bus binding
2033

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

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Required properties:
1111
"renesas,i2c-r8a7793"
1212
"renesas,i2c-r8a7794"
1313
"renesas,i2c-r8a7795"
14+
"renesas,i2c-r8a7796"
1415
- reg: physical base address of the controller and length of memory mapped
1516
region.
1617
- interrupts: interrupt specifier.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
* NXP PCA9541 I2C bus master selector
2+
3+
Required Properties:
4+
5+
- compatible: Must be "nxp,pca9541"
6+
7+
- reg: The I2C address of the device.
8+
9+
The following required properties are defined externally:
10+
11+
- I2C arbitration bus node. See i2c-arb.txt in this directory.
12+
13+
14+
Example:
15+
16+
i2c-arbitrator@74 {
17+
compatible = "nxp,pca9541";
18+
reg = <0x74>;
19+
20+
i2c-arb {
21+
#address-cells = <1>;
22+
#size-cells = <0>;
23+
24+
eeprom@54 {
25+
compatible = "at,24c08";
26+
reg = <0x54>;
27+
};
28+
};
29+
};

MAINTAINERS

+10
Original file line numberDiff line numberDiff line change
@@ -2908,6 +2908,14 @@ S: Maintained
29082908
F: drivers/iio/light/cm*
29092909
F: Documentation/devicetree/bindings/i2c/trivial-devices.txt
29102910

2911+
CAVIUM I2C DRIVER
2912+
M: Jan Glauber <[email protected]>
2913+
M: David Daney <[email protected]>
2914+
W: http://www.cavium.com
2915+
S: Supported
2916+
F: drivers/i2c/busses/i2c-octeon*
2917+
F: drivers/i2c/busses/i2c-thunderx*
2918+
29112919
CAVIUM LIQUIDIO NETWORK DRIVER
29122920
M: Derek Chickles <[email protected]>
29132921
M: Satanand Burla <[email protected]>
@@ -5788,6 +5796,8 @@ S: Maintained
57885796
F: Documentation/i2c/i2c-topology
57895797
F: Documentation/i2c/muxes/
57905798
F: Documentation/devicetree/bindings/i2c/i2c-mux*
5799+
F: Documentation/devicetree/bindings/i2c/i2c-arb*
5800+
F: Documentation/devicetree/bindings/i2c/i2c-gate*
57915801
F: drivers/i2c/i2c-mux.c
57925802
F: drivers/i2c/muxes/
57935803
F: include/linux/i2c-mux.h

drivers/gpio/gpio-pca953x.c

+9-7
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
732732
static const struct of_device_id pca953x_dt_ids[];
733733

734734
static int pca953x_probe(struct i2c_client *client,
735-
const struct i2c_device_id *id)
735+
const struct i2c_device_id *i2c_id)
736736
{
737737
struct pca953x_platform_data *pdata;
738738
struct pca953x_chip *chip;
@@ -773,27 +773,29 @@ static int pca953x_probe(struct i2c_client *client,
773773
}
774774
chip->regulator = reg;
775775

776-
if (id) {
777-
chip->driver_data = id->driver_data;
776+
if (i2c_id) {
777+
chip->driver_data = i2c_id->driver_data;
778778
} else {
779-
const struct acpi_device_id *id;
779+
const struct acpi_device_id *acpi_id;
780780
const struct of_device_id *match;
781781

782782
match = of_match_device(pca953x_dt_ids, &client->dev);
783783
if (match) {
784784
chip->driver_data = (int)(uintptr_t)match->data;
785785
} else {
786-
id = acpi_match_device(pca953x_acpi_ids, &client->dev);
787-
if (!id) {
786+
acpi_id = acpi_match_device(pca953x_acpi_ids, &client->dev);
787+
if (!acpi_id) {
788788
ret = -ENODEV;
789789
goto err_exit;
790790
}
791791

792-
chip->driver_data = id->driver_data;
792+
chip->driver_data = acpi_id->driver_data;
793793
}
794794
}
795795

796796
mutex_init(&chip->i2c_lock);
797+
lockdep_set_subclass(&chip->i2c_lock,
798+
i2c_adapter_depth(client->adapter));
797799

798800
/* initialize cached registers from their original values.
799801
* we can't share this chip with another i2c master.

drivers/gpu/drm/drm_dp_helper.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,12 @@ static void unlock_bus(struct i2c_adapter *i2c, unsigned int flags)
790790
mutex_unlock(&i2c_to_aux(i2c)->hw_mutex);
791791
}
792792

793+
static const struct i2c_lock_operations drm_dp_i2c_lock_ops = {
794+
.lock_bus = lock_bus,
795+
.trylock_bus = trylock_bus,
796+
.unlock_bus = unlock_bus,
797+
};
798+
793799
/**
794800
* drm_dp_aux_init() - minimally initialise an aux channel
795801
* @aux: DisplayPort AUX channel
@@ -807,9 +813,7 @@ void drm_dp_aux_init(struct drm_dp_aux *aux)
807813
aux->ddc.algo_data = aux;
808814
aux->ddc.retries = 3;
809815

810-
aux->ddc.lock_bus = lock_bus;
811-
aux->ddc.trylock_bus = trylock_bus;
812-
aux->ddc.unlock_bus = unlock_bus;
816+
aux->ddc.lock_ops = &drm_dp_i2c_lock_ops;
813817
}
814818
EXPORT_SYMBOL(drm_dp_aux_init);
815819

drivers/i2c/busses/Kconfig

+12-1
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ config I2C_SH7760
836836
config I2C_SH_MOBILE
837837
tristate "SuperH Mobile I2C Controller"
838838
depends on HAS_DMA
839-
depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
839+
depends on ARCH_SHMOBILE || ARCH_RENESAS || COMPILE_TEST
840840
help
841841
If you say yes to this option, support will be included for the
842842
built-in I2C interface on the Renesas SH-Mobile processor.
@@ -956,6 +956,17 @@ config I2C_OCTEON
956956
This driver can also be built as a module. If so, the module
957957
will be called i2c-octeon.
958958

959+
config I2C_THUNDERX
960+
tristate "Cavium ThunderX I2C bus support"
961+
depends on 64BIT && PCI && (ARM64 || COMPILE_TEST)
962+
select I2C_SMBUS
963+
help
964+
Say yes if you want to support the I2C serial bus on Cavium
965+
ThunderX SOC.
966+
967+
This driver can also be built as a module. If so, the module
968+
will be called i2c-thunderx.
969+
959970
config I2C_XILINX
960971
tristate "Xilinx I2C Controller"
961972
depends on HAS_IOMEM

drivers/i2c/busses/Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ obj-$(CONFIG_I2C_UNIPHIER) += i2c-uniphier.o
9191
obj-$(CONFIG_I2C_UNIPHIER_F) += i2c-uniphier-f.o
9292
obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
9393
obj-$(CONFIG_I2C_WMT) += i2c-wmt.o
94+
i2c-octeon-objs := i2c-octeon-core.o i2c-octeon-platdrv.o
9495
obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o
96+
i2c-thunderx-objs := i2c-octeon-core.o i2c-thunderx-pcidrv.o
97+
obj-$(CONFIG_I2C_THUNDERX) += i2c-thunderx.o
9598
obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
9699
obj-$(CONFIG_I2C_XLR) += i2c-xlr.o
97100
obj-$(CONFIG_I2C_XLP9XX) += i2c-xlp9xx.o

drivers/i2c/busses/i2c-amd756.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,8 @@ static int amd756_probe(struct pci_dev *pdev, const struct pci_device_id *id)
378378
amd756_ioport);
379379

380380
error = i2c_add_adapter(&amd756_smbus);
381-
if (error) {
382-
dev_err(&pdev->dev,
383-
"Adapter registration failed, module not inserted\n");
381+
if (error)
384382
goto out_err;
385-
}
386383

387384
return 0;
388385

drivers/i2c/busses/i2c-at91.c

-2
Original file line numberDiff line numberDiff line change
@@ -1122,8 +1122,6 @@ static int at91_twi_probe(struct platform_device *pdev)
11221122

11231123
rc = i2c_add_numbered_adapter(&dev->adapter);
11241124
if (rc) {
1125-
dev_err(dev->dev, "Adapter %s registration failed\n",
1126-
dev->adapter.name);
11271125
clk_disable_unprepare(dev->clk);
11281126

11291127
pm_runtime_disable(dev->dev);

drivers/i2c/busses/i2c-axxia.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,11 @@ static int axxia_i2c_probe(struct platform_device *pdev)
545545
return ret;
546546
}
547547

548-
clk_prepare_enable(idev->i2c_clk);
548+
ret = clk_prepare_enable(idev->i2c_clk);
549+
if (ret) {
550+
dev_err(&pdev->dev, "failed to enable clock\n");
551+
return ret;
552+
}
549553

550554
i2c_set_adapdata(&idev->adapter, idev);
551555
strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name));
@@ -560,7 +564,7 @@ static int axxia_i2c_probe(struct platform_device *pdev)
560564

561565
ret = i2c_add_adapter(&idev->adapter);
562566
if (ret) {
563-
dev_err(&pdev->dev, "failed to add adapter\n");
567+
clk_disable_unprepare(idev->i2c_clk);
564568
return ret;
565569
}
566570

drivers/i2c/busses/i2c-bcm-iproc.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -488,13 +488,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
488488
adap->dev.parent = &pdev->dev;
489489
adap->dev.of_node = pdev->dev.of_node;
490490

491-
ret = i2c_add_adapter(adap);
492-
if (ret) {
493-
dev_err(iproc_i2c->device, "failed to add adapter\n");
494-
return ret;
495-
}
496-
497-
return 0;
491+
return i2c_add_adapter(adap);
498492
}
499493

500494
static int bcm_iproc_i2c_remove(struct platform_device *pdev)

drivers/i2c/busses/i2c-bcm-kona.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -858,10 +858,8 @@ static int bcm_kona_i2c_probe(struct platform_device *pdev)
858858
adap->dev.of_node = pdev->dev.of_node;
859859

860860
rc = i2c_add_adapter(adap);
861-
if (rc) {
862-
dev_err(dev->device, "failed to add adapter\n");
861+
if (rc)
863862
return rc;
864-
}
865863

866864
dev_info(dev->device, "device registered successfully\n");
867865

0 commit comments

Comments
 (0)