From 9810735e3236bcd3a3ed345acc18978bfee5e352 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Thu, 14 Sep 2023 21:53:27 +0200 Subject: [PATCH] jtag: rework detectChain: try unmasked idcode first --- src/jtag.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/jtag.cpp b/src/jtag.cpp index 29fff2a..d368e4e 100644 --- a/src/jtag.cpp +++ b/src/jtag.cpp @@ -198,10 +198,12 @@ int Jtag::detectChain(int max_dev) /* ckeck highest nibble to prevent confusion between Cologne Chip * GateMate and Efinix Trion T4/T8 devices */ - if (tmp != 0x20000001) - found = search_and_insert_device_with_idcode(tmp & 0x0fffffff); - if (!found) /* if masked not found -> search for full */ + if (tmp == 0x20000001) found = search_and_insert_device_with_idcode(tmp); + if (!found) /* not specific case -> search for full */ + found = search_and_insert_device_with_idcode(tmp); + if (!found) /* if full idcode not found -> search for masked */ + found = search_and_insert_device_with_idcode(tmp & 0x0fffffff); if (!found) { uint16_t mfg = IDCODE2MANUFACTURERID(tmp);