From c5a8beffec05c906b0f3a06eed1f2820d11d8b15 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Tue, 2 Jun 2020 10:31:17 +0200 Subject: iceprog: Improve reset to disable both CRM and QPI 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 --- iceprog/iceprog.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c index 8c3827b..34245e3 100644 --- a/iceprog/iceprog.c +++ b/iceprog/iceprog.c @@ -202,9 +202,15 @@ static void flash_reset() { uint8_t data[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + // This disables CRM is if it was enabled flash_chip_select(); mpsse_xfer_spi(data, 8); flash_chip_deselect(); + + // This disables QPI if it was enable + flash_chip_select(); + mpsse_xfer_spi_bits(0xFF, 2); + flash_chip_deselect(); } static void flash_power_up() -- cgit v1.2.3