Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions drivers/flash/Kconfig.stm32_qspi
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ config FLASH_STM32_QSPI
select FLASH_HAS_PAGE_LAYOUT
select DMA if $(DT_STM32_QUADSPI_HAS_DMA)
select USE_STM32_HAL_DMA if $(DT_STM32_QUADSPI_HAS_DMA)
select USE_STM32_HAL_MDMA if !$(DT_STM32_QUADSPI_HAS_DMA)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed logic is not correct.
User always has the possibility of not using DMA wth QSPI, even if supported on the series in use.
With this change, MDMA is systematically enabled in this case.

Copy link
Contributor Author

@SpooniSpoon SpooniSpoon May 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The MDMA is always required by the STM32 QSPI HAL driver also without DMA support. As a workaround to avoid compiler errors I enabled the MDMA HAL driver if DMA support is disabled.

Copy link
Member

@erwango erwango May 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This maybe the case on H7, but not on all STM32 series.
You can have a try by doing the folloing change in disco_l475_iot1.dts:

 &quadspi {
 	pinctrl-0 = <&quadspi_clk_pe10 &quadspi_ncs_pe11
 		     &quadspi_bk1_io0_pe12 &quadspi_bk1_io1_pe13
 		     &quadspi_bk1_io2_pe14 &quadspi_bk1_io3_pe15>;
-	dmas = <&dma1 5 5 0x0000 0x03>;
-	dma-names = "tx_rx";
+	//dmas = <&dma1 5 5 0x0000 0x03>;
+	//dma-names = "tx_rx";
 

Then run:

west build -b  disco_l475_iot1 samples/drivers/flash_shell

help
Enable QSPI-NOR support on the STM32 family of processors.
For STM32H7 devices DMA is not yet supported.
6 changes: 6 additions & 0 deletions drivers/flash/flash_stm32_qspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
#include <logging/log.h>
LOG_MODULE_REGISTER(flash_stm32_qspi, CONFIG_FLASH_LOG_LEVEL);

#ifdef CONFIG_SOC_SERIES_STM32H7X
#if DT_NODE_HAS_PROP(DT_NODELABEL(quadspi), dmas)
#error "STM32H7 QSPI flash driver do not support DMA"
#endif
#endif

#define STM32_QSPI_FIFO_THRESHOLD 8
#define STM32_QSPI_CLOCK_PRESCALER_MAX 255

Expand Down
11 changes: 11 additions & 0 deletions dts/arm/st/h7/stm32h7.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,17 @@
label = "I2C_4";
};

quadspi: quadspi@52005000 {
compatible = "st,stm32-qspi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x52005000 0x400>;
interrupts = <92 0>;
clocks = <&rcc STM32_CLOCK_BUS_AHB3 0x00004000>;
status = "disabled";
label = "QUADSPI";
};

spi1: spi@40013000 {
compatible = "st,stm32-spi-fifo", "st,stm32-spi";
#address-cells = <1>;
Expand Down
3 changes: 2 additions & 1 deletion dts/bindings/qspi/st,stm32-qspi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ properties:
description: |
Optional DMA channel specifier. If DMA should be used, specifier should
hold a phandle reference to the dma controller, the channel number,
the slot number, channel configuration and finally features.
the slot number, channel configuration and finally features. For STM32H7
devices DMA is not yet supported.

For example dmas for TX/RX on QSPI
dmas = <&dma1 5 5 0x0000 0x03>;
Expand Down