Skip to content

Commit 3cb8f23

Browse files
committed
spi: atmel-quadspi: add missed changes during v6.6.9 migration
During kernel migration from v6.1.4 to v6.6.9, usually at91/spi branch is ported first and then by taking at91/spi branch as base for porting the at91/spi-nor branch. We missed to take at91/spi as base instead we cherry-picked only required commits and ported at91/spi-nor branch, which causes conflicts and few changes missed when resolving conflicts. Now the missed changes are ported on top of at91/spi-nor branch and sending as separate PR. NOTE: During next version of kernel migration this commit should be ignored when the ported at91/spi branch is taken as base for at91/spi-nor branch. Always first pull-request should be send from at91/spi and then at91/spi-nor to avoid conflicts. Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
1 parent 325b1fd commit 3cb8f23

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

drivers/spi/atmel-quadspi.c

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
#define QSPI_CALIB_TIME 2000 /* 2 us */
232232

233233
/* Use PIO for small transfers. */
234-
#define ATMEL_QSPI_DMA_MIN_BYTES 16
234+
#define ATMEL_QSPI_DMA_MIN_BYTES 0
235235
/**
236236
* struct atmel_qspi_pcal - Pad Calibration Clock Division
237237
* @pclk_rate: peripheral clock rate.
@@ -885,7 +885,7 @@ static int atmel_qspi_sama7g5_transfer(struct spi_mem *mem,
885885

886886
/* Send/Receive data. */
887887
if (op->data.dir == SPI_MEM_DATA_IN) {
888-
if (aq->rx_chan && op->addr.nbytes &&
888+
if (aq->rx_chan &&
889889
op->data.nbytes > ATMEL_QSPI_DMA_MIN_BYTES) {
890890
ret = atmel_qspi_dma_transfer(mem, op, offset);
891891
if (ret)
@@ -903,7 +903,7 @@ static int atmel_qspi_sama7g5_transfer(struct spi_mem *mem,
903903
return ret;
904904
}
905905
} else {
906-
if (aq->tx_chan && op->addr.nbytes &&
906+
if (aq->tx_chan &&
907907
op->data.nbytes > ATMEL_QSPI_DMA_MIN_BYTES) {
908908
ret = atmel_qspi_dma_transfer(mem, op, offset);
909909
if (ret)
@@ -952,13 +952,15 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
952952
return err;
953953

954954
err = aq->ops->set_cfg(aq, op, &offset);
955-
if (err) {
956-
pm_runtime_mark_last_busy(&aq->pdev->dev);
957-
pm_runtime_put_autosuspend(&aq->pdev->dev);
958-
return err;
959-
}
955+
if (err)
956+
goto pm_runtime_put;
957+
958+
err = aq->ops->transfer(mem, op, offset);
960959

961-
return aq->ops->transfer(mem, op, offset);
960+
pm_runtime_put:
961+
pm_runtime_mark_last_busy(&aq->pdev->dev);
962+
pm_runtime_put_autosuspend(&aq->pdev->dev);
963+
return err;
962964
}
963965

964966
static const char *atmel_qspi_get_name(struct spi_mem *spimem)
@@ -1476,14 +1478,9 @@ static int atmel_qspi_sama7g5_suspend(struct atmel_qspi *aq)
14761478
if (ret)
14771479
return ret;
14781480

1479-
ret = readl_poll_timeout(aq->regs + QSPI_SR2, val,
1481+
return readl_poll_timeout(aq->regs + QSPI_SR2, val,
14801482
!(val & QSPI_SR2_CALBSY), 40,
14811483
ATMEL_QSPI_TIMEOUT);
1482-
if (ret)
1483-
return ret;
1484-
1485-
clk_disable_unprepare(aq->pclk);
1486-
return 0;
14871484
}
14881485

14891486
static void atmel_qspi_remove(struct platform_device *pdev)
@@ -1532,9 +1529,9 @@ static int __maybe_unused atmel_qspi_suspend(struct device *dev)
15321529
return ret;
15331530

15341531
if (aq->caps->has_gclk)
1535-
return atmel_qspi_sama7g5_suspend(aq);
1536-
1537-
atmel_qspi_write(QSPI_CR_QSPIDIS, aq, QSPI_CR);
1532+
ret = atmel_qspi_sama7g5_suspend(aq);
1533+
else
1534+
atmel_qspi_write(QSPI_CR_QSPIDIS, aq, QSPI_CR);
15381535

15391536
pm_runtime_mark_last_busy(dev);
15401537
pm_runtime_force_suspend(dev);
@@ -1554,9 +1551,6 @@ static int __maybe_unused atmel_qspi_resume(struct device *dev)
15541551
clk_prepare(aq->pclk);
15551552
clk_prepare(aq->qspick);
15561553

1557-
if (aq->caps->has_gclk)
1558-
return atmel_qspi_sama7g5_init(aq);
1559-
15601554
ret = pm_runtime_force_resume(dev);
15611555
if (ret < 0)
15621556
return ret;

0 commit comments

Comments
 (0)