ARM: I2C: Add device tree bindings to i2c-mux-gpio
Subsystems (5)
v4 cover ARM: I2C: Add device tree bindings to i2c-mux-gpio
Hi everyone,
This patchset adds the device tree entry to the CFA-10049 board of its i2c muxer. This muxer controls sub-buses that contains three Nuvoton NAU7802 ADCs and a NXP PCA955 GPIO expander. Support for these will be added eventually.
Thanks,
Maxime
Changes from v3:
- Rebased on top of 3.7-rc1
Maxime Ripard (2):
i2c: mux: Add dt support to i2c-mux-gpio driver
ARM: dts: cfa10049: Add the i2c muxer buses to the CFA-10049
.../devicetree/bindings/i2c/i2c-mux-gpio.txt | 81 ++++++++++ arch/arm/boot/dts/imx28-cfa10049.dts | 24 +++ drivers/i2c/muxes/i2c-mux-gpio.c | 169 +++++++++++++++----- 3 files changed, 235 insertions(+), 39 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
Signature · 1 line
1.7.9.5
PATCH v4 1/2 i2c: mux: Add dt support to i2c-mux-gpio driver
Allow the i2c-mux-gpio to be used by a device tree enabled device. The bindings are inspired by the one found in the i2c-mux-pinctrl driver.
--- .../devicetree/bindings/i2c/i2c-mux-gpio.txt | 81 ++++++++++ drivers/i2c/muxes/i2c-mux-gpio.c | 169 +++++++++++++++----- 2 files changed, 211 insertions(+), 39 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt new file +81 -0
@@ -0,0 +1,81 @@ +GPIO-based I2C Bus Mux + +This binding describes an I2C bus multiplexer that uses GPIOs to +route the I2C signals. + + +-----+ +-----+ + | dev | | dev | + +------------+ +-----+ +-----+ + | SoC | | | + | | /--------+--------+ + | +------+ | +------+ child bus A, on GPIO value set to 0 + | | I2C |-|--| Mux | + | +------+ | +--+---+ child bus B, on GPIO value set to 1 + | | | \----------+--------+--------+ + | +------+ | | | | | + | | GPIO |-|-----+ +-----+ +-----+ +-----+ + | +------+ | | dev | | dev | | dev | + +------------+ +-----+ +-----+ +-----+ + +Required properties: +- compatible: i2c-mux-gpio +- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side + port is connected to. +- mux-gpios: list of gpios to use to control the muxer +* Standard I2C mux properties. See mux.txt in this directory. +* I2C child bus nodes. See mux.txt in this directory. + +Optional properties: +- idle-state: value to set to the muxer when idle. When no value is + given, it defaults to the first value in the array. + +For each i2c child node, an I2C child bus will be created. They will +be numbered based on the reg property of each node. + +Whenever an access is made to a device on a child bus, the value set +in the revelant node's reg property will be output using the list of +GPIOs, the first in the list holding the most-significant value. + +If an idle state is defined, using the idle-state (optional) property, +whenever an access is not being made to a device on a child bus, the +idle value will be programmed into the GPIOs. + +If an idle state is not defined, the most recently used value will be +left programmed into hardware whenever no access is being made of a +device on a child bus. + +Example: + i2cmux { + compatible = "i2c-mux-gpio"; + #address-cells = <1>; + #size-cells = <0>; + mux-gpios = <&gpio1 22 0 &gpio1 23 0>; + i2c-parent = <&i2c1>; + + i2c at 1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + ssd1307: oled at 3c { + compatible = "solomon,ssd1307fb-i2c"; + reg = <0x3c>; + pwms = <&pwm 4 3000>; + reset-gpios = <&gpio2 7 1>; + reset-active-low; + }; + }; + + i2c at 3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + + pca9555: pca9555 at 20 { + compatible = "nxp,pca9555"; + gpio-controller; + #gpio-cells = <2>; + reg = <0x20>; + }; + }; + };
drivers/i2c/muxes/i2c-mux-gpio.c +130 -39
283 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 1/2 i2c: mux: Add dt support to i2c-mux-gpio driver
Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt line 30
Quoted 8 lines · Maxime Ripard
Allow the i2c-mux-gpio to be used by a device tree enabled device. The bindings are inspired by the one found in the i2c-mux-pinctrl driver.
+++
b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txtDocumentation/devicetree/bindings/i2c/i2c-mux-gpio.txt new file +3
-0+Optional properties: +- idle-state: value to set to the muxer when idle. When no value is + given, it defaults to the first value in the array.
That's inconsistent with the following text that appears later (and describes what the driver actually does):
Quoted 7 lines
Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt new file +7
-0+If an idle state is defined, using the idle-state (optional) property, +whenever an access is not being made to a device on a child bus, the +idle value will be programmed into the GPIOs. + +If an idle state is not defined, the most recently used value will be +left programmed into hardware whenever no access is being made of a +device on a child bus.
PATCH v4 1/2 i2c: mux: Add dt support to i2c-mux-gpio driver
Le 19/10/2012 00:36, Stephen Warren a ?crit :
Quoted 12 lines · Maxime Ripard
Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt line 30
Quoted 8 lines
Allow the i2c-mux-gpio to be used by a device tree enabled device. The bindings are inspired by the one found in the i2c-mux-pinctrl driver.
+++
b/Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txtDocumentation/devicetree/bindings/i2c/i2c-mux-gpio.txt new file +3
-0+Optional properties: +- idle-state: value to set to the muxer when idle. When no value is + given, it defaults to the first value in the array.That's inconsistent with the following text that appears later (and describes what the driver actually does):
Ah, right, sorry
Maxime
Signature · 4 lines
Maxime Ripard, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH v4 2/2 ARM: dts: cfa10049: Add the i2c muxer buses to the CFA-10049
In reply to Maxime RipardThis will allow to add the 3 Nuvoton NAU7802 ADCs and the NXP PCA9555 GPIO expander eventually.
--- arch/arm/boot/dts/imx28-cfa10049.dts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/boot/dts/imx28-cfa10049.dts +24 -0
@@ -76,6 +76,30 @@ status = "okay"; }; + i2cmux { + compatible = "i2c-mux-gpio"; + #address-cells = <1>; + #size-cells = <0>; + mux-gpios = <&gpio1 22 0 &gpio1 23 0>; + i2c-parent = <&i2c1>; + + i2c at 0 { + reg = <0>; + }; + + i2c at 1 { + reg = <1>; + }; + + i2c at 2 { + reg = <2>; + }; + + i2c at 3 { + reg = <3>; + }; + }; + usbphy1: usbphy at 8007e000 { status = "okay"; };
Signature · 1 line
1.7.9.5