How to register GPIO interrupt on LX2160A using LLDP Linux

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

How to register GPIO interrupt on LX2160A using LLDP Linux

491 Views
Taeyoon
Contributor I

Hi,

I’m working with the LX2160ARDB-rev2 and using LLDP Linux Distribution RevL6.1.22_2.0.0, but 5.15-rt Linux kernel. I need to register my GPIO interrupt handler in the LLDP Linux Distribution. I’m looking for guidance on how to properly register and manage a GPIO interrupt handler.

I’ve found that I can use `request_irq()` to register my own interrupt handler. However, I've also known that the IRQ number passed to `request_irq()` is a logical number managed by the kernel, and it is different from the GIC’s Interrupt ID (hwirq). I don't know how to get IRQ number from one specific GPIO pin.

According to the LX2160A Reference Manual, the Interrupt ID(hwirq) of GPIO module on the GIC is 68 for GPIO1 & GPIO2 ORed, and 69 for GPIO3 & GPIO4 ORed. It looks like the gpio-mpc8xxx.c file calls `devm_request_irq()` to register the mpc8xxx_gpio_irq_cascade handler, which in turn calls `generic_handle_domain_irq()` to handle individual GPIO pin interrupts. So, I would like to know how to register an interrupt handler for a single GPIO pin.

I want to use one GPIO pin in input mode to receive periodic interrupts from an external device and register a handler to process these interrupts. Based on the GPIO section in the LLDPUG_RevL6.1.22_2.0.0 documentation (section 7.5.23), it seems like I can use J29 on the LX2160ARDB board.

In conclusion,  I have a few questions:

  1. Device Tree Configuration: Do I need to add content to the device tree? If so, what should I add?
  2. Driver Development: Should I write a new device driver for the external device connected to J29 and register the handler with Linux, or should I modify gpio-mpc8xxx.c?
  3. Getting IRQ Number: If I need to write a new device driver, how do I obtain the IRQ number for `request_irq()`? For example, should I use gpio_to_irq()? How do I determine the PIN number to pass to `gpio_to_irq()`?

 

Best regards,

0 Kudos
Reply
2 Replies

443 Views
yipingwang
NXP TechSupport
NXP TechSupport

1. No need to add content in the dts file.

2. No need to modify gpio-mpc8xxx.c.

0 Kudos
Reply

300 Views
Taeyoon
Contributor I

Then, what Pin number I should use for linux GPIO APIs(e.g. gpio_request(), gpio_to_irq() etc..)?

0 Kudos
Reply