Skip to content

Commit bb8e8e9

Browse files
besmarshjhedberg
authored andcommitted
drivers: flash: stm32_{o|x}spi: Add Microchip-specific special case
Commit 76740ae added a special case to the STM32 QSPI driver to support Microchip QSPI flash ICs, such as the SST26VF series, which use the PP_1_1_4 opcode in PP_1_4_4 mode. This commit adds the same special case to the STM32 OSPI and XSPI drivers. Signed-off-by: Ben Marsh <[email protected]>
1 parent 633e9c7 commit bb8e8e9

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

drivers/flash/Kconfig.stm32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ config FLASH_STM32_OPTION_BYTES
9797

9898
config USE_MICROCHIP_QSPI_FLASH_WITH_STM32
9999
bool "Include patch for Microchip qspi flash when running with stm32"
100-
depends on DT_HAS_ST_STM32_QSPI_NOR_ENABLED
100+
depends on FLASH_STM32_QSPI || FLASH_STM32_OSPI || FLASH_STM32_XSPI
101101
help
102102
Set to use Microchip QSPI flash memories which use the PP_1_1_4 opcode
103103
(32H) for the PP_1_4_4 operation (usually 38H).

drivers/flash/flash_stm32_ospi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,10 @@ static int flash_stm32_ospi_write(const struct device *dev, off_t addr,
15131513
case SPI_NOR_CMD_PP_1_4_4_4B:
15141514
__fallthrough;
15151515
case SPI_NOR_CMD_PP_1_4_4:
1516+
#if defined(CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32)
1517+
/* Microchip QSPI flash uses PP_1_1_4 opcode for the PP_1_4_4 operation */
1518+
cmd_pp.Instruction = SPI_NOR_CMD_PP_1_1_4;
1519+
#endif /* CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32 */
15161520
cmd_pp.InstructionMode = HAL_OSPI_INSTRUCTION_1_LINE;
15171521
cmd_pp.AddressMode = HAL_OSPI_ADDRESS_4_LINES;
15181522
cmd_pp.DataMode = HAL_OSPI_DATA_4_LINES;

drivers/flash/flash_stm32_xspi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,10 @@ static int flash_stm32_xspi_write(const struct device *dev, off_t addr,
13801380
case SPI_NOR_CMD_PP_1_4_4_4B:
13811381
__fallthrough;
13821382
case SPI_NOR_CMD_PP_1_4_4: {
1383+
#if defined(CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32)
1384+
/* Microchip QSPI flash uses PP_1_1_4 opcode for the PP_1_4_4 operation */
1385+
cmd_pp.Instruction = SPI_NOR_CMD_PP_1_1_4;
1386+
#endif /* CONFIG_USE_MICROCHIP_QSPI_FLASH_WITH_STM32 */
13831387
cmd_pp.InstructionMode = HAL_XSPI_INSTRUCTION_1_LINE;
13841388
cmd_pp.AddressMode = HAL_XSPI_ADDRESS_4_LINES;
13851389
cmd_pp.DataMode = HAL_XSPI_DATA_4_LINES;

0 commit comments

Comments
 (0)