Skip to content

Commit c4d26da

Browse files
committed
spiFlash: added Macronix MX25L6405
1 parent db7bd47 commit c4d26da

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/spiFlash.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,19 +421,21 @@ bool SPIFlash::prepare_flash(const int base_addr, const int len)
421421
_must_relock = true;
422422
}
423423
}
424+
const uint32_t jedec = _jedec_id >> 8;
424425
/* ISSI IS25LP032 seems have a bug:
425426
* block protection is always in top mode regardless of
426427
* the TB bit: if write is not at offset 0 -> force unlock
427428
*/
428-
if ((_jedec_id >> 8) == 0x9d6016 && tb == 1 && base_addr != 0) {
429+
if (jedec == 0x9d6016 && tb == 1 && base_addr != 0) {
429430
_unprotect = true;
430431
_must_relock = true;
431432
}
432-
/* ST M25P16 has not TB bit:
433+
/* ST M25P16 / MX25L6045 have not TB bit:
433434
* block protection is always in top mode:
434435
* if write is not at offset 0 -> force unlock
435436
*/
436-
if ((_jedec_id >> 8) == 0x202015 && tb == 1 && base_addr != 0) {
437+
if (((jedec == 0x202015) || (jedec == 0xC22017))
438+
&& tb == 1 && base_addr != 0) {
437439
_unprotect = true;
438440
_must_relock = true;
439441
}

src/spiFlashdb.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,23 @@ static std::map <uint32_t, flash_t> flash_list = {
500500
.quad_mask = (1 << 6),
501501
.global_lock = false,
502502
}},
503+
{0xc22017, {
504+
/* https://www.macronix.com/Lists/Datasheet/Attachments/8554/MX25L1605D,%203V,%2016Mb,%20v1.5.pdf */
505+
.manufacturer = "Macronix",
506+
.model = "MX25L6405",
507+
.nr_sector = 128,
508+
.sector_erase = true,
509+
.subsector_erase = true,
510+
.has_extended = false,
511+
.tb_otp = true,
512+
.tb_offset = 0,
513+
.tb_register = NONER,
514+
.bp_len = 5,
515+
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)},
516+
.quad_register = NONER,
517+
.quad_mask = 0,
518+
.global_lock = false,
519+
}},
503520
{0xc22018, {
504521
/* https://www.macronix.com/Lists/Datasheet/Attachments/8934/MX25L12833F,%203V,%20128Mb,%20v1.0.pdf */
505522
.manufacturer = "Macronix",

0 commit comments

Comments
 (0)