Skip to contentSkip to conversation

ARM: dts: imx23-olinuxino: Add i2c support

PATCH New Harald Geyer 3 participants 8 messages Apr 8, 2015 – Apr 10, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

The imx23-olinuxino board has an i2c interface exposed on UEXT connector. This patch provides the necessary devicetree code.
Tested with MOD-LCD1x9 from Olimex.

This patch is based on work by Fadil Berisha with his permission. However all bugs are mine.

---
 arch/arm/boot/dts/imx23-olinuxino.dts |    6 +++++
 arch/arm/boot/dts/imx23.dtsi          |   40 ++++++++++++++++++++++++++++++++-
 2 files changed, 45 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx23-olinuxino.dts +6 -0
index 7e6eef2..85718df 100644
@@ -73,6 +73,12 @@
 				status = "okay";
 			};
 
+			i2c: i2c at 80058000 {
+				pinctrl-names = "default";
+				pinctrl-0 = <&i2c_pins_b>;
+				status = "okay";
+			};
+
 			duart: serial at 80070000 {
 				pinctrl-names = "default";
 				pinctrl-0 = <&duart_pins_a>;
arch/arm/boot/dts/imx23.dtsi +39 -1
index bbcfb5a..c892d58 100644
@@ -308,6 +308,39 @@
 					fsl,voltage = <MXS_VOLTAGE_HIGH>;
 					fsl,pull-up = <MXS_PULL_ENABLE>;
 				};
+
+				i2c_pins_a: i2c at 0 {
+					reg = <0>;
+					fsl,pinmux-ids = <
+						MX23_PAD_I2C_SCL__I2C_SCL
+						MX23_PAD_I2C_SDA__I2C_SDA
+					>;
+					fsl,drive-strength = <MXS_DRIVE_8mA>;
+					fsl,voltage = <MXS_VOLTAGE_HIGH>;
+					fsl,pull-up = <MXS_PULL_ENABLE>;
+				};
+
+				i2c_pins_b: i2c at 1 {
+					reg = <1>;
+					fsl,pinmux-ids = <
+						MX23_PAD_LCD_ENABLE__I2C_SCL
+						MX23_PAD_LCD_HSYNC__I2C_SDA
+					>;
+					fsl,drive-strength = <MXS_DRIVE_8mA>;
+					fsl,voltage = <MXS_VOLTAGE_HIGH>;
+					fsl,pull-up = <MXS_PULL_ENABLE>;
+				};
+
+				i2c_pins_c: i2c at 2 {
+					reg = <2>;
+					fsl,pinmux-ids = <
+						MX23_PAD_SSP1_DATA1__I2C_SCL
+						MX23_PAD_SSP1_DATA2__I2C_SDA
+					>;
+					fsl,drive-strength = <MXS_DRIVE_8mA>;
+					fsl,voltage = <MXS_VOLTAGE_HIGH>;
+					fsl,pull-up = <MXS_PULL_ENABLE>;
+				};
 			};
 
 			digctl at 8001c000 {
@@ -444,8 +477,13 @@
 				status = "disabled";
 			};
 
-			i2c at 80058000 {
+			i2c: i2c at 80058000 {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "fsl,imx23-i2c";
 				reg = <0x80058000 0x2000>;
+				interrupts = <27>;
+				clock-frequency = <100000>;
 				dmas = <&dma_apbx 3>;
 				dma-names = "rx-tx";
 				status = "disabled";
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

Hi Harald,

[ add devicetree mailinglist ]

Quoted 4 lines

Harald Geyer <[email protected]> hat am 8. April 2015 um 19:45 geschrieben:

The imx23-olinuxino board has an i2c interface exposed on UEXT connector.

AFAIK the iMX233-OLinuXino-MICRO don't have a UEXT connector. Maybe we reached the point
to make dts files for every Olinuxino board. In that case we could also handle the USB Host / Peripherial issue.

Quoted 42 lines

This patch provides the necessary devicetree code. Tested with MOD-LCD1x9 from Olimex.

This patch is based on work by Fadil Berisha with his permission. However all bugs are mine.

---
arch/arm/boot/dts/imx23-olinuxino.dts | 6 +++++ arch/arm/boot/dts/imx23.dtsi | 40 ++++++++++++++++++++++++++++++++-

2 files changed, 45 insertions(+), 1 deletion(-)

[...]

arch/arm/boot/dts/imx23.dtsi +23 -0
@@ -308,6 +308,39 @@
 fsl,voltage = <MXS_VOLTAGE_HIGH>;
 fsl,pull-up = <MXS_PULL_ENABLE>;
 };
+
+ i2c_pins_a: i2c at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX23_PAD_I2C_SCL__I2C_SCL
+ MX23_PAD_I2C_SDA__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+
+ i2c_pins_b: i2c at 1 {
+ reg = <1>;
+ fsl,pinmux-ids = <
+ MX23_PAD_LCD_ENABLE__I2C_SCL
+ MX23_PAD_LCD_HSYNC__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+

arch/arm/boot/dts/imx23.dtsi line 343

Quoted 10 lines
arch/arm/boot/dts/imx23.dtsi +10 -0
+ i2c_pins_c: i2c at 2 {
+ reg = <2>;
+ fsl,pinmux-ids = <
+ MX23_PAD_SSP1_DATA1__I2C_SCL
+ MX23_PAD_SSP1_DATA2__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };

Please add only i2c_pins_b because this pin muxing is the only used one.

Thanks Stefan

#2 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

Hi Stefan!

Quoted 9 lines · Stefan Wahren

Hi Harald,

[ add devicetree mailinglist ]

Quoted 5 lines

Harald Geyer <[email protected]> hat am 8. April 2015 um 19:45 geschrieben:

The imx23-olinuxino board has an i2c interface exposed on UEXT

connector.

Quoted 2 lines

AFAIK the iMX233-OLinuXino-MICRO don't have a UEXT connector.

Yes, but I don't think having default i2c pins there would be a bad thing.

Quoted 2 lines

Maybe we reached the point to make dts files for every Olinuxino board. In that case we could also handle the USB Host / Peripherial issue.

Yes, I'm thinking in this direction. But even if peripherial mode works on micro/nano (which I haven't been able to confirm yet) that doesn't mean that it should be set in the default device tree. After all Olimex themself
advertise the port as host.

Quoted 4 lines
Quoted 4 lines

This patch provides the necessary devicetree code. Tested with MOD-LCD1x9 from Olimex.

This patch is based on work by Fadil Berisha with his permission.

However

Quoted 42 lines
Quoted 42 lines

all bugs are mine.

---
arch/arm/boot/dts/imx23-olinuxino.dts | 6 +++++ arch/arm/boot/dts/imx23.dtsi | 40 ++++++++++++++++++++++++++++++++-

2 files changed, 45 insertions(+), 1 deletion(-)

[...]

arch/arm/boot/dts/imx23.dtsi +27 -0
@@ -308,6 +308,39 @@
 fsl,voltage = <MXS_VOLTAGE_HIGH>;
 fsl,pull-up = <MXS_PULL_ENABLE>;
 };
+
+ i2c_pins_a: i2c at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX23_PAD_I2C_SCL__I2C_SCL
+ MX23_PAD_I2C_SDA__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+
+ i2c_pins_b: i2c at 1 {
+ reg = <1>;
+ fsl,pinmux-ids = <
+ MX23_PAD_LCD_ENABLE__I2C_SCL
+ MX23_PAD_LCD_HSYNC__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+
+ i2c_pins_c: i2c at 2 {
+ reg = <2>;
+ fsl,pinmux-ids = <
+ MX23_PAD_SSP1_DATA1__I2C_SCL
Quoted 8 lines

arch/arm/boot/dts/imx23.dtsi line 343

Quoted 6 lines
arch/arm/boot/dts/imx23.dtsi +6 -0
+ MX23_PAD_SSP1_DATA2__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };

Please add only i2c_pins_b because this pin muxing is the only used one.

I disagree: Having all possible i2c pin groups documented in devicetree is a good thing. Also imx23.dtsi is more general then olinuxino - somebody might produce a imx23 based board where one of the other pin groups makes more sense to use. Well, even on olinuxino somebody might use i2c_pins_a if they don't need an UART, but use an LCD.

Thanks,
Harald

#3 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

Hi Harald,

Quoted 54 lines
Quoted 4 lines
Quoted 4 lines

This patch provides the necessary devicetree code. Tested with MOD-LCD1x9 from Olimex.

This patch is based on work by Fadil Berisha with his permission.

However

Quoted 41 lines
Quoted 41 lines

all bugs are mine.

---
arch/arm/boot/dts/imx23-olinuxino.dts | 6 +++++ arch/arm/boot/dts/imx23.dtsi | 40 ++++++++++++++++++++++++++++++++-

2 files changed, 45 insertions(+), 1 deletion(-)

[...]

arch/arm/boot/dts/imx23.dtsi +26 -0
@@ -308,6 +308,39 @@
 fsl,voltage = <MXS_VOLTAGE_HIGH>;
 fsl,pull-up = <MXS_PULL_ENABLE>;
 };
+
+ i2c_pins_a: i2c at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX23_PAD_I2C_SCL__I2C_SCL
+ MX23_PAD_I2C_SDA__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+
+ i2c_pins_b: i2c at 1 {
+ reg = <1>;
+ fsl,pinmux-ids = <
+ MX23_PAD_LCD_ENABLE__I2C_SCL
+ MX23_PAD_LCD_HSYNC__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+
+ i2c_pins_c: i2c at 2 {
+ reg = <2>;
+ fsl,pinmux-ids = <
Quoted 8 lines

arch/arm/boot/dts/imx23.dtsi line 343

Quoted 7 lines
arch/arm/boot/dts/imx23.dtsi +7 -0
+ MX23_PAD_SSP1_DATA1__I2C_SCL
+ MX23_PAD_SSP1_DATA2__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };

Please add only i2c_pins_b because this pin muxing is the only used one.

Quoted 5 lines

I disagree: Having all possible i2c pin groups documented in devicetree is a good thing. Also imx23.dtsi is more general then olinuxino - somebody might produce a imx23 based board where one of the other pin groups makes more sense to use. Well, even on olinuxino somebody might use i2c_pins_a if they don't need an UART, but use an LCD.

Sure. But this 2 additional muxes have nothing to do with adding i2c support to olinuxino and should be a separate patch. In case of a revert of this patch the other i.MX23 boards are also affected. So i think it should be a separate patch.

Btw i read that Shawn only want used muxes [1].

[1] -
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-August/115779.html

Quoted 2 lines

Thanks,
Harald

#4 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

Hi Stefan!

Quoted 56 lines · Stefan Wahren

Hi Harald,

Quoted 54 lines
Quoted 4 lines
Quoted 4 lines

This patch provides the necessary devicetree code. Tested with MOD-LCD1x9 from Olimex.

This patch is based on work by Fadil Berisha with his permission.

However

Quoted 49 lines
Quoted 38 lines

all bugs are mine.

---
arch/arm/boot/dts/imx23-olinuxino.dts | 6 +++++ arch/arm/boot/dts/imx23.dtsi | 40 ++++++++++++++++++++++++++++++++-

2 files changed, 45 insertions(+), 1 deletion(-)

[...]

arch/arm/boot/dts/imx23.dtsi +23 -0
@@ -308,6 +308,39 @@
 fsl,voltage = <MXS_VOLTAGE_HIGH>;
 fsl,pull-up = <MXS_PULL_ENABLE>;
 };
+
+ i2c_pins_a: i2c at 0 {
+ reg = <0>;
+ fsl,pinmux-ids = <
+ MX23_PAD_I2C_SCL__I2C_SCL
+ MX23_PAD_I2C_SDA__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+
+ i2c_pins_b: i2c at 1 {
+ reg = <1>;
+ fsl,pinmux-ids = <
+ MX23_PAD_LCD_ENABLE__I2C_SCL
+ MX23_PAD_LCD_HSYNC__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };
+

arch/arm/boot/dts/imx23.dtsi line 343

Quoted 10 lines
arch/arm/boot/dts/imx23.dtsi +10 -0
+ i2c_pins_c: i2c at 2 {
+ reg = <2>;
+ fsl,pinmux-ids = <
+ MX23_PAD_SSP1_DATA1__I2C_SCL
+ MX23_PAD_SSP1_DATA2__I2C_SDA
+ >;
+ fsl,drive-strength = <MXS_DRIVE_8mA>;
+ fsl,voltage = <MXS_VOLTAGE_HIGH>;
+ fsl,pull-up = <MXS_PULL_ENABLE>;
+ };

Please add only i2c_pins_b because this pin muxing is the only used

one.

Quoted 4 lines
Quoted 4 lines

I disagree: Having all possible i2c pin groups documented in devicetree is
a good thing. Also imx23.dtsi is more general then olinuxino - somebody might produce a imx23 based board where one of the other pin groups

makes

Quoted 1 line
Quoted 1 line

more sense to use. Well, even on olinuxino somebody might use

i2c_pins_a

Quoted 6 lines
Quoted 1 line

if they don't need an UART, but use an LCD.

Sure. But this 2 additional muxes have nothing to do with adding i2c support to olinuxino and should be a separate patch. In case of a revert of this patch the other i.MX23 boards are also affected. So i think it should be a separate patch.

If it is prefered, I will split the changes to imx23.dtsi and imx23-olinuxino.dts into two patches.

Quoted 4 lines

Btw i read that Shawn only want used muxes [1].

[1] -

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-August/115779.html

If that is an issue, then I'll just test all three pin groups on my olinuxino
board. After all it would be really awkward to have only one pin group and that
one is labeled "i2c_pins_b" ...

Thanks,
Harald

#5 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

Hi Harald,

Quoted 12 lines

harald at ccbib.org hat am 9. April 2015 um 15:03 geschrieben:

Hi Stefan!

Quoted 4 lines · Stefan Wahren

Btw i read that Shawn only want used muxes [1].

[1] -

Quoted 7 lines

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-August/115779.html

If that is an issue, then I'll just test all three pin groups on my olinuxino
board. After all it would be really awkward to have only one pin group and that
one is labeled "i2c_pins_b" ...

from my understanding you are free about the labels. So you could rename it to "i2c_pins_a" and change the other pin groups.

Quoted 3 lines

Thanks,
Harald

Stefan

#6 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

Quoted 9 lines · Stefan Wahren
Quoted 9 lines
Quoted 4 lines · Stefan Wahren

Btw i read that Shawn only want used muxes [1].

[1] -

http://lists.infradead.org/pipermail/linux-arm-kernel/2012-August/115779.html

Quoted 8 lines
Quoted 5 lines

If that is an issue, then I'll just test all three pin groups on my olinuxino
board. After all it would be really awkward to have only one pin group and that
one is labeled "i2c_pins_b" ...

from my understanding you are free about the labels. So you could rename it to "i2c_pins_a" and change the other pin groups.

Theoretically yes, but there are two reasons not to do that:
1) When Fadil Berisha chose the labels he didn't do so arbitrarily. The labels make sense the way the pinmux table is organised in the datasheet. (otherwise he sure would have chosen "i2c_pins_a" for the default pin group on olinuxino).
2) The labels are in use for about two years now by a lot of people. (Yes it really takes that long to have this merged.) I would hate to break their setups for no strong reason.

Harald

reviewer
#7 lore raw

PATCH 1/1 ARM: dts: imx23-olinuxino: Add i2c support

In reply to Stefan Wahren

Hi Stefan,

Quoted 4 lines · Stefan Wahren

AFAIK the iMX233-OLinuXino-MICRO don't have a UEXT connector. Maybe we reached the point
to make dts files for every Olinuxino board. In that case we could also handle the USB Host / Peripherial issue.

Yes, I agree. it would be better to split the dts files for the olinuxino variants.

Regards,

Fabio Estevam