Driving the LEDs with a kernel module #19
Replies: 3 comments 1 reply
-
Ah, really quick update. I just got the LKM LED driver to work successfully. I was able to find this guide: HOWTO Create a Device Tree on rocketboards and it gave me exactly what I was missing. It's section on using sopc-create-header-files gave me the correct base address I was looking for. I updated my change to socfpga.dtsi with this:
I will work on creating a PR containing instructions for how to do this. |
Beta Was this translation helpful? Give feedback.
-
The PR is now on this repo and I have created a video walkthrough of getting a linux driver to work for this repo's setup. Feel free to check it out now if you are interested: |
Beta Was this translation helpful? Give feedback.
-
Quite a long time after, I'm reacting to this discussion because I'm stuck with an issue around the same topic : Right now, I can't build my own kernel module. I'm stuck when I try to run the make command to build my driver. The system answers that '/lib/modules/5.12.0zImage/build' does not exist. I'm working on a DE10-Nano with the Debian image released here |
Beta Was this translation helpful? Give feedback.
-
I am currently working on trying to recreate Step 10 - Driving the LEDs with a kernel module, but have it work specifically with the setup for this repo.
I have gone through Configuring the Device Tree which allows the mmap() syscall to work for controlling the LEDs in a user program. This made sense to me and worked for me.
I have been studying Step 10 - Driving the LEDs with a kernel module and 12. Writing a Simple Driver on rocketboards.
I used the GHRD and generated soc_system.dts, but if I try to use this device tree unmodified there seems to be some compatibility issues (for example, packets are dropped when I ping the DE10-nano over the home network).
I noticed that in my soc_system.dts there is this:
I tried to add this inside of linux-socfpga/arch/arm/boot/dts/socfpga.dtsi inside of the soc {...} block. I modified it to look like this:
The .dtb builds successfully, and I thought my changes would make the register point to where the lightweight HPS-FPGA bridge is located (changes from Configuring the Device Tree are also added and FPGA bridges are all enabled in this custom device tree).
After changing the device tree and rebooting, my IP show up under /sys/device/platform/soc/ and my LKM successfully runs the probe function. My LKM is exactly the 12. Writing a Simple Driver on rocketboards, with small necessary changes to get it to build successfully. However, the LEDs do not respond to the driver when it tries to turn them on. This must mean that on entry, the probe function is not writting to the correct memory location where the lw bridge is located.
I am going to continue studying this, but if someone has more expience with correctly adding custom IPs to the device tree and can advise on this please let me know! If I get it working, I am planning on writing a PR to expand this guide with that new step.
Best regards,
Cameron Kirk
Beta Was this translation helpful? Give feedback.
All reactions