From 4c544bad280f0467746d7d87bb9907350d82bb95 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Mon, 8 Aug 2022 00:56:48 +0100 Subject: [PATCH] adiv5: Add a dummy read to the end of firmware_mem_write_sized() so we always wait on the write to ensure it's complete before any DP access can occur --- src/target/adiv5.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/target/adiv5.c b/src/target/adiv5.c index 6688ec6..1394133 100644 --- a/src/target/adiv5.c +++ b/src/target/adiv5.c @@ -996,6 +996,8 @@ void firmware_mem_write_sized(ADIv5_AP_t *ap, uint32_t dest, const void *src, si adiv5_dp_low_access(ap->dp, ADIV5_LOW_WRITE, ADIV5_AP_TAR, dest); } } + /* Make sure this write is complete by doing a dummy read */ + adiv5_dp_read(ap->dp, ADIV5_DP_RDBUFF); } void firmware_ap_write(ADIv5_AP_t *ap, uint16_t addr, uint32_t value)