Skip to content

Commit

Permalink
Merge branch 'bugfix/bootloader_flash_update_size' into 'master'
Browse files Browse the repository at this point in the history
fix(bootloader_support): Adds bootloader_flash_update_size() for the rest chips

Closes IDFGH-12123

See merge request espressif/esp-idf!29049
  • Loading branch information
KonstantinKondrashov committed Feb 22, 2024
2 parents 47c575d + 9ffafd5 commit b8e2342
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -34,6 +34,11 @@ void bootloader_flash_update_id()
chip->device_id = bootloader_read_flash_id();
}

void bootloader_flash_update_size(uint32_t size)
{
rom_spiflash_legacy_data->chip.chip_size = size;
}

void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_CS_HOLD_M | SPI_MEM_CS_SETUP_M);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -35,6 +35,11 @@ void bootloader_flash_update_id()
chip->device_id = bootloader_read_flash_id();
}

void bootloader_flash_update_size(uint32_t size)
{
rom_spiflash_legacy_data->chip.chip_size = size;
}

void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_CS_HOLD_M | SPI_MEM_CS_SETUP_M);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ void bootloader_flash_update_id()
chip->device_id = bootloader_read_flash_id();
}

void bootloader_flash_update_size(uint32_t size)
{
rom_spiflash_legacy_data->chip.chip_size = size;
}

void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_CS_HOLD_M | SPI_MEM_CS_SETUP_M);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -31,6 +31,11 @@ void bootloader_flash_update_id()
chip->device_id = bootloader_read_flash_id();
}

void bootloader_flash_update_size(uint32_t size)
{
rom_spiflash_legacy_data->chip.chip_size = size;
}

void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_CS_HOLD_M | SPI_MEM_CS_SETUP_M);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -32,6 +32,11 @@ void bootloader_flash_update_id()
chip->device_id = bootloader_read_flash_id();
}

void bootloader_flash_update_size(uint32_t size)
{
rom_spiflash_legacy_data->chip.chip_size = size;
}

void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_MEM_USER_REG(0), SPI_MEM_CS_HOLD_M | SPI_MEM_CS_SETUP_M);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ void bootloader_flash_update_id()
chip->device_id = bootloader_read_flash_id();
}

void bootloader_flash_update_size(uint32_t size)
{
rom_spiflash_legacy_data->chip.chip_size = size;
}

void IRAM_ATTR bootloader_flash_cs_timing_config()
{
SET_PERI_REG_MASK(SPI_MEM_C_USER_REG, SPI_MEM_C_CS_HOLD_M | SPI_MEM_C_CS_SETUP_M);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -41,6 +41,11 @@ void bootloader_flash_update_id()
chip->device_id = bootloader_read_flash_id();
}

void bootloader_flash_update_size(uint32_t size)
{
rom_spiflash_legacy_data->chip.chip_size = size;
}

void IRAM_ATTR bootloader_flash_cs_timing_config()
{
//SPI0/1 share the cs_hold / cs_setup, cd_hold_time / cd_setup_time, cs_hold_delay registers for FLASH, so we only need to set SPI0 related registers here
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_SPI_FLASH_SIZE_OVERRIDE=y

0 comments on commit b8e2342

Please sign in to comment.