I am using Yocto on a imx8 quad max evaluation board, and I want to add a custom spi module. I have done all the steps described in yocto manual, but when I plug in the board the probe function is not called so when I try to use my driver calling a write I have kernel exception messages (when spi_sync is called) such as "Unable to handle kernel NULL pointer dereference at virtual address". I previously tried this module on a Udoo-neo board (with imx6) and it worked fine.
Do I need to modify my device tree files in order to enable my module to use spi? If yes, how can I modify them?
I read a lot of stuff about dts files but still do not understand how they work.
I am new to Yocto and to kernel drivers.
Thank you in advance for your help!
Hi Erica,
the flexspi port connects to an OctaSPI flash (serial flash with 8 SPI lines), so this is most likley not the SPI port you are looking for. The flash type on the 8QM board is a MICRON MT35XU512, that's why you find the name in this section.
On our 8QM board we don't have anything connected to standard SPI, that's why you don't find any setup for it.
>> I read a lot of stuff about dts files but still do not understand how they work.
You're not alone :smileycool:
OK, this is the SPI setup on the i.MX 8QM:
This is what you need to do:
I need to admit that at the time of writing I didn't test it on the 8QM board, so if you can't make it working please come back to me and I will give it a try on my side.
Regards,
Bernhard.
Well explanation bernhardfink I would like enable the SPI support for u-boot. I can't get any SPI Bus driver or compatible driver "fsl,imx7ulp-spi" from uboot. Can you please share the details.
Bernhard, is there such an excellent explanation for those who work with Android 9? We weren't able to enable spidev easily on Android 9. And "make manuconfig" doesn't seem to work as well.
Hello, thank you for your answer. I have tried this but my custom driver does not probe. In my init function spi_register_driver returns 0 but my probe function does not print anything. Do I need to insert { .compatible = "fsl,imx7ulp-spi" } in the struct of_device_id of my custom driver? Or I need to write something else in .compatile?
Adding .compatible = "fsl,imx7ulp-spi" still does not probe. I also added status = "okay" in the lpspi0 entry in the first file.
Hi Erica
example for i.MX8QM can be found in
linux/arch/arm64/boot/dts/freescale/fsl-imx8qm-mek.dts
fsl-imx8qm-mek.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel
However this processor is not publicly released and not supported yet.
For i.MX8MQ example on below link and procedure is similar to i.MX6 processors.
linux/arch/arm64/boot/dts/freescale/fsl-imx8mq-evk.dts
fsl-imx8mq-evk.dts\freescale\dts\boot\arm64\arch - linux-imx - i.MX Linux kernel
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you for your answer!
Opening the first link, on the section "&flexspi0" there is this:
flash0: mt35xu512aba@0 { reg = <0>; #address-cells = <1>; #size-cells = <1>; compatible = "micron,mt35xu512aba"; spi-max-frequency = <29000000>; spi-nor,ddr-quad-read-dummy = <8>; };
can you please explain what flash0, mt35xu512aba@0 and compatible mean?
Is this part the key to add my driver or I am wrong?
for dts definitions one can look at AN5125 Introduction to Device Tree
https://www.nxp.com/docs/en/application-note/AN5125.pdf
Best regards
igor