Skip to content

Commit 6ce956d

Browse files
ambaruscristibirsan
authored andcommitted
spi: atmel-quadspi: fix resume call
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 <mdeneen@gmail.com> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> [claudiu.beznea@microchip.com: adapt to current code base] Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent 9a4ba1f commit 6ce956d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

drivers/spi/atmel-quadspi.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ struct atmel_qspi {
155155
struct clk *clk;
156156
struct platform_device *pdev;
157157
u32 pending;
158+
u32 scr;
158159
struct completion cmd_completion;
159160
};
160161

@@ -353,7 +354,7 @@ static int atmel_qspi_setup(struct spi_device *spi)
353354
struct spi_controller *ctrl = spi->master;
354355
struct atmel_qspi *aq = spi_controller_get_devdata(ctrl);
355356
unsigned long src_rate;
356-
u32 scr, scbr;
357+
u32 scbr;
357358

358359
if (ctrl->busy)
359360
return -EBUSY;
@@ -370,8 +371,8 @@ static int atmel_qspi_setup(struct spi_device *spi)
370371
if (scbr > 0)
371372
scbr--;
372373

373-
scr = QSPI_SCR_SCBR(scbr);
374-
qspi_writel(aq, QSPI_SCR, scr);
374+
aq->scr = QSPI_SCR_SCBR(scbr);
375+
writel_relaxed(aq->scr, aq->regs + QSPI_SCR);
375376

376377
return 0;
377378
}
@@ -516,6 +517,9 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev)
516517
clk_prepare_enable(aq->clk);
517518

518519
atmel_qspi_init(aq);
520+
521+
writel_relaxed(aq->scr, aq->regs + QSPI_SCR);
522+
519523
return 0;
520524
}
521525

0 commit comments

Comments
 (0)