diff mbox

[3/3] sunxi: A20-OLinuXino-LIME2: Add i2c2 bus in DTS

Message ID 1458932647-24268-3-git-send-email-haas@computerlinguist.org (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Haas March 25, 2016, 7:04 p.m. UTC
The A20 processor provides a third I2C bus on pins PB20 and PB21.
The A20-OLinuXino-LIME2 exposes this bus via its GPIO1 port.

Olimex also provide a breakout board called the
A20-OLinuXino-LIME2-UEXT. This change is required to properly
support I2C on the UEXT connector found there.

Signed-off-by: Michael Haas <haas@computerlinguist.org>
---
 arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Iain Paton March 26, 2016, 12:48 a.m. UTC | #1
On 25/03/16 19:04, Michael Haas wrote:
> The A20 processor provides a third I2C bus on pins PB20 and PB21.
> The A20-OLinuXino-LIME2 exposes this bus via its GPIO1 port.
> 
> Olimex also provide a breakout board called the
> A20-OLinuXino-LIME2-UEXT. This change is required to properly
> support I2C on the UEXT connector found there.
> 
> Signed-off-by: Michael Haas <haas@computerlinguist.org>

Acked-by: Iain Paton <ipaton0@gmail.com>

This didn't go in originally simply because not everyone will have 
the breakout and they may want to use those pins for other things.
Maxime Ripard April 2, 2016, 10:34 a.m. UTC | #2
Hi,

On Fri, Mar 25, 2016 at 08:04:07PM +0100, Michael Haas wrote:
> The A20 processor provides a third I2C bus on pins PB20 and PB21.
> The A20-OLinuXino-LIME2 exposes this bus via its GPIO1 port.
> 
> Olimex also provide a breakout board called the
> A20-OLinuXino-LIME2-UEXT. This change is required to properly
> support I2C on the UEXT connector found there.
> 
> Signed-off-by: Michael Haas <haas@computerlinguist.org>

What are the other options on that pin? Is it something exclusively
dedicated to i2c on the pin headers and the documentation, or is
anyone free to use that pin for whatever he wishes?

Thanks,
Maxime
Priit Laes April 2, 2016, 2:42 p.m. UTC | #3
On Sat, 2016-04-02 at 12:34 +0200, Maxime Ripard wrote:
> Hi,
> 
> On Fri, Mar 25, 2016 at 08:04:07PM +0100, Michael Haas wrote:
> > 
> > The A20 processor provides a third I2C bus on pins PB20 and PB21.
> > The A20-OLinuXino-LIME2 exposes this bus via its GPIO1 port.
> > 
> > Olimex also provide a breakout board called the
> > A20-OLinuXino-LIME2-UEXT. This change is required to properly
> > support I2C on the UEXT connector found there.

Documentation for Olimex UEXT interface:
https://www.olimex.com/Products/Modules/UEXT/resources/UEXT_rev_B.pdf

Basically it *should* by default work as a board to board connector
which supports three serial communication interfaces: I2C, SPI and UART
(original document mentions RS232, but official modules work only with
3.3V logic levels).

> > 
> > Signed-off-by: Michael Haas <haas@computerlinguist.org>
> What are the other options on that pin? Is it something exclusively
> dedicated to i2c on the pin headers and the documentation, or is
> anyone free to use that pin for whatever he wishes?
> 
> Thanks,
> Maxime
> 
> -- 
> Maxime Ripard, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
>
Michael Haas April 2, 2016, 4:21 p.m. UTC | #4
Hello Maxime,

thank you for taking the time to review this patch set.

On 04/02/2016 12:34 PM, Maxime Ripard wrote:
> Hi,
>
> On Fri, Mar 25, 2016 at 08:04:07PM +0100, Michael Haas wrote:
>> The A20 processor provides a third I2C bus on pins PB20 and PB21.
>> The A20-OLinuXino-LIME2 exposes this bus via its GPIO1 port.
>>
>> Olimex also provide a breakout board called the
>> A20-OLinuXino-LIME2-UEXT. This change is required to properly
>> support I2C on the UEXT connector found there.
>>
>> Signed-off-by: Michael Haas <haas@computerlinguist.org>
>
> What are the other options on that pin? Is it something exclusively
> dedicated to i2c on the pin headers and the documentation, or is
> anyone free to use that pin for whatever he wishes?
>
> Thanks,
> Maxime

I assume you are talking about the UEXT connector, not about PB20 and
PB21. These are regular GPIO pins multiplexed with I2C, but no other
function.

Regarding UEXT: the A20-OLinuXino-LIME2-UEXT breakout board supports two
use cases here.

The first one: provide a simple adapter from the 0.05" pin headers on
the olinuxino to the more common world of 0.1" headers. In this use
case, you can plug the A20-OLinuXino-LIME2-UEXT intoany of LCD_CON or
GIO-{1,2,3} and you're good to go.

The second one: here, you want to use UEXT modules provided by Olimex.
It's a simple connector exposing I2C, SPI and UART as mentioned by
Priit. To use UEXT, you have to use GPIO-1 to get the correct pin mapping.

Regarding the official documentation provided by Olimex. The
A20-OLinuXino-Lime2_Rev_c.pdf shows the pins on GPIO-1 as PB20 and PB21.
In the schematics for the breakout board,
A20-OLinuXino-Lime2-UEXT_sch.pdf, the pins for the UEXT connector are
labeled as PB20/SCK and PB21/SDA. This acknowledges the double use.
However, PB20 and PB21 have pull-ups by default according to
A20-OLinuXino-Lime2_Rev_c.pdf,
which makes them a lot more useful as I2C than as GPIO.

What originally prompted me to submit this patch: I bought a breakout
board and a small LCD with UEXT connector together with my board. Then I
found out that it doesn't work out of the box because i2c2 is not
enabled. Since using UEXT is probably common for that particular
vendor, I believe it should be enabled by default.

Michael
Maxime Ripard April 10, 2016, 10:32 a.m. UTC | #5
Hi Michael,

On Sat, Apr 02, 2016 at 06:21:17PM +0200, Michael Haas wrote:
> Hello Maxime,
> 
> thank you for taking the time to review this patch set.
> 
> On 04/02/2016 12:34 PM, Maxime Ripard wrote:
> > Hi,
> >
> > On Fri, Mar 25, 2016 at 08:04:07PM +0100, Michael Haas wrote:
> >> The A20 processor provides a third I2C bus on pins PB20 and PB21.
> >> The A20-OLinuXino-LIME2 exposes this bus via its GPIO1 port.
> >>
> >> Olimex also provide a breakout board called the
> >> A20-OLinuXino-LIME2-UEXT. This change is required to properly
> >> support I2C on the UEXT connector found there.
> >>
> >> Signed-off-by: Michael Haas <haas@computerlinguist.org>
> >
> > What are the other options on that pin? Is it something exclusively
> > dedicated to i2c on the pin headers and the documentation, or is
> > anyone free to use that pin for whatever he wishes?
> >
> > Thanks,
> > Maxime
> 
> I assume you are talking about the UEXT connector, not about PB20 and
> PB21. These are regular GPIO pins multiplexed with I2C, but no other
> function.
> 
> Regarding UEXT: the A20-OLinuXino-LIME2-UEXT breakout board supports two
> use cases here.
> 
> The first one: provide a simple adapter from the 0.05" pin headers on
> the olinuxino to the more common world of 0.1" headers. In this use
> case, you can plug the A20-OLinuXino-LIME2-UEXT intoany of LCD_CON or
> GIO-{1,2,3} and you're good to go.
> 
> The second one: here, you want to use UEXT modules provided by Olimex.
> It's a simple connector exposing I2C, SPI and UART as mentioned by
> Priit. To use UEXT, you have to use GPIO-1 to get the correct pin mapping.
> 
> Regarding the official documentation provided by Olimex. The
> A20-OLinuXino-Lime2_Rev_c.pdf shows the pins on GPIO-1 as PB20 and PB21.
> In the schematics for the breakout board,
> A20-OLinuXino-Lime2-UEXT_sch.pdf, the pins for the UEXT connector are
> labeled as PB20/SCK and PB21/SDA. This acknowledges the double use.
> However, PB20 and PB21 have pull-ups by default according to
> A20-OLinuXino-Lime2_Rev_c.pdf,
> which makes them a lot more useful as I2C than as GPIO.

Thanks for the explanation.

> What originally prompted me to submit this patch: I bought a breakout
> board and a small LCD with UEXT connector together with my board. Then I
> found out that it doesn't work out of the box because i2c2 is not
> enabled. Since using UEXT is probably common for that particular
> vendor, I believe it should be enabled by default.

Unfortunately, if it isn't present on the main board, it shouldn't be
in the DT for that board. Otherwise, people relying on these pins and
not using the UEXT connector would be force fed a configuration that
they don't want, without any way to remove it.

That kind of adjustements is a perfect use case for the overlays
though, so I'd rather suggest writing one for the UEXT connector.

Thanks!
Maxime
diff mbox

Patch

diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
index d370166..17791ef 100644
--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
+++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts
@@ -179,6 +179,12 @@ 
 	};
 };
 
+&i2c2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c2_pins_a>;
+	status = "okay";
+};
+
 &mmc0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;