feat(mt8188): remove apusys kernel handler usage constraints

It is expected that kernel can control the flow of the TF-A operations.
This patch remove the apusys kernel handler usage constraints, making
the operations all controlled on kernel side.

Signed-off-by: Karl Li <karl.li@mediatek.com>
Change-Id: Idc205a2cf23e1ff5f1920658a3b089c823f0288a
This commit is contained in:
Karl Li 2024-04-26 15:08:02 +08:00 committed by Karl Li
parent a1901c7d0d
commit 0c77651fb4
2 changed files with 0 additions and 96 deletions

View file

@ -37,18 +37,8 @@ void apusys_rv_mbox_mpu_init(void)
int apusys_kernel_apusys_rv_setup_reviser(void)
{
static bool apusys_rv_setup_reviser_called;
spin_lock(&apusys_rv_lock);
if (apusys_rv_setup_reviser_called) {
WARN(MODULE_TAG "%s: already initialized\n", __func__);
spin_unlock(&apusys_rv_lock);
return -1;
}
apusys_rv_setup_reviser_called = true;
mmio_write_32(USERFW_CTXT, CFG_4GB_SEL_EN | CFG_4GB_SEL);
mmio_write_32(SECUREFW_CTXT, CFG_4GB_SEL_EN | CFG_4GB_SEL);
@ -74,18 +64,8 @@ int apusys_kernel_apusys_rv_setup_reviser(void)
int apusys_kernel_apusys_rv_reset_mp(void)
{
static bool apusys_rv_reset_mp_called;
spin_lock(&apusys_rv_lock);
if (apusys_rv_reset_mp_called) {
WARN(MODULE_TAG "%s: already initialized\n", __func__);
spin_unlock(&apusys_rv_lock);
return -1;
}
apusys_rv_reset_mp_called = true;
mmio_write_32(MD32_SYS_CTRL, MD32_SYS_CTRL_RST);
dsb();
@ -106,18 +86,8 @@ int apusys_kernel_apusys_rv_reset_mp(void)
int apusys_kernel_apusys_rv_setup_boot(void)
{
static bool apusys_rv_setup_boot_called;
spin_lock(&apusys_rv_lock);
if (apusys_rv_setup_boot_called) {
WARN(MODULE_TAG "%s: already initialized\n", __func__);
spin_unlock(&apusys_rv_lock);
return -1;
}
apusys_rv_setup_boot_called = true;
mmio_write_32(MD32_BOOT_CTRL, APU_SEC_FW_IOVA);
mmio_write_32(MD32_PRE_DEFINE, (PREDEFINE_CACHE_TCM << PREDEF_1G_OFS) |
@ -130,55 +100,17 @@ int apusys_kernel_apusys_rv_setup_boot(void)
int apusys_kernel_apusys_rv_start_mp(void)
{
static bool apusys_rv_start_mp_called;
spin_lock(&apusys_rv_lock);
if (apusys_rv_start_mp_called) {
WARN(MODULE_TAG "%s: already initialized\n", __func__);
spin_unlock(&apusys_rv_lock);
return -1;
}
apusys_rv_start_mp_called = true;
mmio_write_32(MD32_RUNSTALL, MD32_RUN);
spin_unlock(&apusys_rv_lock);
return 0;
}
static bool watch_dog_is_timeout(void)
{
if (mmio_read_32(WDT_INT) != WDT_INT_W1C) {
ERROR(MODULE_TAG "%s: WDT does not timeout\n", __func__);
return false;
}
return true;
}
int apusys_kernel_apusys_rv_stop_mp(void)
{
static bool apusys_rv_stop_mp_called;
spin_lock(&apusys_rv_lock);
if (apusys_rv_stop_mp_called) {
WARN(MODULE_TAG "%s: already initialized\n", __func__);
spin_unlock(&apusys_rv_lock);
return -1;
}
if (watch_dog_is_timeout() == false) {
spin_unlock(&apusys_rv_lock);
return -1;
}
apusys_rv_stop_mp_called = true;
mmio_write_32(MD32_RUNSTALL, MD32_STALL);
spin_unlock(&apusys_rv_lock);
return 0;
@ -186,19 +118,10 @@ int apusys_kernel_apusys_rv_stop_mp(void)
int apusys_kernel_apusys_rv_setup_sec_mem(void)
{
static bool apusys_rv_setup_sec_mem_called;
int ret;
spin_lock(&apusys_rv_lock);
if (apusys_rv_setup_sec_mem_called) {
WARN(MODULE_TAG "%s: already initialized\n", __func__);
spin_unlock(&apusys_rv_lock);
return -1;
}
apusys_rv_setup_sec_mem_called = true;
ret = set_apu_emi_mpu_region();
if (ret != 0) {
ERROR(MODULE_TAG "%s: set emimpu protection failed\n", __func__);
@ -230,12 +153,6 @@ int apusys_kernel_apusys_rv_clear_wdt_isr(void)
int apusys_kernel_apusys_rv_cg_gating(void)
{
spin_lock(&apusys_rv_lock);
if (watch_dog_is_timeout() == false) {
spin_unlock(&apusys_rv_lock);
return -1;
}
mmio_write_32(MD32_CLK_CTRL, MD32_CLK_DIS);
spin_unlock(&apusys_rv_lock);
@ -245,12 +162,6 @@ int apusys_kernel_apusys_rv_cg_gating(void)
int apusys_kernel_apusys_rv_cg_ungating(void)
{
spin_lock(&apusys_rv_lock);
if (watch_dog_is_timeout() == false) {
spin_unlock(&apusys_rv_lock);
return -1;
}
mmio_write_32(MD32_CLK_CTRL, MD32_CLK_EN);
spin_unlock(&apusys_rv_lock);

View file

@ -271,15 +271,8 @@ int apusys_devapc_ao_init(void)
int apusys_devapc_rcx_init(void)
{
static bool apusys_devapc_rcx_init_called;
enum apusys_apc_err_status ret;
if (apusys_devapc_rcx_init_called == true) {
INFO(MODULE_TAG "%s: init more than once!\n", __func__);
return -1;
}
apusys_devapc_rcx_init_called = true;
apusys_devapc_init("APUAPC_CTRL_RCX", APU_CTRL_DAPC_RCX_BASE);
apusys_devapc_init("APUAPC_NOC_RCX", APU_NOC_DAPC_RCX_BASE);