/dev/spidev not appearing on iMX6Q despite kernel configuration and modalias="spidev"

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

/dev/spidev not appearing on iMX6Q despite kernel configuration and modalias="spidev"

Jump to solution
4,052 Views
muthuswamydiksh
Contributor II

I am using iMX6Q with BSP L3.0.35_4.1.0.

I configured the kernel in imx6_defconfig.dev as

CONFIG_SPI_SPI_DEV=y 

CONFIG_SPI=y

CONFIG_SPI_MASTER=y

I modified the /arch/arm/mach-mx6/board-*.c file.

I did the following changes.

1.

IOMUX for chip select.

static int mx6q_spi_cs[] = {

        -1, IS THIS A PROMLEM? I want to use SS of ecspi.

};

2.

static const struct spi_imx_master e25_mx6q_spi_data __initconst = {

        .chipselect     = e25_mx6q_spi_cs,

        .num_chipselect = ARRAY_SIZE(e25_mx6q_spi_cs),

};

3.

static struct spi_board_info my_spi5_board_info[] __initdata = {

        {

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

                .modalias       = "spidev",

                .max_speed_hz   = 10000000,

                .bus_num        = 4,

                .chip_select    = 0,

                .platform_data  = NULL,I

        },

};

4.

        imx6q_add_ecspi(4, &mx6q_spi_data);

        spi_device_init();

I tried to configure CS a GPIO nd gave teh corresponding GPIO number in the mc6q_spi_cs struct. But not luck.

Any pointers would be very helpful.

0 Kudos
Reply
1 Solution
2,411 Views
muthuswamydiksh
Contributor II

Move the post to i.MX Commnity.

I found the solution.

The port pin has to be correctly configured for the required chip select in IOMUX.

The array has to be:

static int mx6q_spi_cs[] = {

        -1,

        -1,

        -1,

};

three -1s are required here as i am using CS2. If you dig more into kernel spi code, you will find that size of the array mx6q_spi_cs has to be greater than your .chip_select field. With these changes, I can see /dev/spi4.2.

Hope this helps.

View solution in original post

0 Kudos
Reply
3 Replies
2,411 Views
Wlodek_D_
Senior Contributor II

Hello,

Thank you for your post, however please consider moving it to the right community place (e.g. i.MX Community ) to get it visible for active members.

For details please see general advice Where to post a Discussion?

Thank you for using Freescale Community.

0 Kudos
Reply
2,412 Views
muthuswamydiksh
Contributor II

Move the post to i.MX Commnity.

I found the solution.

The port pin has to be correctly configured for the required chip select in IOMUX.

The array has to be:

static int mx6q_spi_cs[] = {

        -1,

        -1,

        -1,

};

three -1s are required here as i am using CS2. If you dig more into kernel spi code, you will find that size of the array mx6q_spi_cs has to be greater than your .chip_select field. With these changes, I can see /dev/spi4.2.

Hope this helps.

0 Kudos
Reply
2,411 Views
muthuswamydiksh
Contributor II

I referred:

spidev

how open spidev on imx28 platform?

But still it is not appearing.

0 Kudos
Reply