Unable to find SPI node in /dev directory

Hi support team,

I want to test SPI Interface on Colibri VF50 module(Iris carrier board). but there was I am unable to find /dev/spidevB.C node in /dev directory. even I have checked there was driver installed already.

so how to access spi interface from the user-space?

see the below information which may help you to debug the issue:

root@colibri-vf:~# find / -name *spi*
/etc/ssl/certs/spi-cacert-2008.pem
/lib/modules/4.1.15-v2.5b3+ge6d111c/kernel/drivers/net/can/spi
/sys/bus/spi
/sys/bus/spi/devices/spi1.0
/sys/bus/spi/drivers/spidev
/sys/bus/platform/devices/4002d000.dspi1
/sys/bus/platform/drivers/fsl-dspi
/sys/bus/platform/drivers/fsl-dspi/4002d000.dspi1
/sys/devices/platform/soc/soc:aips-bus@40000000/4002d000.dspi1
/sys/devices/platform/soc/soc:aips-bus@40000000/4002d000.dspi1/spi_master
/sys/devices/platform/soc/soc:aips-bus@40000000/4002d000.dspi1/spi_master/spi1
/sys/devices/platform/soc/soc:aips-bus@40000000/4002d000.dspi1/spi_master/spi1/spi1.0
/sys/class/spi_master
/sys/class/spi_master/spi1
/sys/class/spidev
/sys/firmware/devicetree/base/soc/aips-bus@40000000/quadspi@40044000
/sys/firmware/devicetree/base/soc/aips-bus@40000000/dspi0@4002c000
/sys/firmware/devicetree/base/soc/aips-bus@40000000/dspi0@4002c000/spi-num-chipselects
/sys/firmware/devicetree/base/soc/aips-bus@40000000/dspi1@4002d000
/sys/firmware/devicetree/base/soc/aips-bus@40000000/dspi1@4002d000/can@0/spi-max-frequency
/sys/firmware/devicetree/base/soc/aips-bus@40000000/dspi1@4002d000/spi-num-chipselects
/sys/firmware/devicetree/base/soc/aips-bus@40000000/iomuxc@40048000/vf610-colibri/dspi1grp
/sys/kernel/debug/clk/qspi0_sel
/sys/kernel/debug/clk/qspi0_en
/sys/kernel/debug/clk/qspi0_x4
/sys/kernel/debug/clk/qspi0_x2
/sys/kernel/debug/clk/qspi0_x1
/sys/kernel/debug/clk/qspi0
/sys/kernel/debug/clk/qspi1_sel
/sys/kernel/debug/clk/qspi1_en
/sys/kernel/debug/clk/qspi1_x4
/sys/kernel/debug/clk/qspi1_x2
/sys/kernel/debug/clk/qspi1_x1
/sys/kernel/debug/clk/qspi1
/sys/kernel/debug/clk/dspi0
/sys/kernel/debug/clk/dspi1
/sys/kernel/debug/clk/dspi2
/sys/kernel/debug/clk/dspi3
/sys/kernel/debug/regmap/4002d000.dspi1
/sys/module/mcp251x/drivers/spi:mcp251x
/sys/module/spidev
/usr/share/ca-certificates/spi-inc.org
/usr/share/ca-certificates/spi-inc.org/spi-cacert-2008.crt
/usr/share/terminfo/s/spinwriter
/home/my_spi
/home/my_spi1
/proc/irq/23/4002d000.dspi1

root@colibri-vf:/home# cat /proc/devices | grep spi
153 spi
root@colibri-vf:/home#

The spidev node will not be available by default since it is no more supported in device trees, refer this discussion in ml for more info. Said that one could still add spidev node to the device tree. Note that this will lead to a loud warning about using ‘spidev’ from DT.

e.g

spidev0: spi@0 {
	compatible = "spidev";
	reg = <1>;
	spi-max-frequency = <10000000>;
};

I have changed device tree as per given solution and I got the /dev/spidev1.0 node, but there was other kernel modules failed to load in init section.

Is that mcp251x kernel module ?
Do you still have the mcp2515 can enabled in device tree?
To use dspi1_0 with spidev one need to disable mcp2515 can driver since by default we use dspi1_0 for exernal mcp251x CAN controller on evaluation board or use other instance, e.g. dspi1_1

dspi1 set as compatible = “spidev” in DT (vf-colibri-eval-v3.dtsi) and also added compatibility in driver/spi/spidev.c . so I got the node in /dev directory. but there was I got garbage values when I tried to read data from external flash memory which has interfaced via spi and sometimes also get proper values.

can you share helpful information regarding to my issue?

many thanks\

What is the external SPI flash chip you are using ?

I used M25P20-VMN6PB-SOIC8 Flash memory.

Unfortunately I’m not having M25P20 at my end to test. There is driver available for M25Pxx SPI based flash memory chips. Device tree binding example is provided in devicetree binding documentation. May be you could try that.

Do you say anything about this:
[ 23.349682] spi1.0 supply vdd not found, using dummy regulator
[ 23.452040] spi1.0 supply xceiver not found, using dummy regulator

Q. Why it is getting dummy regulator?
Q. Here, i got the spi1.0 node without any modification in DT.but it not showing in /dev directory?

Waiting for your ans on above question…

Many thanks\

Those kernel messages are from mcp251x CAN controller driver, the driver has two optional properties for providing the supply regulators to CAN chip, which in our case are not applicable, by default driver fall back with dummy regulators.
The ‘spi1.0’ in kernel message’s are wrt to mcp251x DT node not with spidev, by default in our device tree DSPI1_CS0 is used for interfacing MCP2515 CAN controller available on Colibri Evaluation Board. If to use DSPI1_CS0 with spidev one would disable the mcp251x node and append the spidev node.

@bhuvan.tx I have same problem(spidev not found) in colibri Imx7 with voila plus board. how to solve it ?

Please create a new post for your query.

@sanchayan.tx but it’s same query ?

@balakumaran, it sounds similar but environment is different and it will be nice to have a new post for better visibility.

I have same problem(spidev not found) in colibri Imx7 with voila plus board. how to solve it ?

By default spidev is disabled and MCP251x CAN driver is enabled, have a look at this. To enable spidev one will need to disable the CAN driver and enable the spidev.

Have you had a chance to open a new topic for this?