From ee7bd6b03730c9caeee249adf71c868b9a6d96c3 Mon Sep 17 00:00:00 2001 From: notaz Date: Sun, 1 Sep 2013 19:41:29 +0300 Subject: [PATCH] mx_flasher: set mode after other writes seems to improve reliability (less random write errors) --- mx/linux/mx_flasher.c | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/mx/linux/mx_flasher.c b/mx/linux/mx_flasher.c index 7bebc9c..1bec278 100644 --- a/mx/linux/mx_flasher.c +++ b/mx/linux/mx_flasher.c @@ -1072,28 +1072,6 @@ breakloop: goto end; } - /* set mode */ - if (mx_mode || w_fsize > 0x200000) { - if (mx_mode == 0) - mx_mode = '3'; - printf("MX mode set to "); - switch (mx_mode) { - case '1': - printf("2M with RAM.\n"); - mx_mode = C_MODE_2M_RAM; - break; - case '2': - printf("4M, no RAM.\n"); - mx_mode = C_MODE_4M_NORAM; - break; - default: - printf("4M with RAM.\n"); - mx_mode = C_MODE_4M_RAM; - break; - } - set_ram_mode(device, mx_mode); - } - /* erase */ if (do_erase_size != 0) { if (erase_method) @@ -1149,6 +1127,28 @@ breakloop: fprintf(stderr, "warning: failed to save RAM filename\n"); } + /* set mode */ + if (mx_mode || w_fsize > 0x200000) { + if (mx_mode == 0) + mx_mode = '3'; + printf("MX mode set to "); + switch (mx_mode) { + case '1': + printf("2M with RAM.\n"); + mx_mode = C_MODE_2M_RAM; + break; + case '2': + printf("4M, no RAM.\n"); + mx_mode = C_MODE_4M_NORAM; + break; + default: + printf("4M with RAM.\n"); + mx_mode = C_MODE_4M_RAM; + break; + } + set_ram_mode(device, mx_mode); + } + /* read flash */ if (do_read && r_fname == NULL) { ret = read_filename(device, fname_buff, sizeof(fname_buff), FILENAME_ROM0); -- 2.39.5