Page 1 of 1

sama5D3 SPI failure

Posted: Wed Feb 08, 2017 3:52 pm
by Rami Rosenbaum
Hi,
I'm working on a custom board, based on the sama5D36.
I'm trying to get SPI0 working, after the kernel has booted, using spidev, but looking at the analyzer, the clock is garbage (and maybe MOSI as well).
at91bootstrap and u-boot-at91 work with SPI0 (they load the u-boot and Linux from the SPI flash) - SPI looks perfect on analyzer.
I followed the instructions of "Usage of SPI 0 and SPI 1": discussions/viewtopic.php/f,33/t,25273.html, but when insmod-ing spidev.ko I get the following panic:

Code: Select all

root@SparkGate:~# insmod spidev.ko
spidev spi32766.0: buggy DT: spidev listed directly in DT
------------[ cut here ]------------
WARNING: CPU: 0 PID: 877 at drivers/spi/spidev.c:730 spidev_probe+0x16c/0x1a8 [spidev]()
Modules linked in: spidev(+)
CPU: 0 PID: 877 Comm: insmod Not tainted 4.1.0-linux4sam_5.2-ShiraTech-00.02-SparkGate-svn9836 #52
Hardware name: Atmel SAMA5
[<c0013754>] (unwind_backtrace) from [<c0011740>] (show_stack+0x10/0x14)
[<c0011740>] (show_stack) from [<c001c9bc>] (warn_slowpath_common+0x74/0xac)
[<c001c9bc>] (warn_slowpath_common) from [<c001ca10>] (warn_slowpath_null+0x1c/0x24)
[<c001ca10>] (warn_slowpath_null) from [<bf000288>] (spidev_probe+0x16c/0x1a8 [spidev])
[<bf000288>] (spidev_probe [spidev]) from [<c02b090c>] (spi_drv_probe+0x5c/0x74)
[<c02b090c>] (spi_drv_probe) from [<c0259210>] (driver_probe_device+0x1c0/0x264)
[<c0259210>] (driver_probe_device) from [<c0259340>] (__driver_attach+0x8c/0x90)
[<c0259340>] (__driver_attach) from [<c0257aa0>] (bus_for_each_dev+0x54/0x88)
[<c0257aa0>] (bus_for_each_dev) from [<c025893c>] (bus_add_driver+0xd4/0x1d0)
[<c025893c>] (bus_add_driver) from [<c0259948>] (driver_register+0x78/0xf4)
[<c0259948>] (driver_register) from [<bf003074>] (spidev_init+0x74/0xbc [spidev])
[<bf003074>] (spidev_init [spidev]) from [<c00095bc>] (do_one_initcall+0x80/0x1d0)
[<c00095bc>] (do_one_initcall) from [<c04aa310>] (do_init_module+0x58/0x1a8)
[<c04aa310>] (do_init_module) from [<c005a978>] (load_module+0x1570/0x1b80)
[<c005a978>] (load_module) from [<c005b054>] (SyS_init_module+0xcc/0x11c)
[<c005b054>] (SyS_init_module) from [<c000f2a0>] (ret_fast_syscall+0x0/0x3c)
---[ end trace 0de491496f5b34c9 ]---
spidev spi32766.1: buggy DT: spidev listed directly in DT
------------[ cut here ]------------
I'm not sure if it's all due to the 'compatible' issue, and if so - if it's related to my problem.

Interesting, that if I send N bytes (echo -ne "123...N" > /dev/spidev32766.0), I see N bursts, but each is garbage.
My Linux is 4.1, linux4sam_5.2

Thanks

Re: sama5D3 SPI failure

Posted: Sat Feb 11, 2017 12:56 am
by blue_z
Rami Rosenbaum wrote:... when insmod-ing spidev.ko I get the following panic:
Where does it say that it is a panic?
That's not a kernel panic.
It's a warning message (with a stack backtrace) because you're using a kernel kludge (i.e. spidev) instead of a proper SPI protocol driver for the SPI slave device.
Look at the spidev source code, it's not fatal.

Regards