Commit graph

431 commits

Author SHA1 Message Date
Edward-JW Yang
4cc1ff7ef2 feat(mt8188): add MCUSYS support
Add MCUSYS drivers support for MT8188.

Signed-off-by: Edward-JW Yang <edward-jw.yang@mediatek.com>
Change-Id: I84107702a9fd021c37d2997ad25b321a483a1a66
2022-09-22 19:26:15 +08:00
Edward-JW Yang
45711e4e16 feat(mt8188): add armv8.2 support
Add armv8.2 support for MT8188.

Signed-off-by: Edward-JW Yang <edward-jw.yang@mediatek.com>
Change-Id: I0ac865949ba864fb207ee1f0937092cbabd550de
2022-09-22 19:26:15 +08:00
Fengquan Chen
7079a942bd feat(mt8188): add DFD control in SiP service
DFD (Design for Debug) is a debugging tool, which scans flip-flops and
dumps to internal RAM on the WDT reset. After system reboots, those
values could be showed for debugging.

TEST=build pass.
BUG=b:244216434

Signed-off-by: Fengquan Chen <fengquan.chen@mediatek.corp-partner.google.com>
Change-Id: I468036131e941a46bc1ec12d33105146000730d8
2022-09-22 19:26:15 +08:00
Dawei Chien
8454f0d65e feat(mt8188): add EMI MPU basic drivers
EMI MPU stands for external memory interface memory protect unit.
MT8188 supports 32 regions and 16 domains.

Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
Change-Id: I9bbeb355665401cc71dda6db22157d9d751570d1
2022-09-22 19:26:15 +08:00
Garmin Chang
bc9410e237 feat(mt8188): add DCM driver
DCM means dynamic clock management, and it can dynamically
slow down or gate clocks during CPU or bus idle.

1. Add MCUSYS related DCM drivers.
2. Enable MCUSYS related DCM by default.

Signed-off-by: Garmin Chang <garmin.chang@mediatek.com>
Change-Id: I131354d72bbc190af504e9639bcc85a720e2bb17
2022-09-22 19:26:15 +08:00
Rex-BC Chen
a72b9e7754 feat(mt8188): add reset and poweroff functions
- Add mtk_pm_system_reset_cros() for cros reset.
- Add mtk_pm_system_off_cros() for cros power-off.

TEST=build pass
BUG=b:236331724

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I4117f6080e282551b37a936a490ab7b37ac31827
2022-09-22 19:26:15 +08:00
Edward-JW Yang
6ca2046ef1 feat(mediatek): add more flexibility of mtk_pm.c
To use power manager function more easier, we add some drivers to let
the implementation easier.

Signed-off-by: Edward-JW Yang <edward-jw.yang@mediatek.com>
Change-Id: Ibc6e1680c4534592ed37de49da39b6667f468ea1
2022-09-22 19:26:15 +08:00
Edward-JW Yang
5b95e439c7 feat(mediatek): add more options for build helper
To support more LPM feature, we add more options for build helper.

Signed-off-by: Edward-JW Yang <edward-jw.yang@mediatek.com>
Change-Id: I17eeedbe0674e321f1891074ba0c72d858841dae
2022-09-22 19:26:15 +08:00
Bo-Chen Chen
f604e4ef6e feat(mt8188): add LPM driver support
Add LPM drivers and create rules.mk for makefile.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I0bfb99a4a763e7ca93260f62d1ced184259acb39
2022-09-22 19:26:15 +08:00
Bo-Chen Chen
abb995abbe feat(mt8188): apply ERRATA for CA-78
Apply ERRATA_A78_2376745 and ERRATA_A78_2395406 for CA-78.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I4575e83025af971a669dc1f8561cf19e1fdac469
2022-09-22 19:26:15 +08:00
Bo-Chen Chen
8cd3b693d6 fix(mediatek): remove unused cold_boot.[c|h]
We are not using cold_boot.[c|h] for mt8188, so remove them first.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I721aca37d5fb422f274bb1ab46150e1eddf7c480
2022-09-22 19:26:15 +08:00
Bo-Chen Chen
24476b2e61 fix(mediatek): wrap cold_boot.h with MTK_SIP_KERNEL_BOOT_ENABLE
We should wrap cold_boot.h with MTK_SIP_KERNEL_BOOT_ENABLE to avoid
build error.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: Idfd760fbb7c782d4fc9de674d86a7123e0129c0d
2022-09-22 19:26:15 +08:00
Allen-KH Cheng
3d4b6f9324 feat(mt8186): add EMI MPU support for SCP and DSP
1. Enable domain D0 and D3 (SCP) access 0x50000000~0x5109FFFF.
2. Enable domain D4 (DSP & AFE) access 0x60000000~0x610FFFFF.

BUG=b:204229221
TEST=build pass

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.corp-partner.google.com>
Change-Id: I6a7d2eafaaa7a558829a0d741dfb3307885e3b98
2022-09-22 19:26:15 +08:00
Bo-Chen Chen
4dbe24cf7d feat(mediatek): add smcc call for MSDC
Some registers of MSDC need to be set in ATF, so we add MSDC drivers.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: Idde51a136ad08dbaece0bdaa804b934fca7046b6
2022-09-08 18:02:02 +08:00
Bo-Chen Chen
3bdd9a24e9 refactor(mediatek): refactor plat_sip_calls.h for mt8192/mt8195/mt8186
- MTK_SIP_KERNEL_DFD can be moved to mtk_sip_def.h.
- Remove unused MTK_SIP_* definations which are already defined in
  mtk_sip_def.h.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: Ife8f1e842d986691488548632426f194199d42b9
2022-09-08 18:01:49 +08:00
Jianguo Zhang
ec4cfb91fc feat(mt8188): add pinctrl support
Add pinctrl support for MT8188.

TEST=build pass
BUG=b:236331724

Signed-off-by: Jianguo Zhang <jianguo.zhang@mediatek.corp-partner.google.com>
Change-Id: Id4ac8f67009621fff8f15f3ab2d8f200343c8356
2022-09-05 18:12:24 +08:00
Song Fan
af5d8e0795 feat(mt8188): add RTC support
TEST=build pass.
BUG=b:233720142

Signed-off-by: Song Fan <ot_song.fan@mediatek.corp-partner.google.com>
Change-Id: I348eff0f53341593f74a63780e2e8298cbc3ec88
2022-09-05 18:12:24 +08:00
Hui Liu
e9310c34b0 feat(mt8188): add pmic and pwrap support
Add PWRAP and PMIC driver to support power-off.

TEST=build pass.
BUG=b:233720142

Signed-off-by: Hui Liu <hui.liu@mediatek.corp-partner.google.com>
Change-Id: Id9951134925f6cb5f8d304a7b8e7901837809bd9
2022-09-05 18:12:24 +08:00
Bo-Chen Chen
80fa75842d refator(mediatek): move pmic.[c|h] to common folder
These two files are identical on MT8192 and MT8195. They can also be
used on MT8188. So move them to common/drivers/pmic/.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I8c12d15f1da79ab5767ac02b3ab70e8508155ee8
2022-09-05 18:12:24 +08:00
Bo-Chen Chen
ca93b018dc refator(mediatek): move common definitions of pmic wrap to common folder
Some definitions can be shared among mt8192, mt8195, and
mt8186, so move them to pmic_wrap_init_common.h.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I992b61a47a84039fe8c246e2ff75721c57ee41a5
2022-09-05 18:12:24 +08:00
Chengci Xu
be457248c6 feat(mt8188): add IOMMU enable control in SiP service
Add SiP service for multimedia & infra master to enable/disable
MM & INFRA IOMMU in secure world

TEST=build pass
BUG=b:236339614

Signed-off-by: Chengci Xu <chengci.xu@mediatek.corp-partner.google.com>
Change-Id: I4eb1fda6044cf2cb6c22c005cb2fa550906b71e9
2022-09-05 18:12:24 +08:00
Rex-BC Chen
a4e502319d feat(mt8188): add display port control in SiP service
MTK display port mute/unmute control registers need to be
set in secure world.

TEST=build pass
BUG=b:236331724

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I0aa0675f07c80aab4349493bfbb0782bf0bbef58
2022-09-05 18:12:21 +08:00
Rex-BC Chen
810d568141 fix(mediatek): use uppercase for definition
Use uppercase for definition.
s/eDP_SEC_BASE/EDP_SEC_BASE/.
s/eDP_SEC_SIZE/EDP_SEC_SIZE/.

TEST=build pass for mt8195
BUG=b:233720142

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I390055500a6347b67fefde36a7f103438ba2d5ff
2022-09-05 13:53:14 +08:00
Rex-BC Chen
d150b6296e feat(mediatek): move dp drivers to common folder
Display port driver can be reused, so we move it to common/drivers.

TEST=build mt8195 pass
BUG=b:233720142

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I58c7b41ba3ad653cdf6f6fbae6778abfd7e950a9
2022-09-05 13:53:14 +08:00
Rex-BC Chen
cc76896d9e feat(mediatek): move mtk_cirq.c drivers to cirq folder
To use cirq drivers more easier, we place mtk_cirq.c and mtk_cirq.h
to common/drivers/cirq.

We also rename mtk_cirq.c/h to mt_cirq.c/h for consistency with other
driver folders.

TEST=build pass for mt8192/mt8195/mt8186
BUG=b:236331724

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I71bc442f00b16fb4031260937982c0496fcaaea0
2022-09-05 13:53:13 +08:00
Rex-BC Chen
cfb0516f3c feat(mt8188): initialize GIC
Initialize GIC for mt8188.

TEST=build pass
BUG=b:236331724

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I5acf77d654f1bbce32e9fbb3f3567600b7db10ed
2022-09-05 13:52:20 +08:00
Rex-BC Chen
215869c693 feat(mt8188): initialize systimer
Add systimer to support timer function.

TEST=build pass
BUG=b:236331724

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: Ibe6b96a162caa8804bebb7ff7de326ebcb2a6daa
2022-09-05 13:52:20 +08:00
Rex-BC Chen
de310e1e5f feat(mt8188): initialize platform for MediaTek MT8188
- Add basic platform setup.
- Add MT8188 documentation at docs/plat/.
- Add generic CPU helper functions.
- Add basic register address.
- Add mtk_pm.c in lib/pm

TEST=build pass
BUG=b:236331724

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I5f8617c42ffba2c9d3a16f3980cb75fda5624031
2022-09-05 13:52:20 +08:00
Bo-Chen Chen
a59cbd9e31 refator(mediatek): remove unused files
We do not use oem_svc.[c|h], so remove them.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I0afb64d997cf4e23063f4fa2226e8d2649d22574
2022-09-05 13:52:20 +08:00
Bo-Chen Chen
3374752fc1 refator(mediatek): move drivers folder in common to plat/mediatek
We plan to put some soc related drivers in common/drivers. To reduce
confision, we move them to plat/mediatek.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I6b344e660f40a23b15151aab073d3045b28f52aa
2022-09-05 13:52:17 +08:00
Rex-BC Chen
ef988aed9e feat(mediatek): support coreboot BL31 loading
The ChromeOS project uses Coreboot as BL2 instead of MediaTek regular
bootloader, so we use COREBOOT flag to support Coreboot boot flow.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I45e95ea51e90158187452eba52fc58090d1c60a4
2022-08-31 09:32:32 +08:00
Leon Chen
394b92084d feat(mediatek): implement generic platform port
Implement mandatory platform port functions. Receive
boot arguments from bl2, populate bl33 and bl32 image
entry structs, call each MTK initcall levels
in these mandatory platform port functions.
After bl31_main exit and handover to 2nd boot loader,
mtk bl33 issues SMC and traps to TF-A to execute boot_to_kernel
and then handover to Linux kernel.

Signed-off-by: Leon Chen <leon.chen@mediatek.com>
Change-Id: I8d5a3511668fc749c4c71edf1ac700002cb5a9c8
2022-08-30 16:47:43 +08:00
Leon Chen
6a7e8ebf76 refactor(mediatek): smc registration services
To modularize SMC handler, provide macro function in mtk_sip_svc.h.
Drivers register SMC name with value in mtk_sip_def.h, and bind the SMC
handler with the SMC ID by calling DECLARE_SMC_HANDLER macro.

MTK_SIP_SMC_FROM_BL33_TABLE expand the SMC table as switch-case table
statically. DECLARE_SMC_HANDLER wrap SMC handlers with a structure and
put in a section.
During cold boot initialization, in MTK_EARLY_PLAT_INIT level parse the
section to assign each handler with an index. Each SMC request can be
identified with switch-case and take the index to call into
corresponding SMC handler.

Signed-off-by: Leon Chen <leon.chen@mediatek.com>
Change-Id: I03da212c786de0ec0ea646ba906065ecfcd82571
2022-08-30 16:47:43 +08:00
Leon Chen
52035dee1a feat(mediatek): introduce mtk init framework
Provide six initcall levels for drivers/modules initialize HW
controllers or runtime arguments during cold boot.

The initcall level cold boot execution order:

-MTK_EARLY_PLAT_INIT
Call before MMU enabled.

-MTK_ARCH_INIT
MMU Enabled, arch related init(GiC init, interrupt type registration).

-MTK_PLAT_SETUP_0_INIT
MTK driver init level 0.

-MTK_PLAT_SETUP_1_INIT
MTK driver init level 1.

-MTK_PLAT_RUNTIME_INIT
MTK driver init. After this initcall, TF-A handovers to MTK 2nd
bootloader.

-MTK_PLAT_BL33_DEFER_INIT
MTK 2nd bootloader traps to TF-A before handover to rich OS.
This initcall executed in the trap handler(boot_to_kernel).

Signed-off-by: Leon Chen <leon.chen@mediatek.com>
Change-Id: Icd7fe95372441db73c975ccb6ce77a6c529df1cc
2022-08-30 16:47:43 +08:00
Leon Chen
2f3f5939a1 refactor(mediatek): partition MTK SiP SMC ID
Manage MTK SiP SMC ID with macros for 32/64 bit and
function declaration code generation.
Partition SMC ID with different exception level sources.

Signed-off-by: Leon Chen <leon.chen@mediatek.com>
Change-Id: I8966cd94f0d825e7ebae08833d2bd9fceedfd45e
2022-08-30 16:47:43 +08:00
Leon Chen
99d30b72c0 feat(mediatek): extend SiP vendor subscription events
Leverage pubsub event framework to customize vendor's
event for better software modularization instead of adding
call entries in abstraction layer for customized platform function
with wrap-up define.

Signed-off-by: Leon Chen <leon.chen@mediatek.com>
Change-Id: I48be2303c45f759776fa2baa1c21130c1a8f0fa3
2022-08-30 16:47:43 +08:00
Yidi Lin
2a2b51d8f7 fix(mt8186): move SSPM base register definition to platform_def.h
- move base register definition to platform_def.h for maintenance.
- SSPM_MBOX_3_BASE is redefined, use SSPM_MBOX_BASE instead.

Signed-off-by: Yidi Lin <yidilin@chromium.org>
Change-Id: Ibb0291ce7b7426068392e90bd70f29d1a90d5297
2022-07-19 15:56:19 +08:00
Manish Pandey
a150486c97 refactor(mt6795): remove mediatek's mt6795 platform
Mediatek's mt6795 platform was deprecated in 2.5 release and as per [1]
a platform which has been marked deprecated should be removed from repo
after 2 release cycle.

[1] https://trustedfirmware-a.readthedocs.io/en/latest/plat/deprecated.html?highlight=deprecated

Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ic427a3071316a13f34a726a1eb086b679e1671a1
2022-05-04 12:23:29 +02:00
Leon Chen
500d40d877 feat(plat/mediatek/build_helpers): introduce mtk makefile
In order to modularize software libraries and platform drivers,
we create makefile helpers to treat a folder as a basic compile
unit.

Each module has a build rule (rules.mk) to describe driver and software
library source codes to be built in.

Signed-off-by: Leon Chen <leon.chen@mediatek.com>
Change-Id: Ib2113b259dc97937b7295b265509025b43b14077
2022-04-28 10:29:33 +02:00
Rex-BC Chen
e46e9df0d0 feat(mt8186): add DFD control in SiP service
DFD (Design for Debug) is a debugging tool, which scans flip-flops and
dumps to internal RAM on the WDT reset. After system reboots, those
values could be showed for debugging.

BUG=b:222217317
TEST=build pass

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I659ea1e0789cf135a71a13b752edaa35123e0941
2022-03-11 17:47:05 +08:00
jason-ch chen
9457cec8c0 feat(mt8186): disable 26MHz clock while suspending
Change resource_req to 0 to disable 26MHz clock.
SPM firmware will pull-down SRCLKENA0 after 26MHz off while suspending.

TEST=verify 26MHz clock off using the oscilloscope.
BUG=b:215639203

Signed-off-by: Jason-ch Chen <jason-ch.chen@mediatek.com>
Change-Id: I05702d14a015cabccd6d4af0e3f2a534fbe4dd12
2022-02-24 15:56:50 +08:00
jason-ch chen
635e6b108e feat(mt8186): add Vcore DVFS driver
Add Vcore DVFS to SPM driver.

TEST=build pass
BUG=b:202871018

Signed-off-by: Jason-ch Chen <jason-ch.chen@mediatek.com>
Change-Id: I52b241b2cdb792be74390cbaa09a728ddbe6593a
2022-01-13 10:11:39 +08:00
jason-ch chen
7ac6a76c47 feat(mt8186): add SPM suspend driver
Add SPM suspend driver for suspend/resume features.

TEST=build pass
BUG=b:202871018

Signed-off-by: Jason-ch Chen <jason-ch.chen@mediatek.com>
Change-Id: I25b4b97cd3138a7b347385539e47ccfa884d64fc
2022-01-13 10:10:56 +08:00
Rex-BC Chen
c21a736d6f feat(mt8195): apply erratas of CA78 for MT8195
MT8195 uses Cortex A78 CPU, so we apply these erratas.

TEST=build pass
BUG=none

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I5ce3d5c490a12226bff4eb5a2d55687da0f74f0e
2022-01-05 17:10:44 +08:00
Madhukar Pappireddy
64fc535972 Merge "feat(plat/mediatek/mt8195): improve SPM wakeup log" into integration 2022-01-04 20:10:25 +01:00
Rex-BC Chen
bc714bafe7 fix(mt8186): remove unused files in drivers/mcdi
We don't use mbox drivers which are implemented in these files for
mcdi, so remove related files from mcdi folder.

TEST=build pass
BUG=b:202871018

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: Idea5ebe5b25f91066ebd653cdcdafe65ca292b0f
2021-12-30 17:21:33 +08:00
Rex-BC Chen
24dd5a7b71 feat(plat/mediatek/mt8186): add reboot function for PSCI
Add system_reset function in PSCI operations.

TEST=build pass
BUG=b:202871018

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I41001484f6244bd6ae7dedcfb6ce71cd6c035a1e
2021-12-22 18:06:53 +08:00
Rex-BC Chen
a68346a772 feat(plat/mdeiatek/mt8186): add power-off function for PSCI
Add support for system-off.

TEST=build pass
BUG=b:202871018

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: Ic734696aab1b71ae85bca6ed08e544a522ce5c95
2021-12-22 18:06:53 +08:00
Rex-BC Chen
572f8adbb0 feat(plat/mediatek/mt8186): apply erratas for MT8186
MT8186 uses Cortex A76 CPU, so we apply these erratas.

TEST=build pass
BUG=b:202871018

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I84741535fbe429f664092f624c2da653532204cd
2021-12-22 18:06:53 +08:00
Garmin.Chang
06cb65ef07 feat(plat/mediatek/mt8186): add MCDI drivers
Add MCDI related drivers to handle CPU powered on/off in CPU suspend.

TEST=build pass
BUG=b:202871018

Change-Id: I85aaaf3a0e992a39d17c58f3d9d5ff1b5770f748
Signed-off-by: Garmin.Chang <Garmin.Chang@mediatek.com>
2021-12-22 18:06:53 +08:00