Skip to content

Commit 65a6e9c

Browse files
committed
Merge branch 'fix/flash_qio_read_failed' into 'master'
fix(spi_flash): Fix spi flash qio read failed on gpspi flash See merge request espressif/esp-idf!41204
2 parents e31611d + 34f9863 commit 65a6e9c

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

components/hal/spi_flash_hal_common.inc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ esp_err_t spi_flash_hal_configure_host_io_mode(
125125
* - DIO is similar.
126126
*/
127127
if (conf_required) {
128-
#if !SOC_SPI_MEM_SUPPORT_WB_MODE_INDEPENDENT_CONTROL
129128
int line_width = (io_mode == SPI_FLASH_DIO? 2: 4);
130129
dummy_cyclelen_base -= SPI_FLASH_LL_CONTINUOUS_MODE_BIT_NUMS / line_width;
130+
#if !SOC_SPI_MEM_SUPPORT_WB_MODE_INDEPENDENT_CONTROL
131131
addr_bitlen += SPI_FLASH_LL_CONTINUOUS_MODE_BIT_NUMS;
132132
#endif
133133
spi_flash_ll_set_extra_address(dev, 0);
@@ -145,7 +145,9 @@ esp_err_t spi_flash_hal_configure_host_io_mode(
145145
}
146146
#endif
147147
#else
148-
gpspi_flash_ll_set_dummy_out(dev, (conf_required? 1: 0), 1);
148+
if (conf_required) {
149+
gpspi_flash_ll_set_dummy_out(dev, (conf_required? 1: 0), 1);
150+
}
149151
#endif
150152

151153
#if SOC_IS(ESP32P4)

components/spi_flash/esp_flash_spi_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static uint32_t init_gpspi_clock(esp_flash_t *chip, const esp_flash_spi_device_c
294294
#if GPSPI_FLASH_LL_SUPPORT_CLK_SRC_PRE_DIV
295295
uint32_t pre_div = s_spi_find_clock_src_pre_div(clk_src_freq, GPSPI_FLASH_LL_PERIPHERAL_FREQUENCY_MHZ * 1000 * 1000);
296296
gpspi_flash_ll_clk_source_pre_div(spi_flash_ll_get_hw(config->host_id), pre_div / 2, 2);
297-
final_freq_mhz = clk_src_freq / (1 * 1000 * 1000) / (pre_div);
297+
final_freq_mhz = clk_src_freq / (pre_div);
298298
#else
299299
final_freq_mhz = clk_src_freq / (1 * 1000 * 1000);
300300
#endif

components/spi_flash/include/spi_flash/spi_flash_defs.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,8 @@
5757

5858
#define CMD_RDSFDP 0x5A /* Read the SFDP of the flash */
5959

60-
#if !SOC_SPI_MEM_SUPPORT_WB_MODE_INDEPENDENT_CONTROL
6160
#define SPI_FLASH_DIO_DUMMY_BITLEN 4
6261
#define SPI_FLASH_QIO_DUMMY_BITLEN 6
63-
#else
64-
#define SPI_FLASH_DIO_DUMMY_BITLEN 0
65-
#define SPI_FLASH_QIO_DUMMY_BITLEN 4
66-
#endif
6762
#define SPI_FLASH_DIO_ADDR_BITLEN 24
6863
#define SPI_FLASH_QIO_ADDR_BITLEN 24
6964
#define SPI_FLASH_QOUT_ADDR_BITLEN 24

0 commit comments

Comments
 (0)