Skip to content

Commit 86d57d9

Browse files
Robin Gongbroonie
authored andcommitted
spi: imx: keep dma request disabled before dma transfer setup
Since sdma hardware configure postpone to transfer phase, have to disable dma request before dma transfer setup because there is a hardware limitation on sdma event enable(ENBLn) as below: "It is thus essential for the Arm platform to program them before any DMA request is triggered to the SDMA, otherwise an unpredictable combination of channels may be started." Signed-off-by: Carlos Song <[email protected]> Signed-off-by: Robin Gong <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 3cd2018 commit 86d57d9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/spi/spi-imx.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,15 @@ static void mx51_ecspi_trigger(struct spi_imx_data *spi_imx)
519519
{
520520
u32 reg;
521521

522-
reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
523-
reg |= MX51_ECSPI_CTRL_XCH;
524-
writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
522+
if (spi_imx->usedma) {
523+
reg = readl(spi_imx->base + MX51_ECSPI_DMA);
524+
reg |= MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN;
525+
writel(reg, spi_imx->base + MX51_ECSPI_DMA);
526+
} else {
527+
reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
528+
reg |= MX51_ECSPI_CTRL_XCH;
529+
writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
530+
}
525531
}
526532

527533
static void mx51_ecspi_disable(struct spi_imx_data *spi_imx)
@@ -759,7 +765,6 @@ static void mx51_setup_wml(struct spi_imx_data *spi_imx)
759765
writel(MX51_ECSPI_DMA_RX_WML(spi_imx->wml - 1) |
760766
MX51_ECSPI_DMA_TX_WML(tx_wml) |
761767
MX51_ECSPI_DMA_RXT_WML(spi_imx->wml) |
762-
MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN |
763768
MX51_ECSPI_DMA_RXTDEN, spi_imx->base + MX51_ECSPI_DMA);
764769
}
765770

@@ -1520,6 +1525,8 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
15201525
reinit_completion(&spi_imx->dma_tx_completion);
15211526
dma_async_issue_pending(controller->dma_tx);
15221527

1528+
spi_imx->devtype_data->trigger(spi_imx);
1529+
15231530
transfer_timeout = spi_imx_calculate_timeout(spi_imx, transfer->len);
15241531

15251532
/* Wait SDMA to finish the data transfer.*/

0 commit comments

Comments
 (0)