Allwinner GPIO IRQ?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Allwinner GPIO IRQ?

Dustin Marquess
I'm trying to setup gpiopps on my Pine A64.  I managed to hack up the
device tree and that part seems to work, however I was getting:

gpiopps0: Pin cannot be configured for the requested signal edge

I noticed that sys/arm/allwinner/a10_gpio.c had:

#define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT |     \
    GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)

So I changed that to:

#define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT |     \
    GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN | GPIO_INTR_MASK)

That changed the error to:

gpiopps0: Cannot allocate an IRQ for the GPIO

And now I'm having problems finding a DEVMETHOD mapping for
bus_alloc_resource for the Allwinner gpios.  Am I right in guessing
that this code simply doesn't exist yet?

Thanks!
-Dustin
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Allwinner GPIO IRQ?

Ian Lepore-3
On Mon, 2017-07-31 at 15:38 -0500, Dustin Marquess wrote:

> I'm trying to setup gpiopps on my Pine A64.  I managed to hack up the
> device tree and that part seems to work, however I was getting:
>
> gpiopps0: Pin cannot be configured for the requested signal edge
>
> I noticed that sys/arm/allwinner/a10_gpio.c had:
>
> #define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT
> |     \
>     GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
>
> So I changed that to:
>
> #define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT
> |     \
>     GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN | GPIO_INTR_MASK)
>
> That changed the error to:
>
> gpiopps0: Cannot allocate an IRQ for the GPIO
>
> And now I'm having problems finding a DEVMETHOD mapping for
> bus_alloc_resource for the Allwinner gpios.  Am I right in guessing
> that this code simply doesn't exist yet?
>
> Thanks!
> -Dustin

It looks like you've got the right bottom line: aw gpio isn't ready to
support interrupts yet.  It's not because bus_alloc_resource is
missing, it's because the code just doesn't support being an interrupt
controller yet.  The methods missing are these (from imx_gpio.c):

        DEVMETHOD(pic_disable_intr, gpio_pic_disable_intr),
        DEVMETHOD(pic_enable_intr, gpio_pic_enable_intr),
        DEVMETHOD(pic_map_intr, gpio_pic_map_intr),
        DEVMETHOD(pic_setup_intr, gpio_pic_setup_intr),
        DEVMETHOD(pic_teardown_intr, gpio_pic_teardown_intr),
        DEVMETHOD(pic_post_filter, gpio_pic_post_filter),
        DEVMETHOD(pic_post_ithread, gpio_pic_post_ithread),
        DEVMETHOD(pic_pre_ithread, gpio_pic_pre_ithread),

From a quick glance at the docs, it looks like only 32 of the pins on
allwinner can be configured as interrupt sources, but it doesn't look
like our code is ready to do that at all (I don't see any pins in the
padconf tables that have "irq" as one of their choices).

-- Ian

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Allwinner GPIO IRQ?

Dustin Marquess
Ian,

Thanks for the confirmation!  I'm not exactly a kernel-level dev, so I
was just pretty much guessing and poking around :).

Thanks!
-Dustin

On Mon, Jul 31, 2017 at 4:45 PM, Ian Lepore <[hidden email]> wrote:

> On Mon, 2017-07-31 at 15:38 -0500, Dustin Marquess wrote:
>> I'm trying to setup gpiopps on my Pine A64.  I managed to hack up the
>> device tree and that part seems to work, however I was getting:
>>
>> gpiopps0: Pin cannot be configured for the requested signal edge
>>
>> I noticed that sys/arm/allwinner/a10_gpio.c had:
>>
>> #define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT
>> |     \
>>     GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
>>
>> So I changed that to:
>>
>> #define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT
>> |     \
>>     GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN | GPIO_INTR_MASK)
>>
>> That changed the error to:
>>
>> gpiopps0: Cannot allocate an IRQ for the GPIO
>>
>> And now I'm having problems finding a DEVMETHOD mapping for
>> bus_alloc_resource for the Allwinner gpios.  Am I right in guessing
>> that this code simply doesn't exist yet?
>>
>> Thanks!
>> -Dustin
>
> It looks like you've got the right bottom line: aw gpio isn't ready to
> support interrupts yet.  It's not because bus_alloc_resource is
> missing, it's because the code just doesn't support being an interrupt
> controller yet.  The methods missing are these (from imx_gpio.c):
>
>         DEVMETHOD(pic_disable_intr,     gpio_pic_disable_intr),
>         DEVMETHOD(pic_enable_intr,      gpio_pic_enable_intr),
>         DEVMETHOD(pic_map_intr,         gpio_pic_map_intr),
>         DEVMETHOD(pic_setup_intr,       gpio_pic_setup_intr),
>         DEVMETHOD(pic_teardown_intr,    gpio_pic_teardown_intr),
>         DEVMETHOD(pic_post_filter,      gpio_pic_post_filter),
>         DEVMETHOD(pic_post_ithread,     gpio_pic_post_ithread),
>         DEVMETHOD(pic_pre_ithread,      gpio_pic_pre_ithread),
>
> From a quick glance at the docs, it looks like only 32 of the pins on
> allwinner can be configured as interrupt sources, but it doesn't look
> like our code is ready to do that at all (I don't see any pins in the
> padconf tables that have "irq" as one of their choices).
>
> -- Ian
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Allwinner GPIO IRQ?

Emmanuel Vadot-7
On Mon, 31 Jul 2017 17:22:11 -0500
Dustin Marquess <[hidden email]> wrote:

> Ian,
>
> Thanks for the confirmation!  I'm not exactly a kernel-level dev, so I
> was just pretty much guessing and poking around :).
>
> Thanks!
> -Dustin
>

 As Ian said the controller driver doesn't support interrupts, this
would be easy to add but I have too much stuff to do so if someone want
to work on this I'll be very happy.

> On Mon, Jul 31, 2017 at 4:45 PM, Ian Lepore <[hidden email]> wrote:
> > On Mon, 2017-07-31 at 15:38 -0500, Dustin Marquess wrote:
> >> I'm trying to setup gpiopps on my Pine A64.  I managed to hack up the
> >> device tree and that part seems to work, however I was getting:
> >>
> >> gpiopps0: Pin cannot be configured for the requested signal edge
> >>
> >> I noticed that sys/arm/allwinner/a10_gpio.c had:
> >>
> >> #define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT
> >> |     \
> >>     GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)
> >>
> >> So I changed that to:
> >>
> >> #define A10_GPIO_DEFAULT_CAPS   (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT
> >> |     \
> >>     GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN | GPIO_INTR_MASK)
> >>
> >> That changed the error to:
> >>
> >> gpiopps0: Cannot allocate an IRQ for the GPIO
> >>
> >> And now I'm having problems finding a DEVMETHOD mapping for
> >> bus_alloc_resource for the Allwinner gpios.  Am I right in guessing
> >> that this code simply doesn't exist yet?
> >>
> >> Thanks!
> >> -Dustin
> >
> > It looks like you've got the right bottom line: aw gpio isn't ready to
> > support interrupts yet.  It's not because bus_alloc_resource is
> > missing, it's because the code just doesn't support being an interrupt
> > controller yet.  The methods missing are these (from imx_gpio.c):
> >
> >         DEVMETHOD(pic_disable_intr,     gpio_pic_disable_intr),
> >         DEVMETHOD(pic_enable_intr,      gpio_pic_enable_intr),
> >         DEVMETHOD(pic_map_intr,         gpio_pic_map_intr),
> >         DEVMETHOD(pic_setup_intr,       gpio_pic_setup_intr),
> >         DEVMETHOD(pic_teardown_intr,    gpio_pic_teardown_intr),
> >         DEVMETHOD(pic_post_filter,      gpio_pic_post_filter),
> >         DEVMETHOD(pic_post_ithread,     gpio_pic_post_ithread),
> >         DEVMETHOD(pic_pre_ithread,      gpio_pic_pre_ithread),
> >
> > From a quick glance at the docs, it looks like only 32 of the pins on
> > allwinner can be configured as interrupt sources, but it doesn't look
> > like our code is ready to do that at all (I don't see any pins in the
> > padconf tables that have "irq" as one of their choices).

 Yes, not all pins can be interrupts sources.
 I've added for most of the padconf information on which pins can do it
(see
https://svnweb.freebsd.org/base/head/sys/arm/allwinner/a20/a20_padconf.c?revision=310117&view=markup#l104
for example).
 They are named eint like in the datasheet and linux (so a dts that
would reference them on linux would work for us).

> > -- Ian
> >
> _______________________________________________
> [hidden email] mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "[hidden email]"


--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Allwinner GPIO IRQ?

Milan Obuch-16
On Tue, 1 Aug 2017 08:19:21 +0200
Emmanuel Vadot <[hidden email]> wrote:

> On Mon, 31 Jul 2017 17:22:11 -0500
> Dustin Marquess <[hidden email]> wrote:
>
> > Ian,
> >
> > Thanks for the confirmation!  I'm not exactly a kernel-level dev,
> > so I was just pretty much guessing and poking around :).
> >
> > Thanks!
> > -Dustin
> >  
>
>  As Ian said the controller driver doesn't support interrupts, this
> would be easy to add but I have too much stuff to do so if someone
> want to work on this I'll be very happy.
>

[ snip ]

I am interested in this, too, as I am just starting to try a gpiopps...

> > > From a quick glance at the docs, it looks like only 32 of the
> > > pins on allwinner can be configured as interrupt sources, but it
> > > doesn't look like our code is ready to do that at all (I don't
> > > see any pins in the padconf tables that have "irq" as one of
> > > their choices).  
>
>  Yes, not all pins can be interrupts sources.
>  I've added for most of the padconf information on which pins can do
> it (see
> https://svnweb.freebsd.org/base/head/sys/arm/allwinner/a20/a20_padconf.c?revision=310117&view=markup#l104
> for example).
>  They are named eint like in the datasheet and linux (so a dts that
> would reference them on linux would work for us).
>

From a quick glance over this file I see there are both PC19 and PH10
marked as eint12 - is it OK? Similarly PC20 and PH11, PC21 and PH12,
PC22 and PH13. Also, Pins PI10 to PI19 are marked with eint. I did not
try to read a datasheet, yet, so this could be dumb question, but
still, I would like to know the reason...

Anyway, as I am working with Orange Pi boards, I think this is not
relevant for me, I am looking in h3_padconf.c and h3_r_padconf.c, it
looks like all pins from PA, PG and PL blocks are usable as interrupt
source... and I see no such double usage here.

Regards,
Milan
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Allwinner GPIO IRQ?

Emmanuel Vadot-7
On Tue, 1 Aug 2017 12:50:24 +0200
Milan Obuch <[hidden email]> wrote:

> On Tue, 1 Aug 2017 08:19:21 +0200
> Emmanuel Vadot <[hidden email]> wrote:
>
> > On Mon, 31 Jul 2017 17:22:11 -0500
> > Dustin Marquess <[hidden email]> wrote:
> >
> > > Ian,
> > >
> > > Thanks for the confirmation!  I'm not exactly a kernel-level dev,
> > > so I was just pretty much guessing and poking around :).
> > >
> > > Thanks!
> > > -Dustin
> > >  
> >
> >  As Ian said the controller driver doesn't support interrupts, this
> > would be easy to add but I have too much stuff to do so if someone
> > want to work on this I'll be very happy.
> >
>
> [ snip ]
>
> I am interested in this, too, as I am just starting to try a gpiopps...
>
> > > > From a quick glance at the docs, it looks like only 32 of the
> > > > pins on allwinner can be configured as interrupt sources, but it
> > > > doesn't look like our code is ready to do that at all (I don't
> > > > see any pins in the padconf tables that have "irq" as one of
> > > > their choices).  
> >
> >  Yes, not all pins can be interrupts sources.
> >  I've added for most of the padconf information on which pins can do
> > it (see
> > https://svnweb.freebsd.org/base/head/sys/arm/allwinner/a20/a20_padconf.c?revision=310117&view=markup#l104
> > for example).
> >  They are named eint like in the datasheet and linux (so a dts that
> > would reference them on linux would work for us).
> >
>
> From a quick glance over this file I see there are both PC19 and PH10
> marked as eint12 - is it OK? Similarly PC20 and PH11, PC21 and PH12,
> PC22 and PH13. Also, Pins PI10 to PI19 are marked with eint. I did not
> try to read a datasheet, yet, so this could be dumb question, but
> still, I would like to know the reason...

 See http://dl.linux-sunxi.org/A20/A20%20User%20Manual%202013-03-22.pdf

 Multiple pins have the same function, depending on pinmuxing.
 I could have made a mistake (it happened before as I "parse" the
datasheet manually) but here it's correct :)

> Anyway, as I am working with Orange Pi boards, I think this is not
> relevant for me, I am looking in h3_padconf.c and h3_r_padconf.c, it
> looks like all pins from PA, PG and PL blocks are usable as interrupt
> source... and I see no such double usage here.
>
> Regards,
> Milan

 Different SoC, different pinmux setting :)

--
Emmanuel Vadot <[hidden email]> <[hidden email]>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[hidden email]"