From b891657fb6b4d82e1747e88619bb84e06072ad60 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Mon, 11 Jul 2022 22:28:09 +0300 Subject: [PATCH] bdk: tsec: fix regression on HOS 6.2.0 not booting With the latest BDK changes on enabling always on AHB redirect with a compile time flag, TSEC fw boot was regressed because it needs it off. Always disable redirect and if the flag is enabled, enable it on exit. --- bdk/sec/tsec.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bdk/sec/tsec.c b/bdk/sec/tsec.c index 3ff9974..201df3d 100644 --- a/bdk/sec/tsec.c +++ b/bdk/sec/tsec.c @@ -86,6 +86,9 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt) clock_enable_kfuse(); kfuse_wait_ready(); + // Disable AHB aperture. + mc_disable_ahb_redirect(); + if (type == TSEC_FW_TYPE_NEW) { // Disable all CCPLEX core rails. @@ -205,8 +208,8 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt) if (type == TSEC_FW_TYPE_EMU) { - u32 start = get_tmr_us(); u32 k = se[SE_CRYPTO_KEYTABLE_DATA_REG / 4]; + u32 timeout = get_tmr_us() + 125000; u32 key[16] = {0}; u32 kidx = 0; @@ -221,7 +224,7 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt) } // Failsafe. - if ((u32)get_tmr_us() - start > 125000) + if ((u32)get_tmr_us() > timeout) break; } @@ -301,5 +304,10 @@ out: bpmp_mmu_enable(); bpmp_clk_rate_set(prev_fid); +#ifdef BDK_MC_ENABLE_AHB_REDIRECT + // Re-enable AHB aperture. + mc_enable_ahb_redirect(); +#endif + return res; }