ARM: I2C: Add device tree bindings to i2c-mux-gpio
Subsystems (5)
v7 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 v6:
- Changed the return value when neither platform data nor dt was available
- Fix a sentence in the documentation
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 | 146 +++++++++++++++----- 3 files changed, 220 insertions(+), 31 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-mux-gpio.txt
Signature · 1 line
1.7.9.5
PATCH v7 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 | 146 +++++++++++++++----- 2 files changed, 196 insertions(+), 31 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 used 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 the muxer to when idle. When no value is + given, it defaults to the last value used. + +For each i2c child node, an I2C child bus will be created. They will +be numbered based on their order in the device tree. + +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 least-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 +GPIOs will be set according to the idle value. + +If an idle state is not defined, the most recently used value will be +left programmed into hardware whenever no access is being made to 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 +115 -31
230 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
Quoted 6 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.
Signed-off-by Maxime Ripard <[email protected]>Reviewed-by Stephen Warren <[email protected]>Acked-by Peter Korsgaard <[email protected]>
checkpatch found a whitespace error in line 115, please run it before submitting. Fixed that and pushed to for-next. Thanks.
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121116/e472467c/attachment.sig>
PATCH v7 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
PATCH 2/2 ARM: dts: cfa10049: Add the i2c muxer buses to the CFA-10049
Quoted 4 lines · Maxime Ripard
This will allow to add the 3 Nuvoton NAU7802 ADCs and the NXP PCA9555 GPIO expander eventually.
Signed-off-by Maxime Ripard <[email protected]>
Shawn, I pushed the needed code to my for-next now. So you could apply this patch for 3.8 or give an ack in case you want me to pick it via i2c.
Regards,
Wolfram
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121116/9c047769/attachment.sig>
PATCH 2/2 ARM: dts: cfa10049: Add the i2c muxer buses to the CFA-10049
Quoted 10 lines · Wolfram Sang
Quoted 4 lines · Maxime Ripard
This will allow to add the 3 Nuvoton NAU7802 ADCs and the NXP PCA9555 GPIO expander eventually.
Signed-off-by Maxime Ripard <[email protected]>Shawn, I pushed the needed code to my for-next now. So you could apply this patch for 3.8 or give an ack in case you want me to pick it via i2c.
I have already sent mxs 3.8 stuff to arm-soc, so please have it go via i2c tree. Thanks.
PATCH 2/2 ARM: dts: cfa10049: Add the i2c muxer buses to the CFA-10049
Quoted 7 lines · Shawn Guo
Quoted 6 lines · Wolfram Sang
Quoted 4 lines · Maxime Ripard
This will allow to add the 3 Nuvoton NAU7802 ADCs and the NXP PCA9555 GPIO expander eventually.
Signed-off-by Maxime Ripard <[email protected]>
Quoted 8 lines
Quoted 4 lines
Shawn, I pushed the needed code to my for-next now. So you could apply this patch for 3.8 or give an ack in case you want me to pick it via i2c.
I have already sent mxs 3.8 stuff to arm-soc, so please have it go via i2c tree. Thanks.
Acked-by Shawn Guo <[email protected]>
OK. Applied to my for-next, thanks!
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121116/a635c146/attachment.sig>