UIO to handle interrupts of LX2160A

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

UIO to handle interrupts of LX2160A

跳至解决方案
504 次查看
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 项奖励
1 解答
325 次查看
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 项奖励
2 回复数
219 次查看
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 项奖励
326 次查看
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 项奖励