1 // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include <stdlib.h> 16 #include "spi_flash_chip_driver.h" 17 #include "spi_flash_chip_generic.h" 18 #include "spi_flash_chip_issi.h" 19 #include "spi_flash_chip_mxic.h" 20 #include "spi_flash_chip_gd.h" 21 #include "spi_flash_chip_winbond.h" 22 #include "spi_flash_chip_boya.h" 23 #include "sdkconfig.h" 24 25 /* 26 * Default registered chip drivers. Note these are tested in order and first 27 * match is taken, so generic/catchall entries should go last. Note that the 28 * esp_flash_registered_flash_ops pointer can be changed to point to a different 29 * array of registered ops, if desired. 30 * 31 * It can be configured to support only available chips in the sdkconfig, to 32 * avoid possible issues, and speed up the auto-detecting. 33 */ 34 static const spi_flash_chip_t *default_registered_chips[] = { 35 #ifdef CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP 36 &esp_flash_chip_issi, 37 #endif 38 #ifdef CONFIG_SPI_FLASH_SUPPORT_GD_CHIP 39 &esp_flash_chip_gd, 40 #endif 41 #ifdef CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP 42 &esp_flash_chip_mxic, 43 #endif 44 #ifdef CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP 45 &esp_flash_chip_winbond, 46 #endif 47 #ifdef CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP 48 &esp_flash_chip_boya, 49 #endif 50 // Default chip drivers that will accept all chip ID. 51 // FM, Winbond and XMC chips are supposed to be supported by this chip driver. 52 &esp_flash_chip_generic, 53 NULL, 54 }; 55 56 const spi_flash_chip_t **esp_flash_registered_chips = default_registered_chips; 57