aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2019-08-05 14:34:49 +0200
committerSylvain Munaut <tnt@246tNt.com>2019-08-05 14:34:49 +0200
commita7c42cd29b6bda83b8f08bba755cd5f20a582de7 (patch)
treedfde73ef8f771fee16e571c93e344ccc06aab19c
parent792cef084a751e32f541332feb4905f8e49e9943 (diff)
downloadicestorm-a7c42cd29b6bda83b8f08bba755cd5f20a582de7.tar.gz
icestorm-a7c42cd29b6bda83b8f08bba755cd5f20a582de7.tar.bz2
icestorm-a7c42cd29b6bda83b8f08bba755cd5f20a582de7.zip
iceprog: Better reset of flash
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>
-rw-r--r--iceprog/iceprog.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c
index bae9e71..695e3ed 100644
--- a/iceprog/iceprog.c
+++ b/iceprog/iceprog.c
@@ -195,12 +195,10 @@ static void flash_read_id()
static void flash_reset()
{
- flash_chip_select();
- mpsse_xfer_spi_bits(0xFF, 8);
- flash_chip_deselect();
+ uint8_t data[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
flash_chip_select();
- mpsse_xfer_spi_bits(0xFF, 2);
+ mpsse_xfer_spi(data, 8);
flash_chip_deselect();
}