gpioiic FDT overlays for sun8i-h3

Nick Kostirya nikolay.kostirya at i11.co
Fri Dec 20 08:07:24 UTC 2019


On Thu, 19 Dec 2019 10:29:16 -0700
Ian Lepore <ian at freebsd.org> wrote:

 
> The gpioiic node needs to be defined at the root of the devicetree, not
> under the pinctrl node.  Assuming that all pins are configured as gpios
> by default (they are on most SOCs) you probably don't need a pinctrl
> node for them at all.  If you do, someone who knows allwinner stuff
> better than me would have to provide an example of that part.
> 
> To add the gpioiic driver node using pins 0 and 2 like your example, I
> think it should be just this:
> 
>    /dts-v1/;
>    /plugin/;
> 
>    / {
>        compatible = "allwinner,sun8i-h3";
>    };
> 
>    &{/} {
>        gpioiic at 0 {
>            compatible = "i2c-gpio";
>            scl-gpios =
>    <&pio 0 0 GPIO_ACTIVE_HIGH>;
>            sdl-gpios = <&pio 0 2
>    GPIO_ACTIVE_HIGH>;  
>    };
> 
> That should be enough to attach the i2c bus and the iic driver which
> will give you a /dev/iic# node for userland access to the bus.  If you
> want to add slave devices that have kernel drivers, they get added as
> child nodes within gpioiic at 0, like this:
> 
>    &{/} {
>        gpioiic at 0 {
>            compatible = "i2c-gpio";
>            scl-gpios = <&pio 0 0 GPIO_ACTIVE_HIGH>;
>            sdl-gpios = <&pio 0 2 GPIO_ACTIVE_HIGH>;
> 
>            eeprom at 50 {
>                compatible = "atmel,24c512";
>                reg = <0x50>;
>            };
>            rtc at 51 {
>                compatible="nxp,pcf2127";
>                reg = <0x51>;
>            };
>        };
>    };
> 
> -- Ian
> 

It is works!
Thank you very much!
Nick.


More information about the freebsd-arm mailing list