Skip to content

Commit

Permalink
Merge branch 'i2c/for-4.9' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/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
  ...
  • Loading branch information
torvalds committed Oct 7, 2016
2 parents 2ab704a + 662786a commit 87840a2
Show file tree
Hide file tree
Showing 82 changed files with 2,121 additions and 1,332 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ Required properties:
- our-claim-gpio: The GPIO that we use to claim the bus.
- their-claim-gpios: The GPIOs that the other sides use to claim the bus.
Note that some implementations may only support a single other master.
- Standard I2C mux properties. See i2c-mux.txt in this directory.
- Single I2C child bus node at reg 0. See i2c-mux.txt in this directory.
- I2C arbitration bus node. See i2c-arb.txt in this directory.

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

i2c-arbitrator {
compatible = "i2c-arb-gpio-challenge";
#address-cells = <1>;
#size-cells = <0>;

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

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

i2c@0 {
reg = <0>;
i2c-arb {
#address-cells = <1>;
#size-cells = <0>;

Expand Down
35 changes: 35 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-arb.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Common i2c arbitration bus properties.

- i2c-arb child node

Required properties for the i2c-arb child node:
- #address-cells = <1>;
- #size-cells = <0>;

Optional properties for i2c-arb child node:
- Child nodes conforming to i2c bus binding


Example :

/*
An NXP pca9541 I2C bus master selector at address 0x74
with a NXP pca8574 GPIO expander attached.
*/

arb@74 {
compatible = "nxp,pca9541";
reg = <0x74>;

i2c-arb {
#address-cells = <1>;
#size-cells = <0>;

gpio@38 {
compatible = "nxp,pca8574";
reg = <0x38>;
#gpio-cells = <2>;
gpio-controller;
};
};
};
41 changes: 41 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-gate.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
An i2c gate is useful to e.g. reduce the digital noise for RF tuners connected
to the i2c bus. Gates are similar to arbitrators in that you need to perform
some kind of operation to access the i2c bus past the arbitrator/gate, but
there are no competing masters to consider for gates and therefore there is
no arbitration happening for gates.

Common i2c gate properties.

- i2c-gate child node

Required properties for the i2c-gate child node:
- #address-cells = <1>;
- #size-cells = <0>;

Optional properties for i2c-gate child node:
- Child nodes conforming to i2c bus binding


Example :

/*
An Invensense mpu9150 at address 0x68 featuring an on-chip Asahi
Kasei ak8975 compass behind a gate.
*/

mpu9150@68 {
compatible = "invensense,mpu9150";
reg = <0x68>;
interrupt-parent = <&gpio1>;
interrupts = <18 1>;

i2c-gate {
#address-cells = <1>;
#size-cells = <0>;

ax8975@c {
compatible = "ak,ak8975";
reg = <0x0c>;
};
};
};
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/i2c/i2c-meson.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Amlogic Meson I2C controller

Required properties:
- compatible: must be "amlogic,meson6-i2c"
- compatible: must be "amlogic,meson6-i2c" or "amlogic,meson-gxbb-i2c"
- reg: physical address and length of the device registers
- interrupts: a single interrupt specifier
- clocks: clock for the device
Expand Down
23 changes: 18 additions & 5 deletions Documentation/devicetree/bindings/i2c/i2c-mux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@ Common i2c bus multiplexer/switch properties.

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

Required properties:
Optional properties:
- #address-cells = <1>;
This property is required is the i2c-mux child node does not exist.

- #size-cells = <0>;
This property is required is the i2c-mux child node does not exist.

- i2c-mux
For i2c multiplexers/switches that have child nodes that are a mixture
of both i2c child busses and other child nodes, the 'i2c-mux' subnode
can be used for populating the i2c child busses. If an 'i2c-mux'
subnode is present, only subnodes of this will be considered as i2c
child busses.

Required properties for the i2c-mux child node:
- #address-cells = <1>;
- #size-cells = <0>;

Required properties for child nodes:
Required properties for i2c child bus nodes:
- #address-cells = <1>;
- #size-cells = <0>;
- reg : The sub-bus number.

Optional properties for child nodes:
Optional properties for i2c child bus nodes:
- Other properties specific to the multiplexer/switch hardware.
- Child nodes conforming to i2c bus binding

Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/i2c/i2c-rcar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Required properties:
"renesas,i2c-r8a7793"
"renesas,i2c-r8a7794"
"renesas,i2c-r8a7795"
"renesas,i2c-r8a7796"
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: interrupt specifier.
Expand Down
29 changes: 29 additions & 0 deletions Documentation/devicetree/bindings/i2c/nxp,pca9541.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
* NXP PCA9541 I2C bus master selector

Required Properties:

- compatible: Must be "nxp,pca9541"

- reg: The I2C address of the device.

The following required properties are defined externally:

- I2C arbitration bus node. See i2c-arb.txt in this directory.


Example:

i2c-arbitrator@74 {
compatible = "nxp,pca9541";
reg = <0x74>;

i2c-arb {
#address-cells = <1>;
#size-cells = <0>;

eeprom@54 {
compatible = "at,24c08";
reg = <0x54>;
};
};
};
10 changes: 10 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2908,6 +2908,14 @@ S: Maintained
F: drivers/iio/light/cm*
F: Documentation/devicetree/bindings/i2c/trivial-devices.txt

CAVIUM I2C DRIVER
M: Jan Glauber <[email protected]>
M: David Daney <[email protected]>
W: http://www.cavium.com
S: Supported
F: drivers/i2c/busses/i2c-octeon*
F: drivers/i2c/busses/i2c-thunderx*

CAVIUM LIQUIDIO NETWORK DRIVER
M: Derek Chickles <[email protected]>
M: Satanand Burla <[email protected]>
Expand Down Expand Up @@ -5788,6 +5796,8 @@ S: Maintained
F: Documentation/i2c/i2c-topology
F: Documentation/i2c/muxes/
F: Documentation/devicetree/bindings/i2c/i2c-mux*
F: Documentation/devicetree/bindings/i2c/i2c-arb*
F: Documentation/devicetree/bindings/i2c/i2c-gate*
F: drivers/i2c/i2c-mux.c
F: drivers/i2c/muxes/
F: include/linux/i2c-mux.h
Expand Down
16 changes: 9 additions & 7 deletions drivers/gpio/gpio-pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
static const struct of_device_id pca953x_dt_ids[];

static int pca953x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
const struct i2c_device_id *i2c_id)
{
struct pca953x_platform_data *pdata;
struct pca953x_chip *chip;
Expand Down Expand Up @@ -773,27 +773,29 @@ static int pca953x_probe(struct i2c_client *client,
}
chip->regulator = reg;

if (id) {
chip->driver_data = id->driver_data;
if (i2c_id) {
chip->driver_data = i2c_id->driver_data;
} else {
const struct acpi_device_id *id;
const struct acpi_device_id *acpi_id;
const struct of_device_id *match;

match = of_match_device(pca953x_dt_ids, &client->dev);
if (match) {
chip->driver_data = (int)(uintptr_t)match->data;
} else {
id = acpi_match_device(pca953x_acpi_ids, &client->dev);
if (!id) {
acpi_id = acpi_match_device(pca953x_acpi_ids, &client->dev);
if (!acpi_id) {
ret = -ENODEV;
goto err_exit;
}

chip->driver_data = id->driver_data;
chip->driver_data = acpi_id->driver_data;
}
}

mutex_init(&chip->i2c_lock);
lockdep_set_subclass(&chip->i2c_lock,
i2c_adapter_depth(client->adapter));

/* initialize cached registers from their original values.
* we can't share this chip with another i2c master.
Expand Down
10 changes: 7 additions & 3 deletions drivers/gpu/drm/drm_dp_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,12 @@ static void unlock_bus(struct i2c_adapter *i2c, unsigned int flags)
mutex_unlock(&i2c_to_aux(i2c)->hw_mutex);
}

static const struct i2c_lock_operations drm_dp_i2c_lock_ops = {
.lock_bus = lock_bus,
.trylock_bus = trylock_bus,
.unlock_bus = unlock_bus,
};

/**
* drm_dp_aux_init() - minimally initialise an aux channel
* @aux: DisplayPort AUX channel
Expand All @@ -807,9 +813,7 @@ void drm_dp_aux_init(struct drm_dp_aux *aux)
aux->ddc.algo_data = aux;
aux->ddc.retries = 3;

aux->ddc.lock_bus = lock_bus;
aux->ddc.trylock_bus = trylock_bus;
aux->ddc.unlock_bus = unlock_bus;
aux->ddc.lock_ops = &drm_dp_i2c_lock_ops;
}
EXPORT_SYMBOL(drm_dp_aux_init);

Expand Down
13 changes: 12 additions & 1 deletion drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ config I2C_SH7760
config I2C_SH_MOBILE
tristate "SuperH Mobile I2C Controller"
depends on HAS_DMA
depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
depends on ARCH_SHMOBILE || ARCH_RENESAS || COMPILE_TEST
help
If you say yes to this option, support will be included for the
built-in I2C interface on the Renesas SH-Mobile processor.
Expand Down Expand Up @@ -956,6 +956,17 @@ config I2C_OCTEON
This driver can also be built as a module. If so, the module
will be called i2c-octeon.

config I2C_THUNDERX
tristate "Cavium ThunderX I2C bus support"
depends on 64BIT && PCI && (ARM64 || COMPILE_TEST)
select I2C_SMBUS
help
Say yes if you want to support the I2C serial bus on Cavium
ThunderX SOC.

This driver can also be built as a module. If so, the module
will be called i2c-thunderx.

config I2C_XILINX
tristate "Xilinx I2C Controller"
depends on HAS_IOMEM
Expand Down
3 changes: 3 additions & 0 deletions drivers/i2c/busses/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ obj-$(CONFIG_I2C_UNIPHIER) += i2c-uniphier.o
obj-$(CONFIG_I2C_UNIPHIER_F) += i2c-uniphier-f.o
obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
obj-$(CONFIG_I2C_WMT) += i2c-wmt.o
i2c-octeon-objs := i2c-octeon-core.o i2c-octeon-platdrv.o
obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o
i2c-thunderx-objs := i2c-octeon-core.o i2c-thunderx-pcidrv.o
obj-$(CONFIG_I2C_THUNDERX) += i2c-thunderx.o
obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
obj-$(CONFIG_I2C_XLR) += i2c-xlr.o
obj-$(CONFIG_I2C_XLP9XX) += i2c-xlp9xx.o
Expand Down
5 changes: 1 addition & 4 deletions drivers/i2c/busses/i2c-amd756.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,8 @@ static int amd756_probe(struct pci_dev *pdev, const struct pci_device_id *id)
amd756_ioport);

error = i2c_add_adapter(&amd756_smbus);
if (error) {
dev_err(&pdev->dev,
"Adapter registration failed, module not inserted\n");
if (error)
goto out_err;
}

return 0;

Expand Down
2 changes: 0 additions & 2 deletions drivers/i2c/busses/i2c-at91.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,8 +1122,6 @@ static int at91_twi_probe(struct platform_device *pdev)

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

pm_runtime_disable(dev->dev);
Expand Down
8 changes: 6 additions & 2 deletions drivers/i2c/busses/i2c-axxia.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ static int axxia_i2c_probe(struct platform_device *pdev)
return ret;
}

clk_prepare_enable(idev->i2c_clk);
ret = clk_prepare_enable(idev->i2c_clk);
if (ret) {
dev_err(&pdev->dev, "failed to enable clock\n");
return ret;
}

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

ret = i2c_add_adapter(&idev->adapter);
if (ret) {
dev_err(&pdev->dev, "failed to add adapter\n");
clk_disable_unprepare(idev->i2c_clk);
return ret;
}

Expand Down
8 changes: 1 addition & 7 deletions drivers/i2c/busses/i2c-bcm-iproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,7 @@ static int bcm_iproc_i2c_probe(struct platform_device *pdev)
adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;

ret = i2c_add_adapter(adap);
if (ret) {
dev_err(iproc_i2c->device, "failed to add adapter\n");
return ret;
}

return 0;
return i2c_add_adapter(adap);
}

static int bcm_iproc_i2c_remove(struct platform_device *pdev)
Expand Down
4 changes: 1 addition & 3 deletions drivers/i2c/busses/i2c-bcm-kona.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,10 +858,8 @@ static int bcm_kona_i2c_probe(struct platform_device *pdev)
adap->dev.of_node = pdev->dev.of_node;

rc = i2c_add_adapter(adap);
if (rc) {
dev_err(dev->device, "failed to add adapter\n");
if (rc)
return rc;
}

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

Expand Down
Loading

0 comments on commit 87840a2

Please sign in to comment.