Commit graph

11079 commits

Author SHA1 Message Date
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
Olivier Deprez
5340c5a041 Merge changes from topics "mtk_cold_boot", "mtk_init_scheme", "smc_registration_use_case", "vendor_extend_pubsub_event" into integration
* changes:
  feat(mediatek): implement generic platform port
  refactor(mediatek): smc registration services
  feat(mediatek): introduce mtk init framework
  refactor(mediatek): partition MTK SiP SMC ID
  feat(mediatek): extend SiP vendor subscription events
2022-08-30 12:26:47 +02: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
Madhukar Pappireddy
029f9b9c01 Merge changes I60b3b59e,Ibd5d22b4 into integration
* changes:
  fix(ufs): init utrlba/utrlbau with desc_base
  fix(ufs): fix slot base address computation
2022-08-29 15:35:35 +02:00
Madhukar Pappireddy
46577fb599 Merge "feat(stm32mp15-fdts): add Avenger96 board with STM32MP157A DHCOR SoM" into integration 2022-08-25 23:11:19 +02:00
Johann Neuhauser
51e223058f feat(stm32mp15-fdts): add Avenger96 board with STM32MP157A DHCOR SoM
This should replace the stm32mp157a-avenger96.dts with the new device
tree files split into the STM32MP15 DHCOR SoM definition and the
Avenger96 baseboard like it's done in Linux and U-Boot.

Differences to stm32mp157a-avenger96.dts:
- Enable sdmmc2 for booting from eMMC
- improved clock settings like in U-Boot commit b6055945
  "ARM: dts: stm32: Adjust PLL4 settings on AV96 again"
- improved DDR settings for DHSOMs like in U-Boot commit 92ca0f74
  "ARM: dts: stm32: Synchronize DDR setttings on DH SoMs"

TF-A with this new dts(i) files on this board was fully tested with
the latest OP-TEE developer setup.

Change-Id: I85ce8eca7747965af3555fc19fd7b192dc3e5740
Signed-off-by: Johann Neuhauser <jneuhauser@dh-electronics.com>
2022-08-25 22:11:33 +02:00
Olivier Deprez
0c0bab0cb4 Merge changes from topic "ffa_el3_spmc" into integration
* changes:
  feat(tsp): enable test cases for EL3 SPMC
  feat(tsp): increase stack size for tsp
  feat(tsp): add ffa_helpers to enable more FF-A functionality
2022-08-25 16:28:09 +02:00
Marc Bonnici
15ca1ee342 feat(tsp): enable test cases for EL3 SPMC
Introduce initial test cases to the TSP which are
designed to be exercised by the FF-A Test Driver
in the Normal World. These have been designed to
test basic functionality of the EL3 SPMC.

These tests currently ensure the following functionality:
  - Partition discovery.
  - Direct messaging.
  - Communication with a Logical SP.
  - Memory Sharing and Lending ABIs
  - Sharing of contiguous and non-contiguous memory regions.
  - Memory region descriptors spread of over multiple
    invocations.

Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
Change-Id: Iaee4180aa18d6b7ac7b53685c6589f0ab306e876
2022-08-25 14:57:20 +01:00
Shruti Gupta
5b7bd2af0b feat(tsp): increase stack size for tsp
TSP testcases for EL3 SPMC have higher stack usage.

Change-Id: Ib5bfdccc6d0f65174e257f3b0e8b41bcd3c704a6
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
2022-08-25 13:37:34 +01:00
Marc Bonnici
e9b1f300a9 feat(tsp): add ffa_helpers to enable more FF-A functionality
Include ffa_helpers originally taken from the TF-A Tests repo
to provide support for additional FF-A functionality.

Change-Id: Iacc3ee270d5e3903f86f8078ed915d1e791c1298
Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
2022-08-25 13:37:19 +01:00
Bipin Ravi
748749a870 Merge "fix(errata): workaround for Cortex-A510 erratum 2371937" into integration 2022-08-24 23:46:02 +02:00
Bipin Ravi
ac2605e69a Merge "fix(errata): workaround for Cortex-A78C erratum 2395411" into integration 2022-08-24 23:37:52 +02:00
Akram Ahmad
4b6f0026ea fix(errata): workaround for Cortex-A78C erratum 2395411
Cortex-A78C erratum 2395411 is a Cat B erratum that affects
revisions r0p1 and r0p2, and is currently open. The workaround
is to set CPUACTLR2_EL1[40] to 1, which will disable folding
of demand requests into older prefetches with L2 miss requests
outstanding.

SDEN can be found here:
https://developer.arm.com/documentation/SDEN2004089/latest

Signed-off-by: Akram Ahmad <Akram.Ahmad@arm.com>
Change-Id: I4f0fb278ac20a2eb4dd7e4efd1b1246dd85e48c4
2022-08-24 19:46:13 +01:00
Bipin Ravi
e221c55c52 Merge "fix(errata): workaround for Cortex-A710 erratum 2147715" into integration 2022-08-24 20:10:21 +02:00
Akram Ahmad
a67c1b1b2b fix(errata): workaround for Cortex-A510 erratum 2371937
Cortex-A510 erratum 2371937 is a Cat B erratum that applies
to revisions r0p0, r0p1, r0p2, r0p3, r1p0, and r1p1. It is
fixed in r1p2. The workaround is to set the ATOM field of
CPUECTLR_EL1 (bits [40:38]) to 0b010, which will force all
cacheable atomic operations to be executed near.

SDEN can be found here:
https://developer.arm.com/documentation/SDEN1873351/latest
https://developer.arm.com/documentation/SDEN1873361/latest

Signed-off-by: Akram Ahmad <Akram.Ahmad@arm.com>
Change-Id: Ia219a609a3397e39631de65831ecff8a3cd1227e
2022-08-24 16:35:25 +02:00
Olivier Deprez
19037a7100 Merge changes from topic "ffa_el3_spmc" into integration
* changes:
  feat(tsp): add FF-A support to the TSP
  feat(fvp/tsp_manifest): add example manifest for TSP
  fix(spmc): fix relinquish validation check
2022-08-24 16:31:01 +02:00
Achin Gupta
4a8bfdb909 feat(tsp): add FF-A support to the TSP
This patch adds the FF-A programming model in the test
secure payload to ensure that it can be used to test
the following spec features.

1. SP initialisation on the primary and secondary cpus.
2. An event loop to receive direct requests and respond
   with direct responses.
3. Ability to receive messages that indicate power on
   and off of a cpu.
4. Ability to handle a secure interrupt.

Signed-off-by: Achin Gupta <achin.gupta@arm.com>
Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Signed-off-by: Shruti <shruti.gupta@arm.com>
Change-Id: I81cf744904d5cdc0b27862b5e4bc6f2cfe58a13a
2022-08-24 14:46:30 +01:00
Bipin Ravi
51efe88344 Merge "feat(qemu): increase size of bl31" into integration 2022-08-24 02:01:02 +02:00
Lauren Wehrmeister
9d5069e72b Merge "build: fix syntax error in semantic ver generation" into integration 2022-08-23 18:33:47 +02:00
Harrison Mutai
d424b8e71a build: fix syntax error in semantic ver generation
Change-Id: I344aa5c779ec3f0a410d3b8bc42b6014a9b37314
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
2022-08-23 16:51:13 +01:00
Joanna Farley
5936b5bedb Merge "build: fix semantic ver generation for windows" into integration 2022-08-23 17:01:34 +02:00
Joanna Farley
d97fc8de85 Merge "fix(zynqmp): fix for incorrect afi write mask value" into integration 2022-08-23 10:52:21 +02:00
Akshay Belsare
4264bd33e7 fix(zynqmp): fix for incorrect afi write mask value
Currently, the AFIFM6_WRCTRL bus-width configuration is not happening
correctly due to the wrong register write mask value. To fix this issue
updated the mask value handling logic.

Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
Signed-off-by: Akshay Belsare <Akshay.Belsare@amd.com>
Acked-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Change-Id: I8443c369a84339018310cfb6cd498d21474da3e4
2022-08-23 11:50:52 +05:30
Akram Ahmad
3280e5e655 fix(errata): workaround for Cortex-A710 erratum 2147715
Cortex-A710 erratum 2147715 is a Cat B erratum that applies
to revision r2p0 of the CPU, and is fixed in r2p1. The work-
around is to set CPUACTLR_EL1[22]=1. Setting this will cause
the CFP instruction to invalidate all branch predictor resources
regardless of the context.

SDEN can be found here:
https://developer.arm.com/documentation/SDEN1775101/latest

Signed-off-by: Akram Ahmad <Akram.Ahmad@arm.com>
Change-Id: I94771bc1fc9b65a0c17d75200ec2b1df8a3279c6
2022-08-22 20:30:36 +02:00
Sandrine Bailleux
49b8b704f9 Merge "fix(lib/psa): update measured boot handle" into integration 2022-08-22 15:07:43 +02:00
Marc Bonnici
3cf080ed61 feat(fvp/tsp_manifest): add example manifest for TSP
Add an example manifest for the EL3 SPMC on the FVP Platform
that allows booting the TSP example partition.

Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Change-Id: Ie7f40328e0313abb5b1a121dfdc22a5f7387587f
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
2022-08-21 23:33:58 +01:00
Marc Bonnici
b4c3621e0d fix(spmc): fix relinquish validation check
The current implementation expects that the endpoint IDs of all
participants of a memory transaction to be listed in the relinquish
descriptor. As per the FF-A spec, aside from the current partition
ID, only the IDs of stream endpoints whose behalf it is relinquishing
the memory region must be specified.

The current implementation does not currently support proxy endpoints
therefore ensure that the endpoint count is always equal to 1 and
no stream endpoint IDs are specified and instead just verify the
caller is a valid participant in the memory transaction.

Additionally reuse the updated check in the retrieve request flow
for additional verification.

Signed-off-by: Marc Bonnici <marc.bonnici@arm.com>
Change-Id: I3b970196af8a16b2531607775398cb8a2473793b
2022-08-21 23:33:40 +01:00
Madhukar Pappireddy
6c15235526 Merge changes from topic "stm32mp13-updates" into integration
* changes:
  feat(stm32mp1): manage STM32MP13 rev.Y
  feat(stm32mp13-fdts): use STM32MP_DDR_S_SIZE in fw-config
  fix(stm32mp13-fdts): cleanup DT files
  fix(stm32mp13-fdts): update SDMMC max frequency
  fix(stm32mp13-fdts): align sdmmc pins with kernel
2022-08-19 17:20:50 +02:00
Bipin Ravi
3a41658864 Merge "feat(rng-trap): add EL3 support for FEAT_RNG_TRAP" into integration 2022-08-18 22:24:41 +02:00
Juan Pablo Conde
ff86e0b4e6 feat(rng-trap): add EL3 support for FEAT_RNG_TRAP
FEAT_RNG_TRAP introduces support for EL3 trapping of reads of the
RNDR and RNDRRS registers, which is enabled by setting the
SCR_EL3.TRNDR bit. This patch adds a new build flag
ENABLE_FEAT_RNG_TRAP that enables the feature.
This feature is supported only in AArch64 state from Armv8.5 onwards.

Signed-off-by: Juan Pablo Conde <juanpablo.conde@arm.com>
Change-Id: Ia9f17aef3444d3822bf03809036a1f668c9f2d89
2022-08-18 15:53:54 -04:00
Bipin Ravi
25c9a4c820 Merge "fix(errata): workaround for Neoverse-N2 erratum 2376738" into integration 2022-08-18 01:04:51 +02:00
Yann Gautier
a3f97f66c3 feat(stm32mp1): manage STM32MP13 rev.Y
The new SoC version for STM32MP13 is the revision Y. The register
SYSCFG_IDC is updated for this new version with the value 0x1003.
The function stm32mp_get_soc_name() should also be updated to manage
this new SoC revision.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I4f2fa5f1503f17db93d8413c79c2b7a18d279f9b
2022-08-17 17:25:45 +02:00
Yann Gautier
936f29f6b5 feat(stm32mp13-fdts): use STM32MP_DDR_S_SIZE in fw-config
Align with STM32MP15 file, use the macro STM32MP_DDR_S_SIZE, instead of
an hard-coded value.

Signed-off-by: Yann Gautier <yann.gautier@st.com>
Change-Id: Ib31bed1ffe89ff221fab1884a2db729ce1e21846
2022-08-17 17:25:45 +02:00
Yann Gautier
4c07deb53e fix(stm32mp13-fdts): cleanup DT files
Instead of adding all peripheral nodes in SoC DT files, and then
removing them with BL2 overlay file, just remove them from SoC files.
And remove peripherals that are not used in TF-A on STM32MP13.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I0c408d29b55cb94644c92539460fc62485781223
2022-08-17 17:24:30 +02:00
Yann Gautier
c9a4cb552c fix(stm32mp13-fdts): update SDMMC max frequency
On STM32MP13, the max frequency for IOs is 130MHz, update the SDMMC
max-frequency property with this value. This is an alignment with
Linux DT file.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: If4b364f53f87d4b5d276a976af486a3bf083f49b
2022-08-17 17:18:25 +02:00
Yann Gautier
c7ac7d65a7 fix(stm32mp13-fdts): align sdmmc pins with kernel
Update the pinctrl nodes for sdmmc instances in stm32mp13-pinctrl.dtsi
file to align with Linux. The boards DT files then need to be updated
accordingly.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I4e1f3cf78794bfb7bbe53cfc7e88623c7e79855d
2022-08-17 17:18:25 +02:00
Madhukar Pappireddy
afbb10abdc Merge changes from topic "st-mmc-updates" into integration
* changes:
  feat(st-sdmmc2): define FIFO size
  feat(st-sdmmc2): make reset property optional
  feat(st): enable MMC_FLAG_SD_CMD6 for SD-cards
  feat(st-sdmmc2): manage CMD6
  feat(mmc): manage SD Switch Function for high speed mode
2022-08-17 16:33:10 +02:00
Madhukar Pappireddy
51d52c7923 Merge changes from topic "st-etzpc-cleanup" into integration
* changes:
  refactor(stm32mp15-fdts): remove ETZPC status
  refactor(st-drivers): do not rely on DT in etzpc_init
2022-08-17 16:32:55 +02:00
Akram Ahmad
e6602d4b15 fix(errata): workaround for Neoverse-N2 erratum 2376738
Neoverse-N2 erratum 2376738 is a Cat B erratum that applies
to revision r0p0 of the CPU. It is fixed in r0p1. The workaround
is to set CPUACTLR2_EL1[0] to 1 to force PLDW/PFRM ST to
behave like PLD/PRFM LD and not cause invalidations to other
PE caches.

SDEN can be found here:
https://developer.arm.com/documentation/SDEN1982442/latest

Signed-off-by: Akram Ahmad <Akram.Ahmad@arm.com>
Change-Id: I4ad4434f9b7210244e67046d9657d218857dced5
2022-08-17 11:11:26 +02:00
Yann Gautier
b46f74d4e6 feat(st-sdmmc2): define FIFO size
Instead of using hard-coded values in stm32_sdmmc2_read() function,
use a defined SDMMC_FIFO_SIZE, which is 64 on STM32MP1.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I1ace0a28fbddae474379f0187371b9c360ceb7b3
2022-08-16 15:58:22 +02:00
Yann Gautier
8324b16cd5 feat(st-sdmmc2): make reset property optional
Although not recommended, the reset property could be made optional.
This way the driver will probe even if no reset property is provided
in an sdmmc node in DT. This reset is already optional in Linux.

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
Change-Id: I6e63ff00118d9497f505d6379982334dd62686ca
2022-08-16 15:58:22 +02:00
Yann Gautier
53d5b8ff50 feat(st): enable MMC_FLAG_SD_CMD6 for SD-cards
This flag allows switching to High-Speed mode on SD-cards.
The gain is ~44ms when using SP_min, and ~55ms with OP-TEE.

Change-Id: Ic396c6a14201580b5e5627e6174b85b437b87cae
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-08-16 15:58:22 +02:00
Yann Gautier
3deebd4ccf feat(st-sdmmc2): manage CMD6
For SD-cards, CMD6 is used to switch functions, like setting high speed
mode. As it has another meaning for eMMC, and may not work on standard
capacity SD-cards, it must be checked with MMC_IS_SD_HC flag.
As ACMD6 is also used, and will have the same index, a check on
CMD/ACMD commands is done: a boolean is stored depending on previous
command. It is set to true if CMD55 is issued, for other commands
it is set to false.

Change-Id: I6c2b9c7637656f858601ec075de1cb5f57af271a
Signed-off-by: Yann Gautier <yann.gautier@st.com>
2022-08-16 15:58:22 +02:00