imx53 L2.6.35_11.09.01 linux-2.6.35.3
if I use transport test , I can transport buf to spi slave,
transport test:
st[ 1 ].tx_buf = buf;
st[ 1 ].len =1;
but when I use receive test, I can receive any message, the spi bus is always 0x80.when I insmod module,the system is crash and print cann't use tx_buf = NULL .
receive test:
st[ 1 ].rx_buf = buf;
st[ 1 ].len =1;
setup spi :
8bit/w 15000000kbps
also I cann't find "mxc_spi_buf_tx_u8" in my linux code.
kernel print:
[fkuexl]#insmod ads7846.ko
ads7846 probe start
mxc_spi_setup: mode 0, 8 bpw, 1500000 hz
setup mode 0, 8 bits/w, 1500000 Hz max --> 0
ads7846 spi2.0: touchscreen, irq 128
spi_sync 111
xfer_len=8 master_drv_data->usedma=1
mxc_spi_pio_transfer tx=cf325800,rx=0,len=1
transfer.count =1
transfer.rx_count=1
spi_sync 222=0
clk
transfer.count=0
mxc_spi_pio_transfer tx=0,rx=cf325804,len=2
transfer.count =2
transfer.rx_count=2
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/devices/virtual/gsl_kmod/gsl_kmod/dev
Modules linked in: ads7846(+)
CPU: 0 Not tainted (2.6.35.3-1129-g691c08a-fkuexl #255)
PC is at mxc_spi_buf_tx_u8+0x8/0x14
LR is at mxc_spi_pio_transfer+0x110/0x1ec
pc : [<802d64a8>] lr : [<802d74f8>] psr: 80000013
sp : cf0a3f20 ip : d0936000 fp : d0876004
r10: 00000001 r9 : d0876000 r8 : 00000002
r7 : 00000000 r6 : cf0f3518 r5 : cf0f3600 r4 : cf325858
r3 : 00000000 r2 : cf0f3518 r1 : 807f91fa r0 : cf0f3518
Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387d Table: bf3bc019 DAC: 00000017
Process mxc_spi.1 (pid: 225, stack limit = 0xcf0a22e8)
Stack: (0xcf0a3f20 to 0xcf0a4000)
3f20: 802d73e8 cf0f3600 cf325858 cf0a2000 cf325828 cf325808 cf0f3600 cf0f3518
3f40: 00000000 802d6594 cf325858 00000000 cf0a2000 802d49e0 cf0a2000 ffffffff
3f60: 802d6564 cf0f352c cf0e4cc0 cf0a2000 cf0e4cc0 cf0e4cc8 802d4870 cf0a3f94
3f80: cf0f3520 00000000 cf0f351c 800c0248 cf0a2000 00000000 cf1b65c0 800c3b10
3fa0: cf0a3fa0 cf0a3fa0 00000000 cf039e78 cf0a3fd4 800c00cc cf0e4cc0 00000000
3fc0: 00000000 00000000 00000000 800c37dc 00000000 00000000 cf0a3fd8 cf0a3fd8
3fe0: 00000000 cf039e78 800c3764 800899c0 00000013 800899c0 5a999cc1 5a899cc9
[<802d64a8>] (mxc_spi_buf_tx_u8+0x8/0x14) from [<802d74f8>] (mxc_spi_pio_transfer+0x110/0x1ec)
[<802d74f8>] (mxc_spi_pio_transfer+0x110/0x1ec) from [<802d6594>] (mxc_spi_transfer+0x24/0x28)
[<802d6594>] (mxc_spi_transfer+0x24/0x28) from [<802d49e0>] (bitbang_work+0x170/0x2e0)
[<802d49e0>] (bitbang_work+0x170/0x2e0) from [<800c0248>] (worker_thread+0x17c/0x228)
[<800c0248>] (worker_thread+0x17c/0x228) from [<800c37dc>] (kthread+0x78/0x80)
[<800c37dc>] (kthread+0x78/0x80) from [<800899c0>] (kernel_thread_exit+0x0/0x8)
Solved! Go to Solution.
Hi ,
You can try to modify drivers/spi/mxc_spi.c. Change the MXC_SPI_BUF_TX(type) as below. Hope this helps.
#define MXC_SPI_BUF_RX(type) \
void mxc_spi_buf_rx_##type(struct mxc_spi *master_drv_data, u32 val)\
{\
type *rx = master_drv_data->transfer.rx_buf;\
if(rx) { \
*rx++ = (type)val;\
master_drv_data->transfer.rx_buf = rx;\
} \
}
#define MXC_SPI_BUF_TX(type) \
u32 mxc_spi_buf_tx_##type(struct mxc_spi *master_drv_data)\
{\
u32 val;\
const type *tx = master_drv_data->transfer.tx_buf;\
if(tx) { \
val = *tx++;\
master_drv_data->transfer.tx_buf = tx;\
return val;\
} \
master_drv_data->transfer.count -= sizeof(type);\
return 0;\
}
You forgot to mention the FSL processor you are using, BSP version, etc :-)
I have update some informations.can you help me?
Hi,
I found that the spi could not work normally when i modified the file as above. Try to port drivers/spi/spi_imx.c to your current kernel from a higher version of kernel, such as linux-3.0.35.
Sorry for the mistake.
Hi,
I'm with the same issue with the SPI on i.MX53. On my BSP, I have the spi_imx module ported, but, when I probe it, the inode /dev/spixxx isn't created. Do you have more hints about the usage of spi_imx on kernel 2.6.35?
Hi ,
I'm using imx51. I ported the spi_imx from linux-3.0.35(the kernel for imx6) to kernel 2.6.35. There is no /dev/sipXX, but I can operate through SPI normally in the driver layer.
Hi ,
You can try to modify drivers/spi/mxc_spi.c. Change the MXC_SPI_BUF_TX(type) as below. Hope this helps.
#define MXC_SPI_BUF_RX(type) \
void mxc_spi_buf_rx_##type(struct mxc_spi *master_drv_data, u32 val)\
{\
type *rx = master_drv_data->transfer.rx_buf;\
if(rx) { \
*rx++ = (type)val;\
master_drv_data->transfer.rx_buf = rx;\
} \
}
#define MXC_SPI_BUF_TX(type) \
u32 mxc_spi_buf_tx_##type(struct mxc_spi *master_drv_data)\
{\
u32 val;\
const type *tx = master_drv_data->transfer.tx_buf;\
if(tx) { \
val = *tx++;\
master_drv_data->transfer.tx_buf = tx;\
return val;\
} \
master_drv_data->transfer.count -= sizeof(type);\
return 0;\
}