Signed-off-by: Nico Huber <[email protected]>
---
 dediprog.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/dediprog.c b/dediprog.c
index 019de46..b7276e5 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -942,7 +942,7 @@ int dediprog_init(void)
        int spispeed_idx = 1;
        int millivolt = 3500;
        long usedevice = 0;
-       long target = 1;
+       long target = FLASH_TYPE_APPLICATION_FLASH_1;
        int i, ret;
 
        spispeed = extract_programmer_param("spispeed");
@@ -1014,7 +1014,18 @@ int dediprog_init(void)
                        free(target_str);
                        return 1;
                }
-               msg_pinfo("Using target %li.\n", target);
+               switch (target) {
+               case 1:
+                       msg_pinfo("Using target %s.\n", 
"FLASH_TYPE_APPLICATION_FLASH_1");
+                       target = FLASH_TYPE_APPLICATION_FLASH_1;
+                       break;
+               case 2:
+                       msg_pinfo("Using target %s.\n", 
"FLASH_TYPE_APPLICATION_FLASH_2");
+                       target = FLASH_TYPE_APPLICATION_FLASH_2;
+                       break;
+               default:
+                       break;
+               }
        }
        free(target_str);
 
@@ -1073,7 +1084,7 @@ int dediprog_init(void)
        dediprog_set_leds(LED_ALL);
 
        /* Select target/socket, frequency and VCC. */
-       if (set_target_flash(FLASH_TYPE_APPLICATION_FLASH_1) ||
+       if (set_target_flash(target) ||
            dediprog_set_spi_speed(spispeed_idx) ||
            dediprog_set_spi_voltage(millivolt)) {
                dediprog_set_leds(LED_ERROR);
-- 
2.7.0


_______________________________________________
flashrom mailing list
[email protected]
https://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to