mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(spi_flash): Add new xmc chip id
This commit is contained in:
parent
0690e53294
commit
75e2d77b26
@ -669,7 +669,8 @@ void bootloader_spi_flash_reset(void)
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#define XMC_SUPPORT CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT
|
#define XMC_SUPPORT CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT
|
||||||
#define XMC_VENDOR_ID 0x20
|
#define XMC_VENDOR_ID_1 0x20
|
||||||
|
#define XMC_VENDOR_ID_2 0x46
|
||||||
|
|
||||||
#if BOOTLOADER_BUILD
|
#if BOOTLOADER_BUILD
|
||||||
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_EARLY_LOG##level(TAG, ##__VA_ARGS__)
|
#define BOOTLOADER_FLASH_LOG(level, ...) ESP_EARLY_LOG##level(TAG, ##__VA_ARGS__)
|
||||||
@ -686,7 +687,7 @@ static IRAM_ATTR bool is_xmc_chip_strict(uint32_t rdid)
|
|||||||
uint32_t mfid = BYTESHIFT(rdid, 1);
|
uint32_t mfid = BYTESHIFT(rdid, 1);
|
||||||
uint32_t cpid = BYTESHIFT(rdid, 0);
|
uint32_t cpid = BYTESHIFT(rdid, 0);
|
||||||
|
|
||||||
if (vendor_id != XMC_VENDOR_ID) {
|
if (vendor_id != XMC_VENDOR_ID_1 && vendor_id != XMC_VENDOR_ID_2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,7 +720,7 @@ esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
|
|||||||
// Check the Manufacturer ID in SFDP registers (JEDEC standard). If not XMC chip, no need to run the flow
|
// Check the Manufacturer ID in SFDP registers (JEDEC standard). If not XMC chip, no need to run the flow
|
||||||
const int sfdp_mfid_addr = 0x10;
|
const int sfdp_mfid_addr = 0x10;
|
||||||
uint8_t mf_id = (bootloader_flash_read_sfdp(sfdp_mfid_addr, 1) & 0xff);
|
uint8_t mf_id = (bootloader_flash_read_sfdp(sfdp_mfid_addr, 1) & 0xff);
|
||||||
if (mf_id != XMC_VENDOR_ID) {
|
if ((mf_id != XMC_VENDOR_ID_1) && (mf_id != XMC_VENDOR_ID_2)) {
|
||||||
BOOTLOADER_FLASH_LOG(D, "non-XMC chip detected by SFDP Read (%02X), skip.", mf_id);
|
BOOTLOADER_FLASH_LOG(D, "non-XMC chip detected by SFDP Read (%02X), skip.", mf_id);
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
@ -751,7 +752,7 @@ esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
|
|||||||
static IRAM_ATTR bool is_xmc_chip(uint32_t rdid)
|
static IRAM_ATTR bool is_xmc_chip(uint32_t rdid)
|
||||||
{
|
{
|
||||||
uint32_t vendor_id = (rdid >> 16) & 0xFF;
|
uint32_t vendor_id = (rdid >> 16) & 0xFF;
|
||||||
return (vendor_id == XMC_VENDOR_ID);
|
return ((vendor_id == XMC_VENDOR_ID_1) || (vendor_id == XMC_VENDOR_ID_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
|
esp_err_t IRAM_ATTR bootloader_flash_xmc_startup(void)
|
||||||
|
@ -20,7 +20,7 @@ void spi_flash_needs_reset_check(void)
|
|||||||
{
|
{
|
||||||
// Currently only XMC is suggested to reset when brownout
|
// Currently only XMC is suggested to reset when brownout
|
||||||
#if CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC
|
#if CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC
|
||||||
if ((g_rom_flashchip.device_id >> 16) == 0x20) {
|
if ((g_rom_flashchip.device_id >> 16) == 0x20 || (g_rom_flashchip.device_id >> 16) == 0x46) {
|
||||||
flash_brownout_needs_reset = true;
|
flash_brownout_needs_reset = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2020-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -115,7 +115,7 @@ static void spi_flash_enable_high_performance_send_cmd(void)
|
|||||||
{
|
{
|
||||||
uint32_t dummy = 24;
|
uint32_t dummy = 24;
|
||||||
bootloader_flash_execute_command_common(CMD_HPMEN, 0, 0, dummy, 0, 0, 0);
|
bootloader_flash_execute_command_common(CMD_HPMEN, 0, 0, dummy, 0, 0, 0);
|
||||||
// Delay for T(HPM) refering to datasheet.
|
// Delay for T(HPM) referring to datasheet.
|
||||||
esp_rom_delay_us(20);
|
esp_rom_delay_us(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,6 +150,8 @@ static esp_err_t spi_flash_hpm_probe_chip_with_dummy(uint32_t flash_id)
|
|||||||
// XMC chips.
|
// XMC chips.
|
||||||
case 0x204017:
|
case 0x204017:
|
||||||
case 0x204018:
|
case 0x204018:
|
||||||
|
case 0x464017:
|
||||||
|
case 0x464018:
|
||||||
break;
|
break;
|
||||||
// GD chips.
|
// GD chips.
|
||||||
case 0xC84017:
|
case 0xC84017:
|
||||||
@ -431,7 +433,7 @@ bool spi_flash_hpm_dummy_adjust(void)
|
|||||||
//-----------------------generic functions-------------------------------------//
|
//-----------------------generic functions-------------------------------------//
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default dummy for almost all flash chips. If your flash does't need to reconfigure dummy,
|
* @brief Default dummy for almost all flash chips. If your flash doesn't need to reconfigure dummy,
|
||||||
* just call this function.
|
* just call this function.
|
||||||
*/
|
*/
|
||||||
void __attribute__((weak)) spi_flash_hpm_get_dummy_generic(spi_flash_hpm_dummy_conf_t *dummy_conf)
|
void __attribute__((weak)) spi_flash_hpm_get_dummy_generic(spi_flash_hpm_dummy_conf_t *dummy_conf)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user