problem with spidev on iMX6DL

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

problem with spidev on iMX6DL

2,296 Views
rafalwegner
Contributor II

Hello everybody!

Currently I am trying to enable the spidev driver for the SPI interface on the board with MX6DL working under Linux.On my board I have fpga chip from altera connected to IMX6DL. I have changed configuration file for my board adding:

#define SABREAUTO_ECSPI2_CS1    IMX_GPIO_NR(5, 9)
#define SABREAUTO_ECSPI2_CS0    IMX_GPIO_NR(5, 12)

static int mx6q_sabreauto_spi_cs[] = {

   SABREAUTO_ECSPI2_CS0,

   SABREAUTO_ECSPI2_CS1,

};

static const struct spi_imx_master mx6q_sabreauto_spi_data __initconst = {

    .chipselect = mx6q_sabreauto_spi_cs,

    .num_chipselect = ARRAY_SIZE(mx6q_sabreauto_spi_cs),

};

I have changed existing m25p32_spi0_board_info struct to use spidev:

static struct spi_board_info m25p32_spi0_board_info[] __initdata = {

    {

        /* The modalias must be the same as spi device driver name */

        .modalias    = "spidev",

        .max_speed_hz    = 70000000,

        .bus_num    = 1,

        .chip_select    = 0,

        .mode = SPI_MODE_0,

    },

};

static void spi_device_init(void)

{

    spi_register_board_info(m25p32_spi0_board_info,

                ARRAY_SIZE(m25p32_spi0_board_info));

}

spi_device_init function is called inside mx6_board_init after:

imx6q_add_ecspi(1, &mx6q_sabreauto_spi_data);

The result is that I don't see entry in /dev eg. /dev/spidevx.y as I would expect.

No matter how I change configuration of my board I always see entries /dev/spi-0 to /dev/spi-4 - don't know what it is.

$ find -name '*spi*'

./dev/spi-2

./dev/spi-0

./dev/spi-3

./dev/spi-1

./dev/spi-4

./proc/irq/64/spi_imx

./sys/devices/platform/imx6q-ecspi.1

./sys/devices/platform/imx6q-ecspi.1/spi_master

./sys/devices/platform/imx6q-ecspi.1/spi_master/spi1

./sys/devices/platform/imx6q-ecspi.1/spi_master/spi1/spi1.0

./sys/devices/platform/imx6q-ecspi.1/spi_master/spi1/spi1.0/spidev

./sys/devices/platform/imx6q-ecspi.1/spi_master/spi1/spi1.0/spidev/spidev1.0

./sys/bus/platform/devices/imx6q-ecspi.1

./sys/bus/platform/drivers/spi_imx

./sys/bus/platform/drivers/spi_imx/imx6q-ecspi.1

./sys/bus/spi

./sys/bus/spi/devices/spi1.0

./sys/bus/spi/drivers/spidev

./sys/bus/spi/drivers/spidev/spi1.0

./sys/class/spi_master

./sys/class/spi_master/spi1

./sys/class/spidev

./sys/class/spidev/spidev1.0

./sys/module/spidev

Additional information: I am using kernel 3.0.35, added in LTIB SPI suppport: "Freescale i.MX SPI controllers" and "User mode SPI device driver support".

Does anyone knows what am I doing wrong or what is missing in my configuration?

Thank in advance

Best regards

Rafal

Labels (2)
Tags (3)
0 Kudos
1 Reply

547 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi,

Everything seems to be correct. As far as I understand udev will have to create the node as long as it finds the spidev entry in the sysfs.

Only one thing I am not sure if 70MHz is a bit rate allowed. And looking at this post /dev/spidev not appearing on iMX6Q despite kernel configuration and modalias="spidev"

The customer problem was with the cs array.

I wonder if you can try that, let me know how it goes.

Best Regards,

Alejandro

0 Kudos