GPIO dynamic IRQ handling for AMlogic

Neil Armstrong narmstrong at baylibre.com
Mon Jul 18 00:56:16 PDT 2022


Hi Peter,

On 09/07/2022 22:14, Peter Höller wrote:
> Hi,
> 
> we are working on an Odroid C2 rev2 (S905 AMlogic) project for 3 years now.
> While upgrading to Kernel 5.16 we stumbled over the issue that there
> were only 8 static IRQ availabe for GPIO, so you get reduzed down to 4
> I/O-pins, if you use them with edge both, rising as well as falling -
> if you set up the IRQs for GPIO statically.
> 
> Referring to your post
> http://lists.infradead.org/pipermail/linux-amlogic/2020-July/007684.html
> from Neil Armstraong:
> <<
> The only available driver for GPIO interrupts is irq-meson-gpio and
> should be enough for most of your use-cases
> if you pass the GPIO interrupt as `interrupt = ` and `interrupt-parent
> =` as we do for the Ethernet PHY on some
> boards.
> 
>>>
> 
> we completely understand there is no out-of-the-box upstream
> compatibilty because you are loosing kernel's compatibilty for other
> boards. But as we are using our kernel only for odroidC2 only, we
> wondered how to customize it correctly:
> 
> So we need information as foollows please:
> 
> 1.) What are the IRQ-ranges availabe for GPIO of odroid C2 working
> with Kernel 5.16. Unfortunately, we cannot derive that information
> from anywhere else.

You can find those numbers in the S905 at [1] page 86, number is in the the "Input Mux Location" column.

> 
> 2.) we would be verry happy to get further syntax information about
> how exactly to implement the mentioned  'interrups =' and
> 'interrupt-parent =' in the DeviceTree with the correct IRQ-ranges.

The syntax is already in the Odroid C2 DTS at [2] and follows the standard interrupts DT syntax.

> and 3.) How to correctly declare/announce the GPIO-IRQs dynamically in
> the DeviceTree (syntax) and, if so, which corresponding syntax-changes
> are needed to be done where in the driver 'irq-meson-gpio' to make
> this finally work.

The only way to get an interrupt for a GPIO in Linux is via the GPIO to_irq() callback,
but unfortunately the HW design of the Amlogic SoC doesn't make it easy to translate any
GPIO to an interrupt because it only has 8 available GPIO interrupts in a separate HW block.

An implementation exists but it's not safe enough and feature-full to be accepted upstream.

Neil

> 
> with kind regards and many many thanks in advance
> 
> Peter
> 
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic


[1] https://dn.odroid.com/S905/DataSheet/S905_Public_Datasheet_V1.1.4.pdf
[2] https://github.com/torvalds/linux/blob/ff6992735ade75aae3e35d16b17da1008d753d28/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts#L246-L248



More information about the linux-amlogic mailing list