jtag: Add an option to ignore the bypass bit
Some CPU wrongly indicate the bypas bit in the codeid. It's the case of the NanoXplore NG-ULTRA chip that export a configurable (and potentially invalid) ID for one of its component. Add an option to ignore it. Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com> Change-Id: Ic59743f23bfc4d4e23da0e8535fec8ca9e87ff1a Reviewed-on: https://review.openocd.org/c/openocd/+/6802 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
This commit is contained in:
parent
e3bda57982
commit
666ff828b2
|
@ -4153,6 +4153,10 @@ option. When vendors put out multiple versions of a chip, or use the same
|
||||||
JTAG-level ID for several largely-compatible chips, it may be more practical
|
JTAG-level ID for several largely-compatible chips, it may be more practical
|
||||||
to ignore the version field than to update config files to handle all of
|
to ignore the version field than to update config files to handle all of
|
||||||
the various chip IDs. The version field is defined as bit 28-31 of the IDCODE.
|
the various chip IDs. The version field is defined as bit 28-31 of the IDCODE.
|
||||||
|
@item @code{-ignore-bypass}
|
||||||
|
@*Specify this to ignore the 'bypass' bit of the idcode. Some vendor put
|
||||||
|
an invalid idcode regarding this bit. Specify this to ignore this bit and
|
||||||
|
to not consider this tap in bypass mode.
|
||||||
@item @code{-ircapture} @var{NUMBER}
|
@item @code{-ircapture} @var{NUMBER}
|
||||||
@*The bit pattern loaded by the TAP into the JTAG shift register
|
@*The bit pattern loaded by the TAP into the JTAG shift register
|
||||||
on entry to the @sc{ircapture} state, such as 0x01.
|
on entry to the @sc{ircapture} state, such as 0x01.
|
||||||
|
|
|
@ -1273,7 +1273,7 @@ static int jtag_examine_chain(void)
|
||||||
jtag_tap_init(tap);
|
jtag_tap_init(tap);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((idcode & 1) == 0) {
|
if ((idcode & 1) == 0 && !tap->ignore_bypass) {
|
||||||
/* Zero for LSB indicates a device in bypass */
|
/* Zero for LSB indicates a device in bypass */
|
||||||
LOG_INFO("TAP %s does not have valid IDCODE (idcode=0x%" PRIx32 ")",
|
LOG_INFO("TAP %s does not have valid IDCODE (idcode=0x%" PRIx32 ")",
|
||||||
tap->dotted_name, idcode);
|
tap->dotted_name, idcode);
|
||||||
|
|
|
@ -59,6 +59,7 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi
|
||||||
#define NTAP_OPT_DISABLED 4
|
#define NTAP_OPT_DISABLED 4
|
||||||
#define NTAP_OPT_EXPECTED_ID 5
|
#define NTAP_OPT_EXPECTED_ID 5
|
||||||
#define NTAP_OPT_VERSION 6
|
#define NTAP_OPT_VERSION 6
|
||||||
|
#define NTAP_OPT_BYPASS 7
|
||||||
|
|
||||||
static int jim_hl_newtap_cmd(struct jim_getopt_info *goi)
|
static int jim_hl_newtap_cmd(struct jim_getopt_info *goi)
|
||||||
{
|
{
|
||||||
|
@ -75,6 +76,7 @@ static int jim_hl_newtap_cmd(struct jim_getopt_info *goi)
|
||||||
{ .name = "-disable", .value = NTAP_OPT_DISABLED },
|
{ .name = "-disable", .value = NTAP_OPT_DISABLED },
|
||||||
{ .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
|
{ .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
|
||||||
{ .name = "-ignore-version", .value = NTAP_OPT_VERSION },
|
{ .name = "-ignore-version", .value = NTAP_OPT_VERSION },
|
||||||
|
{ .name = "-ignore-bypass", .value = NTAP_OPT_BYPASS },
|
||||||
{ .name = NULL, .value = -1},
|
{ .name = NULL, .value = -1},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,9 @@ struct jtag_tap {
|
||||||
/** Flag saying whether to ignore version field in expected_ids[] */
|
/** Flag saying whether to ignore version field in expected_ids[] */
|
||||||
bool ignore_version;
|
bool ignore_version;
|
||||||
|
|
||||||
|
/** Flag saying whether to ignore the bypass bit in the code */
|
||||||
|
bool ignore_bypass;
|
||||||
|
|
||||||
/** current instruction */
|
/** current instruction */
|
||||||
uint8_t *cur_instr;
|
uint8_t *cur_instr;
|
||||||
/** Bypass register selected */
|
/** Bypass register selected */
|
||||||
|
|
|
@ -470,6 +470,7 @@ static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi
|
||||||
#define NTAP_OPT_DISABLED 4
|
#define NTAP_OPT_DISABLED 4
|
||||||
#define NTAP_OPT_EXPECTED_ID 5
|
#define NTAP_OPT_EXPECTED_ID 5
|
||||||
#define NTAP_OPT_VERSION 6
|
#define NTAP_OPT_VERSION 6
|
||||||
|
#define NTAP_OPT_BYPASS 7
|
||||||
|
|
||||||
static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi,
|
static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi,
|
||||||
struct jtag_tap *tap)
|
struct jtag_tap *tap)
|
||||||
|
@ -532,6 +533,7 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi)
|
||||||
{ .name = "-disable", .value = NTAP_OPT_DISABLED },
|
{ .name = "-disable", .value = NTAP_OPT_DISABLED },
|
||||||
{ .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
|
{ .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
|
||||||
{ .name = "-ignore-version", .value = NTAP_OPT_VERSION },
|
{ .name = "-ignore-version", .value = NTAP_OPT_VERSION },
|
||||||
|
{ .name = "-ignore-bypass", .value = NTAP_OPT_BYPASS },
|
||||||
{ .name = NULL, .value = -1 },
|
{ .name = NULL, .value = -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -617,6 +619,9 @@ static int jim_newtap_cmd(struct jim_getopt_info *goi)
|
||||||
case NTAP_OPT_VERSION:
|
case NTAP_OPT_VERSION:
|
||||||
tap->ignore_version = true;
|
tap->ignore_version = true;
|
||||||
break;
|
break;
|
||||||
|
case NTAP_OPT_BYPASS:
|
||||||
|
tap->ignore_bypass = true;
|
||||||
|
break;
|
||||||
} /* switch (n->value) */
|
} /* switch (n->value) */
|
||||||
} /* while (goi->argc) */
|
} /* while (goi->argc) */
|
||||||
|
|
||||||
|
@ -887,6 +892,7 @@ static const struct command_registration jtag_subcommand_handlers[] = {
|
||||||
"['-enable'|'-disable'] "
|
"['-enable'|'-disable'] "
|
||||||
"['-expected_id' number] "
|
"['-expected_id' number] "
|
||||||
"['-ignore-version'] "
|
"['-ignore-version'] "
|
||||||
|
"['-ignore-bypass'] "
|
||||||
"['-ircapture' number] "
|
"['-ircapture' number] "
|
||||||
"['-mask' number]",
|
"['-mask' number]",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue