Commit graph

39 commits

Author SHA1 Message Date
Gavin Liu
b741293f34 feat(mediatek): move plat_helpers.h to the common folder
The plat_helpers.h is identical across various platforms, moved to the
common folder for easier maintenance.

Change-Id: Ic9f10c697fcda7e3cfbf32e67486c9cd28481b8a
Signed-off-by: Gavin Liu <gavin.liu@mediatek.com>
2024-11-05 15:46:19 +08:00
Suyuan Su
b88d1f527b feat(mt8188): add MT8188 TRNG driver
Add MTK TRNG driver for MT8188.

Change-Id: I604edd42ffce9a153e209a015ba454b51da454e1
Signed-off-by: Suyuan Su <suyuan.su@mediatek.com>
Signed-off-by: Gavin Liu <gavin.liu@mediatek.com>
2024-11-04 03:56:21 +01:00
Gavin Liu
240a1ecd18 feat(mediatek): configure DEV_IRQ as G1S interrupt
In order to register DEV_IRQ as secure interrupt in OP-TEE, the the GICD
EnableGrp1S should be enabled for DEV_IRQ. Add mtk_interrupt_props in
MTK GIC driver to configure the interrupt properly.

Signed-off-by: Gavin Liu <gavin.liu@mediatek.com>
Change-Id: Id909a42b535088c6d0dcaf803d3f2faf312ae846
2024-06-20 15:33:51 +08:00
kiwi liu
5fb5ff5694 feat(mt8188): add secure iommu support
The secure IOMMU has two secure banks: VDO and VPP. Add SiP call to
report the secure bank status in debug build.
About more background, please see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/dt-bindings/memory/mediatek,mt8188-memory-port.h?id=d5cda142d649c690fb0fcf1e29f3df63fbafc442

Change-Id: I7b3319e84391fc6d7f456659f8b8c5d9d1c6ab9d
Signed-off-by: Anan Sun <anan.sun@mediatek.corp-partner.google.com>
Signed-off-by: Kiwi Liu <kiwi.liu@mediatek.corp-partner.google.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
2023-12-01 02:53:17 +01:00
Karl Li
5986ae57aa feat(mt8188): add devapc setting of apusys rcx
Apusys rcx is a subsys in apusys, and it is a basic domain of APU and
it connects several components in APU.
The devapc control of apusys rcx is also inside APU and it can only be
set when APU is powered on.
Then apusys kernel driver will trigger rcx devapc init by ATF smc call.

Change-Id: If4249f22a08690b1e4f5aa5f0cbfb54ccacf90e1
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Chungying Lu
94a9e6243e feat(mediatek): add APU bootup control smc call
Add APU bootup control smc call.
The steps of bootup flow:
  1. set up APU config.
  2. reset APU.
  3. set up APU boot config.
  4. boot APU.

Change-Id: I9e930070a64c7c4dcaa3a8b3d28b897823e9f53c
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
Signed-off-by: Karl Li <karl.li@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
ad7673adef feat(mt8188): enable apusys mailbox mpu protect
Enable apusys mailbox mpu protect.

Change-Id: Idbf67084037b7ecf4926f57a901075f98540ee57
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
b5900c92a1 feat(mt8188): enable apusys domain remap
Enable apusys domain remap to protect no-protect memory.
  - Remap request which from domain 5 to domain 14.
  - Remap request which from domain 7 to domain 14.

Change-Id: Iccd188e3b8edbe916fa9767c841a844b66c6011f
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
777e3b71bb feat(mt8188): add apusys ao devapc setting
Apusys ao devapc is a set of control registers inside APU, and it
controls the access permission of APU ao domain.
Moreover, apusys ao devapc must be set after apusys power init, so
we need to place the drivers in TF-A instead of coreboot.

Change-Id: Ife849c32d4dd9dca15432d4b8a51753fde61b148
Signed-off-by: Karl Li <karl.li@mediatek.com>
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-06-06 13:45:40 +08:00
Karl Li
aa1cb279b6 feat(mt8188): increase TZRAM_SIZE from 192KB to 256KB
Increase TZRAM_SIZE to 256KB for MT8188 APUSYS.

Change-Id: Iabe1a4aeb79ba23c3e963170a8eb9ce19f2925f3
Signed-off-by: Karl Li <karl.li@mediatek.com>
2023-06-06 13:44:03 +08:00
Chungying Lu
8e38b92849 feat(mt8188): add apu power on/off control
Add mt8188 apu power on/off control

Change-Id: I8e28bf7a4ad4067553981c67c4c2225fdd802859
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
Signed-off-by: jason-ch chen <Jason-ch.Chen@mediatek.com>
2023-04-06 13:42:55 +08:00
Chungying Lu
5243091633 feat(mediatek): add APU init flow
The patch brings preparation steps before powering on APU
(AI processing unit)

Change-Id: Ica01e035153ec6f3af0de6ba2c66b17a064f8c89
Signed-off-by: Chungying Lu <chungying.lu@mediatek.com>
2023-03-29 16:25:17 +08:00
Shaocheng Wang
e56a939cab feat(mt8188): keep infra and peri on when system suspend
In order to wake up system from USB devices, keep infra and peri on
when system suspend.

Change-Id: I0a0eb2e72709b0cc1bf11b36241a50cb5d85d9b8
Signed-off-by: Shaocheng Wang <shaocheng.wang@mediatek.corp-partner.google.com>
2023-01-11 13:37:47 +08:00
James Liao
380f64b2e3 feat(mt8188): enable SPM and LPM
Enable SPM and LPM features for MT8188.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Change-Id: Ib3e2b305e9e3cf5a67e6e787ff942831b5ff28cd
2023-01-11 13:37:45 +08:00
James Liao
1a64689df5 feat(mt8188): add the register definitions accessed by SPM
SPM needs to access some modules' registers to decide its sleep
behavior. This patch add these register definitions to platform_def.h.

Signed-off-by: James Liao <jamesjj.liao@mediatek.com>
Change-Id: I3bebe74e367d5f6a7b59563036e18a83a3ef31e9
2023-01-11 13:37:38 +08:00
Liju-Clr Chen
32071c0263 fix(mt8188): add mmap entry for CPU idle SRAM
CPU PM driver accesses CPU idle SRAM during the system suspend
process. The region of CPU idle SRAM needs to be added as mmap entry.
Otherwise, the execption would occur.

BUG=b:244215539
TEST=Test of suspend resume passes.

Signed-off-by: Liju-Clr Chen <liju-clr.chen@mediatek.com>
Change-Id: I5838964fd9cb1b833e4006e2123febb4a4601003
2022-11-14 15:54:09 +08:00
Trevor Wu
c70f567ad7 feat(mt8188): add audio support
For MT8188, MTK_AUDIO_SMC_OP_DOMAIN_SIDEBANDS is required for normal
mode switch.
  - Add audio common code and chip specific code.
  - Add new id (MTK_SIP_AUDIO_CONTROL) to mtk_sip_def.h.
  - Enable for MT8188.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Change-Id: Iff4680cd0b520b2b519ecf30ecafe100f147cc62
2022-11-14 09:55:07 +08:00
Riven Chen
44a10511c9 feat(mt8188): add support for PTP3
Add PTP3 driver to protect CPU from excessive voltage drop in CPU
heavy loading.

Signed-off-by: Riven Chen <riven.chen@mediatek.corp-partner.google.com>
Change-Id: I394096be43e1d1d615f99b22f38f0b3ae0bb40c1
2022-11-14 09:55:07 +08:00
Rex-BC Chen
0b1186a3e6 feat(mt8188): enable MTK_PUBEVENT_ENABLE
Enable MTK_PUBEVENT_ENABLE for subscribing CPUPM events. This
patch also corrects the header file naming.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: Iabd89a4ead21ccafa833390367484bfea5d351f6
2022-11-14 09:55:07 +08:00
Bo-Chen Chen
cd7890d79e feat(mediatek): move lpm drivers back to common
In order to sync drivers with MediaTek internal code base, we move lpm
drivers back to common folder.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I1066e092febe0abb9782a46f668613e137737c88
2022-10-04 09:52:10 +08:00
Edward-JW Yang
4fe7e6a8d9 feat(mt8188): add cpu_pm driver
- Add cpu_pm driver for CPU idle and SMP flow.
- Add SMP driver for CPU power on/off control.
- Add CPC driver to handle CPU powered on/off in CPU suspend.
- Add mbox driver for tinysys support.

Signed-off-by: Edward-JW Yang <edward-jw.yang@mediatek.com>
Change-Id: I20141474e1c43cdfacb9f2c6a2285721e50a617c
2022-10-04 09:52:10 +08:00
Bo-Chen Chen
a64d9f442e refactor(mt8188): move platform_def.h to mt8188/include
It is more suitable to place platform_def.h in mt8188/include.

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I35720690ff4f2ca99c9430edb8bbe17edf9aefb9
2022-09-22 19:26:15 +08:00
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
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
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
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
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