spidev not listed in /dev

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

spidev not listed in /dev

Jump to solution
8,742 Views
moose
Contributor IV

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>;
  };
};

0 Kudos
Reply
1 Solution
6,681 Views
moose
Contributor IV

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>;
};

View solution in original post

0 Kudos
Reply
29 Replies
7,021 Views
moose
Contributor IV

Hello @Sanket_Parekh, as I mentioned before, we didn't see any reference to M7 in the linux-imx dts files.

I already shared our board dts file with you in a private message a while back. This file reference one dtsi file, which is copied here. We don't see references to M7. Please let me know how we should proceed.

And yes, we use yocto build platform. Thx!

0 Kudos
Reply
7,012 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @moose 

You have mentioned about .dtsi file. Have you checked your board specific DTS file?

Thanks & Regards

Sanket Parekh

0 Kudos
Reply
7,004 Views
moose
Contributor IV

@Sanket_Parekh, there is no reference to the M7 all board dts files, including the board dts file and the include dtsi file. I already shared the dtsi file in the previous post, and I am going to share the board dts file with you again in a private message. How should we proceed?

0 Kudos
Reply
6,977 Views
moose
Contributor IV

@Sanket_Parekh any update on this? Thx!

0 Kudos
Reply
7,218 Views
_angelo_
Contributor III

So as i said in my intial post. When there is no sign of probe, generally the resource is allocated (partitioned) to the other M core. 

0 Kudos
Reply
7,272 Views
_angelo_
Contributor III

What cpu are you using ? Sometimes spi is not visible at all, and not probed at all, since resource is allocated to m4 or scmfw.

0 Kudos
Reply
7,431 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Please check if you open the config.You can compare your config and official config.

:~# ls /dev/spidev1.0
/dev/spidev1.0
0 Kudos
Reply
7,421 Views
moose
Contributor IV

I checked the config file, and I see all related config statements to be enabled, including CONFG_SPI, CONFIG_SPI_MASTER, CONFIG_SPI_IMX and CONFIG_SPI_SPIDEV. I attached the config file for your reference.

 

If there are specific configuration parameters that I am missing, could you please list them? Thank you!

0 Kudos
Reply
7,403 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Have you checked the kernel log about SPI driver? Maybe the driver does not be loaded correctly.

0 Kudos
Reply
7,386 Views
moose
Contributor IV

Yes, I checked the kernel log, and there are no errors related to SPI.

0 Kudos
Reply
7,331 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @moose 

I hope you are doing well.

Can you please share the board DTS file?

Can you please share the log files?

Thanks & Regards

Sanket Parekh

0 Kudos
Reply
7,322 Views
moose
Contributor IV

Hi @Sanket_Parekh, files have been shared. Thank you.

0 Kudos
Reply
7,316 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @moose 

I am sorry, But attachment is missing in your last reply.

Thanks & Regards

Sanket Parekh

0 Kudos
Reply
7,308 Views
moose
Contributor IV
I sent them in a private message. Did you not receive the message?
0 Kudos
Reply
7,294 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @moose 

I got the attachments.

I found that few properties are missing from your board DTS file. Please add "fsl,spi-num-chipselects" and "cs-gpios" in ecspi node as per your board design. For more details please refer Documentation/devicetree/bindings/spi/fsl-imx-cspi.txt.

Thanks & Regards

Sanket Parekh

0 Kudos
Reply
7,290 Views
moose
Contributor IV

Hi @Sanket_Parekh, I did add "fsl,spi-num-chipselects" and "cs-gpios" proprties and I was hoping this would be it but I still don't see spidev under "/dev". I do see the following new message in the kernel log:

spidev@0 enforce active low on chipselect handle

Below is the ecspi node definition. How should we proceed? Thx!

&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
status = "okay";
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio5 13 0>;
 
spidev@0{
compatible = "spidev";
reg = <0>;
spi-max-frequency = <4000000>;
};
};

 

0 Kudos
Reply
7,278 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @moose 

I went through the kernel configuration file and found that lots of other options related to SPI are enabled in kernel configuration file. Please disable all the options and enable only the below mentioned options and check the same.

CONFIG_SPI=y

CONFIG_SPI_MASTER=y

CONFIG_SPI_BITBANG=y

CONFIG_SPI_IMX=y

CONFIG_SPI_SPIDEV=y

Thanks & Regards

Sanket Parekh

0 Kudos
Reply
7,272 Views
moose
Contributor IV

Hi @Sanket_Parekh,

I removed the SPI configs as instructed, but I still can't see spidev. I attached the fragmentation file that removes the unnecessary SPI configs you mentioned as well as the final config file. If you see anything that I am supposed to remove, please let me know. Otherwise, please let me know how we should proceed. Thanks! 

0 Kudos
Reply
7,267 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @moose 

Configuration changes looks good.

Can you please check the M4 core configuration like is M4 core using the SPI device or not? Because in this case it is possible to not create the SPIDEV at A53 core.

Thanks & Regards

Sanket Parekh

0 Kudos
Reply
7,265 Views
moose
Contributor IV

@Sanket_Parekh I am using imx8mn with builtin M7. I personally do not use the M7 for now, but my bsp is based on the imx8mn DDR3 EVK bsp. I am not as familiar with using the M7, but it seems that EVK code is assigning SAI3, GPT1, and UART4 to M7. I see this in the imx-boot code:

+ 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
+ >;
+ };
 
In the machine.conf, we are loading the following firmware in M7:
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 \
"
 
It doesn't seem to me that the M7 is using SPI.
0 Kudos
Reply