2020-01-29 22:40:38 -05:00
|
|
|
#include "storage.h"
|
2019-03-04 06:32:44 -05:00
|
|
|
#include "qspi.h"
|
|
|
|
|
|
|
|
// This configuration is needed for mboot to be able to write to the external QSPI flash
|
|
|
|
|
2022-08-18 23:49:03 -04:00
|
|
|
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
|
2020-01-29 22:40:38 -05:00
|
|
|
STATIC mp_spiflash_cache_t spi_bdev_cache;
|
2022-08-18 23:49:03 -04:00
|
|
|
#endif
|
2020-01-29 22:40:38 -05:00
|
|
|
|
2019-03-04 06:32:44 -05:00
|
|
|
const mp_spiflash_config_t spiflash_config = {
|
|
|
|
.bus_kind = MP_SPIFLASH_BUS_QSPI,
|
|
|
|
.bus.u_qspi.data = NULL,
|
|
|
|
.bus.u_qspi.proto = &qspi_proto,
|
2022-08-18 23:49:03 -04:00
|
|
|
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
|
2020-01-29 22:40:38 -05:00
|
|
|
.cache = &spi_bdev_cache,
|
2022-08-18 23:49:03 -04:00
|
|
|
#endif
|
2019-03-04 06:32:44 -05:00
|
|
|
};
|
|
|
|
|
2020-01-29 22:40:38 -05:00
|
|
|
spi_bdev_t spi_bdev;
|
2019-03-04 06:32:44 -05:00
|
|
|
|
|
|
|
// This init function is needed to memory map the QSPI flash early in the boot process
|
|
|
|
|
|
|
|
void board_early_init(void) {
|
|
|
|
qspi_init();
|
|
|
|
qspi_memory_map();
|
|
|
|
}
|