From d5322f384b653761cbee8e0694fac57a55ff120f Mon Sep 17 00:00:00 2001 From: CTCaer Date: Fri, 17 Sep 2021 23:10:57 +0300 Subject: [PATCH] tsec: make sure cpu power rails are off --- bdk/sec/tsec.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bdk/sec/tsec.c b/bdk/sec/tsec.c index ad13b87..1e9d01f 100644 --- a/bdk/sec/tsec.c +++ b/bdk/sec/tsec.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -86,7 +87,16 @@ int tsec_query(void *tsec_keys, tsec_ctxt_t *tsec_ctxt) kfuse_wait_ready(); if (type == TSEC_FW_TYPE_NEW) + { + // Disable all CCPLEX core rails. + pmc_enable_partition(POWER_RAIL_CE0, DISABLE); + pmc_enable_partition(POWER_RAIL_CE1, DISABLE); + pmc_enable_partition(POWER_RAIL_CE2, DISABLE); + pmc_enable_partition(POWER_RAIL_CE3, DISABLE); + + // Enable AHB aperture and set it to full mmio. mc_enable_ahb_redirect(true); + } // Configure Falcon. TSEC(TSEC_DMACTL) = 0; @@ -291,6 +301,7 @@ out:; bpmp_mmu_enable(); bpmp_clk_rate_set(prev_fid); + // Disable AHB aperture. if (type == TSEC_FW_TYPE_NEW) mc_disable_ahb_redirect();