aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorJan Matyas <50193733+JanMatCodasip@users.noreply.github.com>2020-12-14 21:32:31 +0100
committerGitHub <noreply@github.com>2020-12-14 12:32:31 -0800
commit5d0543cc1c7749a9bf3538328397a5e817275fb9 (patch)
tree2848bb8402fb3b031f3bdaad33f75f27163924b8 /src/target
parentdd17f7cca7598a0ea19d3f412fe1126ab687d9ec (diff)
downloadriscv-openocd-5d0543cc1c7749a9bf3538328397a5e817275fb9.zip
riscv-openocd-5d0543cc1c7749a9bf3538328397a5e817275fb9.tar.gz
riscv-openocd-5d0543cc1c7749a9bf3538328397a5e817275fb9.tar.bz2
Clear sbcs.sbbusyerror without affecting other sbcs bits (#547)
This is a fix for an issue reported by Joe Stoy at: https://sourceforge.net/p/openocd/mailman/message/37128537/ When clearing sbcs.sbbusyerror, preserve other bits in the sbcs register that are needed for subsequent system bus transactions.
Diffstat (limited to 'src/target')
-rw-r--r--src/target/riscv/riscv-013.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 39da6a5..e458602 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -2192,7 +2192,7 @@ static int sample_memory_bus_v1(struct target *target,
/* Discard this batch (too much hassle to try to recover partial
* data) and try again with a larger delay. */
info->bus_master_read_delay += info->bus_master_read_delay / 10 + 1;
- dmi_write(target, DM_SBCS, DM_SBCS_SBBUSYERROR | DM_SBCS_SBERROR);
+ dmi_write(target, DM_SBCS, sbcs_read | DM_SBCS_SBBUSYERROR | DM_SBCS_SBERROR);
riscv_batch_free(batch);
continue;
}
@@ -2778,7 +2778,7 @@ static int read_memory_bus_v1(struct target *target, target_addr_t address,
if (get_field(sbcs_read, DM_SBCS_SBBUSYERROR)) {
/* We read while the target was busy. Slow down and try again. */
- if (dmi_write(target, DM_SBCS, DM_SBCS_SBBUSYERROR) != ERROR_OK)
+ if (dmi_write(target, DM_SBCS, sbcs_read | DM_SBCS_SBBUSYERROR) != ERROR_OK)
return ERROR_FAIL;
next_address = sb_read_address(target);
info->bus_master_read_delay += info->bus_master_read_delay / 10 + 1;
@@ -3726,7 +3726,7 @@ static int write_memory_bus_v1(struct target *target, target_addr_t address,
if (get_field(sbcs, DM_SBCS_SBBUSYERROR)) {
/* We wrote while the target was busy. Slow down and try again. */
- dmi_write(target, DM_SBCS, DM_SBCS_SBBUSYERROR);
+ dmi_write(target, DM_SBCS, sbcs | DM_SBCS_SBBUSYERROR);
info->bus_master_write_delay += info->bus_master_write_delay / 10 + 1;
}