2021-12-01 07:13:02 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2019-01-08 10:29:25 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "spi_flash_chip_driver.h"
|
|
|
|
#include "spi_flash_chip_generic.h"
|
|
|
|
#include "spi_flash_chip_issi.h"
|
2020-03-19 14:49:25 +00:00
|
|
|
#include "spi_flash_chip_mxic.h"
|
2019-09-09 16:56:46 +00:00
|
|
|
#include "spi_flash_chip_gd.h"
|
2020-07-26 19:13:07 +00:00
|
|
|
#include "spi_flash_chip_winbond.h"
|
2021-01-23 16:48:07 +00:00
|
|
|
#include "spi_flash_chip_boya.h"
|
2021-12-01 07:13:02 +00:00
|
|
|
#include "spi_flash_chip_th.h"
|
2019-01-08 10:29:25 +00:00
|
|
|
#include "sdkconfig.h"
|
|
|
|
|
2021-03-01 04:56:34 +00:00
|
|
|
#if !CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST
|
2019-01-08 10:29:25 +00:00
|
|
|
/*
|
|
|
|
* Default registered chip drivers. Note these are tested in order and first
|
|
|
|
* match is taken, so generic/catchall entries should go last. Note that the
|
|
|
|
* esp_flash_registered_flash_ops pointer can be changed to point to a different
|
|
|
|
* array of registered ops, if desired.
|
|
|
|
*
|
|
|
|
* It can be configured to support only available chips in the sdkconfig, to
|
|
|
|
* avoid possible issues, and speed up the auto-detecting.
|
|
|
|
*/
|
|
|
|
static const spi_flash_chip_t *default_registered_chips[] = {
|
|
|
|
#ifdef CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP
|
|
|
|
&esp_flash_chip_issi,
|
2019-09-09 16:56:46 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SPI_FLASH_SUPPORT_GD_CHIP
|
|
|
|
&esp_flash_chip_gd,
|
2020-03-19 14:49:25 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP
|
|
|
|
&esp_flash_chip_mxic,
|
2020-07-26 19:13:07 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP
|
|
|
|
&esp_flash_chip_winbond,
|
2021-01-23 16:48:07 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP
|
|
|
|
&esp_flash_chip_boya,
|
2021-09-01 07:58:15 +00:00
|
|
|
#endif
|
2021-12-01 07:13:02 +00:00
|
|
|
#ifdef CONFIG_SPI_FLASH_SUPPORT_TH_CHIP
|
|
|
|
&esp_flash_chip_th,
|
|
|
|
#endif
|
2021-09-01 07:58:15 +00:00
|
|
|
#ifdef CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP
|
|
|
|
&esp_flash_chip_mxic_opi,
|
2019-01-08 10:29:25 +00:00
|
|
|
#endif
|
2020-04-02 09:30:08 +00:00
|
|
|
// Default chip drivers that will accept all chip ID.
|
|
|
|
// FM, Winbond and XMC chips are supposed to be supported by this chip driver.
|
2019-01-08 10:29:25 +00:00
|
|
|
&esp_flash_chip_generic,
|
|
|
|
NULL,
|
|
|
|
};
|
2021-03-01 04:56:34 +00:00
|
|
|
#else
|
|
|
|
//When the config option is enabled, user should provide this struct themselves.
|
|
|
|
extern const spi_flash_chip_t *default_registered_chips[];
|
|
|
|
#endif //!CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST
|
2019-01-08 10:29:25 +00:00
|
|
|
|
|
|
|
const spi_flash_chip_t **esp_flash_registered_chips = default_registered_chips;
|