zephyr/drivers
Laurentiu Palcu 27a3f8bb10 spi: dw: arc: add delay between writing DR strobe bit and reading FIFO
According to documentation, there must be at least one cycle delay
between two consecutive writes of the DR register. Apparently, this is
true for reading too, though undocumented.

The read_dr() inline function is called as follows:

*(spi->rx_buf) = read_dr(info->regs);

which the compiler, with full optimizations on, turns it into:

ld_s       r2,[r1,24]       <- the spi->rx_buf
sr         0x80000000,[r4]  <- this is the strobe bit write !!!
lr         r4,[r4]          <- this is the FIFO read!!!
stb        r4,[r2]          <- store the result

Unfortunately, the read from the FIFO is always 0 since the FIFO data is
not yet available.

During my investigations, I found that the following code works:

sys_out32(1 << 31, info->regs + 0xd);
*(spi->rx_buf) = sys_in32(info->regs + 0xd);

This does, basically, the same thing. But the compiler inserts an
instruction in between the write/read:

sr         0x80000000,[r4] <- write of the strobe bit!!!
ld_s       r2,[r1,24]      <- the pointer goes to r2
lr         r4,[r4]         <- read from FIFO!!!
stb        r4,[r2]         <- store the result

A single clock cycle between writing the register and reading seems
to be enough for the data to become available for reading.

This patch adds a nop in the read_dr() inline function.

Change-Id: I0c216d5738d5771835b1052e2e83363e8e3abf0c
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-03-12 03:18:54 +00:00
..
802.15.4 cc2520: Generate a mac address in the driver 2016-03-11 07:26:11 +00:00
adc drivers/adc: fix QMSI ADC config options dependency 2016-03-10 13:28:42 +00:00
aio aio: QMSI analog comparator driver 2016-03-12 03:17:59 +00:00
bluetooth uart: add ISR callback mechanism for UART drivers 2016-03-05 13:37:57 +00:00
clock_control clock_control/Kconfig: fix quark_se dependencies 2016-03-08 16:47:48 +00:00
console uart: add ISR callback mechanism for UART drivers 2016-03-05 13:37:57 +00:00
ethernet eth_dw: fix compilation issue in eth_dw.c driver 2016-02-05 20:25:31 -05:00
flash flash: Use off_t for offset parameters 2016-03-11 01:09:56 +00:00
gpio arm: Add GPIO interrupt/callback support for K64F 2016-03-09 12:54:02 +00:00
grove device: use DEVICE_INIT everwhere 2016-02-05 20:25:25 -05:00
i2c i2c: i2c_atmel_sam3: meet minimum timing requirements 2016-03-05 13:36:02 +00:00
interrupt_controller system_apic: rename irq_enable/disable 2016-03-04 18:52:53 +00:00
ipm device: use DEVICE_INIT everwhere 2016-02-05 20:25:25 -05:00
nble drivers/nble: Implement GATT write without response 2016-03-10 16:55:56 +00:00
pci pci: Fix PCI header initialization 2016-03-07 15:29:00 +00:00
pinmux arm: Add GPIO interrupt/callback support for K64F 2016-03-09 12:54:02 +00:00
pwm pwm: fix K64 PWM config options dependencies 2016-03-10 23:22:49 +00:00
qmsi drivers: Add infrastructure for QMSI drivers 2016-02-05 20:25:15 -05:00
random Fixed file description and applied doxygen style 2016-02-05 20:24:58 -05:00
rtc rtc: Fix Kconfig 2016-03-07 20:04:33 -03:00
serial uart: qmsi: Add support for IRQ APIs 2016-03-11 23:55:13 +00:00
shared_irq irq: rename irq_connect() to IRQ_CONNECT() 2016-02-05 20:25:25 -05:00
spi spi: dw: arc: add delay between writing DR strobe bit and reading FIFO 2016-03-12 03:18:54 +00:00
timer Revert "microkernel: Add support for *_sleep() during initialization" 2016-03-11 22:08:44 +00:00
watchdog watchdog: Remove default value from platform-specific options 2016-02-20 14:20:33 +00:00
Kconfig drivers: framework for a generic flash driver 2016-03-07 16:13:15 +00:00
Makefile arm: Freescale K64/FRDM-K64F Pinmux support 2016-03-09 11:58:02 +00:00