How to use enable the FIQ with the ARM timer on rpi zero in my driver?
s.achterop at rug.nl
s.achterop at rug.nl
Mon Apr 13 05:11:39 EDT 2020
Hello List,
I am on a raspberry pi zero, chipset BCM2835, and try to use the ARM timer to get FIQ interrupts.
I compiled the kernel from source to be able to create my out-of-tree module. Uname -a gives:
Linux raspberrypi 4.19.108+ #1 PREEMPT Tue Mar 31 10:00:18 CEST 2020 armv6l GNU/Linux
(i only set it to be a low-latency-kernel)
I try to create an fiq interrupt in a number of ways, but nothing works.
The driver I created can be found at
https://github.com/SietseAchterop/Batradio/blob/master/batradio_module/fiqtest.c
The ARM timer is configured by directly writing to the registers.
It is running fine and sets it's interrupt bit at some point.
So I assume that linux does not use the ARM timer in a base configuration.
When using:
ret = claim_fiq(&bat_fh);
set_fiq_handler(&batradio_handler, &batradio_handler_end - &batradio_handler);
set_fiq_regs(®s);
enable_fiq(x);
There are no fiq interrupts, i tried several values of x.
My main question is, which irq number should I use.
Note that I use
pdev = platform_device_register_simple("batradio__", 0, NULL, 0);
to register this platform device.
I did find a complete example in
https://bootlin.com/blog/fiq-handlers-in-the-arm-linux-kernel/
But there they used a device tree and got the fiq-irq number via the probe function argument.
Maybe that is a way to get it working, but I don't know with compatible value to use.
I also tried, instead of enable_fiq, to directly connect the ARM timer to FIQ by
writing 0xC0, 0x80 + 0x40, to the FIQ Control register 0x20C.
But then Linux freezes immediately, so that's probably the wrong way.
What could I do to get FIQ interrupts working? Or where can I find which irq number to use in enable_fiq?
Hopefully someone can point me in a direction.
Thanks in advance,
Sietse
PS. I forced dwc_otg to not use fiq by adding the following to /boot/cmdline.txt
dwc_otg.fiq_fsm_enable=0 dwc_otg.fiq_enable=0 dwc_otg.nak_holdoff=0
I also make it boot up with console, so no X stuff, and access via ssh.
More information about the Kernelnewbies
mailing list