mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'backport/spi_flash_fixes_v5.5' into 'release/v5.5'
fix(spi_flash): backport aes-xts error-path & mxic fixes (v5.5) See merge request espressif/esp-idf!51136
This commit is contained in:
@@ -219,6 +219,7 @@ static void s_flash_init_mxic(esp_rom_spiflash_read_mode_t mode)
|
|||||||
}
|
}
|
||||||
#endif // #if CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP
|
#endif // #if CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP
|
||||||
|
|
||||||
|
#if CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP
|
||||||
static void s_mxic_set_required_regs(uint32_t chip_id)
|
static void s_mxic_set_required_regs(uint32_t chip_id)
|
||||||
{
|
{
|
||||||
bool is_swap = false;
|
bool is_swap = false;
|
||||||
@@ -230,6 +231,7 @@ static void s_mxic_set_required_regs(uint32_t chip_id)
|
|||||||
esp_rom_spi_set_dtr_swap_mode(0, is_swap, is_swap);
|
esp_rom_spi_set_dtr_swap_mode(0, is_swap, is_swap);
|
||||||
esp_rom_spi_set_dtr_swap_mode(1, is_swap, is_swap);
|
esp_rom_spi_set_dtr_swap_mode(1, is_swap, is_swap);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@@ -603,7 +603,7 @@ esp_err_t spi_flash_chip_generic_write_encrypted(esp_flash_t *chip, const void *
|
|||||||
esp_flash_encryption->flash_encryption_data_prepare(address, (uint32_t *)data_bytes, block_size);
|
esp_flash_encryption->flash_encryption_data_prepare(address, (uint32_t *)data_bytes, block_size);
|
||||||
err = chip->chip_drv->set_chip_write_protect(chip, false);
|
err = chip->chip_drv->set_chip_write_protect(chip, false);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return err;
|
goto err_out;
|
||||||
}
|
}
|
||||||
// Waiting for encrypting buffer to finish and making result visible for SPI1
|
// Waiting for encrypting buffer to finish and making result visible for SPI1
|
||||||
esp_flash_encryption->flash_encryption_done();
|
esp_flash_encryption->flash_encryption_done();
|
||||||
@@ -614,11 +614,11 @@ esp_err_t spi_flash_chip_generic_write_encrypted(esp_flash_t *chip, const void *
|
|||||||
|
|
||||||
err = chip->chip_drv->write(chip, (uint32_t *)data_bytes, address, length);
|
err = chip->chip_drv->write(chip, (uint32_t *)data_bytes, address, length);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return err;
|
goto err_out;
|
||||||
}
|
}
|
||||||
err = chip->chip_drv->wait_idle(chip, chip->chip_drv->timeout->page_program_timeout);
|
err = chip->chip_drv->wait_idle(chip, chip->chip_drv->timeout->page_program_timeout);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
return err;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: we don't wait for idle status here, because this way
|
// Note: we don't wait for idle status here, because this way
|
||||||
@@ -634,6 +634,11 @@ esp_err_t spi_flash_chip_generic_write_encrypted(esp_flash_t *chip, const void *
|
|||||||
|
|
||||||
esp_flash_encryption->flash_encryption_disable();
|
esp_flash_encryption->flash_encryption_disable();
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
err_out:
|
||||||
|
esp_flash_encryption->flash_encryption_destroy();
|
||||||
|
esp_flash_encryption->flash_encryption_disable();
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
#endif // !CONFIG_SPI_FLASH_ROM_IMPL || ESP_ROM_HAS_ENCRYPTED_WRITES_USING_LEGACY_DRV
|
#endif // !CONFIG_SPI_FLASH_ROM_IMPL || ESP_ROM_HAS_ENCRYPTED_WRITES_USING_LEGACY_DRV
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user