iMX28 SPI multipble Chip select

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

iMX28 SPI multipble Chip select

2,243件の閲覧回数
TimWoodham
Contributor I

Hi All,

 

I've been working with the SPI and have it working correctly for SPI2 and SPI3 which is great using the SPIDEV driver which exposes, /dev/spidev1.0 and /dev/spidev 2.0.  But whatever I do I can only get CS0 to be available, the following CS1 and CS2 won't appear as SPIDEV ports.  I've set the MAX devices from 1 to 3 and the load of the drivers notes that it finds 2 CS per SPI port but the spidev driver won't attached.

 

I've noticed on the forums.freescale.com site that someone else has come across this issue where they had trouble exposing the other 2 chip selects of the 3 that are supposed to be available.  If anyone has any experience that could assist, i'd be happy to hear.

 

forums.freescale.com SPI links

http://forums.freescale.com/t5/i-MX-Microprocessors/i-MX28-and-SPI-running-linux-2-6-35-3/td-p/80427

and

http://forums.freescale.com/t5/i-MX-Microprocessors/using-spi-with-spidev-on-imx28-evk/td-p/77725

 

I'm working with the iMX28 2.6.35 freescale EVK ltib image.

 

Thanks,.

Tim

ラベル(1)
0 件の賞賛
返信
4 返答(返信)

1,309件の閲覧回数
monicachiosa
Contributor I

Hello Tim,

You said that your SPI (SSP2 and SSP3) works just fine with one chip select.

Can you telll me how did you manage to enable the driver for the spi communication?

And for the code, did you use C programming ?

I have tried several variants found on forums, but I got nothing in /dev.

Thanks,

  Monica

0 件の賞賛
返信

1,309件の閲覧回数
polestar
Contributor I

Same problem here:

If each one of them is in separate bus (SSP2 and SSP3), for example?

  • I've edited my board info like this in mx28evk.c:

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 = "m25p80", /* 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

  {

  .modalias = "spidev",

  .max_speed_hz = 20000000,

  .bus_num = 2,

  .chip_select = 0,

  .mode = SPI_MODE_0,

  },

};



  • in addition I've added support for SSP3 in device.c:


static struct mxs_spi_platform_data spi1_data = {

  .clk = "ssp.3",

  .slave_mode = 0,

};

static struct resource ssp3_resources[] = {

  {

  .start = SSP3_PHYS_ADDR,

  .end = SSP3_PHYS_ADDR + 0x2000 - 1,

  .flags = IORESOURCE_MEM,

  }, {

  .start = MXS_DMA_CHANNEL_AHB_APBH_SSP3,

  .end = MXS_DMA_CHANNEL_AHB_APBH_SSP3,

  .flags = IORESOURCE_DMA,

  }, {

  .start = IRQ_SSP3_DMA,

  .end = IRQ_SSP3_DMA,

  .flags = IORESOURCE_IRQ,

  }, {

  .start = IRQ_SSP3,

  .end = IRQ_SSP3,

  .flags = IORESOURCE_IRQ,

  },

};

static void __init mx28_init_spi1(void)

{

  struct platform_device *pdev;

  pdev = mxs_get_device("mxs-spi", 1);

  if (pdev == NULL || IS_ERR(pdev))

  return;

  pdev->resource = ssp3_resources;

  pdev->num_resources = ARRAY_SIZE(ssp3_resources);

  pdev->dev.platform_data = &spi1_data;

  mxs_add_device(pdev, 3);

}



  • and, of course, defined the SSP3 pins in mx28evk_pins.c:

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

static struct pin_desc mx28evk_spi_pins[] = {

  {

  .name = "SSP2 MOSI",

  .id = PINID_SSP2_MOSI,

  .fun = PIN_FUN1,

  .strength = PAD_4MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

  {

  .name = "SSP2 MISO",

  .id = PINID_SSP2_MISO,

  .fun = PIN_FUN1,

  .strength = PAD_4MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

  {

  .name = "SSP2 SCK",

  .id = PINID_SSP2_SCK,

  .fun = PIN_FUN1,

  .strength = PAD_4MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

  {

  .name = "SSP2 SS0",

  .id = PINID_SSP2_SS0,

  .fun = PIN_FUN1,

  .strength = PAD_8MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

  {

  .name = "SSP3 MOSI",

  .id = PINID_SSP3_MOSI,

  .fun = PIN_FUN1,

  .strength = PAD_4MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

  {

  .name = "SSP3 MISO",

  .id = PINID_SSP3_MISO,

  .fun = PIN_FUN1,

  .strength = PAD_4MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

  {

  .name = "SSP3 SCK",

  .id = PINID_SSP3_SCK,

  .fun = PIN_FUN1,

  .strength = PAD_4MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

  {

  .name = "SSP3 SS0",

  .id = PINID_SSP3_SS0,

  .fun = PIN_FUN1,

  .strength = PAD_8MA,

  .voltage = PAD_3_3V,

  .drive = 1,

  },

};

#endif

But still SPIDEV won't create the device driver...

The m25p80 is working fine though...

Thanks a lot for anyone's help with this.....

0 件の賞賛
返信

1,309件の閲覧回数
eik
Contributor I

Hi Tim,

How do you enable the SPI3? I am trying to work with but I am not able to enable it. In fact, I have a SPI flash in the SPI2 working correctly, but for me it is impossible to work with SPI3.

Thanks.

Héctor

0 件の賞賛
返信

1,309件の閲覧回数
darron
Contributor I

I was the responder on that first SPI link.  I ended up with a custom driver, so I just control the chip selects in my driver.  In fact, I've encoded CS0-2 as 8 chip selects from "000" through "111" using GPIO. I have a mutex to ensure only one chip select is active at a time.

 

I could not get the actual devices exposed, and it turned out I needed to be in kernel space anyway.

0 件の賞賛
返信