summaryrefslogtreecommitdiff
path: root/drivers/spi/atmel-quadspi.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-08-26 08:30:21 -0600
committerTom Rini <trini@konsulko.com>2025-08-26 08:30:21 -0600
commit349cf24859b5e169a441d975fb4484d8597964bc (patch)
tree1ad2aa4c3b839b006e40ece58d02848bdaa02b4f /drivers/spi/atmel-quadspi.c
parentdca578a9c9decb85271665de8086b8f41731d388 (diff)
parentc1168f99387b40f5e3323ff16c670427c2c8a66e (diff)
Merge tag 'u-boot-at91-fixes-2025.10-a' of https://source.denx.de/u-boot/custodians/u-boot-at91
First set of u-boot-at91 fixes for the 2025.10 cycle: This set includes smatch fixes for clocks and mmc and one QSPI fix.
Diffstat (limited to 'drivers/spi/atmel-quadspi.c')
-rw-r--r--drivers/spi/atmel-quadspi.c15
1 files changed, 12 insertions, 3 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,