mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	Merge branch 'bugfix/flash_pe_usr_interval' into 'master'
fix(spi_flash): Fix spi_flash write fail on 26M C2(including OTA fail on this chip) See merge request espressif/esp-idf!25790
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -201,7 +201,7 @@ static inline void spi_flash_ll_program_page(spi_dev_t *dev, const void *buffer,
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void spi_flash_ll_user_start(spi_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
@@ -399,16 +399,6 @@ static inline void spi_flash_ll_set_cs_setup(spi_dev_t *dev, uint32_t cs_setup_t
 | 
			
		||||
    dev->ctrl2.setup_time = cs_setup_time - 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Set lock for SPI0 so that spi0 can request new cache request after a cache transfer.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spi_flash_ll_set_pe_bit(spi_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    // Not supported on esp32
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get the spi flash source clock frequency. Used for calculating
 | 
			
		||||
 * the divider parameters.
 | 
			
		||||
 
 | 
			
		||||
@@ -140,8 +140,9 @@ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *bu
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not. (not used in gpspi)
 | 
			
		||||
 */
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev,  bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->ctrl.hold_pol = 1;
 | 
			
		||||
    dev->cmd.update = 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -47,7 +47,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        gpspi_flash_ll_cmd_is_done((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  gpspi_flash_ll_get_buffer_data((spi_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       gpspi_flash_ll_set_buffer_data((spi_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         gpspi_flash_ll_user_start((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 gpspi_flash_ll_user_start((spi_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          gpspi_flash_ll_host_idle((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         gpspi_flash_ll_read_phase((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    gpspi_flash_ll_set_cs_pin((spi_dev_t*)dev, pin)
 | 
			
		||||
@@ -64,7 +64,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             gpspi_flash_ll_set_dummy_out((spi_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   gpspi_flash_ll_set_hold((spi_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        gpspi_flash_ll_set_cs_setup((spi_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         gpspi_flash_ll_set_pe_bit((spi_dev_t*)dev)
 | 
			
		||||
#else
 | 
			
		||||
#define spi_flash_ll_reset(dev)                              spimem_flash_ll_reset((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        spimem_flash_ll_cmd_is_done((spi_mem_dev_t*)dev)
 | 
			
		||||
@@ -75,7 +74,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  spimem_flash_ll_get_buffer_data((spi_mem_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       spimem_flash_ll_set_buffer_data((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_program_page(dev, buffer, len)          spimem_flash_ll_program_page((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         spimem_flash_ll_user_start((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 spimem_flash_ll_user_start((spi_mem_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          spimem_flash_ll_host_idle((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         spimem_flash_ll_read_phase((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    spimem_flash_ll_set_cs_pin((spi_mem_dev_t*)dev, pin)
 | 
			
		||||
@@ -92,7 +91,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             spimem_flash_ll_set_dummy_out((spi_mem_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   spimem_flash_ll_set_hold((spi_mem_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        spimem_flash_ll_set_cs_setup((spi_mem_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         spimem_flash_ll_set_pe_bit((spi_mem_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -368,21 +368,12 @@ static inline void spimem_flash_ll_program_page(spi_mem_dev_t *dev, const void *
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev)
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In user mode, it is set to indicate that program/erase operation will be triggered.
 | 
			
		||||
 * This function is combined with `spimem_flash_ll_user_start`. The pe_bit will be cleared automatically once the operation done.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_set_pe_bit(spi_mem_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.flash_pe = 1;
 | 
			
		||||
    uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000);
 | 
			
		||||
    dev->cmd.val |= usr_pe;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -132,8 +132,9 @@ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *bu
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not. (not used in gpspi)
 | 
			
		||||
 */
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev,  bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.update = 1;
 | 
			
		||||
    while (dev->cmd.update);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -47,7 +47,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        gpspi_flash_ll_cmd_is_done((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  gpspi_flash_ll_get_buffer_data((spi_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       gpspi_flash_ll_set_buffer_data((spi_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         gpspi_flash_ll_user_start((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 gpspi_flash_ll_user_start((spi_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          gpspi_flash_ll_host_idle((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         gpspi_flash_ll_read_phase((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    gpspi_flash_ll_set_cs_pin((spi_dev_t*)dev, pin)
 | 
			
		||||
@@ -64,7 +64,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             gpspi_flash_ll_set_dummy_out((spi_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   gpspi_flash_ll_set_hold((spi_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        gpspi_flash_ll_set_cs_setup((spi_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         gpspi_flash_ll_set_pe_bit((spi_dev_t*)dev)
 | 
			
		||||
#else
 | 
			
		||||
#define spi_flash_ll_reset(dev)                              spimem_flash_ll_reset((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        spimem_flash_ll_cmd_is_done((spi_mem_dev_t*)dev)
 | 
			
		||||
@@ -75,7 +74,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  spimem_flash_ll_get_buffer_data((spi_mem_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       spimem_flash_ll_set_buffer_data((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_program_page(dev, buffer, len)          spimem_flash_ll_program_page((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         spimem_flash_ll_user_start((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 spimem_flash_ll_user_start((spi_mem_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          spimem_flash_ll_host_idle((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         spimem_flash_ll_read_phase((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    spimem_flash_ll_set_cs_pin((spi_mem_dev_t*)dev, pin)
 | 
			
		||||
@@ -92,7 +91,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             spimem_flash_ll_set_dummy_out((spi_mem_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   spimem_flash_ll_set_hold((spi_mem_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        spimem_flash_ll_set_cs_setup((spi_mem_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         spimem_flash_ll_set_pe_bit((spi_mem_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -370,21 +370,12 @@ static inline void spimem_flash_ll_program_page(spi_mem_dev_t *dev, const void *
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev)
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In user mode, it is set to indicate that program/erase operation will be triggered.
 | 
			
		||||
 * This function is combined with `spimem_flash_ll_user_start`. The pe_bit will be cleared automatically once the operation done.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_set_pe_bit(spi_mem_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.flash_pe = 1;
 | 
			
		||||
    uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000);
 | 
			
		||||
    dev->cmd.val |= usr_pe;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -132,8 +132,9 @@ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *bu
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not. (not used in gpspi)
 | 
			
		||||
 */
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev,  bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.update = 1;
 | 
			
		||||
    while (dev->cmd.update);
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        gpspi_flash_ll_cmd_is_done((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  gpspi_flash_ll_get_buffer_data((spi_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       gpspi_flash_ll_set_buffer_data((spi_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         gpspi_flash_ll_user_start((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 gpspi_flash_ll_user_start((spi_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          gpspi_flash_ll_host_idle((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         gpspi_flash_ll_read_phase((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    gpspi_flash_ll_set_cs_pin((spi_dev_t*)dev, pin)
 | 
			
		||||
@@ -65,7 +65,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   gpspi_flash_ll_set_hold((spi_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        gpspi_flash_ll_set_cs_setup((spi_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_extra_address(dev, extra_addr)      { /* Not supported on gpspi on ESP32-C6*/ }
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         gpspi_flash_ll_set_pe_bit((spi_dev_t*)dev)
 | 
			
		||||
#else
 | 
			
		||||
#define spi_flash_ll_reset(dev)                              spimem_flash_ll_reset((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        spimem_flash_ll_cmd_is_done((spi_mem_dev_t*)dev)
 | 
			
		||||
@@ -76,7 +75,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  spimem_flash_ll_get_buffer_data((spi_mem_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       spimem_flash_ll_set_buffer_data((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_program_page(dev, buffer, len)          spimem_flash_ll_program_page((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         spimem_flash_ll_user_start((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 spimem_flash_ll_user_start((spi_mem_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          spimem_flash_ll_host_idle((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         spimem_flash_ll_read_phase((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    spimem_flash_ll_set_cs_pin((spi_mem_dev_t*)dev, pin)
 | 
			
		||||
@@ -93,7 +92,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   spimem_flash_ll_set_hold((spi_mem_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        spimem_flash_ll_set_cs_setup((spi_mem_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_extra_address(dev, extra_addr)      spimem_flash_ll_set_extra_address((spi_mem_dev_t*)dev, extra_addr)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         spimem_flash_ll_set_pe_bit((spi_mem_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -371,21 +371,12 @@ static inline void spimem_flash_ll_program_page(spi_mem_dev_t *dev, const void *
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev)
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In user mode, it is set to indicate that program/erase operation will be triggered.
 | 
			
		||||
 * This function is combined with `spimem_flash_ll_user_start`. The pe_bit will be cleared automatically once the operation done.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_set_pe_bit(spi_mem_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.flash_pe = 1;
 | 
			
		||||
    uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000);
 | 
			
		||||
    dev->cmd.val |= usr_pe;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -132,8 +132,9 @@ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *bu
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not. (not used in gpspi)
 | 
			
		||||
 */
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev,  bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.update = 1;
 | 
			
		||||
    while (dev->cmd.update);
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        gpspi_flash_ll_cmd_is_done((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  gpspi_flash_ll_get_buffer_data((spi_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       gpspi_flash_ll_set_buffer_data((spi_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         gpspi_flash_ll_user_start((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 gpspi_flash_ll_user_start((spi_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          gpspi_flash_ll_host_idle((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         gpspi_flash_ll_read_phase((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    gpspi_flash_ll_set_cs_pin((spi_dev_t*)dev, pin)
 | 
			
		||||
@@ -65,7 +65,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   gpspi_flash_ll_set_hold((spi_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        gpspi_flash_ll_set_cs_setup((spi_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_extra_address(dev, extra_addr)      { /* Not supported on gpspi on ESP32-H2*/ }
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         gpspi_flash_ll_set_pe_bit((spi_dev_t*)dev)
 | 
			
		||||
#else
 | 
			
		||||
#define spi_flash_ll_reset(dev)                              spimem_flash_ll_reset((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        spimem_flash_ll_cmd_is_done((spi_mem_dev_t*)dev)
 | 
			
		||||
@@ -76,7 +75,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  spimem_flash_ll_get_buffer_data((spi_mem_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       spimem_flash_ll_set_buffer_data((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_program_page(dev, buffer, len)          spimem_flash_ll_program_page((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         spimem_flash_ll_user_start((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 spimem_flash_ll_user_start((spi_mem_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          spimem_flash_ll_host_idle((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         spimem_flash_ll_read_phase((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    spimem_flash_ll_set_cs_pin((spi_mem_dev_t*)dev, pin)
 | 
			
		||||
@@ -93,7 +92,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   spimem_flash_ll_set_hold((spi_mem_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        spimem_flash_ll_set_cs_setup((spi_mem_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_extra_address(dev, extra_addr)      spimem_flash_ll_set_extra_address((spi_mem_dev_t*)dev, extra_addr)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         spimem_flash_ll_set_pe_bit((spi_mem_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -372,21 +372,12 @@ static inline void spimem_flash_ll_program_page(spi_mem_dev_t *dev, const void *
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev)
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In user mode, it is set to indicate that program/erase operation will be triggered.
 | 
			
		||||
 * This function is combined with `spimem_flash_ll_user_start`. The pe_bit will be cleared automatically once the operation done.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_set_pe_bit(spi_mem_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.flash_pe = 1;
 | 
			
		||||
    uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000);
 | 
			
		||||
    dev->cmd.val |= usr_pe;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -137,8 +137,9 @@ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *bu
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not. (not used in gpspi)
 | 
			
		||||
 */
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev,  bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->ctrl.hold_pol = 1;
 | 
			
		||||
    dev->cmd.update = 1;
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        gpspi_flash_ll_cmd_is_done((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  gpspi_flash_ll_get_buffer_data((spi_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       gpspi_flash_ll_set_buffer_data((spi_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         gpspi_flash_ll_user_start((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 gpspi_flash_ll_user_start((spi_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          gpspi_flash_ll_host_idle((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         gpspi_flash_ll_read_phase((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    gpspi_flash_ll_set_cs_pin((spi_dev_t*)dev, pin)
 | 
			
		||||
@@ -65,7 +65,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   gpspi_flash_ll_set_hold((spi_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        gpspi_flash_ll_set_cs_setup((spi_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_extra_address(dev, extra_addr)      { /* Not supported on gpspi on ESP32-C6*/ }
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         gpspi_flash_ll_set_pe_bit((spi_dev_t*)dev)
 | 
			
		||||
#else
 | 
			
		||||
#define spi_flash_ll_reset(dev)                              spimem_flash_ll_reset((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        spimem_flash_ll_cmd_is_done((spi_mem_dev_t*)dev)
 | 
			
		||||
@@ -76,7 +75,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  spimem_flash_ll_get_buffer_data((spi_mem_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       spimem_flash_ll_set_buffer_data((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_program_page(dev, buffer, len)          spimem_flash_ll_program_page((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         spimem_flash_ll_user_start((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 spimem_flash_ll_user_start((spi_mem_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          spimem_flash_ll_host_idle((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         spimem_flash_ll_read_phase((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    spimem_flash_ll_set_cs_pin((spi_mem_dev_t*)dev, pin)
 | 
			
		||||
@@ -93,7 +92,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   spimem_flash_ll_set_hold((spi_mem_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        spimem_flash_ll_set_cs_setup((spi_mem_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_extra_address(dev, extra_addr)      spimem_flash_ll_set_extra_address((spi_mem_dev_t*)dev, extra_addr)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         spimem_flash_ll_set_pe_bit((spi_mem_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -376,21 +376,12 @@ static inline void spimem_flash_ll_program_page(spi_mem_dev_t *dev, const void *
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev)
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In user mode, it is set to indicate that program/erase operation will be triggered.
 | 
			
		||||
 * This function is combined with `spimem_flash_ll_user_start`. The pe_bit will be cleared automatically once the operation done.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_set_pe_bit(spi_mem_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.flash_pe = 1;
 | 
			
		||||
    uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000);
 | 
			
		||||
    dev->cmd.val |= usr_pe;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -128,8 +128,9 @@ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *bu
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not. (not used in gpspi)
 | 
			
		||||
 */
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev,  bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -48,7 +48,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        gpspi_flash_ll_cmd_is_done((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  gpspi_flash_ll_get_buffer_data((spi_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       gpspi_flash_ll_set_buffer_data((spi_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         gpspi_flash_ll_user_start((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 gpspi_flash_ll_user_start((spi_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          gpspi_flash_ll_host_idle((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         gpspi_flash_ll_read_phase((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    gpspi_flash_ll_set_cs_pin((spi_dev_t*)dev, pin)
 | 
			
		||||
@@ -65,7 +65,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             gpspi_flash_ll_set_dummy_out((spi_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   gpspi_flash_ll_set_hold((spi_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        gpspi_flash_ll_set_cs_setup((spi_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         gpspi_flash_ll_set_pe_bit((spi_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
@@ -78,7 +77,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  spimem_flash_ll_get_buffer_data((spi_mem_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       spimem_flash_ll_set_buffer_data((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_program_page(dev, buffer, len)          spimem_flash_ll_program_page((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         spimem_flash_ll_user_start((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 spimem_flash_ll_user_start((spi_mem_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          spimem_flash_ll_host_idle((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         spimem_flash_ll_read_phase((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    spimem_flash_ll_set_cs_pin((spi_mem_dev_t*)dev, pin)
 | 
			
		||||
@@ -95,7 +94,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             spimem_flash_ll_set_dummy_out((spi_mem_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   spimem_flash_ll_set_hold((spi_mem_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        spimem_flash_ll_set_cs_setup((spi_mem_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         spimem_flash_ll_set_pe_bit((spi_mem_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -311,21 +311,12 @@ static inline void spimem_flash_ll_program_page(spi_mem_dev_t *dev, const void *
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev)
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In user mode, it is set to indicate that program/erase operation will be triggered.
 | 
			
		||||
 * This function is combined with `spimem_flash_ll_user_start`. The pe_bit will be cleared automatically once the operation done.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_set_pe_bit(spi_mem_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.flash_pe = 1;
 | 
			
		||||
    uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000);
 | 
			
		||||
    dev->cmd.val |= usr_pe;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -137,8 +137,9 @@ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *bu
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not. (not used in gpspi)
 | 
			
		||||
 */
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev)
 | 
			
		||||
static inline void gpspi_flash_ll_user_start(spi_dev_t *dev,  bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.update = 1;
 | 
			
		||||
    while (dev->cmd.update);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -46,7 +46,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_cmd_is_done(dev)                        gpspi_flash_ll_cmd_is_done((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  gpspi_flash_ll_get_buffer_data((spi_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       gpspi_flash_ll_set_buffer_data((spi_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         gpspi_flash_ll_user_start((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 gpspi_flash_ll_user_start((spi_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          gpspi_flash_ll_host_idle((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         gpspi_flash_ll_read_phase((spi_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    gpspi_flash_ll_set_cs_pin((spi_dev_t*)dev, pin)
 | 
			
		||||
@@ -63,7 +63,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             gpspi_flash_ll_set_dummy_out((spi_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   gpspi_flash_ll_set_hold((spi_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        gpspi_flash_ll_set_cs_setup((spi_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         gpspi_flash_ll_set_pe_bit((spi_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
#define spi_flash_ll_reset(dev)                              spimem_flash_ll_reset((spi_mem_dev_t*)dev)
 | 
			
		||||
@@ -75,7 +74,7 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_get_buffer_data(dev, buffer, read_len)  spimem_flash_ll_get_buffer_data((spi_mem_dev_t*)dev, buffer, read_len)
 | 
			
		||||
#define spi_flash_ll_set_buffer_data(dev, buffer, len)       spimem_flash_ll_set_buffer_data((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_program_page(dev, buffer, len)          spimem_flash_ll_program_page((spi_mem_dev_t*)dev, buffer, len)
 | 
			
		||||
#define spi_flash_ll_user_start(dev)                         spimem_flash_ll_user_start((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_user_start(dev, pe_ops)                 spimem_flash_ll_user_start((spi_mem_dev_t*)dev, pe_ops)
 | 
			
		||||
#define spi_flash_ll_host_idle(dev)                          spimem_flash_ll_host_idle((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_read_phase(dev)                         spimem_flash_ll_read_phase((spi_mem_dev_t*)dev)
 | 
			
		||||
#define spi_flash_ll_set_cs_pin(dev, pin)                    spimem_flash_ll_set_cs_pin((spi_mem_dev_t*)dev, pin)
 | 
			
		||||
@@ -92,8 +91,6 @@ typedef union  {
 | 
			
		||||
#define spi_flash_ll_set_dummy_out(dev, en, lev)             spimem_flash_ll_set_dummy_out((spi_mem_dev_t*)dev, en, lev)
 | 
			
		||||
#define spi_flash_ll_set_hold(dev, hold_n)                   spimem_flash_ll_set_hold((spi_mem_dev_t*)dev, hold_n)
 | 
			
		||||
#define spi_flash_ll_set_cs_setup(dev, cs_setup_time)        spimem_flash_ll_set_cs_setup((spi_mem_dev_t*)dev, cs_setup_time)
 | 
			
		||||
#define spi_flash_ll_set_pe_bit(dev)                         spimem_flash_ll_set_pe_bit((spi_mem_dev_t*)dev)
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 */
 | 
			
		||||
@@ -368,21 +368,12 @@ static inline void spimem_flash_ll_program_page(spi_mem_dev_t *dev, const void *
 | 
			
		||||
 * should be configured before this is called.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 * @param pe_ops Is page program/erase operation or not.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev)
 | 
			
		||||
static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.usr = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * In user mode, it is set to indicate that program/erase operation will be triggered.
 | 
			
		||||
 * This function is combined with `spimem_flash_ll_user_start`. The pe_bit will be cleared automatically once the operation done.
 | 
			
		||||
 *
 | 
			
		||||
 * @param dev Beginning address of the peripheral registers.
 | 
			
		||||
 */
 | 
			
		||||
static inline void spimem_flash_ll_set_pe_bit(spi_mem_dev_t *dev)
 | 
			
		||||
{
 | 
			
		||||
    dev->cmd.flash_pe = 1;
 | 
			
		||||
    uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000);
 | 
			
		||||
    dev->cmd.val |= usr_pe;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -151,6 +151,7 @@ esp_err_t spi_flash_hal_common_command(spi_flash_host_inst_t *host, spi_flash_tr
 | 
			
		||||
    esp_flash_io_mode_t io_mode = ((spi_flash_hal_context_t*)host)->base_io_mode;
 | 
			
		||||
    uint16_t command;
 | 
			
		||||
    uint8_t dummy_bitlen;
 | 
			
		||||
    bool pe_ops = false;
 | 
			
		||||
 | 
			
		||||
    command = trans->command;
 | 
			
		||||
    dummy_bitlen = trans->dummy_bitlen;
 | 
			
		||||
@@ -171,9 +172,9 @@ esp_err_t spi_flash_hal_common_command(spi_flash_host_inst_t *host, spi_flash_tr
 | 
			
		||||
 | 
			
		||||
    spi_flash_ll_set_miso_bitlen(dev, trans->miso_len * 8);
 | 
			
		||||
    if ((trans->flags & SPI_FLASH_TRANS_FLAG_PE_CMD) != 0) {
 | 
			
		||||
        spi_flash_ll_set_pe_bit(dev);
 | 
			
		||||
        pe_ops = true;
 | 
			
		||||
    }
 | 
			
		||||
    spi_flash_ll_user_start(dev);
 | 
			
		||||
    spi_flash_ll_user_start(dev, pe_ops);
 | 
			
		||||
    host->driver->poll_cmd_done(host);
 | 
			
		||||
    if (trans->miso_len > 0) {
 | 
			
		||||
        spi_flash_ll_get_buffer_data(dev, trans->miso_data, trans->miso_len);
 | 
			
		||||
@@ -189,7 +190,7 @@ esp_err_t spi_flash_hal_read(spi_flash_host_inst_t *host, void *buffer, uint32_t
 | 
			
		||||
    //filled with ones by the function below
 | 
			
		||||
    spi_flash_ll_set_usr_address(dev, address, bitlen & (~7));
 | 
			
		||||
    spi_flash_ll_set_miso_bitlen(dev, read_len * 8);
 | 
			
		||||
    spi_flash_ll_user_start(dev);
 | 
			
		||||
    spi_flash_ll_user_start(dev, false);
 | 
			
		||||
    host->driver->poll_cmd_done(host);
 | 
			
		||||
    if (read_len > 0) {
 | 
			
		||||
        spi_flash_ll_get_buffer_data(dev, buffer, read_len);
 | 
			
		||||
 
 | 
			
		||||
@@ -53,3 +53,18 @@ def test_esp_flash_rom(dut: Dut) -> None:
 | 
			
		||||
)
 | 
			
		||||
def test_esp_flash_multi(dut: Dut) -> None:
 | 
			
		||||
    dut.run_all_single_board_cases(group='esp_flash_multi', timeout=120)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.esp32c2
 | 
			
		||||
@pytest.mark.generic
 | 
			
		||||
@pytest.mark.xtal_26mhz
 | 
			
		||||
@pytest.mark.parametrize(
 | 
			
		||||
    'config, baud',
 | 
			
		||||
    [
 | 
			
		||||
        ('esp32c2_xtal26m', '74880'),
 | 
			
		||||
        ('esp32c2_xtal26m_rom', '74880'),
 | 
			
		||||
    ],
 | 
			
		||||
    indirect=True,
 | 
			
		||||
)
 | 
			
		||||
def test_esp_flash_26mhz_c2(dut: Dut) -> None:
 | 
			
		||||
    dut.run_all_single_board_cases(group='esp_flash')
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,2 @@
 | 
			
		||||
CONFIG_IDF_TARGET="esp32c2"
 | 
			
		||||
CONFIG_XTAL_FREQ_26=y
 | 
			
		||||
@@ -0,0 +1,3 @@
 | 
			
		||||
CONFIG_IDF_TARGET="esp32c2"
 | 
			
		||||
CONFIG_XTAL_FREQ_26=y
 | 
			
		||||
CONFIG_SPI_FLASH_ROM_IMPL=y
 | 
			
		||||
		Reference in New Issue
	
	Block a user