stm32: Revert "stm32: performance improvement for spi on stm32f0"

This reverts commit a2c309a2b0.

The above commit is causing crashes on the stm32f103xb chip when spi
is in use.  It's unclear what the cause of the regression is, but the
optimization isn't required so revert it until the root cause can be
determined.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-03-04 18:24:11 -05:00
parent e9e0f59204
commit 121249c999
1 changed files with 4 additions and 8 deletions

View File

@ -92,14 +92,10 @@ spi_transfer(struct spi_config config, uint8_t receive_data,
uint8_t len, uint8_t *data)
{
SPI_TypeDef *spi = config.spi;
uint8_t *wptr = data;
uint8_t *end = data + len;
while (data < end) {
if (spi->SR & SPI_SR_TXE && wptr < end)
writeb((void *)&spi->DR, *wptr++);
if (!(spi->SR & SPI_SR_RXNE))
continue;
while (len--) {
writeb((void *)&spi->DR, *data);
while (!(spi->SR & SPI_SR_RXNE))
;
uint8_t rdata = readb((void *)&spi->DR);
if (receive_data)
*data = rdata;