| 1 |
#include "storage.h" |
| 2 |
#include "qspi.h" |
| 3 |
|
| 4 |
// This configuration is needed for mboot to be able to write to the external QSPI flash |
| 5 |
|
| 6 |
#define QSPI_QREAD_NUM_DUMMY (2) |
| 7 |
|
| 8 |
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE |
| 9 |
static mp_spiflash_cache_t spi_bdev_cache; |
| 10 |
#endif |
| 11 |
|
| 12 |
const mp_spiflash_config_t spiflash_config = { |
| 13 |
.bus_kind = MP_SPIFLASH_BUS_QSPI, |
| 14 |
.bus.u_qspi.data = NULL, |
| 15 |
.bus.u_qspi.proto = &qspi_proto, |
| 16 |
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE |
| 17 |
.cache = &spi_bdev_cache, |
| 18 |
#endif |
| 19 |
}; |
| 20 |
|
| 21 |
spi_bdev_t spi_bdev; |
| 22 |
|
| 23 |
// This init function is needed to memory map the QSPI flash early in the boot process |
| 24 |
|
| 25 |
void board_early_init(void) { |
| 26 |
qspi_init(QSPI_QREAD_NUM_DUMMY); |
| 27 |
qspi_memory_map(); |
| 28 |
} |