Support for the Microchip SST25VF040B flash.
Programming is slow, only one byte at a time :-(
This commit is contained in:
parent
f8da6717ce
commit
8c4b1b3afd
|
|
@ -311,6 +311,10 @@ int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
|
||||||
if ((status & 0x1c) != 0)
|
if ((status & 0x1c) != 0)
|
||||||
must_relock = true;
|
must_relock = true;
|
||||||
}
|
}
|
||||||
|
if ((_jedec_id >> 8) == 0xbf258d) {
|
||||||
|
if ((status & 0x1c) != 0)
|
||||||
|
must_relock = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* if it's needs to unlock */
|
/* if it's needs to unlock */
|
||||||
if (must_relock) {
|
if (must_relock) {
|
||||||
|
|
@ -334,6 +338,9 @@ int SPIFlash::erase_and_prog(int base_addr, uint8_t *data, int len)
|
||||||
int size = 0;
|
int size = 0;
|
||||||
for (int addr = 0; addr < len; addr += size, ptr+=size) {
|
for (int addr = 0; addr < len; addr += size, ptr+=size) {
|
||||||
size = (addr + 256 > len)?(len-addr) : 256;
|
size = (addr + 256 > len)?(len-addr) : 256;
|
||||||
|
if ((_jedec_id >> 8) == 0xbf258d) {
|
||||||
|
size = 1;
|
||||||
|
}
|
||||||
if (write_page(base_addr + addr, ptr, size) == -1)
|
if (write_page(base_addr + addr, ptr, size) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
progress.display(addr);
|
progress.display(addr);
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,19 @@ static std::map <uint32_t, flash_t> flash_list = {
|
||||||
.bp_len = 4,
|
.bp_len = 4,
|
||||||
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 6)}}
|
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 6)}}
|
||||||
},
|
},
|
||||||
|
{0xbf258d, {
|
||||||
|
.manufacturer = "microchip",
|
||||||
|
.model = "SST25VF040B",
|
||||||
|
.nr_sector = 8,
|
||||||
|
.sector_erase = true,
|
||||||
|
.subsector_erase = true,
|
||||||
|
.has_extended = false,
|
||||||
|
.tb_otp = true,
|
||||||
|
.tb_offset = (1 << 1),
|
||||||
|
.tb_register = FUNCR,
|
||||||
|
.bp_len = 4,
|
||||||
|
.bp_offset = {(1 << 2), (1 << 3), (1 << 4), (1 << 5)}}
|
||||||
|
},
|
||||||
{0xBF2642, {
|
{0xBF2642, {
|
||||||
.manufacturer = "microchip",
|
.manufacturer = "microchip",
|
||||||
.model = "SST26VF032B",
|
.model = "SST26VF032B",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue