UIO to handle interrupts of LX2160A

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UIO to handle interrupts of LX2160A

Jump to solution
485 Views
SWETHA1
Contributor I

Hi Team,

We are working with LX2160A processor and using LSDK 20.04 with linux 5.4RT. We have connected the alert pins of  INA237 Sensors to IRQ pin of LX2160A. Here we need to poll this interrupt from userspace application. So we decided to use UIO. But /dev/ui0 file is not created.

We have made the following kernel config changes

CONFIG_UIO=m
CONFIG_UIO_PDRV_GENIRQ=m

And added device tree entry as:

user_io@0 {
compatible = "mydevice,generic-uio,ui_pdrv";
status = "okay";
interrupt-parent = <&gpio3>;
interrupts = <15 IRQ_TYPE_EDGE_RISING>;
};

 

We need help to resolve this issue. Please share your inputs.

0 Kudos
1 Solution
306 Views
Glencheck
Contributor I

I know that I might be late to answer this question, but here you go.

It seems like the GPIO chip driver and the HW itself only supports two type of IRQ type(IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_EDGE_BOTH).

(Picture below is code of linux driver for GPIO chip on LX2160A, drivers/gpio/gpio-mpc8xxx.c)

Glencheck_0-1703637862314.png

For HW, I'm not sure I'm allowed to share the screenshot from LX2160A reference manual.
Check description on GPIO interrupt maks register, Chapter 20 General Purpose I/O.

As you set the IRQ type to IRQ_TYPE_EDGE_RISING, the driver code returns -EINVAL which makes UIO driver unable to get interrupt.
So UIO driver fails to probe and that's why you don't get a /dev/uio0.

Also before all of these, you need to change default RCW(Reset Control Word) binary to pin-mux that PIN(GPIO3_15 in this case) to GPIO.
Because it was not muxed to GPIO at default RCW last time I checked.

View solution in original post

0 Kudos
2 Replies
200 Views
SWETHA1
Contributor I


Hi,
The /dev/uio file is created and the DT entry as

INA237_NPU_48V@5 {
compatible = "mydevice,generic-uio,ui_pdrv";
status = "okay";
interrupt-parent = <0x;
interrupts = <0x05 0x02>;
};

And interrupts are generated when probed the GPIO pin and when value is checked when exported the GPIO pin.

But when I sample test with the application,I cannot get the interrupts notification when Interrupt is raised and cleared.

Also tried with the sample code provided here https://www.kernel.org/doc/html/latest/driver-api/uio-howto.html#how-uio-works
Could you add your suggestions on this and help me fix the issue

0 Kudos
307 Views
Glencheck
Contributor I

I know that I might be late to answer this question, but here you go.

It seems like the GPIO chip driver and the HW itself only supports two type of IRQ type(IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_EDGE_BOTH).

(Picture below is code of linux driver for GPIO chip on LX2160A, drivers/gpio/gpio-mpc8xxx.c)

Glencheck_0-1703637862314.png

For HW, I'm not sure I'm allowed to share the screenshot from LX2160A reference manual.
Check description on GPIO interrupt maks register, Chapter 20 General Purpose I/O.

As you set the IRQ type to IRQ_TYPE_EDGE_RISING, the driver code returns -EINVAL which makes UIO driver unable to get interrupt.
So UIO driver fails to probe and that's why you don't get a /dev/uio0.

Also before all of these, you need to change default RCW(Reset Control Word) binary to pin-mux that PIN(GPIO3_15 in this case) to GPIO.
Because it was not muxed to GPIO at default RCW last time I checked.

0 Kudos