This update replaces the HID-based USB protocol with a vendor
control transfer variant. The primary goal is speed- HID transfers
are rate-limited to 1000/s, which gives a maximum transfer rate of
64kb/s. Unfortunately a majority of this bandwidth is wasted, and
typical ice40 flash routines could take up to 17 seconds to
complete. With the switch to a new protocol, the time is reduced to
under 4 seconds.
It's hard to cover 100% of cases, but this seems to improve
probability that a reset works, at least for me on the icebreaker.
Some other flash have a different QPI disable command though :/
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This is useful when testing litex SoC that rely on that bit being set
The setting is non-volatile so it only needs to be done once in case
you happen to have used a flash chip that's not by default QE=1
(This has been designed for winbond flash. Others might use
different bit ...)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
If the flash was in a 'weird' mode (like CRM, QPI, ...), sending
a continuous stream of 0xff should take it out of it.
It looks like the previous code was trying to do that, but
was only transferring 8 bits and then 2 bits which is way
too short.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
In my setup, in OSX I have problems reading from libftdi but not writing. In case of a failure iceprog exits and leaves the FPGA in an useless state. I think it would be a good option to have the possibility to skip the verification process.
In cases when the FLASH chip is bit flaky and the status register
"bounces" this flash_wait should be able to perform a bit better.
Also added more verbose output around block erase.
Just calling a gpio function with two numbers was not very self
explanatory. The functions now refer to the actual indended action, chip
(de)select for flash, reset and chip (de)select for sram. Reading the
code and understanding what steps are taken should be easier now.
Main point was to group the code into three logical segments:
* MPSSE/FTDI defines and functions
* FLASH defines and functions
* iceprog implementation core
While I was at it I also added a few comments for stuff that was not
immediately obvious what it does.