1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-30 17:01:19 +01:00

Merge pull request #17872 from benpicco/drivers/mtd_spi_nor-fix-atmel

drivers/mtd_spi_nor: fix Atmel size calculation
This commit is contained in:
benpicco 2022-03-28 01:16:10 +02:00 committed by GitHub
commit 639a1d19f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,7 +304,8 @@ static uint32_t mtd_spi_nor_get_size(const mtd_jedec_id_t *id)
if (mtd_spi_manuf_match(id, SPI_NOR_JEDEC_ATMEL) &&
/* ID 2 is used to encode the product version, usually 1 or 2 */
(id->device[1] & ~0x3) == 0) {
return (0x1F & id->device[0]) * MBIT_AS_BYTES;
/* capacity encoded as power of 32k sectors */
return (32 * 1024) << (0x1F & id->device[0]);
}
if (mtd_spi_manuf_match(id, SPI_NOR_JEDEC_MICROCHIP)) {
switch (id->device[1]) {