From: Carlos Song <carlos.song@nxp.com>
To: broonie@kernel.org, frank.li@nxp.com, hawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com
Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Carlos Song <carlos.song@nxp.com>
Subject: [PATCH 1/6] spi: imx: group spi_imx_dma_configure() with spi_imx_dma_transfer()
Date: Tue, 25 Nov 2025 18:06:13 +0800 [thread overview]
Message-ID: <20251125100618.2159770-2-carlos.song@nxp.com> (raw)
In-Reply-To: <20251125100618.2159770-1-carlos.song@nxp.com>
Relocate spi_imx_dma_configure() next to spi_imx_dma_transfer() so that
all DMA-related functions are grouped together for better readability.
No functional changes.
Signed-off-by: Carlos Song <carlos.song@nxp.com>
---
drivers/spi/spi-imx.c | 88 +++++++++++++++++++++----------------------
1 file changed, 44 insertions(+), 44 deletions(-)
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index b8b79bb7fec3..e78e02a84b50 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -1282,50 +1282,6 @@ static irqreturn_t spi_imx_isr(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static int spi_imx_dma_configure(struct spi_controller *controller)
-{
- int ret;
- enum dma_slave_buswidth buswidth;
- struct dma_slave_config rx = {}, tx = {};
- struct spi_imx_data *spi_imx = spi_controller_get_devdata(controller);
-
- switch (spi_imx_bytes_per_word(spi_imx->bits_per_word)) {
- case 4:
- buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
- break;
- case 2:
- buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
- break;
- case 1:
- buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
- break;
- default:
- return -EINVAL;
- }
-
- tx.direction = DMA_MEM_TO_DEV;
- tx.dst_addr = spi_imx->base_phys + MXC_CSPITXDATA;
- tx.dst_addr_width = buswidth;
- tx.dst_maxburst = spi_imx->wml;
- ret = dmaengine_slave_config(controller->dma_tx, &tx);
- if (ret) {
- dev_err(spi_imx->dev, "TX dma configuration failed with %d\n", ret);
- return ret;
- }
-
- rx.direction = DMA_DEV_TO_MEM;
- rx.src_addr = spi_imx->base_phys + MXC_CSPIRXDATA;
- rx.src_addr_width = buswidth;
- rx.src_maxburst = spi_imx->wml;
- ret = dmaengine_slave_config(controller->dma_rx, &rx);
- if (ret) {
- dev_err(spi_imx->dev, "RX dma configuration failed with %d\n", ret);
- return ret;
- }
-
- return 0;
-}
-
static int spi_imx_setupxfer(struct spi_device *spi,
struct spi_transfer *t)
{
@@ -1481,6 +1437,50 @@ static int spi_imx_calculate_timeout(struct spi_imx_data *spi_imx, int size)
return secs_to_jiffies(2 * timeout);
}
+static int spi_imx_dma_configure(struct spi_controller *controller)
+{
+ int ret;
+ enum dma_slave_buswidth buswidth;
+ struct dma_slave_config rx = {}, tx = {};
+ struct spi_imx_data *spi_imx = spi_controller_get_devdata(controller);
+
+ switch (spi_imx_bytes_per_word(spi_imx->bits_per_word)) {
+ case 4:
+ buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
+ break;
+ case 2:
+ buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+ break;
+ case 1:
+ buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ tx.direction = DMA_MEM_TO_DEV;
+ tx.dst_addr = spi_imx->base_phys + MXC_CSPITXDATA;
+ tx.dst_addr_width = buswidth;
+ tx.dst_maxburst = spi_imx->wml;
+ ret = dmaengine_slave_config(controller->dma_tx, &tx);
+ if (ret) {
+ dev_err(spi_imx->dev, "TX dma configuration failed with %d\n", ret);
+ return ret;
+ }
+
+ rx.direction = DMA_DEV_TO_MEM;
+ rx.src_addr = spi_imx->base_phys + MXC_CSPIRXDATA;
+ rx.src_addr_width = buswidth;
+ rx.src_maxburst = spi_imx->wml;
+ ret = dmaengine_slave_config(controller->dma_rx, &rx);
+ if (ret) {
+ dev_err(spi_imx->dev, "RX dma configuration failed with %d\n", ret);
+ return ret;
+ }
+
+ return 0;
+}
+
static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
struct spi_transfer *transfer)
{
--
2.34.1
next prev parent reply other threads:[~2025-11-25 10:07 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 10:06 [PATCH 0/6] Support ECSPI dynamic burst feature for DMA mode Carlos Song
2025-11-25 10:06 ` Carlos Song [this message]
2025-11-25 15:32 ` [PATCH 1/6] spi: imx: group spi_imx_dma_configure() with spi_imx_dma_transfer() Frank Li
2025-11-25 10:06 ` [PATCH 2/6] spi: imx: introduce helper to clear DMA mode logic Carlos Song
2025-11-25 15:41 ` Frank Li
2025-11-25 10:06 ` [PATCH 3/6] spi: imx: avoid dmaengine_terminate_all() on TX prep failure Carlos Song
2025-11-25 15:42 ` Frank Li
2025-11-25 10:06 ` [PATCH 4/6] spi: imx: handle DMA submission errors with dma_submit_error() Carlos Song
2025-11-25 15:45 ` Frank Li
2025-11-25 10:06 ` [PATCH 5/6] spi: imx: support dynamic burst length for ECSPI DMA mode Carlos Song
2025-11-25 12:10 ` Marc Kleine-Budde
2025-11-26 7:42 ` Carlos Song
2025-11-26 8:31 ` Marc Kleine-Budde
2025-11-26 9:51 ` [EXT] " Carlos Song
2025-11-26 11:17 ` Carlos Song
2025-11-26 12:36 ` Marc Kleine-Budde
2025-11-27 2:36 ` [EXT] " Carlos Song
2025-11-26 8:11 ` Marc Kleine-Budde
2025-11-26 8:18 ` [EXT] " Carlos Song
2025-11-26 8:20 ` Marc Kleine-Budde
2025-11-26 8:34 ` [EXT] " Carlos Song
2025-11-26 8:44 ` Marc Kleine-Budde
2025-11-26 8:27 ` Marc Kleine-Budde
2025-11-26 8:43 ` [EXT] " Carlos Song
2025-11-26 12:22 ` Marc Kleine-Budde
2025-11-26 12:29 ` [EXT] " Carlos Song
2025-11-26 12:52 ` Marc Kleine-Budde
2025-11-27 2:58 ` Carlos Song
2025-11-25 10:06 ` [PATCH 6/6] spi: imx: enable DMA mode for target operation Carlos Song
2025-11-25 16:05 ` Frank Li
2025-11-26 2:11 ` Carlos Song
2025-12-02 7:00 ` Carlos Song
2025-11-26 12:18 ` Marc Kleine-Budde
2025-11-26 12:30 ` [EXT] " Carlos Song
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=20251125100618.2159770-2-carlos.song@nxp.com \
--to=carlos.song@nxp.com \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=frank.li@nxp.com \
--cc=hawnguo@kernel.org \
--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 \
/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