spi loaded at /dev/spidev32765.0?

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

spi loaded at /dev/spidev32765.0?

Jump to solution
8,951 Views
rathben
Contributor III

Hello All -

I am new to device tree and trying to configure an spi port for spidev access in /dev/spidevX.Y. I was somewhat successful with the code shown below... the port works, I can run a loopback test, however it gets mounted as /dev/spidev32765.0 instead of what I was expecting, /dev/spidev1.0.

I am running on an imx6slevk, kernel 3.10.17, with the following additions to imx6sl-evk.dts:

&ecspi2 {

  fsl,spi-num-chipselects = <1>;

  cs-gpios = <0>;

  pinctrl-names = "default";

  pinctrl-0 = <&pinctrl_ecspi2_1>;

  status = "okay";

    spidev@0x00 {

        compatible = "spidev";

        spi-max-frequency = <20000000>;

        reg = <0>;

    };

};

&iomuxc {

...

...

     ecspi2 {

       pinctrl_ecspi2_1: ecspi2grp-1 {

            fsl,pins = <

                 MX6SL_PAD_LCD_DAT10__ECSPI2_MISO 0x100b1

                 MX6SL_PAD_LCD_DAT9__ECSPI2_MOSI 0x100b1

                 MX6SL_PAD_LCD_DAT8__ECSPI2_SCLK 0x100b1

                 MX6SL_PAD_ECSPI2_SS0__ECSPI2_SS0 0x100b1

            >;

       };

     };

Any ideas? Thanks -Ben

Labels (1)
1 Solution
3,503 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Ben,

This is the expected behavior in 3.10. Please see this thread and the reply from Grant Likely (dt maintainer):

https://www.mail-archive.com/spi-devel-general@lists.sourceforge.net/msg08231.html

Just tested on my mx6qsabresd:

- On 3.10 I get:

m25p80 spi32766.0: m25p32 (4096 Kbytes)

spi nodes look better on more recent kernels though:

- On 3.14-rc2 I get:

m25p80 spi0.0: m25p32 (4096 Kbytes)

Regards,

Fabio Estevam

View solution in original post

0 Kudos
Reply
7 Replies
3,503 Views
qinghuazhu
Contributor III

I'd like to share my rebuild method here

#!/bin/sh

rm tmp/stamps/imx6sxsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0.do_compile.*

bitbake linux-imx -c compile

if [ $? -ne 0 ];then

        exit

fi

rm sstate-cache/ab/sstate:linux-imx:imx6sxsabresd-poky-linux-gnueabi:3.14.28:r0:imx6sxsabresd:3:abcaddfad744af88c57ba3e6769b28dc_deploy.tgz

rm tmp/stamps/imx6sxsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0.do_deploy.abcaddfad744af88c57ba3e6769b28dc

rm tmp/stamps/imx6sxsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0.do_deploy_setscene.abcaddfad744af88c57ba3e6769b28dc

bitbake linux-imx -c deploy

if [ $? -ne 0 ];then

        exit

fi

rm tmp/stamps/imx6sxsabresd-poky-linux-gnueabi/core-image-minimal/1.0-r0.do_rootfs.*

bitbake core-image-minimal

and I don't like "bitbake  xxxxx  -f"

0 Kudos
Reply
3,503 Views
lfk
Contributor II

Hi there Ben,

I was wondering if you'd mind shedding some light on the process you went through to configure the device tree and get the spidev mounted. I'm also working with an i.MX6SL EVK running 3.10.17, but I seem to be missing something crucial here.

Based on Task #5 - Kernel, I've created a defconfig file that has "User mode SPI device driver support" included (*, not M). I've also copied an existing imx6sl-evk.dst file from build/tmp/work/... and modified it, basically reflecting what you've done. Though I've tried various things, however, I can't seem to get these two files included when I bitbake my image. Am I wrong in the assumption that the modified .dst (and defconfig) should be stored somewhere in sources/? I've mainly tried to add it to sources/meta-fsl-bsp-release/imx/meta-fsl-arm/recipes-kernel/linux/linux-imx_3.10.17/mx6 since there's (unless I'm mistaken) a default defconfig there. But though I attempt to modify various SRC_URI's I can't seem to get them included correctly; whenever I boot up, the only SPI-related output I get is related to the already configured flash, and naturally I've got no /dev/spidev nor anything of interest in /proc/devices.

I'd be most grateful if you could point me in the right direction here. Thanks in advance!

Best regards,

Lars

0 Kudos
Reply
3,503 Views
rathben
Contributor III

Hi Lars,

Regarding "Am I wrong in the assumption that the modified .dts (and defconfig) should be stored somewhere in sources?"

Ultimately no, but that isn't where I would start. I would create a modified defconfig/.config via

     bitbake linux-imx -c menuconfig

I would then modify the appropriate .dts in place, something like tmp/work/imx6slevk-poky-linux-gnueabi/linux-imx/1.0-r0/git/arch/arm/dts/imx6sl-evk-common.dts. Then build via

     bitbake linux-imx -c compile -f

     bitbake linux-imx -c deploy -f

Then locate the updated (look at the date/time) uImage and .dtb files under tmp/deploy/images/core-image-minimal (or something like that)

Copy to the appropriate partition on your sd card and away you go. Hope this helps.

3,503 Views
lfk
Contributor II

Hello again Ben,

That's exactly what I needed to get it working, thanks a lot!

0 Kudos
Reply
3,504 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Ben,

This is the expected behavior in 3.10. Please see this thread and the reply from Grant Likely (dt maintainer):

https://www.mail-archive.com/spi-devel-general@lists.sourceforge.net/msg08231.html

Just tested on my mx6qsabresd:

- On 3.10 I get:

m25p80 spi32766.0: m25p32 (4096 Kbytes)

spi nodes look better on more recent kernels though:

- On 3.14-rc2 I get:

m25p80 spi0.0: m25p32 (4096 Kbytes)

Regards,

Fabio Estevam

0 Kudos
Reply
3,503 Views
niklasmolin
Senior Contributor I

Hi Fabio.

I just wanted to check if you know if the 32765 number is "random" or if the SPI bus number is included in the bug number?

I have 3 SPI buses (some with 1 SS and some with 2 SS pins).

How would this show up in that kind of design?

Best regards,

Niklas

0 Kudos
Reply
3,503 Views
rathben
Contributor III

Interesting, thanks for the informative link

0 Kudos
Reply