Application: We want to use GPIOs with rising & falling edge interrupt on M7.
It works when we halt uboot and run M7 binary. But when we boot with linux, Linux kernel panics.
So, we have disable unused and conflicting GPIOs from Device Tree. But the problem still occures. (Note: We cannot block whole “&gpio” node in device tree, as other hardware peripherals are using some gpio pins. some with interrupt and some without interrupt.)
Then we have used RDC with RDC_SEMA42 to temporary lock GPIO Port access on Linux.
Now, what happens is that, when interrupt gets from specific pins, M7 and A53 both calls IRQ. As a result, Linux kernel panics beacause we have blocked GPIO Port access from RDC. Linux Terminal Output is as follows:
Can we use GPIO pins as interrupt on M7?(It is possible, but I want to know it is advisable or not because A53 is also using IRQ and it will conflict if both will try to access IRQ Register at a same time.)
Do I have to make any changes to Linux Kernel Source Code to make it work?
Since I am using RDC as semaphone, do I have to configure Linux Source to make RDC (as semaphone) work properly on A53 ?
indeed you have to disable whole &gpio, especially when using interrupts. Linux GPIO driver will choke when it will see unexpected interrupt, which Linux didn’t enable. Either find a way if any to make this interrupt not reaching Linux or disable whole &gpio. You could as well make Linux ignoring that unexpected interrupt, but then what’s the point to moving it to CM, Linux performance still may suffer handling this unexpected interrupt.
It would be the best to to figure which &gpio bank can be dedicated to CM only and use pins from that bank on CM.
There’s as well partially finished gpio-rpmsg driver (primarily done for imx7ulp, for which NXP finally noticed the need for better sharing GPIO module between Cortex-M and CA. ). Using that driver you could disable real &gpio on Linux and define another one &gpio, which would send RPMSG messages instead of direct I/O to GPIO, Cortex-M will do physical writes/reads to GPIO and send RPMSG messages to CA when interrupt happens. All GPIO pins references from disabled &gpio could be easily remapped to virtual GPIO. libgpiod with Linux gpio-imx-rpmsg.c driver
There are many challanges we have to face when we modify kernel and every time we want to upgrade OS, we have to repeatedly modify and test the kernel.
So, It can be our last option if we couldn’t find easy solution.
Yes, not fully finished and not populated to other SDK’s. I guess only imx7ulp SDK supports it. And RPMSG GPIO stuff in that SDK is hard to separate from other code… But that’s the way to go if you really need to share CM-CA un-shareable GPIO.
If on Linux you don’t need any GPIO interrupts for particular GPIO bank, then you could just remove interrupt assignments in device tree for that bank.
On iMX7 (I hope on iMX8M as well, i don’t know), each &gpio has two interrupts, one for 0-15 pins and another one for 16-31. Current Linux GPIO driver will work if you just remove 2nd interrupt. Driver will think that just 16 pins are available in the bank. So that you could use those 16-31 pins on CM. Unfortunately interrupt order can’t be swapped without driver mods.
Clearly NXP should redesign GPIO to let dedicate every single GPIO to CM or CA. Write access should be restricted to one side, read access should be allowed to both sides.