[PATCH V3] dmaengine: imx-sdma: Fix SPBA bus detection on multi-SPBA platforms
Shengjiu Wang
shengjiu.wang at gmail.com
Tue Apr 21 02:13:57 PDT 2026
On Tue, Apr 21, 2026 at 4:57 PM Marco Felsch <m.felsch at pengutronix.de> wrote:
>
> On 26-04-20, Shengjiu Wang wrote:
> > i.MX8M platforms have multiple SPBA buses under different AIPS buses.
> > The current code searches the entire device tree and returns the first
> > SPBA bus found, which may not be under the same AIPS bus as the SDMA
> > controller.
> >
> > This breaks SDMA P2P transfers because the SDMA script needs to know
> > if peripherals are on SPBA or AIPS to configure watermark levels
> > correctly. Using the wrong SPBA bus causes DMA timeouts and transfer
> > failures.
> >
> > Fix by searching for the SPBA bus under the SDMA's parent node (AIPS)
> > first, then falling back to a global search for backward compatibility.
> >
> > Example device tree showing the issue:
> > aips1 {
> > spba1 { sai at ...; }; /* Correct SPBA for sdma1 */
> > sdma1 at ...;
> > };
> > aips2 {
> > spba2 { uart at ...; }; /* Wrong SPBA - found first by old code */
> > };
> >
> > Fixes: 8391ecf465ec ("dmaengine: imx-sdma: Add device to device support")
> > Cc: stable at vger.kernel.org
> > Signed-off-by: Shengjiu Wang <shengjiu.wang at nxp.com>
> > ---
> > changs in v3:
> > - add fallback to a global search for backward compatibility, which is
> > to address comments from sashiko.dev
> > - update commit subject and commit message
> > - add comments in code.
> > - add Cc stable tag
> > - Don't add Frank's RB on v2 as there are several other changes.
> >
> > changes in v2:
> > - add fixes tag
> > - use __free(device_node) for auto release.
> >
> > drivers/dma/imx-sdma.c | 13 ++++++++++++-
> > 1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
> > index 3d527883776b..592705af2319 100644
> > --- a/drivers/dma/imx-sdma.c
> > +++ b/drivers/dma/imx-sdma.c
> > @@ -2364,7 +2364,18 @@ static int sdma_probe(struct platform_device *pdev)
> > return dev_err_probe(&pdev->dev, ret,
> > "failed to register controller\n");
> >
> > - spba_bus = of_find_compatible_node(NULL, NULL, "fsl,spba-bus");
> > + /*
> > + * On i.MX8M platforms with multiple SPBA buses, we need to find
> > + * the SPBA bus that's under the same AIPS bus as this SDMA controller.
> > + * First check the SDMA's parent (AIPS bus) for a child SPBA bus.
> > + * If not found, fall back to searching the entire device tree for
> > + * backward compatibility with older platforms.
> > + */
> > + struct device_node *sdma_parent_np __free(device_node) = of_get_parent(np);
> > +
> > + spba_bus = of_get_compatible_child(sdma_parent_np, "fsl,spba-bus");
> > + if (!spba_bus)
> > + spba_bus = of_find_compatible_node(NULL, NULL, "fsl,spba-bus");
>
> And yet the search is still broken for i.MX8MP case since this platform
> has two sdma engines below the bus at 30df0000.
I tested on i.MX8MP. It works. Above line is for backward compatibility
The search has no dependence on the number of sdma engines. It searches the
spba-bus, not the sdma node. it will find the aips5 first, then find
the spba-bus for
sdma2 and sdma3.
aips5: bus at 30df0000 {
spba-bus at 30c00000 {
}
sdma2: dma-controller at 30e10000 {
}
sdma3: dma-controller at 30e00000 {
}
}
Best regards
Shengjiu Wang
>
> Regards,
> Marco
>
> > ret = of_address_to_resource(spba_bus, 0, &spba_res);
> > if (!ret) {
> > sdma->spba_start_addr = spba_res.start;
> > --
> > 2.34.1
> >
> >
> >
>
> --
> #gernperDu
> #CallMeByMyFirstName
>
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | https://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
>
More information about the linux-arm-kernel
mailing list