aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2019-12-28 16:51:14 +0100
committerSylvain Munaut <tnt@246tNt.com>2019-12-28 16:53:53 +0100
commitdcda69d9f06b123b9a491de512d8204ceadf2377 (patch)
treea1448570859646ba5676c632afb442061b1b867f
parent0ec00d892a91cc68e45479b46161f649caea2933 (diff)
downloadicestorm-dcda69d9f06b123b9a491de512d8204ceadf2377.tar.gz
icestorm-dcda69d9f06b123b9a491de512d8204ceadf2377.tar.bz2
icestorm-dcda69d9f06b123b9a491de512d8204ceadf2377.zip
iceprog: Add option to keep flash powered up
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r--iceprog/iceprog.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/iceprog/iceprog.c b/iceprog/iceprog.c
index f38b133..798ff75 100644
--- a/iceprog/iceprog.c
+++ b/iceprog/iceprog.c
@@ -448,6 +448,7 @@ static void help(const char *progname)
fprintf(stderr, " (append 'k' to the argument for size in kilobytes,\n");
fprintf(stderr, " or 'M' for size in megabytes)\n");
fprintf(stderr, " -s slow SPI (50 kHz instead of 6 MHz)\n");
+ fprintf(stderr, " -k keep flash in powered up state (i.e. skip power down command)\n");
fprintf(stderr, " -v verbose output\n");
fprintf(stderr, "\n");
fprintf(stderr, "Mode of operation:\n");
@@ -522,6 +523,7 @@ int main(int argc, char **argv)
bool slow_clock = false;
bool disable_protect = false;
bool disable_verify = false;
+ bool disable_powerdown = false;
const char *filename = NULL;
const char *devstr = NULL;
int ifnum = 0;
@@ -539,7 +541,7 @@ int main(int argc, char **argv)
/* Decode command line parameters */
int opt;
char *endptr;
- while ((opt = getopt_long(argc, argv, "d:I:rR:e:o:cbnStvspX", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "d:I:rR:e:o:cbnStvspXk", long_options, NULL)) != -1) {
switch (opt) {
case 'd': /* device string */
devstr = optarg;
@@ -629,6 +631,9 @@ int main(int argc, char **argv)
case 'X': /* disable verification */
disable_verify = true;
break;
+ case 'k': /* disable power down command */
+ disable_powerdown = true;
+ break;
case -2:
help(argv[0]);
return EXIT_SUCCESS;
@@ -956,7 +961,8 @@ int main(int argc, char **argv)
// Reset
// ---------------------------------------------------------
- flash_power_down();
+ if (!disable_powerdown)
+ flash_power_down();
set_cs_creset(1, 1);
usleep(250000);