soc/mediatek/mt8189: Support different PMIC soluitons for MT8189(G/H)

The MT8189 chipset comes in two variants: MT8189G and MT8189H. The
MT8189G variant uses a single PMIC IC (MT6315), whereas the MT8189H
variant uses two PMIC ICs. To ensure driver compatibility, we utilize
the CPU ID and segment ID to accurately determine the required number
of SPMIF instances.

BUG=b:379008996
BRANCH=none
TEST=build pass and boot up normally.

Signed-off-by: Zhigang Qin <zhigang.qin@mediatek.corp-partner.google.com>
Change-Id: I07bc21a2026803e76861b27a178d229deca2090a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87854
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
This commit is contained in:
Zhigang Qin 2025-05-22 20:21:01 +08:00 committed by Yidi Lin
commit 04c0527aba
2 changed files with 13 additions and 1 deletions

View file

@ -17,6 +17,7 @@ bootblock-y += ../common/pll.c pll.c
bootblock-y += ../common/wdt.c ../common/wdt_req.c wdt.c
romstage-y += ../common/cbmem.c
romstage-y += ../common/cpu_id.c ../common/cpu_segment_id.c
romstage-y += ../common/dram_init.c
romstage-y += ../common/dramc_param.c
romstage-y += ../common/emi.c

View file

@ -2,6 +2,7 @@
#include <device/mmio.h>
#include <gpio.h>
#include <soc/cpu_id.h>
#include <soc/pll.h>
#include <soc/pmif_spmi.h>
@ -43,5 +44,15 @@ void pmif_spmi_iocfg(void)
size_t spmi_dev_cnt(void)
{
return ARRAY_SIZE(spmi_dev);
static size_t cached_cnt;
if (cached_cnt)
return cached_cnt;
cached_cnt = ARRAY_SIZE(spmi_dev);
if (get_cpu_id() == MTK_CPU_ID_MT8189 &&
get_cpu_segment_id() == MTK_CPU_SEG_ID_MT8189G)
cached_cnt = 1;
return cached_cnt;
}