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.
This commit is contained in:
CTCaer 2022-07-11 22:28:09 +03:00
parent 801ebd3543
commit b891657fb6

View file

@ -86,6 +86,9 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt)
clock_enable_kfuse(); clock_enable_kfuse();
kfuse_wait_ready(); kfuse_wait_ready();
// Disable AHB aperture.
mc_disable_ahb_redirect();
if (type == TSEC_FW_TYPE_NEW) if (type == TSEC_FW_TYPE_NEW)
{ {
// Disable all CCPLEX core rails. // 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) if (type == TSEC_FW_TYPE_EMU)
{ {
u32 start = get_tmr_us();
u32 k = se[SE_CRYPTO_KEYTABLE_DATA_REG / 4]; u32 k = se[SE_CRYPTO_KEYTABLE_DATA_REG / 4];
u32 timeout = get_tmr_us() + 125000;
u32 key[16] = {0}; u32 key[16] = {0};
u32 kidx = 0; u32 kidx = 0;
@ -221,7 +224,7 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt)
} }
// Failsafe. // Failsafe.
if ((u32)get_tmr_us() - start > 125000) if ((u32)get_tmr_us() > timeout)
break; break;
} }
@ -301,5 +304,10 @@ out:
bpmp_mmu_enable(); bpmp_mmu_enable();
bpmp_clk_rate_set(prev_fid); bpmp_clk_rate_set(prev_fid);
#ifdef BDK_MC_ENABLE_AHB_REDIRECT
// Re-enable AHB aperture.
mc_enable_ahb_redirect();
#endif
return res; return res;
} }