From: "Nuno Sá" <nuno.sa@analog.com>
To: Amelie Delaunay <amelie.delaunay@foss.st.com>
Cc: dmaengine@vger.kernel.org, linux-iio@vger.kernel.org,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>,
Andy Shevchenko <andy@kernel.org>, Frank Li <Frank.Li@nxp.com>,
"moderated list:ARM/STM32 ARCHITECTURE"
<linux-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH v2 5/9] dmaengine: stm32-dma3: Use bus width capability helpers
Date: Mon, 31 Aug 2026 12:31:58 +0100 [thread overview]
Message-ID: <apVlhybgKEtunY2c@nsa> (raw)
In-Reply-To: <286d173b-4fd4-475c-bc49-eb0c9047ca2f@foss.st.com>
On Fri, Aug 28, 2026 at 02:40:05PM +0200, Amelie Delaunay wrote:
> Hi Nuno,
>
> Thanks for the update to the stm32-dma3 driver. It's good to see that it
> helps demonstrate the dma_slave_caps_clear_xxx API.
>
> For future patches touching STM32-related drivers, please CC the linux-stm32
> mailing list, as this one went unnoticed on our side.
>
Yes! You're right, sorry for that! The problem was that this started as
RFC as I just wanted to get opinions from the DMA folks on the way to go!
Then I forgot to include other reviewers (I missed more that ST folks)
on the following iterations.
Also found out an issue with my b4 workflow because of this :)
- Nuno Sá
> On 8/10/26 17:06, Nuno Sá wrote:
> > Advertise the controller-wide bus width capabilities through the new
> > dma_set_src_bus_widths() and dma_set_dst_bus_widths() helpers.
> >
> > Also update the per-channel capability callback to clear unsupported
> > widths through the dma_slave_caps helpers so the bitmap and
> > transitional legacy fields stay in sync.
> >
> > Reviewed-by: Frank Li <Frank.Li@nxp.com>
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > ---
> > drivers/dma/stm32/stm32-dma3.c | 32 ++++++++++++++++++++------------
> > 1 file changed, 20 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
> > index 4724e7fa0008..f0781fb1b66f 100644
> > --- a/drivers/dma/stm32/stm32-dma3.c
> > +++ b/drivers/dma/stm32/stm32-dma3.c
> > @@ -1469,14 +1469,14 @@ static void stm32_dma3_caps(struct dma_chan *c, struct dma_slave_caps *caps)
> > if (!chan->fifo_size) {
> > caps->max_burst = 0;
> > - caps->src_addr_widths &= ~BIT(DMA_SLAVE_BUSWIDTH_8_BYTES);
> > - caps->dst_addr_widths &= ~BIT(DMA_SLAVE_BUSWIDTH_8_BYTES);
> > + dma_slave_caps_clear_src_width(caps, DMA_SLAVE_BUSWIDTH_8_BYTES);
> > + dma_slave_caps_clear_dst_width(caps, DMA_SLAVE_BUSWIDTH_8_BYTES);
> > } else {
> > /* Burst transfer should not exceed half of the fifo size */
> > caps->max_burst = chan->max_burst;
> > if (caps->max_burst < DMA_SLAVE_BUSWIDTH_8_BYTES) {
> > - caps->src_addr_widths &= ~BIT(DMA_SLAVE_BUSWIDTH_8_BYTES);
> > - caps->dst_addr_widths &= ~BIT(DMA_SLAVE_BUSWIDTH_8_BYTES);
> > + dma_slave_caps_clear_src_width(caps, DMA_SLAVE_BUSWIDTH_8_BYTES);
> > + dma_slave_caps_clear_dst_width(caps, DMA_SLAVE_BUSWIDTH_8_BYTES);
> > }
> > }
> > }
> > @@ -1737,6 +1737,12 @@ static int stm32_dma3_probe(struct platform_device *pdev)
> > u32 master_ports, chan_reserved, i, verr;
> > u64 hwcfgr;
> > int ret;
> > + enum dma_slave_buswidth stm32_dma3_buswidths[] = {
> > + DMA_SLAVE_BUSWIDTH_1_BYTE,
> > + DMA_SLAVE_BUSWIDTH_2_BYTES,
> > + DMA_SLAVE_BUSWIDTH_4_BYTES,
> > + DMA_SLAVE_BUSWIDTH_8_BYTES,
> > + };
>
> I'm not fond of having this large block after the "shortest" declaration
> (reversed christmas tree order), and since it is not a global variable, I
> think you can remove the `stm32_dma3` prefix.
>
> By removing the `stm32_dma3` prefix, you could place it after the struct
> declarations, below struct dma_device *dma_dev;
>
> > ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL);
> > if (!ddata)
> > @@ -1775,14 +1781,16 @@ static int stm32_dma3_probe(struct platform_device *pdev)
> > * channel, and can only access address at even boundaries, multiple of the buswidth.
> > */
> > dma_dev->copy_align = DMAENGINE_ALIGN_8_BYTES;
> > - dma_dev->src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
> > - BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
> > - BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) |
> > - BIT(DMA_SLAVE_BUSWIDTH_8_BYTES);
> > - dma_dev->dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
> > - BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
> > - BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) |
> > - BIT(DMA_SLAVE_BUSWIDTH_8_BYTES);
> > + ret = dma_set_src_bus_widths(dma_dev, stm32_dma3_buswidths,
> > + ARRAY_SIZE(stm32_dma3_buswidths));
>
> By using `buswidths` instead of `stm32_dma3_buswidths`, this can fit on a
> single line.
>
> > + if (ret)
> > + goto err_clk_disable;
> > +
> > + ret = dma_set_dst_bus_widths(dma_dev, stm32_dma3_buswidths,
> > + ARRAY_SIZE(stm32_dma3_buswidths));
>
> Ditto
>
> > + if (ret)
> > + goto err_clk_disable;
> > +
> > dma_dev->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV) | BIT(DMA_MEM_TO_MEM);
> > dma_dev->descriptor_reuse = true;
> >
>
> Regards,
> Amelie
next prev parent reply other threads:[~2026-08-31 11:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 15:06 [PATCH v2 0/9] dmaengine: Support bus widths of 32 bytes and above Nuno Sá
2026-08-10 15:06 ` [PATCH v2 1/9] " Nuno Sá
2026-08-10 15:17 ` sashiko-bot
2026-08-10 17:15 ` Andy Shevchenko
2026-08-11 8:46 ` Nuno Sá
2026-08-11 17:58 ` Vinod Koul
2026-08-12 9:08 ` Nuno Sá
2026-08-12 9:38 ` Nuno Sá
2026-08-12 9:50 ` Andy Shevchenko
2026-08-12 9:48 ` Andy Shevchenko
2026-08-12 12:18 ` Nuno Sá
2026-08-12 12:59 ` Nuno Sá
2026-08-13 6:30 ` Andy Shevchenko
2026-08-13 13:17 ` Nuno Sá
2026-08-10 15:06 ` [PATCH v2 2/9] dmaengine: dma-axi-dmac: Use bus width capability helpers Nuno Sá
2026-08-10 15:06 ` [PATCH v2 3/9] dmaengine: dw-axi-dmac: " Nuno Sá
2026-08-10 15:18 ` sashiko-bot
2026-08-10 15:06 ` [PATCH v2 4/9] dmaengine: qcom: gpi: " Nuno Sá
2026-08-10 15:15 ` sashiko-bot
2026-08-10 15:06 ` [PATCH v2 5/9] dmaengine: stm32-dma3: " Nuno Sá
2026-08-28 12:40 ` Amelie Delaunay
2026-08-31 11:31 ` Nuno Sá [this message]
2026-08-10 15:06 ` [PATCH v2 6/9] iio: buffer-dmaengine: Use dma_slave_caps bus width accessors Nuno Sá
2026-08-10 15:32 ` sashiko-bot
2026-08-12 4:48 ` Jonathan Cameron
2026-08-10 15:06 ` [PATCH v2 7/9] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers Nuno Sá
2026-08-10 15:06 ` [PATCH v2 8/9] spi: dw: " Nuno Sá
2026-08-10 15:28 ` sashiko-bot
2026-08-10 15:06 ` [PATCH v2 9/9] dmaengine: Drop legacy bus width fields from dma_slave_caps Nuno Sá
2026-08-10 16:56 ` Frank Li
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=apVlhybgKEtunY2c@nsa \
--to=nuno.sa@analog.com \
--cc=Frank.Li@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=amelie.delaunay@foss.st.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=dmaengine@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=vkoul@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