From 407422154010afa96655a224664d75011cfba839 Mon Sep 17 00:00:00 2001 From: Cao Sen Miao Date: Fri, 25 Feb 2022 17:05:48 +0800 Subject: [PATCH] spi_flash: Fix bug that in bootloader dummy is 0 when mosi is 0 --- components/bootloader_support/src/bootloader_flash.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/bootloader_support/src/bootloader_flash.c b/components/bootloader_support/src/bootloader_flash.c index d5c902186e..d968c503c4 100644 --- a/components/bootloader_support/src/bootloader_flash.c +++ b/components/bootloader_support/src/bootloader_flash.c @@ -603,14 +603,12 @@ IRAM_ATTR uint32_t bootloader_flash_execute_command_common( SPIFLASH.addr = address; #endif //dummy phase + uint32_t total_dummy = dummy_len; if (miso_len > 0) { - uint32_t total_dummy = dummy_len + g_rom_spiflash_dummy_len_plus[1]; - SPIFLASH.user.usr_dummy = total_dummy > 0; - SPIFLASH.user1.usr_dummy_cyclelen = total_dummy - 1; - } else { - SPIFLASH.user.usr_dummy = 0; - SPIFLASH.user1.usr_dummy_cyclelen = 0; + total_dummy += g_rom_spiflash_dummy_len_plus[1]; } + SPIFLASH.user.usr_dummy = total_dummy > 0; + SPIFLASH.user1.usr_dummy_cyclelen = total_dummy - 1; //output data SPIFLASH.user.usr_mosi = mosi_len > 0; #if CONFIG_IDF_TARGET_ESP32