summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/atmel-quadspi.c15
-rw-r--r--drivers/spi/exynos_spi.c10
2 files changed, 14 insertions, 11 deletions
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index 8aa7a83aef4..b2b96e1c4b9 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -615,7 +615,8 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq,
static int atmel_qspi_transfer(struct atmel_qspi *aq,
const struct spi_mem_op *op, u32 offset)
{
- u32 sr, imr;
+ u32 imr, val = 0;
+ unsigned long timeout;
/* Skip to the final steps if there is no data */
if (op->data.nbytes) {
@@ -636,8 +637,16 @@ static int atmel_qspi_transfer(struct atmel_qspi *aq,
/* Poll INSTruction End and Chip Select Rise flags. */
imr = QSPI_SR_INSTRE | QSPI_SR_CSR;
- return readl_poll_timeout(aq->regs + QSPI_SR, sr, (sr & imr) == imr,
- ATMEL_QSPI_TIMEOUT);
+
+ timeout = timer_get_us() + ATMEL_QSPI_TIMEOUT;
+ while (1) {
+ val |= readl(aq->regs + QSPI_SR) & imr;
+ if ((val & imr) == imr)
+ return 0;
+
+ if (time_after(timer_get_us(), timeout))
+ return -ETIMEDOUT;
+ }
}
static int atmel_qspi_sama7g5_set_cfg(struct atmel_qspi *aq,
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index 1b9bf004b7c..7f2965f8321 100644
--- a/drivers/spi/exynos_spi.c
+++ b/drivers/spi/exynos_spi.c
@@ -105,14 +105,10 @@ static int spi_rx_tx(struct exynos_spi_priv *priv, int todo,
uint out_bytes, in_bytes;
int toread;
unsigned start = get_timer(0);
- int stopping;
int step;
out_bytes = in_bytes = todo;
- stopping = priv->skip_preamble && (flags & SPI_XFER_END) &&
- !(priv->mode & SPI_SLAVE);
-
/*
* Try to transfer words if we can. This helps read performance at
* SPI clock speeds above about 20MHz.
@@ -161,12 +157,10 @@ static int spi_rx_tx(struct exynos_spi_priv *priv, int todo,
while (rx_lvl >= step) {
temp = readl(&regs->rx_data);
if (priv->skip_preamble) {
- if (temp == SPI_PREAMBLE_END_BYTE) {
+ if (temp == SPI_PREAMBLE_END_BYTE)
priv->skip_preamble = 0;
- stopping = 0;
- }
} else {
- if (rxp || stopping) {
+ if (rxp) {
if (step == 4)
*(uint32_t *)rxp = temp;
else