fespi: Reset may have occurred. Need to set TXWM again. There are probably more places that need this added.
This commit is contained in:
parent
b04c6cb3ed
commit
75e7c79b2a
|
@ -314,21 +314,27 @@ static int fespi_erase_sector(struct flash_bank *bank, int sector)
|
||||||
uint32_t ctrl_base = fespi_info->ctrl_base;
|
uint32_t ctrl_base = fespi_info->ctrl_base;
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
fespi_tx(bank, SPIFLASH_WRITE_ENABLE);
|
retval = fespi_tx(bank, SPIFLASH_WRITE_ENABLE);
|
||||||
fespi_txwm_wait(bank);
|
if (retval != ERROR_OK) {return retval;}
|
||||||
|
retval = fespi_txwm_wait(bank);
|
||||||
|
if (retval != ERROR_OK) {return retval;}
|
||||||
|
|
||||||
FESPI_WRITE_REG(FESPI_REG_CSMODE, FESPI_CSMODE_HOLD);
|
FESPI_WRITE_REG(FESPI_REG_CSMODE, FESPI_CSMODE_HOLD);
|
||||||
fespi_tx(bank, fespi_info->dev->erase_cmd);
|
retval = fespi_tx(bank, fespi_info->dev->erase_cmd);
|
||||||
|
if (retval != ERROR_OK) {return retval;}
|
||||||
sector = bank->sectors[sector].offset;
|
sector = bank->sectors[sector].offset;
|
||||||
fespi_tx(bank, sector >> 16);
|
retval = fespi_tx(bank, sector >> 16);
|
||||||
fespi_tx(bank, sector >> 8);
|
if (retval != ERROR_OK) {return retval;}
|
||||||
fespi_tx(bank, sector);
|
retval = fespi_tx(bank, sector >> 8);
|
||||||
fespi_txwm_wait(bank);
|
if (retval != ERROR_OK) {return retval;}
|
||||||
|
retval = fespi_tx(bank, sector);
|
||||||
|
if (retval != ERROR_OK) {return retval;}
|
||||||
|
retval = fespi_txwm_wait(bank);
|
||||||
|
if (retval != ERROR_OK) {return retval;}
|
||||||
FESPI_WRITE_REG(FESPI_REG_CSMODE, FESPI_CSMODE_AUTO);
|
FESPI_WRITE_REG(FESPI_REG_CSMODE, FESPI_CSMODE_AUTO);
|
||||||
|
|
||||||
retval = fespi_wip(bank, FESPI_MAX_TIMEOUT);
|
retval = fespi_wip(bank, FESPI_MAX_TIMEOUT);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK){return retval;}
|
||||||
return retval;
|
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -365,7 +371,13 @@ static int fespi_erase(struct flash_bank *bank, int first, int last)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fespi_txwm_wait(bank);
|
|
||||||
|
FESPI_WRITE_REG(FESPI_REG_TXCTRL, FESPI_TXWM(1));
|
||||||
|
retval = fespi_txwm_wait(bank);
|
||||||
|
if (retval != ERROR_OK){
|
||||||
|
LOG_ERROR("WM Didn't go high before attempting.");
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
/* Disable Hardware accesses*/
|
/* Disable Hardware accesses*/
|
||||||
FESPI_DISABLE_HW_MODE();
|
FESPI_DISABLE_HW_MODE();
|
||||||
|
|
Loading…
Reference in New Issue