Hello, we cannot see our spidev device under the "dev" directory. We can see it under "devices" in the "sys/bus/spi" directory as well as spidev driver. Please see below console output for reference. The devicetree node description is listed.
root@board:~# ls /dev/spidev*
ls: cannot access '/dev/spidev*': No such file or directory
root@board:~# ls /sys/bus/spi/devices/
spi1.0
root@board:~# ls /sys/bus/spi/drivers/spidev*
bind uevent unbind
------------------------------------------------
#include "freescale/imx8mn.dtsi"
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
status = "okay";
spidev@0{
compatible = "spidev";
reg = <0>;
spi-max-frequency = <4000000>;
};
};
Solved! Go to Solution.
In my case, none of the comments provided by @Sanket_Parekh were related to the issue, including the M7 comment.
I solved the problem by simply changing the compatible property in my spidev node from "spidev" to "rohm,dh2228fv". Apparently, there was some kernel code change related to this.
spidev@0{
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <4000000>;
};
Hello @Sanket_Parekh, any input on how to proceed? Thank you.
Hi @moose
We can use UART4 pads as a ECSPI2. And the same UART4 is enabled and used in M7. This might be the reason why SPI line is not working. Please find the reference from below.
One can disable all the peripherals which are enable in M7 core and check the status of ECSPI2.
Thanks & Regards
Sanket Parekh
Hello @Sanket_Parekh, we disabled the M7 allocation per your instructions but still no spidev under the dev directory. Below is the patch we used to disable the M7 allocation, which applies only to u-boot-imx dts files. We didn't see any reference to M7 in the linux-imx dts files. We also commented out the lines loading the M7 related binaries. We are assuming that this disables the M7 core but let me know if we missed anything. If not, please let us know how we should proceed. Thank you.
u-boot-imx
Subject: [PATCH] Remove M7 UART4 to enable SPI---arch/arm/dts/imx8mn-550p2-rev4.dts | 34 -------------------------arch/arm/dts/imx8mn-evk-u-boot.dtsi | 39 -----------------------------2 files changed, 73 deletions(-)diff --git a/arch/arm/dts/imx8mn-550p2-rev4.dts b/arch/arm/dts/imx8mn-550p2-rev4.dtsindex 90cae733c1..4530e7bfd2 100644--- a/arch/arm/dts/imx8mn-550p2-rev4.dts+++ b/arch/arm/dts/imx8mn-550p2-rev4.dts@@ -8,40 +8,6 @@/ {model = "Rivieh 550.2V4";-- mcu_rdc {- compatible = "imx8m,mcu_rdc";- /* rdc config when MCU starts- * master- * SDMA3p --> domain 1- * SDMA3b --> domian 1- * SDMA3_SPBA2 --> domian 1- * peripheral:- * SAI3 --> Only Domian 1 can access- * UART4 --> Only Domian 1 can access- * GPT1 --> Only Domian 1 can access- * memory:- * no MRC should be configured when GPU3D is disabled.- * end.- */- start-config = <- RDC_MDA RDC_MDA_SDMA3p DID1 0x0 0x0- RDC_MDA RDC_MDA_SDMA3b DID1 0x0 0x0- RDC_MDA RDC_MDA_SDMA3_SPBA2 DID1 0x0 0x0- RDC_PDAP RDC_PDAP_SAI3 PDAP_D1_ACCESS 0x0 0x0- RDC_PDAP RDC_PDAP_UART4 PDAP_D1_ACCESS 0x0 0x0- RDC_PDAP RDC_PDAP_GPT1 PDAP_D1_ACCESS 0x0 0x0- 0x0 0x0 0x0 0x0 0x0- >;- /* rdc config when MCU stops- * memory:- * no MRC should be configured when GPU3D is disabled.- * end.- */- stop-config = <- 0x0 0x0 0x0 0x0 0x0- >;- };};&ddrc {diff --git a/arch/arm/dts/imx8mn-evk-u-boot.dtsi b/arch/arm/dts/imx8mn-evk-u-boot.dtsiindex 2e2ba3e36e..a29f9f54e6 100644--- a/arch/arm/dts/imx8mn-evk-u-boot.dtsi+++ b/arch/arm/dts/imx8mn-evk-u-boot.dtsi@@ -29,45 +29,6 @@method = "smc";};};- mcu_rdc {- compatible = "imx8m,mcu_rdc";- /* rdc config when MCU starts- * master- * SDMA3p --> domain 1- * SDMA3b --> domian 1- * SDMA3_SPBA2 --> domian 1- * peripheral:- * SAI3 --> Only Domian 1 can access- * UART4 --> Only Domian 1 can access- * GPT1 --> Only Domian 1 can access- * memory:- * TCM --> Only Domian 1 can access (0x7E0000~0x81FFFF)- * DDR --> Only Domian 1 can access (0x80000000~0x81000000)- * end.- */- start-config = <- RDC_MDA RDC_MDA_SDMA3p DID1 0x0 0x0- RDC_MDA RDC_MDA_SDMA3b DID1 0x0 0x0- RDC_MDA RDC_MDA_SDMA3_SPBA2 DID1 0x0 0x0- RDC_PDAP RDC_PDAP_SAI3 PDAP_D1_ACCESS 0x0 0x0- RDC_PDAP RDC_PDAP_UART4 PDAP_D1_ACCESS 0x0 0x0- RDC_PDAP RDC_PDAP_GPT1 PDAP_D1_ACCESS 0x0 0x0- RDC_MEM_REGION 26 TCM_START TCM_END MEM_D1_ACCESS- RDC_MEM_REGION 0 M4_EVK_DDR4_START M4_EVK_DDR4_END MEM_D1_ACCESS- 0x0 0x0 0x0 0x0 0x0- >;- /* rdc config when MCU stops- * memory:- * TCM --> domain 0/1 can access (0x7E0000~0x81FFFF)- * DDR --> domain 0/1 can access (0x80000000~0x81000000)- * end.- */- stop-config = <- RDC_MEM_REGION 26 TCM_START TCM_END MEM_D0D1_ACCESS- RDC_MEM_REGION 0 M4_EVK_DDR4_START M4_EVK_DDR4_END MEM_D0D1_ACCESS- 0x0 0x0 0x0 0x0 0x0- >;- };};&{/soc@0} {--2.38.1
machine file M7 statements
WKS_FILE_DEPENDS:append = " imx-m7-demos"# IMAGE_BOOT_FILES += " \# imx8mnddr3l_m7_TCM_hello_world.bin \# imx8mnddr3l_m7_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin \# imx8mnddr3l_m7_TCM_rpmsg_lite_str_echo_rtos.bin \# imx8mnddr3l_m7_TCM_sai_low_power_audio.bin \# "
Hi @moose
The mentioned changes are of uboot source only. Have you done the same changes in Linux source and M7 SDK?
Thanks & Regards
Sanket Parekh
No, I didn't. I am not familiar with how to do this. Could you please share instructions or links to associated documentation? Thx!
Hi @moose
Please accept my apologies for delayed answer.
I am assuming that you have prepared the binaries from yocto build. Is my understanding correct?
If yes, then in yocto set-up there will be one source like linux-imx. In that directory "core-image-minimal/tmp/work/imx8qxpmek-poky-linux/linux-imx/5.4-r0/git" one sub directory is there like "arch/arm64/boot/dts/" were board dts files are present in that you will have to disable the M7 peripherals.
After that compile the linux source with the help of command bitbake -c compile linux-imx; bitbake -c deploy linux-imx. Replace the .dtb files on your board and check the status of spi.
Thanks & Regards
Sanket Parekh
I am having the same problem.
can you confirm this procedure of disable uart4 in M7 made spidev apprear in the linux kernel ?
In my case, none of the comments provided by @Sanket_Parekh were related to the issue, including the M7 comment.
I solved the problem by simply changing the compatible property in my spidev node from "spidev" to "rohm,dh2228fv". Apparently, there was some kernel code change related to this.
spidev@0{
compatible = "rohm,dh2228fv";
reg = <0>;
spi-max-frequency = <4000000>;
};