spidev node in /dev not coming

Moderator: nferre

Ishmeet
Posts: 8
Joined: Mon Jan 05, 2015 2:22 pm

spidev node in /dev not coming

Wed Feb 11, 2015 3:18 pm

I did the following, however when I use spidev_test.c on the AT sama5d3, it is unable to find /dev/spidev node. I tried the following but /dev/spidev not generating.

First, these are my dmesg | grep "spi" prints

Code: Select all

[    0.970000] atmel_spi f0004000.spi: version: 0x213
[    0.980000] atmel_spi f0004000.spi: Using dma0chan3 (tx) and dma0chan4 (rx) for DMA transfers
[    0.980000] atmel_spi f0004000.spi: Atmel SPI Controller at 0xf0004000 (irq 18)
[    0.990000] atmel_spi f0004000.spi: master is unqueued, this is deprecated
[    1.000000] atmel_spi f8008000.spi: version: 0x213
[    1.000000] atmel_spi f8008000.spi: Using dma1chan0 (tx) and dma1chan1 (rx) for DMA transfers
[    1.010000] atmel_spi f8008000.spi: Atmel SPI Controller at 0xf8008000 (irq 30)
[    1.010000] atmel_spi f8008000.spi: master is unqueued, this is deprecated
And this is after find / -name *spi*

Code: Select all

/sys/bus/spi
/sys/bus/spi/drivers/spidev
/sys/bus/platform/devices/f0004000.spi
/sys/bus/platform/devices/f8008000.spi
/sys/bus/platform/drivers/atmel_spi
/sys/bus/platform/drivers/atmel_spi/f0004000.spi
/sys/bus/platform/drivers/atmel_spi/f8008000.spi
/sys/bus/platform/drivers/spi_gpio
/sys/devices/ahb.0/apb.1/f0004000.spi
/sys/devices/ahb.0/apb.1/f0004000.spi/spi_master
/sys/devices/ahb.0/apb.1/f0004000.spi/spi_master/spi32766
/sys/devices/ahb.0/apb.1/f8008000.spi
/sys/devices/ahb.0/apb.1/f8008000.spi/spi_master
/sys/devices/ahb.0/apb.1/f8008000.spi/spi_master/spi32765
/sys/class/spi_master
/sys/class/spi_master/spi32765
/sys/class/spi_master/spi32766
/sys/class/spidev
/sys/module/spidev
/home/root/spidev_test
/proc/irq/30/f8008000.spi
/proc/irq/18/f0004000.spi
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi1
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi1/spi1-0
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi0
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi0/spi0-0
/proc/device-tree/ahb/apb/spi@f8008000
/proc/device-tree/ahb/apb/spi@f0004000
Did the following things in the kernel before compiling
1. Enabled the "User mode SPI device driver support." - it was already enabled.
2. In sam5d3xmb.dtsi added following

Code: Select all

spi1: spi@f8008000 {
spidev@0 {
compatible = "linux,spidev";
spi-max-frequency = <10000000>;
reg = <0>;
};
};
3. In sama5d3xcm.dtsi

Code: Select all

spi1: spi@f8008000 {
            cs-gpios = <&pioC 25 0>, <0>, <0>, <0>; 
         };
4. However, when I do this inside sama5d3.dtsi file, I am getting linking error while compiling dtb files.

Code: Select all

spi1: spi@f8008000 {                  
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "atmel,at91rm9200-spi";
            reg = <0xf8008000 0x100>;
            interrupts = <25 IRQ_TYPE_LEVEL_HIGH 3>;
            dmas = <&dma1 2 AT91_DMA_CFG_PER_ID(15)>,
                   <&dma1 2 AT91_DMA_CFG_PER_ID(16)>;
            dma-names = "tx", "rx";
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_spi1>;
            clocks = <&spi1_clk>;
            clock-names = "spi_clk";
            status = "disabled";
         };
After this I compiled and flashed the new kernel image and got the prints on dmesg as shown above. However, no /dev/spidev node.
Any Ideas? where I am wrong.
blue_z
Location: USA
Posts: 1721
Joined: Thu Apr 19, 2007 10:15 pm

Re: spidev node in /dev not coming

Thu Feb 12, 2015 9:40 pm

Ishmeet wrote:First, these are my dmesg | grep "spi" prints ...

And this is after find / -name *spi*...
Instead of composing a rendition of the commands you use, please show the actual commands that were typed.
Ishmeet wrote:2. In sam5d3xmb.dtsi added following ...

3. In sama5d3xcm.dtsi ...
What kernel version is this?
Where is the source code from?
What board is this for?
What .dts file are you compiling?
Ishmeet wrote:4. However, when I do this inside sama5d3.dtsi file, I am getting linking error while compiling dtb files.

After this I compiled and flashed the new kernel image and got the prints on dmesg as shown above.
If the compilation of the Device Tree failed ("linking error"??), then how did you obtain a .dtb file with the new configuration?
Ishmeet wrote:Any Ideas? where I am wrong.
You aren't providing salient information for a reasonable answer.
You've posted in the SAMA5D3 Xplained forum, but the description of your actions are not consistent for that board.

Regards
Ishmeet
Posts: 8
Joined: Mon Jan 05, 2015 2:22 pm

Re: spidev node in /dev not coming

Fri Feb 13, 2015 4:45 pm

The commands are
# dmesg | grep "spi"

Code: Select all

[    0.970000] atmel_spi f0004000.spi: version: 0x213
[    0.980000] atmel_spi f0004000.spi: Using dma0chan3 (tx) and dma0chan4 (rx) for DMA transfers
[    0.980000] atmel_spi f0004000.spi: Atmel SPI Controller at 0xf0004000 (irq 18)
[    0.990000] atmel_spi f0004000.spi: master is unqueued, this is deprecated
[    1.000000] atmel_spi f8008000.spi: version: 0x213
[    1.000000] atmel_spi f8008000.spi: Using dma1chan0 (tx) and dma1chan1 (rx) for DMA transfers
[    1.010000] atmel_spi f8008000.spi: Atmel SPI Controller at 0xf8008000 (irq 30)
[    1.010000] atmel_spi f8008000.spi: master is unqueued, this is deprecated
# find /- name *spi*

Code: Select all

/sys/bus/spi
/sys/bus/spi/drivers/spidev
/sys/bus/platform/devices/f0004000.spi
/sys/bus/platform/devices/f8008000.spi
/sys/bus/platform/drivers/atmel_spi
/sys/bus/platform/drivers/atmel_spi/f0004000.spi
/sys/bus/platform/drivers/atmel_spi/f8008000.spi
/sys/bus/platform/drivers/spi_gpio
/sys/devices/ahb.0/apb.1/f0004000.spi
/sys/devices/ahb.0/apb.1/f0004000.spi/spi_master
/sys/devices/ahb.0/apb.1/f0004000.spi/spi_master/spi32766
/sys/devices/ahb.0/apb.1/f8008000.spi
/sys/devices/ahb.0/apb.1/f8008000.spi/spi_master
/sys/devices/ahb.0/apb.1/f8008000.spi/spi_master/spi32765
/sys/class/spi_master
/sys/class/spi_master/spi32765
/sys/class/spi_master/spi32766
/sys/class/spidev
/sys/module/spidev
/home/root/spidev_test
/proc/irq/30/f8008000.spi
/proc/irq/18/f0004000.spi
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi1
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi1/spi1-0
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi0
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi0/spi0-0
/proc/device-tree/ahb/apb/spi@f8008000
/proc/device-tree/ahb/apb/spi@f0004000
Kernel Version : 3.10.0
Source code is from : git checkout origin/linux-3.10-at91 –b linux-3.10-at91
Platform is : Atmel SAMA5D3 Xplained
Following are the dts files compiled (I think): (Makefile code)

Code: Select all

dtb-$(CONFIG_ARCH_AT91) += at91-sama5d3_xplained.dtb
dtb-$(CONFIG_ARCH_AT91) += at91-sama5d3_xplained_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += at91-sama5d3_xplained_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d31ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d31ek_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d31ek_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d31ek_revc.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d31ek_revc_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d31ek_revc_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d33ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d33ek_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d33ek_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d33ek_revc.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d33ek_revc_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d33ek_revc_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek_revc.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek_revc_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d34ek_revc_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d35ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d35ek_revc.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d36ek.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d36ek_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d36ek_pda7.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d36ek_revc.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d36ek_revc_pda4.dtb
dtb-$(CONFIG_ARCH_AT91) += sama5d36ek_revc_pda7.dtb

Code: Select all

If the compilation of the Device Tree failed ("linking error"??), then how did you obtain a .dtb file with the new configuration?
This error I only came when I modify the sama5d3.dtsi file, when I did not change in this file dtb files were obtained.

Code: Select all

You've posted in the SAMA5D3 Xplained forum, but the description of your actions are not consistent for that board. 
This is definitely Atmel SAMA5D3 board.

I am facing problem with spidev.c driver, the device node /dev/spidev is not coming, probably because probe function is not getting called. 
Is this because of the dtb files?
or the modalias value?
What do I need to do, I only want to communicate SPI from Atmel SAMA5D3 to some microcontroller I am using via SPI. 
Please reply ASAP.
blue_z
Location: USA
Posts: 1721
Joined: Thu Apr 19, 2007 10:15 pm

Re: spidev node in /dev not coming

Fri Feb 13, 2015 10:38 pm

Ishmeet wrote:The commands are

# find /- name *spi*
Since that "command" produces on my board:

Code: Select all

# find /- name *spi*
find: /-: No such file or directory
find: name: No such file or directory
find: *spi*: No such file or directory
#
it's obvious that you are still (inaccurately) composing a rendition of the commands you use.
(And even if the Busybox shell doesn't require it, you should learn and use proper shell syntax.)
Ishmeet wrote: Following are the dts files compiled (I think): (Makefile code)
The contents of a Makefile is not a response that helps.

With what compiled .dts file (i.e. which .dtb file) is the kernel booted?
Ishmeet wrote:Please reply ASAP.
Only paying clients get to make such requests.

Regards
Ishmeet
Posts: 8
Joined: Mon Jan 05, 2015 2:22 pm

Re: spidev node in /dev not coming

Sat Feb 14, 2015 5:46 am

it's obvious that you are still (inaccurately) composing a rendition of the commands you use. 
(And even if the Busybox shell doesn't require it, you should learn and use proper shell syntax.)
The command is 

Code: Select all

root@sama5d3_xplained:/# find / -name *spi*
/lib/udev/keymaps/acer-aspire_5920g
/lib/udev/keymaps/acer-aspire_5720
/lib/udev/keymaps/acer-aspire_6920
/lib/udev/keymaps/acer-aspire_8930
/lib/firmware/libertas/gspi8682.bin
/lib/firmware/libertas/gspi8688.bin
/lib/firmware/libertas/gspi8686_v9.bin
/lib/firmware/libertas/gspi8688_helper.bin
/lib/firmware/libertas/gspi8682_helper.bin
/lib/firmware/libertas/gspi8686_v9_helper.bin
/lib/modules/3.10.0-yocto-standard/kernel/drivers/net/wireless/ti/wlcore/wlcore_spi.ko
/lib/modules/3.10.0-yocto-standard/kernel/drivers/net/wireless/p54/p54spi.ko
/lib/modules/3.10.0-yocto-standard/kernel/drivers/net/wireless/libertas/libertas_spi.ko
/sys/bus/spi
/sys/bus/spi/drivers/spidev
/sys/bus/platform/devices/f0004000.spi
/sys/bus/platform/devices/f8008000.spi
/sys/bus/platform/drivers/atmel_spi
/sys/bus/platform/drivers/atmel_spi/f0004000.spi
/sys/bus/platform/drivers/atmel_spi/f8008000.spi
/sys/bus/platform/drivers/spi_gpio
/sys/devices/ahb.0/apb.1/f0004000.spi
/sys/devices/ahb.0/apb.1/f0004000.spi/spi_master
/sys/devices/ahb.0/apb.1/f0004000.spi/spi_master/spi32766
/sys/devices/ahb.0/apb.1/f8008000.spi
/sys/devices/ahb.0/apb.1/f8008000.spi/spi_master
/sys/devices/ahb.0/apb.1/f8008000.spi/spi_master/spi32765
/sys/class/spi_master
/sys/class/spi_master/spi32765
/sys/class/spi_master/spi32766
/sys/class/spidev
/sys/module/spidev
/var/lib/opkg/info/kernel-module-libertas-spi.postrm
/var/lib/opkg/info/kernel-module-wlcore-spi.postinst
/var/lib/opkg/info/kernel-module-libertas-spi.control
/var/lib/opkg/info/kernel-module-libertas-spi.list
/var/lib/opkg/info/kernel-module-wlcore-spi.postrm
/var/lib/opkg/info/kernel-module-p54spi.control
/var/lib/opkg/info/kernel-module-libertas-spi.postinst
/var/lib/opkg/info/kernel-module-wlcore-spi.list
/var/lib/opkg/info/kernel-module-p54spi.list
/var/lib/opkg/info/kernel-module-p54spi.postrm
/var/lib/opkg/info/kernel-module-p54spi.postinst
/var/lib/opkg/info/kernel-module-wlcore-spi.control
/usr/share/terminfo/s/spinwriter
/proc/irq/30/f8008000.spi
/proc/irq/18/f0004000.spi
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi1
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi1/spi1-0
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi0
/proc/device-tree/ahb/apb/pinctrl@fffff200/spi0/spi0-0
/proc/device-tree/ahb/apb/spi@f8008000
/proc/device-tree/ahb/apb/spi@f0004000
root@sama5d3_xplained:/#
With what compiled .dts file (i.e. which .dtb file) is the kernel booted?
I think the kernel is booted with this dtb file :
at91-sama5d3_xplained_pda7.dtb
Ishmeet wrote:
Please reply ASAP.
Only paying clients get to make such requests.
I am sorry for making that request before.
But, please I beg you, help me out here.
blue_z
Location: USA
Posts: 1721
Joined: Thu Apr 19, 2007 10:15 pm

Re: spidev node in /dev not coming

Mon Feb 16, 2015 2:48 am

Ishmeet wrote:I think the kernel is booted with this dtb file :
at91-sama5d3_xplained_pda7.dtb
Why aren't you sure?

Previously you wrote that you modified sam5d3xmb.dtsi by inserting the spidev-related node configuration.
The at91-sama5d3_xplained_pda7.dts does not include the sam5d3xmb.dtsi file, so in effect you have made zero changes in regards to configuring spidev in the Device Tree blob for your board.

Regards
Ishmeet
Posts: 8
Joined: Mon Jan 05, 2015 2:22 pm

Re: spidev node in /dev not coming

Mon Feb 16, 2015 12:56 pm

Did the following changes in at91-sama5d3_xplained_pda7.dts and it worked.
Don't know if its right or wrong but for now I am able to get /dev/spidev32765.0, and able to perform write operations with another microcontroller using spidev_test.c.

at91-sama5d3_xplained_pda7.dts

Code: Select all

                        spi1: spi@f8008000 {
                                cs-gpios = <&pioC 25 0>, <0>, <0>, <&pioD 16 0>;
                                status = "okay";
                                spidev@0 {
                                        compatible = "linux,spidev";
                                        spi-max-frequency = <24000000>;
                                        reg = <0>;
                                };
                        };

Return to “SAMA5-based”

Who is online

Users browsing this forum: No registered users and 2 guests