summaryrefslogtreecommitdiff
path: root/src/flash/nor/str9xpec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/flash/nor/str9xpec.c')
-rw-r--r--src/flash/nor/str9xpec.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c
index 243336a3..3796a4b1 100644
--- a/src/flash/nor/str9xpec.c
+++ b/src/flash/nor/str9xpec.c
@@ -43,13 +43,12 @@ int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end
{
struct scan_field field;
- field.tap = tap;
field.num_bits = tap->ir_length;
field.out_value = calloc(DIV_ROUND_UP(field.num_bits, 8), 1);
buf_set_u32(field.out_value, 0, field.num_bits, new_instr);
field.in_value = NULL;
- jtag_add_ir_scan(1, &field, end_state);
+ jtag_add_ir_scan(tap, 1, &field, end_state);
free(field.out_value);
}
@@ -65,13 +64,12 @@ static uint8_t str9xpec_isc_status(struct jtag_tap *tap)
if (str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE) != ERROR_OK)
return ISC_STATUS_ERROR;
- field.tap = tap;
field.num_bits = 8;
field.out_value = NULL;
field.in_value = &status;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_execute_queue();
LOG_DEBUG("status: 0x%2.2x", status);
@@ -153,13 +151,12 @@ static int str9xpec_read_config(struct flash_bank *bank)
/* execute ISC_CONFIGURATION command */
str9xpec_set_instr(tap, ISC_CONFIGURATION, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 64;
field.out_value = NULL;
field.in_value = str9xpec_info->options;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_execute_queue();
status = str9xpec_isc_status(tap);
@@ -301,21 +298,19 @@ static int str9xpec_blank_check(struct flash_bank *bank, int first, int last)
/* execute ISC_BLANK_CHECK command */
str9xpec_set_instr(tap, ISC_BLANK_CHECK, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 64;
field.out_value = buffer;
field.in_value = NULL;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_add_sleep(40000);
/* read blank check result */
- field.tap = tap;
field.num_bits = 64;
field.out_value = NULL;
field.in_value = buffer;
- jtag_add_dr_scan(1, &field, TAP_IRPAUSE);
+ jtag_add_dr_scan(tap, 1, &field, TAP_IRPAUSE);
jtag_execute_queue();
status = str9xpec_isc_status(tap);
@@ -407,12 +402,11 @@ static int str9xpec_erase_area(struct flash_bank *bank, int first, int last)
/* execute ISC_ERASE command */
str9xpec_set_instr(tap, ISC_ERASE, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 64;
field.out_value = buffer;
field.in_value = NULL;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_execute_queue();
jtag_add_sleep(10);
@@ -468,12 +462,11 @@ static int str9xpec_lock_device(struct flash_bank *bank)
str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
- field.tap = tap;
field.num_bits = 8;
field.out_value = NULL;
field.in_value = &status;
- jtag_add_dr_scan(1, &field, jtag_get_end_state());
+ jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_execute_queue();
} while (!(status & ISC_STATUS_BUSY));
@@ -549,12 +542,11 @@ static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector)
/* set flash controller address */
str9xpec_set_instr(tap, ISC_ADDRESS_SHIFT, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 8;
field.out_value = &sector;
field.in_value = NULL;
- jtag_add_dr_scan(1, &field, jtag_get_end_state());
+ jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
return ERROR_OK;
}
@@ -633,12 +625,11 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off
{
str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 64;
field.out_value = (buffer + bytes_written);
field.in_value = NULL;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
/* small delay before polling */
jtag_add_sleep(50);
@@ -646,12 +637,11 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off
str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
- field.tap = tap;
field.num_bits = 8;
field.out_value = NULL;
field.in_value = scanbuf;
- jtag_add_dr_scan(1, &field, jtag_get_end_state());
+ jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_execute_queue();
status = buf_get_u32(scanbuf, 0, 8);
@@ -683,12 +673,11 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off
str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 64;
field.out_value = last_dword;
field.in_value = NULL;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
/* small delay before polling */
jtag_add_sleep(50);
@@ -696,12 +685,11 @@ static int str9xpec_write(struct flash_bank *bank, uint8_t *buffer, uint32_t off
str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
- field.tap = tap;
field.num_bits = 8;
field.out_value = NULL;
field.in_value = scanbuf;
- jtag_add_dr_scan(1, &field, jtag_get_end_state());
+ jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_execute_queue();
status = buf_get_u32(scanbuf, 0, 8);
@@ -750,12 +738,11 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
str9xpec_set_instr(tap, ISC_IDCODE, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 32;
field.out_value = NULL;
field.in_value = buffer;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
jtag_execute_queue();
idcode = buf_get_u32(buffer, 0, 32);
@@ -867,12 +854,11 @@ static int str9xpec_write_options(struct flash_bank *bank)
/* execute ISC_PROGRAM command */
str9xpec_set_instr(tap, ISC_PROGRAM, TAP_IRPAUSE);
- field.tap = tap;
field.num_bits = 64;
field.out_value = str9xpec_info->options;
field.in_value = NULL;
- jtag_add_dr_scan(1, &field, jtag_set_end_state(TAP_IDLE));
+ jtag_add_dr_scan(tap, 1, &field, jtag_set_end_state(TAP_IDLE));
/* small delay before polling */
jtag_add_sleep(50);
@@ -880,12 +866,11 @@ static int str9xpec_write_options(struct flash_bank *bank)
str9xpec_set_instr(tap, ISC_NOOP, TAP_IRPAUSE);
do {
- field.tap = tap;
field.num_bits = 8;
field.out_value = NULL;
field.in_value = &status;
- jtag_add_dr_scan(1, &field, jtag_get_end_state());
+ jtag_add_dr_scan(tap, 1, &field, jtag_get_end_state());
jtag_execute_queue();
} while (!(status & ISC_STATUS_BUSY));