mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/mtd_spi_nor: fix Atmel size calculation
Lower bits of the device ID are not the capacity in bytes but in sectors: 4 - 4 Mb -> 32k << 4 5 - 8 Mb -> 32k << 5 …
This commit is contained in:
parent
a20d8f67f5
commit
628855fead
@ -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]) {
|
||||
|
Loading…
Reference in New Issue
Block a user