zephyr/drivers
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
..
adc adc: unify kconfig variables and make them consistent 2016-05-12 10:57:25 +00:00
aio aio: unify kconfig variables and make them consistent 2016-05-12 10:57:24 +00:00
bluetooth drivers/nble: Skip not matched UIIDs in GATT discovery 2016-05-20 11:06:52 +00:00
clock_control stm32: rename SOC_STM32F1X -> SOC_SERIES_STM32F1X 2016-04-18 21:24:58 +00:00
console console: shell: Print empty string if no help is passed 2016-05-20 16:08:21 +03:00
counter counter/qmsi: use new DEVICE_AND_API_INIT() 2016-04-28 01:03:38 +00:00
ethernet eth_dw: use sys log interface for debugging 2016-05-12 10:57:27 +00:00
flash qmsi: flash: use built-in qmsi driver 2016-04-22 20:55:36 -04:00
gpio gpio_k64.c: configure pins as gpio alternate function in gpio_k64_configure() 2016-05-17 15:44:35 +00:00
grove grove: add temperature sensor 2016-05-12 12:11:04 +00:00
i2c i2c: unify kconfig options and share them across drivers 2016-05-12 10:57:22 +00:00
ieee802154 ieee802154: cc2520: SPI workaround when QMSI drivers are in use 2016-05-04 13:47:17 +00:00
interrupt_controller arc: early init should invalidate d-cache and set vector table 2016-05-11 11:10:52 +00:00
ipm ipm: convert to use DEVICE_AND_API_INIT() 2016-04-15 22:06:16 +00:00
pci kconfig: use menuconfig for PCI options 2016-03-29 01:31:52 +00:00
pinmux pinmux_dev: Remove PINMUX_SELECT_REGISTER from quark_mcu driver 2016-05-04 13:53:00 +00:00
pwm pwm/qmsi: use new DEVICE_AND_API_INIT() 2016-04-28 01:03:39 +00:00
qmsi aio: unify kconfig variables and make them consistent 2016-05-12 10:57:24 +00:00
random Fixed file description and applied doxygen style 2016-02-05 20:24:58 -05:00
rtc rtc: unify kconfig variable names 2016-05-12 10:57:24 +00:00
sensor sensor: add support for BME280 2016-05-17 20:07:34 +00:00
serial drivers: uart_qmsi: Re-enable HW FC for arduino_101 & quark_se_devboard 2016-04-25 11:42:50 +00:00
shared_irq refactor common driver initialization priorities 2016-03-28 15:58:29 -07:00
spi spi: Stability improvements to the DesignWare SPI driver 2016-05-21 00:48:16 +00:00
timer arc: clarify in comment that ARC must have timer0 2016-05-09 20:56:51 +00:00
watchdog watchdog: unify kconfig variables 2016-05-12 10:57:24 +00:00
Kconfig drivers: Renaming directory "802.15.4" into "ieee802154" 2016-04-07 17:24:55 +00:00
Makefile aio: build only when driver is configured in 2016-04-25 17:01:48 +00:00