Skip to content

Commit ab73561

Browse files
ambarusbroonie
authored andcommitted
spi: atmel-quadspi: fix resume call
When waking up from the Suspend-to-RAM state, the following error was seen: m25p80 spi2.0: flash operation timed out The flash remained in an undefined state, returning 0xFFs. Fix it by setting the Serial Clock Baud Rate, as it was set before the conversion to SPIMEM. Tested with sama5d2_xplained and mx25l25673g spi-nor in Backup + Self-Refresh and Suspend modes. Fixes: 0e6aae0 ("spi: Add QuadSPI driver for Atmel SAMA5D2") Reported-by: Mark Deneen <[email protected]> Signed-off-by: Tudor Ambarus <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 5b74e9a commit ab73561

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/spi/atmel-quadspi.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ struct atmel_qspi {
151151
const struct atmel_qspi_caps *caps;
152152
u32 pending;
153153
u32 mr;
154+
u32 scr;
154155
struct completion cmd_completion;
155156
};
156157

@@ -382,7 +383,7 @@ static int atmel_qspi_setup(struct spi_device *spi)
382383
struct spi_controller *ctrl = spi->master;
383384
struct atmel_qspi *aq = spi_controller_get_devdata(ctrl);
384385
unsigned long src_rate;
385-
u32 scr, scbr;
386+
u32 scbr;
386387

387388
if (ctrl->busy)
388389
return -EBUSY;
@@ -399,8 +400,8 @@ static int atmel_qspi_setup(struct spi_device *spi)
399400
if (scbr > 0)
400401
scbr--;
401402

402-
scr = QSPI_SCR_SCBR(scbr);
403-
writel_relaxed(scr, aq->regs + QSPI_SCR);
403+
aq->scr = QSPI_SCR_SCBR(scbr);
404+
writel_relaxed(aq->scr, aq->regs + QSPI_SCR);
404405

405406
return 0;
406407
}
@@ -584,6 +585,9 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev)
584585
clk_prepare_enable(aq->qspick);
585586

586587
atmel_qspi_init(aq);
588+
589+
writel_relaxed(aq->scr, aq->regs + QSPI_SCR);
590+
587591
return 0;
588592
}
589593

0 commit comments

Comments
 (0)