The TDR register shouldn't be written when the CSRB flag is set. The fix
solves the problem where one SPI transfer includes multiple 8 or 16 bit
tx elements and the current transfer can be corrupted by accessing the
TDR too early.
Signed-off-by: Imre Deak <imre.deak@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
pr_debug("%s: write-%d =%04x\n",
spi->dev.bus_id, bits, val);
#endif
+ if (wait_uwire_csr_flag(CSRB, 0, 0))
+ goto eio;
+
uwire_write_reg(UWIRE_TDR, val);
/* start write */
val = START | w | (bits << 5);
- if (wait_uwire_csr_flag(CSRB, 0, 0))
- goto eio;
uwire_write_reg(UWIRE_CSR, val);
len -= bytes;