Merge changes I58637b8d,I4bb1a50a,Iadac6549,I758e933f into integration

* changes:
  feat(mt8196): turn on APU smpu protection
  feat(mt8196): enable APU spmi operation
  feat(mt8196): add Mediatek MMinfra stub implementation
  feat(mt8196): enable cirq for MediaTek MT8196
This commit is contained in:
Govindraj Raja 2025-01-31 17:15:55 +01:00 committed by TrustedFirmware Code Review
commit 6ef685a913
9 changed files with 66 additions and 15 deletions

View file

@ -1,16 +1,12 @@
/*
* Copyright (c) 2024, MediaTek Inc. All rights reserved.
* Copyright (c) 2024-2025, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <inttypes.h>
#define SPMI_ENABLE (0)
#if SPMI_ENABLE
#include <include/drivers/spmi_api.h>
#endif
#include <common/debug.h>
#include <drivers/delay_timer.h>
@ -259,16 +255,13 @@ static int apu_pcu_init(void)
uint32_t en_set_offset = BUCK_VAPU_PMIC_REG_EN_SET_ADDR;
uint32_t en_clr_offset = BUCK_VAPU_PMIC_REG_EN_CLR_ADDR;
uint32_t en_shift = BUCK_VAPU_PMIC_REG_EN_SHIFT;
#if SPMI_ENABLE
struct spmi_device *vsram_sdev;
#endif
unsigned char vsram = 0;
mmio_write_32(APUSYS_PCU + APU_PCUTOP_CTRL_SET, AUTO_BUCK_EN);
mmio_write_32((APUSYS_PCU + APU_PCU_BUCK_STEP_SEL), BUCK_STEP_SEL_VAL);
#if SPMI_ENABLE
vsram_sdev = get_spmi_device(SPMI_MASTER_1, SPMI_SLAVE_4);
if (!vsram_sdev) {
ERROR("[APUPW] VSRAM BUCK4 get device fail\n");
@ -279,7 +272,6 @@ static int apu_pcu_init(void)
ERROR("[APUPW] VSRAM BUCK4 read fail\n");
return -1;
}
#endif
mmio_write_32(APUSYS_PCU + APU_PCU_BUCK_ON_DAT0_L,
(BUCK_VAPU_PMIC_REG_VOSEL_ADDR << PMIC_OFF_ADDR_OFF) | vsram);

View file

@ -1,14 +1,13 @@
/*
* Copyright (c) 2024, MediaTek Inc. All rights reserved.
* Copyright (c) 2024-2025, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#define ENABLE_SMPU_PROTECT (0)
#define ENABLE_SMPU_PROTECT (1)
#if ENABLE_SMPU_PROTECT
#include "emi.h"
#include "mt_emi.h"
#endif
#include <common/debug.h>

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2024, MediaTek Inc. All rights reserved.
# Copyright (c) 2024-2025, MediaTek Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@ -10,7 +10,6 @@ MODULE := apusys_${MTK_SOC}
ifeq (${CONFIG_MTK_APUSYS_EMI_SUPPORT}, y)
PLAT_INCLUDES += -I${MTK_PLAT}/drivers/emi/common
PLAT_INCLUDES += -I${MTK_PLAT}/drivers/emi/${MTK_SOC}
endif
LOCAL_SRCS-y := ${LOCAL_DIR}/apusys_ammu.c

View file

@ -0,0 +1,17 @@
/*
* Copyright (c) 2025, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <drivers/mminfra_public.h>
int mminfra_get_if_in_use(void)
{
return 0;
}
int mminfra_put(void)
{
return 0;
}

View file

@ -0,0 +1,17 @@
#
# Copyright (c) 2025, MediaTek Inc. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
LOCAL_DIR := $(call GET_LOCAL_DIR)
MODULE := mminfra
PLAT_INCLUDES += -I${MTK_PLAT}/include/drivers/
ifeq ($(MTKLIB_PATH),)
LOCAL_SRCS-y := ${LOCAL_DIR}/mminfra_stub.c
endif
$(eval $(call MAKE_MODULE,$(MODULE),$(LOCAL_SRCS-y),$(MTK_BL)))

View file

@ -0,0 +1,16 @@
/*
* Copyright (c) 2025, MediaTek Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef MMINFRA_PUBLIC_H
#define MMINFRA_PUBLIC_H
#define MMINFRA_RET_ERR (-1)
#define MMINFRA_RET_POWER_OFF 0
#define MMINFRA_RET_POWER_ON 1
int mminfra_get_if_in_use(void);
int mminfra_put(void);
#endif

View file

@ -147,6 +147,15 @@
INTR_PROP_DESC(DEV_IRQ_ID, GIC_HIGHEST_SEC_PRIORITY, grp, \
GIC_INTR_CFG_LEVEL)
/*******************************************************************************
* CIRQ related constants
******************************************************************************/
#define SYS_CIRQ_BASE (IO_PHYS + 0x1CB000)
#define MD_WDT_IRQ_BIT_ID (397)
#define CIRQ_REG_NUM (26)
#define CIRQ_SPI_START (128)
#define CIRQ_IRQ_NUM (831)
/*******************************************************************************
* MM IOMMU & SMI related constants
******************************************************************************/

View file

@ -27,7 +27,7 @@ CTX_INCLUDE_AARCH32_REGS := 0
CONFIG_ARCH_ARM_V9 := y
CONFIG_MTK_APUSYS_CE_SUPPORT := y
CONFIG_MTK_APUSYS_EMI_SUPPORT := n
CONFIG_MTK_APUSYS_EMI_SUPPORT := y
CONFIG_MTK_APUSYS_LOGTOP_SUPPORT := y
CONFIG_MTK_APUSYS_RV_APUMMU_SUPPORT := y
CONFIG_MTK_APUSYS_RV_COREDUMP_WA_SUPPORT := y

View file

@ -29,10 +29,12 @@ MODULES-y += $(MTK_PLAT)/common/lpm_v2
MODULES-y += $(MTK_PLAT)/lib/mtk_init
MODULES-y += $(MTK_PLAT)/lib/pm
MODULES-y += $(MTK_PLAT)/drivers/apusys
MODULES-y += $(MTK_PLAT)/drivers/cirq
MODULES-y += $(MTK_PLAT)/drivers/dp
MODULES-y += $(MTK_PLAT)/drivers/emi
MODULES-y += $(MTK_PLAT)/drivers/gicv3
MODULES-y += $(MTK_PLAT)/drivers/mcusys
MODULES-y += $(MTK_PLAT)/drivers/mminfra
MODULES-y += $(MTK_PLAT)/drivers/spm
MODULES-y += $(MTK_PLAT)/drivers/timer
MODULES-y += $(MTK_PLAT)/drivers/vcp