how open spidev on imx28 platform?

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

how open spidev on imx28 platform?

Jump to solution
4,604 Views
yongkimin
Contributor III

Hi I developing on imx28 platform. I'm using ltib version is L2.6.35_10.12.01.

I did my effort to open spidev I did study on this community. But in my case not opened.

I did

  1. I modify the name to spidev my code mx28evk.c in /arch/arm/mach-mx28 directory
    static struct spi_board_info spi_board_info[] __initdata = {
    #if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
      {
      /* the modalias must be the same as spi device driver name */
      .modalias = "spidev", /* Name of spi_driver for this device */
      .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */

      .bus_num = 1, /* Framework bus number */
      .chip_select = 0, /* Framework chip select. */
      .platform_data = &mx28_spi_flash_data,
      },
    #endif
    };

  2. configuration of spi is
    ./config/platform/imx/imx28evk_defconfig.dev:1053:CONFIG_SPI_SPIDEV=m
  3. in terminal of my device
    root@freescale /module_test$ cat /sys/bus/spi/devices/spi1.0/modalias
    spidev

  4. my application try open "/dev/spidev1.0"
    error return is can't open spidev device,(-1),(No such file or directory)

Who can tell me how open it?

Labels (2)
0 Kudos
1 Solution
2,142 Views
yongkimin
Contributor III

I solved it I hope this help to others.

  • check the configuration (I recommend it should be y not m)
    SPI support – CONFIG_SPI=y

Freescale MXS SPI controller – CONFIG_SPI_MXS=y

User mode SPI device driver support – CONFIG_SPI_SPIDEV=y

  • check also the configuration in /rpm/BUILD/linux/arch/arm/config/
  • change the spi_board_info in mx28evk.c
    static struct spi_board_info spi_devboard_info[] __initdata = {

#if defined(CONFIG_SPI_MXS) || defined(CONFIG_SPI_MXS_MODULE)

  {

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

  .modalias = "spidev", /* Name of spi_driver for this device */

  .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */

  .bus_num = 1, /* Framework bus number */

  .chip_select = 0, /* Framework chip select. */

  .mode = SPI_MODE_0,

  },

#endif

};

static void spi_device_init(void)

{

#if 0

  spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));

#else

  spi_register_board_info(spi_devboard_info, ARRAY_SIZE(spi_devboard_info));

  printk(KERN_INFO "register (spi_devboard_info) \n");

#endif

  • after update uImage rebuilt check if spidev_init log you add it.

after update of uImage I can see the /dev/spidev1.0

Thanks.



View solution in original post

0 Kudos
8 Replies
2,142 Views
shashikanthirem
Contributor III

hello suppose if you have two SPI

SSP1_SS0

 SSP2_SS1

 SSP2_SS3

how you will create three spidev1.0 , spidev2.1, and spidev2.3

Only one am able to create 

0 Kudos
2,142 Views
shashikanthirem
Contributor III

yes now I got the spidev1.0,2.0

but unable to pass the spidev test function , unable to transfer:invalid argument

I am using 2.6.35.3 kernel linux

any patch?/ solution

0 Kudos
2,142 Views
monicachiosa
Contributor I

Hey Min,

I have tried the same as you did, but without successful.

I have the same configuration in kernelconfig file, but in the file from linux/arch/arm/config/ CONFIG_SPI_MXS=m. I don`t know if this is the issue or not.

Have you installed some special patches for spidev for imx28.


I am using TQMA28 module and I want to enable and to use the SSP2. The module has on it imx287.


Thanks,

Monica

2,143 Views
yongkimin
Contributor III

I solved it I hope this help to others.

  • check the configuration (I recommend it should be y not m)
    SPI support – CONFIG_SPI=y

Freescale MXS SPI controller – CONFIG_SPI_MXS=y

User mode SPI device driver support – CONFIG_SPI_SPIDEV=y

  • check also the configuration in /rpm/BUILD/linux/arch/arm/config/
  • change the spi_board_info in mx28evk.c
    static struct spi_board_info spi_devboard_info[] __initdata = {

#if defined(CONFIG_SPI_MXS) || defined(CONFIG_SPI_MXS_MODULE)

  {

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

  .modalias = "spidev", /* Name of spi_driver for this device */

  .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */

  .bus_num = 1, /* Framework bus number */

  .chip_select = 0, /* Framework chip select. */

  .mode = SPI_MODE_0,

  },

#endif

};

static void spi_device_init(void)

{

#if 0

  spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));

#else

  spi_register_board_info(spi_devboard_info, ARRAY_SIZE(spi_devboard_info));

  printk(KERN_INFO "register (spi_devboard_info) \n");

#endif

  • after update uImage rebuilt check if spidev_init log you add it.

after update of uImage I can see the /dev/spidev1.0

Thanks.



0 Kudos
2,142 Views
tongchunyang
Contributor III

Hi Min

Thanks for your helpful information about this desicussion.

Now I have the same problem with imx28.

And I have found the /dev/spidev1.0 by your work.

Now there is no spi device on the imx28, so I think test spidev by using mxc_spi_test.out could failed.

----------------------------------

root@freescale /unit_tests$ ./mxc_spi_test1.out -D 0 -s 1000000 -b 8 E6E0

Execute data transfer test: 0 4 E6E0

spi mode: 0

bits per word: 8

max speed: 1000000 Hz (1000 KHz)

Failed transferring data: 22

-----------------------------------

0 Kudos
2,142 Views
yongkimin
Contributor III

Dear Tong,

I don't know "mxc_spi_test1.out" pls understand me. I did test with spidev_test.c in /document/spi directory.

You can understand that. My application use that and works is good. If your HW is have no problem then you get good result.

Thanks.

0 Kudos
2,142 Views
shashikanthirem
Contributor III

I got the spidev1.0,2.0

 

but unable to pass the spidev test function , unable to transfer:invalid argument -22

 

I am using 2.6.35.3 kernel linux

Can you tell me where to debug

0 Kudos
2,142 Views
tongchunyang
Contributor III

Hi Min

Thanks a lot.

I am confirming my problem now. Need to connect another device to test I think...

Thank you again:smileyhappy:

0 Kudos