SDMA available for M7 in Verdin iMX8M-Plus

From the iMX8M-Plus Reference Manual (chapter 7.2) I read that

The Smart Direct Memory Access (SDMA) controller offers highly-competitive DMA features combined with software-based virtual-DMA flexibility. It enables data transfers between peripheral I/O devices and internal/external memories

I would like using SDMA for UART RX/TX transfer on M7 core side, based on this example from NXP tha uses SDMA-1.
I need to be sure that sdma1 is not used by TorizonOS/U-Boot/ATF and so it’s available for M7 core.
As an example, I see in verdin-imx8mp_hmp_overlay.dts that

&sai3 {
    status = "disabled";
};

&sdma3 {
    status = "disabled";
};

and I imagine that sdma3 is used for sai audio interface (or something like that) on TorizonOS side.

Can someone from Toradex confirm that sdma1 is not used on A53 at all? And so it can be reserved to M7?

Thanks

Hi @vix !

Sorry for the delay. During this period of the year support bandwidth is limited.

By checking the entire Device Tree imx8mp-verdin-wifi-dev.dts from linux-toradex checked out at the branch toradex_5.15-2.2.x-imx (BSP 6) - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules -, we can see that some nodes reference the 'sdma1in the fileimx8mp.dtsi` (this specific file is part of the original NXP’s BSP: Device Trees on Toradex System on Modules | Toradex Developer Center):

 $ find-in-dt arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts 'sdma1'
/mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx
search_in: all, returning: all
searching in:
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/pwm/pwm.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/clock/imx8mp-clock.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/reset/imx8mp-reset.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/gpio/gpio.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/input/input.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/interrupt-controller/arm-gic.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/thermal/thermal.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp-pinfunc.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/input/linux-event-codes.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/interrupt-controller/irq.h
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp-verdin.dtsi
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi.dtsi
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp-verdin-dev.dtsi
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp.dtsi
        /mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp-verdin-wifi-dev.dts
findings:
/mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/include/dt-bindings/clock/imx8mp-clock.h
        241 : #define IMX8MP_CLK_SDMA1_ROOT                     236

/mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp-pinfunc.h
        31 : #define MX8MP_IOMUXC_GPIO1_IO03__SDMA1_EXT_EVENT00                   0x020 0x280 0x000 0x5 0x0
        35 : #define MX8MP_IOMUXC_GPIO1_IO04__SDMA1_EXT_EVENT01                   0x024 0x284 0x000 0x5 0x0

/mnt/kingston_1tb/linux-toradex_5.15-2.2.x-imx/arch/arm64/boot/dts/freescale/imx8mp.dtsi
        916 :                           dmas = <&sdma1 0 7 1>, <&sdma1 1 7 2>;
        933 :                           dmas = <&sdma1 2 7 1>, <&sdma1 3 7 2>;
        950 :                           dmas = <&sdma1 4 7 1>, <&sdma1 5 7 2>;
        962 :                           dmas = <&sdma1 22 4 0>, <&sdma1 23 4 0>;
        974 :                           dmas = <&sdma1 26 4 0>, <&sdma1 27 4 0>;
        1097 :                          dmas = <&sdma1 28 4 0>, <&sdma1 29 4 0>;
        1187 :                  sdma1: dma-controller@30bd0000 {
        1191 :                          clocks = <&clk IMX8MP_CLK_SDMA1_ROOT>,

search_in: all, returning: all
----------------------------------------------------------------------------------------------------

By checking the imx8mp.dtsi (imx8mp.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules), we see that the nodes ecspi1, ecspi2, ecspi3, uart1, uart3, uart4 are the ones that refer to sdma1.

Having said that, you can try to remove the properties related to DMA from these nodes. To do so you can use delete-property (doesn’t work as intended on overlays): Device Tree Technical Overview | Toradex Developer Center.

I do not have much experience with (S)DMA. Let us know if simply removing the properties from the device tree works for you.

FYI: I used the GitHub - griloHBG/find_in_devicetree: A helper to find stuff on a device tree hierarchy. Searches recursively inside included files. to search for sdma1 in the device tree files.

Best regards,

Hi @henrique.tx
thank you very much.

As far as I uderstand, every dmas entry in the device tree contains an array of DMA specifiers, each describing a DMA channel. The format depends on the DMA controller binding.
And so I see that several DMA channels are already configured for different peripherals (0 and 1 for ecspi1, 2 and 3 for ecspi2, 4 and 5 for ecspi3, 22 and 23 for uart1, 26 and 27 for uart3, 28 and 29 for uart4).

If I disable the peripheral on Linux side, I think I can re-use the same DMA channels on M7 side.

The last question for me is what is the syntax for DMA specifiers for imx8mp.
The first field sdma1 should be the DMA controller.
The second one should be the DMA channel number.
But what are the third and the fourth ones?
Where I can find this information?

Hi @vix !

Kernel-related information is usually (hopefully) present in the kernel source tree itself. For device tree bindings, you can always refer to Documentation/devicetree/bindings: bindings « devicetree « Documentation - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules (be aware that you must switch to the correct branch regarding the TorizonOS/Toradex BSP you are targeting according to the Embedded Linux Release Matrix | Toradex Developer Center article)

By searching in the place I pointed out, I found this: fsl-imx-sdma.txt « dma « bindings « devicetree « Documentation - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules. This certainly tells you what you need :wink:

Best regards,

Thanks a lot @henrique.tx !

You are welcome!

Happy to help :smiley:

Have a nice day!