UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor ekigwana
Visitor
9,071 Views
Registered: ‎07-15-2015

RE: Linux 4.x. Has anyone found a solution to SPI driver crashes? Specifically spidev on top of spi-xilinx

Jump to solution

All attempts to access any spidev result in this

 

[  373.497956] Unhandled fault: imprecise external abort (0x1406) at 0x00df35e8
[  373.497965] pgd = c0004000
[  373.497970] [00df35e8] *pgd=00000000
[  373.497980] Internal error: : 1406 [#1] PREEMPT SMP ARM
[  373.500458] Modules linked in:
[  373.502201] CPU: 0 PID: 502 Comm: spi32764 Not tainted 4.0.0-xilinx-adi-g4de595d #1
[  373.508530] Hardware name: Xilinx Zynq Platform
[  373.511744] task: ee958e40 ti: eea0e000 task.ti: eea0e000
[  373.515833] PC is at xspi_read32+0x8/0x10
[  373.518517] LR is at xilinx_spi_txrx_bufs+0x170/0x26c
[  373.522249] pc : [<c03293ec>]    lr : [<c0329718>]    psr: 20050013
               sp : eea0feb0  ip : 00000000  fp : 00000000
[  373.531099] r10: ee336c80  r9 : 00000086  r8 : 00000001
[  373.535006] r7 : 00000010  r6 : 00000026  r5 : 00000003  r4 : ee8e2a60
[  373.540213] r3 : 000000ff  r2 : 00000001  r1 : 00000000  r0 : f012006c
[  373.545424] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[  373.551412] Control: 18c5387d  Table: 2e3bc04a  DAC: 00000015
[  373.555838] Process spi32764 (pid: 502, stack limit = 0xeea0e210)
[  373.560612] Stack: (0xeea0feb0 to 0xeea10000)
[  373.563653] fea0:                                     2318fa36 ee8e2a88 eefde6c0 ee336c80
[  373.570511] fec0: 00000000 ee115ee0 ee978800 ee8e2a60 00000001 c069c06c 00000000 c0328a3c
[  373.577368] fee0: 00000000 ee8e2800 00000000 ee8e2a04 ee115ee0 00000001 eea0e000 00000001
[  373.584225] ff00: ee8e29e0 00000000 ee8e2800 c03267dc ee959104 c068ce70 eea0e000 00000000
[  373.591082] ff20: ee8e29dc ee8e29f4 00000000 ee8e29dc eea0e000 00000001 ee8e29e0 00000000
[  373.597939] ff40: 00000000 c0042ea0 ee958e40 00000000 eeabd380 ee8e29dc c0042e00 00000000
[  373.604796] ff60: 00000000 c0042de8 ee996680 00000000 eea0ff70 ee8e29dc 00000000 00000000
[  373.611654] ff80: eea0ff80 eea0ff80 00000000 00000000 eea0ff90 eea0ff90 eea0ffac eeabd380
[  373.618511] ffa0: c0042d0c 00000000 00000000 c000f380 00000000 00000000 00000000 00000000
[  373.625368] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  373.632225] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 ffffffff
[  373.639092] [<c03293ec>] (xspi_read32) from [<c0329718>] (xilinx_spi_txrx_bufs+0x170/0x26c)
[  373.646118] [<c0329718>] (xilinx_spi_txrx_bufs) from [<c0328a3c>] (spi_bitbang_transfer_one+0x9c/0x240)
[  373.654190] [<c0328a3c>] (spi_bitbang_transfer_one) from [<c03267dc>] (__spi_pump_messages+0x37c/0x4cc)
[  373.662265] [<c03267dc>] (__spi_pump_messages) from [<c0042ea0>] (kthread_worker_fn+0xa0/0xf0)
[  373.669553] [<c0042ea0>] (kthread_worker_fn) from [<c0042de8>] (kthread+0xdc/0xf4)
[  373.675806] [<c0042de8>] (kthread) from [<c000f380>] (ret_from_fork+0x14/0x34)
[  373.681703] Code: e5845000 e8bd8038 e5903000 f57ff04f (e1a00003) 
[  373.686479] ---[ end trace e134e2e095c07284 ]---

 

The crash is triggered by running linux/Documentation/spi/spidev_test.c from the kernel.

zynq_gentoo spi # ./spidev_test -D /dev/spidev32761.0

 

Nothing special just default. That happens to point to an ADT7320.

 

I get the following response with 3.19:

 

spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00 
00 80 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 00 00 00 00 00 
00 01 40 00 00 A0 
00 00

 

Any later kernels cause a crash.

 

I asked for some help from ADI folks and was pointed this way.

 

Apparently ...

 

"It looks as if the crash happens when the RX FIFO register is accessed. Even though the core documentation states that a empty RX FIFO read should not result AXI bus error, this is the only reason I could imagine why that happens. It's not clear though why the driver would try to read a empty FIFO in the first place.

 

As a workaround for now I recommend to use the v3.19 version of the driver:

git checkout v3.19 drivers/spi/spi-xilinx.c"

 

I am going to try the suggestion in the meantime. Assistance in resolving this matter is appreciated. I need drivers in 4.0 series that are not 3.19 and I heavily use the spidev driver

 

Thank,

 

Ed

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Visitor ekigwana
Visitor
17,025 Views
Registered: ‎07-15-2015

Re: RE: Linux 4.x. Has anyone found a solution to SPI driver crashes? Specifically spidev on top of spi-xilinx

Jump to solution

Hi all,


I was unable to get response from Xilinx so I contacted the maintainer Ricardo Ribalda Delgado and he was able to help me troubleshoot the issue. I am sure he'll put out a patch soon but in the mean time.

It appears that this piece breaks it all:

 

xspi->write_fn(XSPI_INTR_TX_EMPTY, xspi->regs + XIPIF_V123B_IISR_OFFSET);

Hang tight for the officail patch. Until then, here you go.

 

Regards

 

Ed

2 Replies
Highlighted
Visitor ekigwana
Visitor
17,026 Views
Registered: ‎07-15-2015

Re: RE: Linux 4.x. Has anyone found a solution to SPI driver crashes? Specifically spidev on top of spi-xilinx

Jump to solution

Hi all,


I was unable to get response from Xilinx so I contacted the maintainer Ricardo Ribalda Delgado and he was able to help me troubleshoot the issue. I am sure he'll put out a patch soon but in the mean time.

It appears that this piece breaks it all:

 

xspi->write_fn(XSPI_INTR_TX_EMPTY, xspi->regs + XIPIF_V123B_IISR_OFFSET);

Hang tight for the officail patch. Until then, here you go.

 

Regards

 

Ed

Visitor ekigwana
Visitor
8,834 Views
Registered: ‎07-15-2015

Re: RE: Linux 4.x. Has anyone found a solution to SPI driver crashes? Specifically spidev on top of spi-xilinx

Jump to solution

Final follow up with patches that include explanations. Apply as follows ...

git am bar.patch
git am foo.patch

 

0 Kudos