Add 39SF020 and 39SF010 to flashrom programmer

This commit is contained in:
sanni 2024-09-20 16:38:00 +02:00
parent 4f427c0ce4
commit fb87a0aa44

View File

@ -694,6 +694,14 @@ idtheflash:
println_Msg(F("39F040 detected")); println_Msg(F("39F040 detected"));
flashSize = 524288; flashSize = 524288;
flashromType = 1; flashromType = 1;
} else if (flashid == 0xBFB6) {
println_Msg(F("39F020 detected"));
flashSize = 262144;
flashromType = 1;
} else if (flashid == 0xBFB5) {
println_Msg(F("39F010 detected"));
flashSize = 131072;
flashromType = 1;
} else if (secondID == 1) { } else if (secondID == 1) {
// Read ID a second time using a different command (type 1 flashrom) // Read ID a second time using a different command (type 1 flashrom)
resetFlash8(); resetFlash8();
@ -706,6 +714,10 @@ idtheflash:
// Read ID a third time using a different command (type 2 flashrom) // Read ID a third time using a different command (type 2 flashrom)
resetFlash8(); resetFlash8();
idFlash29F1610(); idFlash29F1610();
secondID = 3;
goto idtheflash;
} else if (secondID == 3) {
idFlash39SF040();
secondID = 0; secondID = 0;
goto idtheflash; goto idtheflash;
} else { } else {
@ -1476,7 +1488,7 @@ bool openVerifyFlashFile() {
Command functions Command functions
*****************************************/ *****************************************/
void writeByteCommand_Flash(byte command) { void writeByteCommand_Flash(byte command) {
if (mapping == 3) { if ((flashid == 0xBFB7) || (flashid == 0xBFB6) || (flashid == 0xBFB5)) {
//39F040 //39F040
writeByte_Flash(0x5555, 0xaa); writeByte_Flash(0x5555, 0xaa);
writeByte_Flash(0x2aaa, 0x55); writeByte_Flash(0x2aaa, 0x55);
@ -1501,7 +1513,7 @@ void writeWordCommand_Flash(byte command) {
} }
/****************************************** /******************************************
29F032 flashrom functions 29F032/39SF040 flashrom functions
*****************************************/ *****************************************/
void resetFlash29F032() { void resetFlash29F032() {
// Set data pins to output // Set data pins to output
@ -1516,6 +1528,23 @@ void resetFlash29F032() {
delay(500); delay(500);
} }
void idFlash39SF040() {
// Set data pins to output
dataOut();
writeByte_Flash(0x5555, 0xaa);
writeByte_Flash(0x2aaa, 0x55);
writeByte_Flash(0x5555, 0x90);
// Set data pins to input again
dataIn8();
// Read the two id bytes into a string
flashid = readByte_Flash(0) << 8;
flashid |= readByte_Flash(1);
sprintf(flashid_str, "%04X", flashid);
}
void idFlash29F032() { void idFlash29F032() {
// Set data pins to output // Set data pins to output
dataOut(); dataOut();