Find a file
Chuck Jordan df962d9a0e spi: Stability improvements to the DesignWare SPI driver
I've found many problems with the SPI driver and this repairs many of them.

The baud rate divisor was being derived from the CPU clock. But, some
targets may have a seperate clock attached to SPI. If the soc.h file
defines the symbol SPI_DW_SPI_CLOCK, it will use this instead
of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC for the baud rate calculation.

completed() had a mistake where it would terminate the SPI transaction
too early, well before the tx data has cleared the FIFO. I found I couldn't
drive an OLED display correctly because completed() was wrong.
The repair is to now consider a new flag called spi->last_tx,
which will be set after the TX interrupt occurs with nothing to send any
longer. There is also a while loop added to SPIN until BUSY drops.

Another improvement is that push_data will NOT consider RX fifo size
if there is no RX going on. The calculation here when RX is going on
could go negative. I've added a check for that and prevent TX handling
if RX buffer is full. I think that is the intention -- to deal with RX first
if its fifos are more full.

In spi_dw_transceive, if we are only doing spi_write w/o reading,
don't enable RX interrupts at all. The OLED I'm working with failed
to have a pull-up on MISO SPI signal. As a result, a huge number of
garbage RX events arrive, and the interrupt handler finds there is
no rx buffer, so it tosses the data. But this is a waist of realtime.
It seems WRONG to enable RX interrupts if its something your not using,
so software can GATE these spurious events in this way.

With these changes, SPI can be used much more reliably, with FIFOs
that are deeper, and SPI devices that only require TX.

Change-Id: I0fe0745f2381c61c8a19ce086496b422a32a30a5
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-05-21 00:48:16 +00:00
arch x86 exceptions: Fix _ExcEntSetupDone 2016-05-20 00:09:16 +00:00
boards spi: consalidate and simplify 2016-05-12 10:57:26 +00:00
doc doc: fix Arduino 101 documentation formatting issues 2016-05-20 16:18:38 +00:00
drivers spi: Stability improvements to the DesignWare SPI driver 2016-05-21 00:48:16 +00:00
include net: 6lowpan: Fix 6lowpan fragmentation 2016-05-19 14:18:38 +00:00
kernel kernel: catch overflowing kserver stack with asserts 2016-05-18 22:06:39 +00:00
lib build: move library related code to lib/ 2016-05-16 19:43:50 +00:00
misc misc: clean up __ASSERT warnings during build 2016-05-18 22:06:54 +00:00
net net: tcp: Fix the TCP client not sending multiple SYN 2016-05-20 12:59:08 +03:00
samples samples: Use GPIO_0 as the default instance 2016-05-20 10:54:06 -04:00
scripts toolchain/xtools: enhance include search path to sysroot 2016-05-17 20:09:50 +00:00
tests Bluetooth: tester: Fix handling execute write error responses 2016-05-20 11:31:33 +00:00
.checkpatch.conf checkpatch: change default kconfig help length warns 2016-05-11 20:23:51 +00:00
.gitattributes First commit 2015-04-10 16:44:37 -07:00
.gitignore build: rename non-generated linker scripts to .ld extension 2016-05-09 18:09:26 +00:00
.gitreview Add a .gitreview file 2016-02-20 14:25:01 +00:00
.mailmap mailmap: Fix a couple of incorrect git author names 2016-05-10 18:45:22 +00:00
Kbuild build: add more dependencies to build process 2016-05-20 18:25:19 +00:00
Kconfig kconfig: Do not put architecture in the title 2016-03-14 16:50:51 -04:00
Kconfig.zephyr tinycrypt: move from lib to regular objects 2016-05-16 19:43:50 +00:00
LICENSE add top level Apache 2.0 license file 2016-02-05 20:24:37 -05:00
Makefile misc: clean up __ASSERT warnings during build 2016-05-18 22:06:54 +00:00
Makefile.inc build: Do not depend on python while creating the relative path 2016-05-16 22:21:01 +00:00
zephyr-env.sh zephyr-env.sh: Add a note to indicate the required version of zsh 2016-03-18 22:01:19 +00:00