[<prev] [next>] [day] [month] [year] [list]
Message-Id: <B4201E8C-196E-47A9-8AD5-97109CE5A991@gmail.com>
Date: Thu, 18 Aug 2016 13:47:56 +0200
From: Jonatan Magnusson <jonatan.magnusson@...il.com>
To: broonie@...nel.org, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org, samuel.ortiz@...ia.com,
juha.yrjola@...ia.com
Subject: omap2-mcspi, invalid SPI data received
Hi,
I have this problem that originally started when I tried to use an ENC28J60 device on a Beaglebone (Beaglebone Green Wireless). I noted that while reading one register on the device (EREVID) the value was 0x3C. That register holds the hardware revision and should not be higher than 6 or possibly 7. So I started investigating the code and to make a long story short I ended up writing this silly loop that continuously reads and prints out EREVID:
for(;;) {
printk(KERN_ALERT "REV: 0x%02x\n", nolock_regb_read(priv, EREVID));
}
It reports 0x3C every time so it’s not completely random. If I force the pin to 0V i get 0x00 instead, and 0xFF if I force the pin to 3.3V. That should mean that the hardware config and pinmux is correct, since otherwise it would not change anything if I manipulate the pin.
With this loop active I could investigate what happens with a scope and to my surprise both the sent byte and the received byte are what to be expected: 0x12 and 0x06. But somehow the SPI driver still reads 0x3C instead of 0x06.
Here’s two screenshots from the scope: https://dl.dropboxusercontent.com/u/176615/erevid.png
The first shows clock and mosi, the second clock and miso.
I’ve tried to track the error and got as far as drivers/spi/spi-omap2-mcspi.c, function omap2_mcspi_txrx_pio. Around line 715, readl_relaxed returns 0x3C.
Any ideas?
Best regards,
Jonatan Magnusson
Powered by blists - more mailing lists