IRQ & Device Tree Tutorial/Course recommendation

CodePsion

New Member
Joined
Dec 13, 2022
Messages
2
Reaction score
1
Credits
35
Background simplified, I need to generate a kernel signal when pin-X drops low. The CPU documentation identifies this as IRQ-1 (zero based), and searching the kernel code shows me that IPIC_EXT1 = 17... except that when I try to register my callback function I get an error that IRQ17 is already in use with ttyS1. Clearly I am missing something. It doesn't help that the legacy code snipit I am trying to merge in was from an old 2.x kernel (before device trees).

So... can anyone recommend a set of tutorials on hwirq/irq mapping and maybe also the device tree? Better yet, does anyone know of a good free webinar or online collage course covering these subjects and/or linux kernel driver development in general?

My starting point is 'user space c/c++ expert', but my only prior kernel work is to recompile with different #define config options.
 


We have a bunch of people who provide help here and, over time, you learn who is good at what. I'd normally ping someone, but I'm not sure who here has this kind of knowledge. Maybe one of our programmers or IT gurus?

Anyhow...

This looks like something that's more SBC than dev-ops or maybe a hardware type of question, but I'm guessing. What sort of hardware are you working on? (I'm trying to figure out if this is really the right sub-forum for this question.)

Then again, all sorts of things fall into dev-ops these days.
 
I don't think this is hardware specific, but for what it is worth the hardware is a PowerPC embedded/headless server. Uboot programming, RS232 terminal access for maintenance/debugging. The software isn't much more than a linux kernel, busybox, the core scripts (rcS, inittab, etc), and a custom server/manager app. When I picked it up there were two software forks: one based on Kernel 2.6 that had some nifty custom IRQ handling code for graceful shutdown/poweroff, and a branch based on Kernel 5.12 whose developer vanished in the middle of Alpha. The new 5.12 base added in WiFi driver support, but ommited the IRQ poweroff signal generating code. I guess its usable if one accepts that unplugging the device is the correct shutdown procedure, but it seemed like a good excuse to learn about the linux kernel.

So, I'm looking less for a quick answer than for a tip on where to start looking for knowledge.
Something more comprehensive than Device Trees for Dummies by Petizoni, but more structured/user friendly than trying to learn by reading the Kernel.org documentation.

On the IRQ side I have even less to go on. I thought I had it figured out, but the more I study the issue the more convinced I become that my assumptions must be wrong. The documentation implies those should match to hardware... but it acts like these are software pipes assigned sequentially first come first served? I feel like I'm back to square zero.


I realize this isn't exactly Dev-Opp, but I couldn't find a better place to ask.
 
Yeah, I have no idea how to help you and I'm not sure that there's a better place for the question. It might fit in hardware a bit better, but I'm just gonna leave it for now.

Don't worry. Folks will still see it. If anyone has a clue about helping, they'll chime in - regardless of which sub-forum it is in.
 
In order to properly handle hardware interrupts in the Linux kernel, you'll need to understand the concepts of IRQ numbers, interrupt controllers, and device trees.

Here are some resources that may be helpful:

  1. Linux kernel documentation: The official documentation for the Linux kernel is a great place to start. You can find information on IRQ handling, interrupt controllers, and device trees in the following sections:
    • Interrupts and Interrupt Handlers
    • Interrupt Controllers
    • Device Tree Bindings
  2. Linux Device Drivers book by Jonathan Corbet, Alessandro Rubini, and Greg Kroah-Hartman: This book is widely considered to be the definitive guide to writing Linux device drivers. It covers a wide range of topics, including IRQ handling and device trees.
  3. Linux Device Drivers development: This is a comprehensive online course, which covers Linux device driver development, IRQ handling, and device tree binding. You can also find similar courses on online platforms like Coursera, Udemy, and edX.
  4. Writing Linux Device Drivers A guide with exercises: This guide gives a good introduction to the basics of Linux device driver development and also covers IRQ handling and device tree bindings.
  5. Linux kernel mailing list: You can join the Linux kernel mailing list and ask questions directly to the developers who work on the kernel. This can be a great way to get answers to specific questions and to stay informed about new developments in the kernel.
 

Members online


Top