From: Frank Li <Frank.li@nxp.com>
To: carlos.song@nxp.com
Cc: broonie@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com,
linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: imx: keep dma request disabled before dma transfer setup
Date: Fri, 24 Oct 2025 10:16:10 -0400 [thread overview]
Message-ID: <aPuKKrb56CLLeYTb@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20251024055320.408482-1-carlos.song@nxp.com>
On Fri, Oct 24, 2025 at 01:53:20PM +0800, carlos.song@nxp.com wrote:
> From: Robin Gong <yibin.gong@nxp.com>
>
> 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:
Due to a hardware limitation on SDMA event enable (ENBLn), the DMA request
must remain disabled until the DMA transfer setup is complete.
Ref spec section [...]
>
> "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."
SDMA hardware configuration is postponed to the transfer phase, so enabling
the DMA request too early may cause unpredictable channel activation. Then
keep dma request disabled before dma transfer setup.
Frank
>
> Signed-off-by: Carlos Song <carlos.song@nxp.com>
> Signed-off-by: Robin Gong <yibin.gong@nxp.com>
> ---
> drivers/spi/spi-imx.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index cd40db61d8d1..765ea507dd8d 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -529,9 +529,15 @@ static void mx51_ecspi_trigger(struct spi_imx_data *spi_imx)
> {
> u32 reg;
>
> - reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
> - reg |= MX51_ECSPI_CTRL_XCH;
> - writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
> + if (spi_imx->usedma) {
> + reg = readl(spi_imx->base + MX51_ECSPI_DMA);
> + reg |= MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN;
> + writel(reg, spi_imx->base + MX51_ECSPI_DMA);
> + } else {
> + reg = readl(spi_imx->base + MX51_ECSPI_CTRL);
> + reg |= MX51_ECSPI_CTRL_XCH;
> + writel(reg, spi_imx->base + MX51_ECSPI_CTRL);
> + }
> }
>
> static void mx51_ecspi_disable(struct spi_imx_data *spi_imx)
> @@ -772,7 +778,6 @@ static void mx51_setup_wml(struct spi_imx_data *spi_imx)
> writel(MX51_ECSPI_DMA_RX_WML(spi_imx->wml - 1) |
> MX51_ECSPI_DMA_TX_WML(tx_wml) |
> MX51_ECSPI_DMA_RXT_WML(spi_imx->wml) |
> - MX51_ECSPI_DMA_TEDEN | MX51_ECSPI_DMA_RXDEN |
> MX51_ECSPI_DMA_RXTDEN, spi_imx->base + MX51_ECSPI_DMA);
> }
>
> @@ -1539,6 +1544,8 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
> reinit_completion(&spi_imx->dma_tx_completion);
> dma_async_issue_pending(controller->dma_tx);
>
> + spi_imx->devtype_data->trigger(spi_imx);
> +
> transfer_timeout = spi_imx_calculate_timeout(spi_imx, transfer->len);
>
> /* Wait SDMA to finish the data transfer.*/
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-10-24 14:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 5:53 [PATCH] spi: imx: keep dma request disabled before dma transfer setup carlos.song
2025-10-24 14:16 ` Frank Li [this message]
2025-11-05 13:22 ` Mark Brown
2025-11-06 23:54 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aPuKKrb56CLLeYTb@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=broonie@kernel.org \
--cc=carlos.song@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox