gowin: Arora V: fix SRAM erase/load when flash is blank and timeout bit is set
This commit is contained in:
parent
ee8decdfe6
commit
ab8d8fc0d3
|
|
@ -394,13 +394,6 @@ void Gowin::programSRAM()
|
||||||
if (!eraseSRAM())
|
if (!eraseSRAM())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* GW5AST-138k WA. Temporary until found correct solution/sequence */
|
|
||||||
if (is_gw5a && _idcode == 0x0001081b) {
|
|
||||||
printf("double eraseSRAM\n");
|
|
||||||
if (!eraseSRAM())
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load bitstream in SRAM */
|
/* load bitstream in SRAM */
|
||||||
if (!writeSRAM(_fs->getData(), _fs->getLength()))
|
if (!writeSRAM(_fs->getData(), _fs->getLength()))
|
||||||
return;
|
return;
|
||||||
|
|
@ -912,13 +905,18 @@ bool Gowin::eraseSRAM()
|
||||||
displayReadReg("before erase sram", status);
|
displayReadReg("before erase sram", status);
|
||||||
|
|
||||||
// If flash is invalid, send extra cmd 0x3F before SRAM erase
|
// If flash is invalid, send extra cmd 0x3F before SRAM erase
|
||||||
// This is required on GW5A-25
|
// This is required on GW5A-25 or GW5AST-138 when timeout bit
|
||||||
bool auto_boot_2nd_fail = (status & 0x8) >> 3;
|
// is set
|
||||||
if ((_idcode == 0x0001281B) && auto_boot_2nd_fail)
|
bool auto_boot_2nd_fail = (status & (1 << 4)) == (1 << 4);
|
||||||
{
|
bool is_timeout = (status & (1 << 3)) == (1 << 3);
|
||||||
disableCfg();
|
if (is_gw5a && (is_timeout || auto_boot_2nd_fail)) {
|
||||||
|
send_command(CONFIG_ENABLE);
|
||||||
send_command(0x3F);
|
send_command(0x3F);
|
||||||
|
send_command(CONFIG_DISABLE);
|
||||||
send_command(NOOP);
|
send_command(NOOP);
|
||||||
|
send_command(READ_IDCODE);
|
||||||
|
send_command(NOOP);
|
||||||
|
_jtag->toggleClk(125 * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!enableCfg()) {
|
if (!enableCfg()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue