FDT/OFW GPIO bus

Warner Losh imp at bsdimp.com
Fri Feb 7 03:22:01 UTC 2014


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

> Hello guys,
> 
> Last call for alcohol^Wtest and reviews.
> 
> I’ve finally managed to test these changes on a some FDT and non FDT systems, so now it is all cleared to commit.
> 
> 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)).
> 
> 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.
> 
> 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).
> 
> I used the RSPRO (MIPS/ar71xx) to check for regressions without any visible problem.
> 
> gpioiic(4) devices can be described in DTS as follow:
> 
>                gpio {
> 
>                        gpioiic {
>                                compatible = "gpioiic";

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

>                                gpios = <&gpio 17 2 0
>                                         &gpio 21 2 0>;
>                                scl = <0>;
>                                sda = <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 = <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 = "lm75";
>                                        i2c-address = <0x4b>;
>                                };
>                                lm751 {
>                                        compatible = "lm75";
>                                        i2c-address = <0x4f>;
>                                };
>                        };
> 		};
> 
> gpioled(4) devices can be described in two ways:
> 
> - directly under the GPIO controller node:
> 
>                gpio {
> 
>                        led0 {
>                                compatible = "gpioled";

cool.

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

This follows Linux convention, which is cool...

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

Cool.

> From 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.
> 
> 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
> 
> <001-ofw-gpiobus.diff><002-iicbb-ofw-iicbus.diff><003-ofw-gpio-man.diff><004-gpio-node.diff><005-bbb-gpioled.diff>_______________________________________________
> freebsd-embedded at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-embedded
> To unsubscribe, send any mail to "freebsd-embedded-unsubscribe at freebsd.org"



More information about the freebsd-arm mailing list