Merge pull request #23 from sifive/w1-to-clear-cmderr
riscv: Use write-1-to-clear for CMDERR, not write 0 to clear.
This commit is contained in:
commit
69a8273da5
|
@ -563,7 +563,7 @@ static int execute_abstract_command(struct target *target, uint32_t command)
|
||||||
command, errors[get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)],
|
command, errors[get_field(abstractcs, DMI_ABSTRACTCS_CMDERR)],
|
||||||
abstractcs);
|
abstractcs);
|
||||||
// Clear the error.
|
// Clear the error.
|
||||||
dmi_write(target, DMI_ABSTRACTCS, 0);
|
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1858,7 +1858,6 @@ static int read_memory(struct target *target, uint32_t address,
|
||||||
abstract_register_size(xlen(target)) | reg_number_to_no(S1)) != ERROR_OK) {
|
abstract_register_size(xlen(target)) | reg_number_to_no(S1)) != ERROR_OK) {
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR);
|
|
||||||
|
|
||||||
uint32_t abstractcs;
|
uint32_t abstractcs;
|
||||||
for (uint32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
|
@ -1891,11 +1890,11 @@ static int read_memory(struct target *target, uint32_t address,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dmi_write(target, DMI_ABSTRACTAUTO, 0);
|
dmi_write(target, DMI_ABSTRACTAUTO, 0);
|
||||||
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR);
|
|
||||||
abstractcs = dmi_read(target, DMI_ABSTRACTCS);
|
abstractcs = dmi_read(target, DMI_ABSTRACTCS);
|
||||||
unsigned cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR);
|
unsigned cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR);
|
||||||
if (cmderr == CMDERR_BUSY) {
|
if (cmderr == CMDERR_BUSY) {
|
||||||
dmi_write(target, DMI_ABSTRACTCS, 0);
|
// Clear the error and wait longer.
|
||||||
|
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR);
|
||||||
increase_ac_busy_delay(target);
|
increase_ac_busy_delay(target);
|
||||||
} else if (cmderr) {
|
} else if (cmderr) {
|
||||||
LOG_ERROR("cmderr=%d", get_field(abstractcs, DMI_ABSTRACTCS_CMDERR));
|
LOG_ERROR("cmderr=%d", get_field(abstractcs, DMI_ABSTRACTCS_CMDERR));
|
||||||
|
@ -1980,9 +1979,6 @@ static int write_memory(struct target *target, uint32_t address,
|
||||||
AC_ACCESS_REGISTER_WRITE | AC_ACCESS_REGISTER_POSTEXEC
|
AC_ACCESS_REGISTER_WRITE | AC_ACCESS_REGISTER_POSTEXEC
|
||||||
| abstract_register_size(xlen(target)) |
|
| abstract_register_size(xlen(target)) |
|
||||||
reg_number_to_no(S1), true);
|
reg_number_to_no(S1), true);
|
||||||
scans_add_dmi_write(scans, DMI_ABSTRACTCS,
|
|
||||||
DMI_ABSTRACTCS_CMDERR,
|
|
||||||
false);
|
|
||||||
scans_add_dmi_write(scans, DMI_ABSTRACTAUTO,
|
scans_add_dmi_write(scans, DMI_ABSTRACTAUTO,
|
||||||
0x1 << DMI_ABSTRACTAUTO_AUTOEXECDATA_OFFSET,
|
0x1 << DMI_ABSTRACTAUTO_AUTOEXECDATA_OFFSET,
|
||||||
false);
|
false);
|
||||||
|
@ -2001,7 +1997,7 @@ static int write_memory(struct target *target, uint32_t address,
|
||||||
uint32_t abstractcs = dmi_read(target, DMI_ABSTRACTCS);
|
uint32_t abstractcs = dmi_read(target, DMI_ABSTRACTCS);
|
||||||
unsigned cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR);
|
unsigned cmderr = get_field(abstractcs, DMI_ABSTRACTCS_CMDERR);
|
||||||
if (cmderr == CMDERR_BUSY) {
|
if (cmderr == CMDERR_BUSY) {
|
||||||
dmi_write(target, DMI_ABSTRACTCS, 0);
|
dmi_write(target, DMI_ABSTRACTCS, DMI_ABSTRACTCS_CMDERR);
|
||||||
increase_ac_busy_delay(target);
|
increase_ac_busy_delay(target);
|
||||||
} else if (cmderr) {
|
} else if (cmderr) {
|
||||||
LOG_ERROR("cmderr=%d", get_field(abstractcs, DMI_ABSTRACTCS_CMDERR));
|
LOG_ERROR("cmderr=%d", get_field(abstractcs, DMI_ABSTRACTCS_CMDERR));
|
||||||
|
|
Loading…
Reference in New Issue