summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2025-04-16 21:46:15 +0200
committerDamien George <damien@micropython.org>2025-05-07 16:20:19 +1000
commit80d03b77804da44d56b7b9446520ffafde7e3eea (patch)
treeafaa64b572fa09f17dc613d9eb4f14130bbdf461
parent2e6df08e05f4832806f062c56f78c5412fd37ceb (diff)
samd/samd_qspiflash: Remove the attempt to handle a unknown device.
Since all QSPI flash device used by this port are defined, this code was only used unintentionally. Besides that it was incomplete, so better drop it. Note: The flash type for Mini-SAM had to be changed too. Signed-off-by: robert-hh <robert@hammelrath.com>
-rw-r--r--ports/samd/boards/MINISAM_M4/mpconfigboard.h2
-rw-r--r--ports/samd/samd_qspiflash.c32
2 files changed, 2 insertions, 32 deletions
diff --git a/ports/samd/boards/MINISAM_M4/mpconfigboard.h b/ports/samd/boards/MINISAM_M4/mpconfigboard.h
index 6d908bdcb..30a7a8045 100644
--- a/ports/samd/boards/MINISAM_M4/mpconfigboard.h
+++ b/ports/samd/boards/MINISAM_M4/mpconfigboard.h
@@ -7,4 +7,4 @@
#define MICROPY_HW_DEFAULT_I2C_ID (2)
#define MICROPY_HW_DEFAULT_SPI_ID (1)
-#define MICROPY_HW_QSPIFLASH GD25Q16C
+#define MICROPY_HW_QSPIFLASH W25Q16JV_IQ
diff --git a/ports/samd/samd_qspiflash.c b/ports/samd/samd_qspiflash.c
index e25ddf21e..f314a9551 100644
--- a/ports/samd/samd_qspiflash.c
+++ b/ports/samd/samd_qspiflash.c
@@ -105,7 +105,6 @@ static const external_flash_device possible_devices[] = {
#define EXTERNAL_FLASH_DEVICE_COUNT MP_ARRAY_SIZE(possible_devices)
static external_flash_device const *flash_device;
-static external_flash_device generic_config = GENERIC;
extern const mp_obj_type_t samd_qspiflash_type;
// The QSPIflash object is a singleton
@@ -248,15 +247,6 @@ static uint8_t get_baud(int32_t freq_mhz) {
return baud;
}
-int get_sfdp_table(uint8_t *table, int maxlen) {
- uint8_t header[16];
- read_memory_single(QSPI_CMD_READ_SFDP_PARAMETER, 0, header, sizeof(header));
- int len = MIN(header[11] * 4, maxlen);
- int addr = header[12] + (header[13] << 8) + (header[14] << 16);
- read_memory_single(QSPI_CMD_READ_SFDP_PARAMETER, addr, table, len);
- return len;
-}
-
static mp_obj_t samd_qspiflash_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
mp_arg_check_num(n_args, n_kw, 0, 0, false);
@@ -297,19 +287,6 @@ static mp_obj_t samd_qspiflash_make_new(const mp_obj_type_t *type, size_t n_args
uint8_t jedec_ids[3];
read_command(QSPI_CMD_READ_JEDEC_ID, jedec_ids, sizeof(jedec_ids));
- // Read the common sfdp table
- // Check the device addr length, support of 1-1-4 mode and get the sector size
- uint8_t sfdp_table[128];
- int len = get_sfdp_table(sfdp_table, sizeof(sfdp_table));
- if (len >= 29) {
- self->sectorsize = 1 << sfdp_table[28];
- bool addr4b = ((sfdp_table[2] >> 1) & 0x03) == 0x02;
- bool supports_qspi_114 = (sfdp_table[2] & 0x40) != 0;
- if (addr4b || !supports_qspi_114) {
- mp_raise_ValueError(MP_ERROR_TEXT("QSPI mode not supported"));
- }
- }
-
// Check, if the flash device is known and get it's properties.
flash_device = NULL;
for (uint8_t i = 0; i < EXTERNAL_FLASH_DEVICE_COUNT; i++) {
@@ -321,15 +298,8 @@ static mp_obj_t samd_qspiflash_make_new(const mp_obj_type_t *type, size_t n_args
break;
}
}
-
- // If the flash device is not known, try generic config options
if (flash_device == NULL) {
- if (jedec_ids[0] == 0xc2) { // Macronix devices
- generic_config.quad_enable_bit_mask = 0x04;
- generic_config.single_status_byte = true;
- }
- generic_config.total_size = 1 << jedec_ids[2];
- flash_device = &generic_config;
+ mp_raise_ValueError(MP_ERROR_TEXT("QSPI device not supported"));
}
self->size = flash_device->total_size;