mips_ejtag: cache ejtag version to avoid recalculation

Some parts of code are version specific. It will be easier
if we extract ejtag version and store it some where.

Change-Id: I8f9addc42108cba5ae9d61b8ade8f9d7f02a0fb5
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/1462
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
__archive__
Oleksij Rempel 2013-06-28 22:49:48 +02:00 committed by Spencer Oliver
parent e68f4b77f9
commit e3042a86ed
2 changed files with 16 additions and 9 deletions

View File

@ -273,7 +273,6 @@ int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info)
int mips_ejtag_init(struct mips_ejtag *ejtag_info)
{
uint32_t ejtag_version;
int retval;
retval = mips_ejtag_get_impcode(ejtag_info, &ejtag_info->impcode);
@ -282,25 +281,25 @@ int mips_ejtag_init(struct mips_ejtag *ejtag_info)
LOG_DEBUG("impcode: 0x%8.8" PRIx32 "", ejtag_info->impcode);
/* get ejtag version */
ejtag_version = ((ejtag_info->impcode >> 29) & 0x07);
ejtag_info->ejtag_version = ((ejtag_info->impcode >> 29) & 0x07);
switch (ejtag_version) {
case 0:
switch (ejtag_info->ejtag_version) {
case EJTAG_VERSION_20:
LOG_DEBUG("EJTAG: Version 1 or 2.0 Detected");
break;
case 1:
case EJTAG_VERSION_25:
LOG_DEBUG("EJTAG: Version 2.5 Detected");
break;
case 2:
case EJTAG_VERSION_26:
LOG_DEBUG("EJTAG: Version 2.6 Detected");
break;
case 3:
case EJTAG_VERSION_31:
LOG_DEBUG("EJTAG: Version 3.1 Detected");
break;
case 4:
case EJTAG_VERSION_41:
LOG_DEBUG("EJTAG: Version 4.1 Detected");
break;
case 5:
case EJTAG_VERSION_51:
LOG_DEBUG("EJTAG: Version 5.1 Detected");
break;
default:

View File

@ -122,6 +122,13 @@
#define EJTAG_DBCn_BLM_SHIFT 4
#define EJTAG_DBCn_BE (1 << 0)
#define EJTAG_VERSION_20 0
#define EJTAG_VERSION_25 1
#define EJTAG_VERSION_26 2
#define EJTAG_VERSION_31 3
#define EJTAG_VERSION_41 4
#define EJTAG_VERSION_51 5
struct mips_ejtag {
struct jtag_tap *tap;
uint32_t impcode;
@ -132,6 +139,7 @@ struct mips_ejtag {
uint32_t reg9;
unsigned scan_delay;
int mode;
unsigned int ejtag_version;
};
void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info,