From 22dfd0efaddaa70baf9e65aff661554c4497909a Mon Sep 17 00:00:00 2001 From: Tomas Vanek Date: Tue, 13 Aug 2024 16:23:20 +0200 Subject: [PATCH] tcl/target/rp2350: workarounds for ROM API issues A0 chip: remove pad isolation A2 chip: instead of reset init fixes we will fix the flash driver with the following patch by Luke Wren: 8729: flash/nor/rp2xxx: fix flash operation after halt in RISC-V bootsel https://review.openocd.org/c/openocd/+/8729 I don't have A1 version to test. Signed-off-by: Tomas Vanek Change-Id: I9e9fab04ead929fe6e0a17c6c2f32a6f02e9beb9 Reviewed-on: https://review.openocd.org/c/openocd/+/8450 Tested-by: jenkins --- tcl/target/rp2350.cfg | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tcl/target/rp2350.cfg b/tcl/target/rp2350.cfg index 775561f06..d2465bd2f 100644 --- a/tcl/target/rp2350.cfg +++ b/tcl/target/rp2350.cfg @@ -94,8 +94,7 @@ if { [info exists _TARGETNAME_RV0] } { target create $_TARGETNAME_RV0 riscv -dap $_CHIPNAME.dap -ap-num 0xa000 -coreid 0 $_TARGETNAME_RV0 riscv set_enable_virt2phys off - # Workaround for stray IO_QSPI: GPIO_QSPI_SD1_CTRL: INOVER bit in RISC-V BOOTSEL - $_TARGETNAME_RV0 configure -event reset-init { mww 0x4003002c 0 } + $_TARGETNAME_RV0 configure -event reset-init "_rv_reset_init" if { [info exists _TARGETNAME_CM0] } { # just for setting after init when the event become-available is not fired @@ -204,3 +203,22 @@ if { $_RESCUE } { init rescue_reset } + +proc _rv_reset_init { } { + set chip_id [format 0x%08x [read_memory 0x40000000 32 1]] + + # Version related workarounds + switch $chip_id { + 0x00004927 { # A0 + # remove IO_QSPI isolation + mww 0x40030014 0 + mww 0x4003001c 0 + mww 0x40030024 0 + mww 0x4003002c 0 + mww 0x40030034 0 + mww 0x4003003c 0 + } + } + + rp2xxx rom_api_call FC +} -- 2.50.1