Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Feb 2014 20:21:52 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Luiz Otavio O Souza <loos.br@gmail.com>
Cc:        freebsd-arm@freebsd.org, freebsd-embedded@freebsd.org
Subject:   Re: FDT/OFW GPIO bus
Message-ID:  <C8E49E48-F575-466F-8036-8E57CC025ADE@bsdimp.com>
In-Reply-To: <2D5F2707-FD55-46BB-A44F-8870B48E2BB1@gmail.com>
References:  <2D5F2707-FD55-46BB-A44F-8870B48E2BB1@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Feb 6, 2014, at 11:53 AM, Luiz Otavio O Souza wrote:

> Hello guys,
>=20
> Last call for alcohol^Wtest and reviews.
>=20
> I=92ve finally managed to test these changes on a some FDT and non FDT =
systems, so now it is all cleared to commit.
>=20
> I plan to commit these changes on the weekend unless someone objects.

This is cool.

> They add support to describe GPIO connections on the DTS files. It =
also add the support to the in tree GPIO devices (gpioiic(4), =
gpioled(4)).
>=20
> The last patch (005-bbb-gpioled.diff) sets the gpioled(4) for the 4 on =
board LEDs on BBB (beaglebone-black). The RPi led is already set and =
just need the first patch (001-ofw-gpiobus.diff) to work.
>=20
> The tests were done on RPi and BBB using I2C devices (two lm75 on the =
same bus), LEDs (for gpioled(4)) and even with some non committed =
ethernet over SPI. The I2C tests are conducted using the hardware I2C =
controller (when available) and also the software big bang controller - =
gpioiic(4).
>=20
> I used the RSPRO (MIPS/ar71xx) to check for regressions without any =
visible problem.
>=20
> gpioiic(4) devices can be described in DTS as follow:
>=20
>                gpio {
>=20
>                        gpioiic {
>                                compatible =3D "gpioiic";

Linux uses 'i2c-gpio' here. Can we follow that standard rather than =
invent our own? Or at least support both?

>                                gpios =3D <&gpio 17 2 0
>                                         &gpio 21 2 0>;
>                                scl =3D <0>;
>                                sda =3D <1>;

Linux doesn't have these at all, it seems, since they are implicit in =
the gpios property. It would be ideal if the scl and sda properties were =
optional...

In addition, you'll often see things like:

  i2c-gpio,sda-open-drain;
  i2c-gpio,scl-open-drain;
  i2c-gpio,delay-us =3D <2>;

as well. These should be easy enough to add and shouldn't gate things.

There's also many DTS files that don't have this as a direct child of =
gpio... But that's not strictly required. I'll cope with adding support =
for that when I get the Atmel stuff working...

>                                lm750 {
>                                        compatible =3D "lm75";
>                                        i2c-address =3D <0x4b>;
>                                };
>                                lm751 {
>                                        compatible =3D "lm75";
>                                        i2c-address =3D <0x4f>;
>                                };
>                        };
> 		};
>=20
> gpioled(4) devices can be described in two ways:
>=20
> - directly under the GPIO controller node:
>=20
>                gpio {
>=20
>                        led0 {
>                                compatible =3D "gpioled";

cool.

>                                gpios =3D <&gpio 16 2 0>;
>                                label =3D "ok";
>                        };
>=20
>                        led1 {
>                                compatible =3D "gpioled";
>                                gpios =3D <&gpio 17 2 0>;
>                                name =3D "user-led1";
>                        };
> 		};
>=20
> - Or under a single =93gpio-leds=94 node:

This follows Linux convention, which is cool...

>       leds {
>               compatible =3D "gpio-leds";
>=20
>               led1 {
>                       gpios =3D <&GPIO 53 2 0>;
>                       name =3D "led1";
>               };
>=20
>               led2 {
>                       gpios =3D <&GPIO 54 2 0>;
>                       name =3D "led2";
>               };
> 	};
>=20
>=20
> gpioiic(4) and gpioled(4) man pages were updated to cover FDT/OFW =
based systems.

Cool.

> =46rom the latest patchset (published on freebsd-arch@ and =
freebsd-arm@) i removed the check for disabled devices on DTS as this =
seems to indicate that the device needs special attention but should not =
be skipped at attach time.
>=20
> Please let me know if there are problems or concerns with the =
following changes.

I'll have to look at these in detail

> Thanks,
> Luiz
>=20
> =
<001-ofw-gpiobus.diff><002-iicbb-ofw-iicbus.diff><003-ofw-gpio-man.diff><0=
04-gpio-node.diff><005-bbb-gpioled.diff>__________________________________=
_____________
> freebsd-embedded@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-embedded
> To unsubscribe, send any mail to =
"freebsd-embedded-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C8E49E48-F575-466F-8036-8E57CC025ADE>