GPIO implementation Bananapi m2 ultra

41 views
Skip to first unread message

mcabal...@gmail.com

unread,
May 4, 2019, 1:34:28 AM5/4/19
to linux-sunxi
Hi all, this is my first post, I have a question about dts implementation for my BananaPi m2 ultra. I was looking for hints in previous posts, and other places, with no luck. Sorry if it´s a begginer question.

I´m trying to modify my dts file to add support for GPIO (no through gpio-leds, direct GPIO support). My scenario is:

HW: BananaPi-m2-ultra
O.S.: Armbian.
kernel version: 4.19.36-sunxi

I added a child node to the standard pinctrl descrpition:

    pio: pinctrl@1c20800 {
               compatible = "allwinner,sun8i-r40-pinctrl";
               reg = <0x1c20800 0x400>;
               interrupts = <0x0 0x1c 0x4>;
               clocks = <0x7 0x4f 0x2 0x4>;
               clock-names = "apb", "hosc", "losc";
               gpio-controller;
               interrupt-controller;
               #interrupt-cells = <0x3>;
               #gpio-cells = <0x3>;
               pinctrl-names = "default";
               pinctrl-0 = <0x13>;
               phandle = >0xd>;

               clk-out-a-pin {
                   pins = "PI12";
                   function = "clk_out_a";
                   drive = <0x0>;
                   pull = <0x0>;
                   phandle = <0x13>;
               };

               /* A lot of child node */

               /* My child node */
               myCustomOutput {
                   allwinner,pins = "PH3";
                   allwinner,function = "myOutput";
                   allwinner,drive = "1"; /* 20mA capable output */
               };
           }; /* End of pio */

So, when I want to implement the client node for myCustomOutputs I don't figure what the value for compatible property must to be.

At root level, I want to write:

    myOutput {
        compatible = "?????"; /* What value must be here */
        gpios = <0x7 0x3 GPIO_ACTIVE_HIGH>;
    };

Could please somebody point me in the right direction?    

Thanks in advance!

Mariano

Ondřej Jirman

unread,
May 5, 2019, 3:38:11 PM5/5/19
to mcabal...@gmail.com, linux-sunxi
Hi,

On Fri, May 03, 2019 at 09:41:23AM -0700, mcabal...@gmail.com wrote:
> Hi all, this is my first post, I have a question about dts implementation
> for my BananaPi m2 ultra. I was looking for hints in previous posts, and
> other places, with no luck. Sorry if it´s a begginer question.
>
> I´m trying to modify my dts file to add support for GPIO (no through
> gpio-leds, direct GPIO support). My scenario is:

It's not clear if you want to use GPIO from userspace or from the kernel.

Here's some info on how to access GPIO from userspace:

http://linux-sunxi.org/GPIO

regards,
o.
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

MH C

unread,
May 7, 2019, 12:21:07 PM5/7/19
to Mariano Hernan Caballero, linux-sunxi

Hi Ondřej, many thanks for your reply. You are right, I was not clear enough.


My final aim is to write an own driver to manage 4 GPIO inputs + 4 GPIO outputs in a very specific way (including interrupt in falling edge of inputs), so in the end of the road, I´m thinking about to access these pins from the user space, but through my own char device driver, so I will work in kernel and user spaces.


It´s my first time with an embedded running over an O.S. so I thought it would be a good idea to play for a while with GPIOs before to face the big problem.


I will check documentation that you suggested me.


One more time, thank you very much.


--
Mariano H. Caballero
Reply all
Reply to author
Forward
0 new messages