Commit 5ee2433f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'i2c-for-6.9-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull more i2c updates from Wolfram Sang:
 "Some more I2C updates after the dependencies have been merged now.

  Plus a DT binding fix"

* tag 'i2c-for-6.9-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  dt-bindings: i2c: qcom,i2c-cci: Fix OV7251 'data-lanes' entries
  i2c: muxes: pca954x: Allow sharing reset GPIO
  i2c: nomadik: sort includes
  i2c: nomadik: support Mobileye EyeQ5 I2C controller
  i2c: nomadik: fetch i2c-transfer-timeout-us property from devicetree
  i2c: nomadik: replace jiffies by ktime for FIFO flushing timeout
  i2c: nomadik: support short xfer timeouts using waitqueue & hrtimer
  i2c: nomadik: use bitops helpers
  i2c: nomadik: simplify IRQ masking logic
  i2c: nomadik: rename private struct pointers from dev to priv
  dt-bindings: i2c: nomadik: add mobileye,eyeq5-i2c bindings and example
parents 8e938e39 e593a4a2
...@@ -270,7 +270,7 @@ examples: ...@@ -270,7 +270,7 @@ examples:
port { port {
ov7251_ep: endpoint { ov7251_ep: endpoint {
data-lanes = <0 1>; data-lanes = <0>;
link-frequencies = /bits/ 64 <240000000 319200000>; link-frequencies = /bits/ 64 <240000000 319200000>;
remote-endpoint = <&csiphy3_ep>; remote-endpoint = <&csiphy3_ep>;
}; };
......
...@@ -14,9 +14,6 @@ description: The Nomadik I2C host controller began its life in the ST ...@@ -14,9 +14,6 @@ description: The Nomadik I2C host controller began its life in the ST
maintainers: maintainers:
- Linus Walleij <linus.walleij@linaro.org> - Linus Walleij <linus.walleij@linaro.org>
allOf:
- $ref: /schemas/i2c/i2c-controller.yaml#
# Need a custom select here or 'arm,primecell' will match on lots of nodes # Need a custom select here or 'arm,primecell' will match on lots of nodes
select: select:
properties: properties:
...@@ -24,21 +21,23 @@ select: ...@@ -24,21 +21,23 @@ select:
contains: contains:
enum: enum:
- st,nomadik-i2c - st,nomadik-i2c
- mobileye,eyeq5-i2c
required: required:
- compatible - compatible
properties: properties:
compatible: compatible:
oneOf: oneOf:
# The variant found in STn8815
- items: - items:
- const: st,nomadik-i2c - const: st,nomadik-i2c
- const: arm,primecell - const: arm,primecell
# The variant found in DB8500
- items: - items:
- const: stericsson,db8500-i2c - const: stericsson,db8500-i2c
- const: st,nomadik-i2c - const: st,nomadik-i2c
- const: arm,primecell - const: arm,primecell
- items:
- const: mobileye,eyeq5-i2c
- const: arm,primecell
reg: reg:
maxItems: 1 maxItems: 1
...@@ -55,7 +54,7 @@ properties: ...@@ -55,7 +54,7 @@ properties:
- items: - items:
- const: mclk - const: mclk
- const: apb_pclk - const: apb_pclk
# Clock name in DB8500 # Clock name in DB8500 or EyeQ5
- items: - items:
- const: i2cclk - const: i2cclk
- const: apb_pclk - const: apb_pclk
...@@ -70,6 +69,16 @@ properties: ...@@ -70,6 +69,16 @@ properties:
minimum: 1 minimum: 1
maximum: 400000 maximum: 400000
mobileye,olb:
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
- items:
- description: Phandle to OLB system controller node.
- description: Platform-wide controller ID (integer starting from zero).
description:
The phandle pointing to OLB system controller node, with the I2C
controller index.
required: required:
- compatible - compatible
- reg - reg
...@@ -79,6 +88,20 @@ required: ...@@ -79,6 +88,20 @@ required:
unevaluatedProperties: false unevaluatedProperties: false
allOf:
- $ref: /schemas/i2c/i2c-controller.yaml#
- if:
properties:
compatible:
contains:
const: mobileye,eyeq5-i2c
then:
required:
- mobileye,olb
else:
properties:
mobileye,olb: false
examples: examples:
- | - |
#include <dt-bindings/interrupt-controller/irq.h> #include <dt-bindings/interrupt-controller/irq.h>
...@@ -111,5 +134,19 @@ examples: ...@@ -111,5 +134,19 @@ examples:
clocks = <&i2c0clk>, <&pclki2c0>; clocks = <&i2c0clk>, <&pclki2c0>;
clock-names = "mclk", "apb_pclk"; clock-names = "mclk", "apb_pclk";
}; };
- |
#include <dt-bindings/interrupt-controller/mips-gic.h>
i2c@300000 {
compatible = "mobileye,eyeq5-i2c", "arm,primecell";
reg = <0x300000 0x1000>;
interrupt-parent = <&gic>;
interrupts = <GIC_SHARED 1 IRQ_TYPE_LEVEL_HIGH>;
clock-frequency = <400000>;
#address-cells = <1>;
#size-cells = <0>;
clocks = <&i2c_ser_clk>, <&i2c_clk>;
clock-names = "i2cclk", "apb_pclk";
mobileye,olb = <&olb 0>;
};
... ...
This diff is collapsed.
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <dt-bindings/mux/mux.h> #include <dt-bindings/mux/mux.h>
...@@ -116,6 +117,9 @@ struct pca954x { ...@@ -116,6 +117,9 @@ struct pca954x {
unsigned int irq_mask; unsigned int irq_mask;
raw_spinlock_t lock; raw_spinlock_t lock;
struct regulator *supply; struct regulator *supply;
struct gpio_desc *reset_gpio;
struct reset_control *reset_cont;
}; };
/* Provide specs for the MAX735x, PCA954x and PCA984x types we know about */ /* Provide specs for the MAX735x, PCA954x and PCA984x types we know about */
...@@ -518,6 +522,35 @@ static int pca954x_init(struct i2c_client *client, struct pca954x *data) ...@@ -518,6 +522,35 @@ static int pca954x_init(struct i2c_client *client, struct pca954x *data)
return ret; return ret;
} }
static int pca954x_get_reset(struct device *dev, struct pca954x *data)
{
data->reset_cont = devm_reset_control_get_optional_shared(dev, NULL);
if (IS_ERR(data->reset_cont))
return dev_err_probe(dev, PTR_ERR(data->reset_cont),
"Failed to get reset\n");
else if (data->reset_cont)
return 0;
/*
* fallback to legacy reset-gpios
*/
data->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(data->reset_gpio)) {
return dev_err_probe(dev, PTR_ERR(data->reset_gpio),
"Failed to get reset gpio");
}
return 0;
}
static void pca954x_reset_deassert(struct pca954x *data)
{
if (data->reset_cont)
reset_control_deassert(data->reset_cont);
else
gpiod_set_value_cansleep(data->reset_gpio, 0);
}
/* /*
* I2C init/probing/exit functions * I2C init/probing/exit functions
*/ */
...@@ -526,7 +559,6 @@ static int pca954x_probe(struct i2c_client *client) ...@@ -526,7 +559,6 @@ static int pca954x_probe(struct i2c_client *client)
const struct i2c_device_id *id = i2c_client_get_device_id(client); const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct i2c_adapter *adap = client->adapter; struct i2c_adapter *adap = client->adapter;
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct gpio_desc *gpio;
struct i2c_mux_core *muxc; struct i2c_mux_core *muxc;
struct pca954x *data; struct pca954x *data;
int num; int num;
...@@ -554,15 +586,13 @@ static int pca954x_probe(struct i2c_client *client) ...@@ -554,15 +586,13 @@ static int pca954x_probe(struct i2c_client *client)
return dev_err_probe(dev, ret, return dev_err_probe(dev, ret,
"Failed to enable vdd supply\n"); "Failed to enable vdd supply\n");
/* Reset the mux if a reset GPIO is specified. */ ret = pca954x_get_reset(dev, data);
gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (ret)
if (IS_ERR(gpio)) {
ret = PTR_ERR(gpio);
goto fail_cleanup; goto fail_cleanup;
}
if (gpio) { if (data->reset_cont || data->reset_gpio) {
udelay(1); udelay(1);
gpiod_set_value_cansleep(gpio, 0); pca954x_reset_deassert(data);
/* Give the chip some time to recover. */ /* Give the chip some time to recover. */
udelay(1); udelay(1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment