zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.8k stars 6.58k forks source link

SPI2 DMA configuration isses STM32WB55 #57325

Closed pebeoo closed 1 year ago

pebeoo commented 1 year ago

Describe the bug In our project we are using DMA2 to handle SPI2 transfers. With following configuration transmission works:

&spi2 {
    dmas = <&dmamux1 10 9 0x00440
            &dmamux1 11 8 0x00480>;
    dma-names = "tx", "rx";
};

but when we want to use dma2 notation, transmission does not work properly:

&spi2 {
  dmas = <&dma2 4 9 0x00440
          &dma2 5 8 0x00480>;
    dma-names = "tx", "rx";
};

To Reproduce Set SPI dmas configuration to dma2 channel using dma notation.

Expected behavior Possibility to setup SPI on DMA2 with dma notation in dts files.

Environment (please complete the following information): OS: Linux Toolchain Zephyr SDK Commit SHA or Version used: 3.3.99

FRASTM commented 1 year ago

Because the stm32wb has a DMAMUX in front of DMA1 and DMA2, you cannot access the DMA directly. but through DMAMUX channels:

With the dts

&spi2 {
    dmas = <&dmamux1 10 9 0x00440
            &dmamux1 11 8 0x00480>;
    dma-names = "tx", "rx";
};

channels 10 and 11 are on the DMA2

pebeoo commented 1 year ago

Thank you for reply, but I am little bit confused. In other thread there was suggestion to use access by &dma1 and &dma2: https://github.com/zephyrproject-rtos/zephyr/issues/55754#issuecomment-1468128986. So I assumed that this approach is valid for all drivers.

FRASTM commented 1 year ago

Thank you for reply, but I am little bit confused. In other thread there was suggestion to use access by &dma1 and &dma2: #55754 (comment). So I assumed that this approach is valid for all drivers.

spi and qspi/ospi stm32 Drivers use the DMAMUX in a different way. That's what the dts/bindings/ospi/st,stm32-ospi.yaml dts/bindings/qspi/st,stm32-qspi.yaml means in "If DMA should be used, specifier should hold a phandle reference to the dma controller (not the DMAMUX even if present)," Maybe that could be harmonized in the future of ospi/qspi driver evolution.

pebeoo commented 1 year ago

Thank you for the clarification. In this case issue could be closed.