colognechip: add bulk erase + quad enable features and simplify spi_wait overload (#582)
* colognechip: add bulk erase + quad enable features and simplify spi_wait overload * colognechip: remove unnecessary code in `set_quad_bit` and `bulk_erase_flash`
This commit is contained in:
parent
501d37e351
commit
cfddee3611
|
|
@ -213,6 +213,30 @@ bool CologneChip::dumpFlash(uint32_t base_addr, uint32_t len)
|
|||
return post_flash_access();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set QE bit, if available. Works in both SPI and JTAG-SPI-bypass mode.
|
||||
*/
|
||||
bool CologneChip::set_quad_bit(bool set_quad)
|
||||
{
|
||||
if (!SPIInterface::set_quad_bit(set_quad)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Peform bulk erase. Works in both SPI and JTAG-SPI-bypass mode.
|
||||
*/
|
||||
bool CologneChip::bulk_erase_flash()
|
||||
{
|
||||
if (!SPIInterface::bulk_erase_flash()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse bitstream from *.bit or *.cfg and program FPGA in SPI or JTAG mode
|
||||
* or write configuration to external flash via SPI or JTAG-SPI-bypass.
|
||||
|
|
@ -450,15 +474,10 @@ int CologneChip::spi_wait(uint8_t cmd, uint8_t mask, uint8_t cond,
|
|||
_jtag->read_write(&tx, NULL, 8, 0);
|
||||
|
||||
do {
|
||||
if (count == 0) {
|
||||
_jtag->read_write(dummy, rx, 16, 0);
|
||||
uint8_t b0 = ConfigBitstreamParser::reverseByte(rx[0]);
|
||||
uint8_t b1 = ConfigBitstreamParser::reverseByte(rx[1]);
|
||||
tmp = (b0 << 1) | ((b1 >> 7) & 0x01);
|
||||
} else {
|
||||
_jtag->read_write(dummy, rx, 8, 0);
|
||||
tmp = ConfigBitstreamParser::reverseByte(rx[0]);
|
||||
}
|
||||
|
||||
count++;
|
||||
if (count == timeout) {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ class CologneChip: public Device, SPIInterface {
|
|||
printError("protect flash not supported"); return false;}
|
||||
virtual bool unprotect_flash() override {
|
||||
printError("unprotect flash not supported"); return false;}
|
||||
virtual bool bulk_erase_flash() override {
|
||||
printError("bulk erase flash not supported"); return false;}
|
||||
bool set_quad_bit(bool set_quad) override;
|
||||
bool bulk_erase_flash() override;
|
||||
void program(unsigned int offset, bool unprotect_flash) override;
|
||||
|
||||
uint32_t idCode() override {return 0;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue