kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: "s.achterop@rug.nl" <s.achterop@rug.nl>
To: kernelnewbies@kernelnewbies.org
Subject: How to use enable the FIQ with the ARM timer on rpi zero in my driver?
Date: Mon, 13 Apr 2020 11:11:39 +0200	[thread overview]
Message-ID: <2746719d-8b3f-d08d-0f41-83ff00ff2734@rug.nl> (raw)

   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(&regs);
  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.


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

             reply	other threads:[~2020-04-13  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13  9:11 s.achterop [this message]
2020-04-13  9:37 ` How to use enable the FIQ with the ARM timer on rpi zero in my driver? s.achterop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2746719d-8b3f-d08d-0f41-83ff00ff2734@rug.nl \
    --to=s.achterop@rug.nl \
    --cc=kernelnewbies@kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).