efinix: add support for flash detect and flash dump in SoJ mode

This commit is contained in:
Joshua Wise 2024-08-19 21:29:30 -04:00
parent 286b34b14d
commit 90e62e07c3
2 changed files with 16 additions and 3 deletions

View File

@ -228,11 +228,23 @@ void Efinix::program(unsigned int offset, bool unprotect_flash)
delete bit;
}
bool Efinix::detect_flash()
{
if (_jtag) {
return SPIInterface::detect_flash();
}
uint32_t timeout = 1000;
_spi->gpio_clear(_rst_pin);
return reinterpret_cast<SPIInterface *>(_spi)->detect_flash();
}
bool Efinix::dumpFlash(uint32_t base_addr, uint32_t len)
{
if (!_spi) {
printError("jtag: dumpFlash not supported");
return false;
if (_jtag) {
SPIInterface::set_filename(_filename);
return SPIInterface::dump(base_addr, len);
}
uint32_t timeout = 1000;

View File

@ -28,6 +28,7 @@ class Efinix: public Device, SPIInterface {
~Efinix();
void program(unsigned int offset, bool unprotect_flash) override;
bool detect_flash() override;
bool dumpFlash(uint32_t base_addr, uint32_t len) override;
bool protect_flash(uint32_t len) override {
(void) len;