Help on modelling gpio interrupt source when interrupt is shared

Rajasekhar Pulluru pullururajasekhar at gmail.com
Mon Jan 23 10:46:45 EST 2017


Hi,

I have a query on device tree pertaining to modelling a gpio pin as an
interrupt source.
I have searched mailing list archives and kernel documentation before
posting this and couldn't get any direct solution.
(My understanding is limited and hence posting the query below:)

My SOC has a gpio controller and uart both sharing same interrupt line as
specified below.

interrupt-parent = <&gic>;

        mygpio: gpio at 0x19008000 {
                compatible = "mysoc,mygpio-controller,gc";
                #address-cells = <1>;
                #size-cells = <1>;
                #gpio-cells = <2>;
                reg = gpio: <0x19008000 0x50>;
                ngpios = <12>;
                pin-offset = <4>;
                pin-base = <4>;
                irq-base = <256>; /* sw irq base for irq handlers */
                gpio-controller;
                interrupt-controller;
                interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
        };

        uart0: serial at 0x19000300 {
                compatible = "snps,dw-apb-uart";
                reg = <0x19000300 0x100>;
                interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <62500000>;
        };

gpio pin 0 of mygpio is used as an interrupt source for detecting the
presence of external pluggable device (that is not driven by kernel).
And I intend to detect the presence of the pluggable device from user space
by means of generic uio platform driver using below device
tree configuration. (following
https://yurovsky.github.io/2014/10/10/linux-uio-gpio-interrupt/)

        user_io at 0 {
            compatible = "mydevice,generic-uio,ui_pdrv";
            status = "okay";
            interrupt-parent = <&mygpio>;
            interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
        };

Running modprobe uio_pdrv_genirq of_id="mydevice,generic-uio,ui_pdrv" and
creating /dev/uio0 using mknod (major number from cat /proc/devices | grep
uio),
I couldn't see an irq entry bind to uio driver under /proc/interrupts.
Am I doing anything wrong here?

Other method I have tried to get notified of the gpio pin0 interrupt in
user space is to poll on /sys/class/gpio/gpio0/value. But merely exporting
gpio0
wasn't sufficient as kernel should make a call to request_irq on the gpio0
interrupt line. Is there a generic driver framework (like pinctrl) that can
export
a device node to register the gpio pin0 as an interrupt source that allows
me to poll on its sysfs entry?

Thanks,
Rajasekhar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170123/b022adbc/attachment.html 


More information about the Kernelnewbies mailing list