AnsweredAssumed Answered

Can't use spidev on i.MX53.

Question asked by ricardo sousa on Oct 30, 2013

Hello,

 

I'm trying to communicate with a LCD module via SPI on my i.MX53 NOVSOM module(BSP 11.09, kernel 2.6.35), but I'm failing on two dfferent ways. First of all: All the IOMUX configurations was done on mx53_xxx.c for the ECSPI1 interface. In order to use the spidev interface, I use the following structure:

 

static struct mxc_spi_master mxcspi1_data = {

  .maxchipselect = 4,

  .spi_version = 23,

  .chipselect_active = mx53_evk_gpio_spi_chipselect_active,

  .chipselect_inactive = mx53_evk_gpio_spi_chipselect_inactive,

};

 

 

static struct spi_board_info spi1_board_info[] __initdata = {

  {

  /* 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 SCK clock speed in HZ */

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

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

  .mode = SPI_MODE_1,

  }

};

 

After that, on ltib menuconfig, I enable the drivers that I'll need.

 

Problem 1:

 

When using mxc_spi and spidev modules, the inode is created on /dev, but when I try to write a byte and after read other three, I get this Oops:

 

root@freescale ~$ init_lcd /dev/spidev1.0

B0!!!

CSPI1: count=1 fifo_size=2048

CSPI Finish

RX_DATA0 = 0x0

data IN = 0x0

Unable to handle kernel NULL pointer dereference at virtual address 00000000

pgd = 80004000

[00000000] *pgd=00000000

Internal error: Oops: 17 [#1] PREEMPT

last sysfs file: /sys/kernel/uevent_seqnum

Modules linked in: spidev mxc_spi

CPU: 0    Not tainted  (2.6.35.3-850-gbc67621-g74af6dc-dirty #190)

PC is at mxc_spi_buf_rx_u16+0x24/0x50 [mxc_spi]

LR is at mxc_spi_buf_rx_u16+0x18/0x50 [mxc_spi]

pc : [<7f000268>]    lr : [<7f00025c>]    psr: 40000013

sp : 954b3f20  ip : 968ba000  fp : 00000000

r10: 00000000  r9 : 00000000  r8 : 00000004

r7 : 00000000  r6 : 95489118  r5 : 00000000  r4 : 00000000

r3 : 954b3f2c  r2 : 954b3f14  r1 : 7f001093  r0 : 7f0010a7

Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel

Control: 10c5387d  Table: 853f0019  DAC: 00000017

Process mxc_spi.0 (pid: 1906, stack limit = 0x954b22e8)

Stack: (0x954b3f20 to 0x954b4000)

3f20: 95489118 954a9f1c 95489600 00000001 00000004 7f000828 954a9f1c 00000000

3f40: 95489118 954a9f10 954a9ef0 ffffffff 95489600 802513f4 804c1870 954b2000

3f60: 7f0001ac 9548912c 95259ea0 95259ea0 954b2000 95259ea8 80251270 954b3f94

3f80: 95489120 00000000 9548911c 80069bc0 95212000 00000000 95212000 8006d51c

3fa0: 954b3fa0 954b3fa0 00000000 9543fe10 954b3fd4 80069a4c 95259ea0 00000000

3fc0: 00000000 00000000 00000000 8006d1f8 00000000 00000000 954b3fd8 954b3fd8

3fe0: 00000000 9543fe10 8006d180 8002c9c8 00000013 8002c9c8 707e7021 707e7421

[<7f000268>] (mxc_spi_buf_rx_u16+0x24/0x50 [mxc_spi]) from [<7f000828>] (mxc_spi_poll_transfer+0x12c/0x1bc [mxc_spi])

[<7f000828>] (mxc_spi_poll_transfer+0x12c/0x1bc [mxc_spi]) from [<802513f4>] (bitbang_work+0x184/0x30c)

[<802513f4>] (bitbang_work+0x184/0x30c) from [<80069bc0>] (worker_thread+0x174/0x218)

[<80069bc0>] (worker_thread+0x174/0x218) from [<8006d1f8>] (kthread+0x78/0x80)

[<8006d1f8>] (kthread+0x78/0x80) from [<8002c9c8>] (kernel_thread_exit+0x0/0x8)

Code: eb4e16c7 e5965050 e59f0024 e1a04005 (e1d510b0)

---[ end trace 2d71ca80cc18c456 ]---

 

 

Problem 2:

 

If I try to use spi_imx instead of mxc_spi, the /dev entry isn't created!

 

Can somebody help me? I think that Problem 2 is easier to solve than 1, so anybody could give me a hint?

 

 

Best Regards,

Ricardo Gurgel

Outcomes