aboutsummaryrefslogtreecommitdiff
path: root/plat/mediatek
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-12-14 00:18:21 +0000
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2019-01-04 10:43:17 +0000
commit09d40e0e08283a249e7dce0e106c07c5141f9b7e (patch)
tree46e7af7b5be2738948b359b2a07078e4cf1bbec1 /plat/mediatek
parentf5478dedf9e096d9539362b38ceb096b940ba3e2 (diff)
downloadtrusted-firmware-a-09d40e0e08283a249e7dce0e106c07c5141f9b7e.tar.gz
Sanitise includes across codebase
Enforce full include path for includes. Deprecate old paths. The following folders inside include/lib have been left unchanged: - include/lib/cpus/${ARCH} - include/lib/el3_runtime/${ARCH} The reason for this change is that having a global namespace for includes isn't a good idea. It defeats one of the advantages of having folders and it introduces problems that are sometimes subtle (because you may not know the header you are actually including if there are two of them). For example, this patch had to be created because two headers were called the same way: e0ea0928d5b7 ("Fix gpio includes of mt8173 platform to avoid collision."). More recently, this patch has had similar problems: 46f9b2c3a282 ("drivers: add tzc380 support"). This problem was introduced in commit 4ecca33988b9 ("Move include and source files to logical locations"). At that time, there weren't too many headers so it wasn't a real issue. However, time has shown that this creates problems. Platforms that want to preserve the way they include headers may add the removed paths to PLAT_INCLUDES, but this is discouraged. Change-Id: I39dc53ed98f9e297a5966e723d1936d6ccf2fc8f Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'plat/mediatek')
-rw-r--r--plat/mediatek/common/custom/oem_svc.c15
-rw-r--r--plat/mediatek/common/mtk_plat_common.c16
-rw-r--r--plat/mediatek/common/mtk_plat_common.h5
-rw-r--r--plat/mediatek/common/mtk_sip_svc.c13
-rw-r--r--plat/mediatek/mt6795/bl31.ld.S2
-rw-r--r--plat/mediatek/mt6795/bl31_plat_setup.c29
-rw-r--r--plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c10
-rw-r--r--plat/mediatek/mt6795/include/mcucfg.h3
-rw-r--r--plat/mediatek/mt6795/include/plat_macros.S2
-rw-r--r--plat/mediatek/mt6795/include/plat_private.h3
-rw-r--r--plat/mediatek/mt6795/include/platform_def.h2
-rw-r--r--plat/mediatek/mt6795/plat_delay_timer.c5
-rw-r--r--plat/mediatek/mt6795/plat_mt_gic.c7
-rw-r--r--plat/mediatek/mt6795/plat_pm.c19
-rw-r--r--plat/mediatek/mt6795/plat_topology.c5
-rw-r--r--plat/mediatek/mt6795/power_tracer.c3
-rw-r--r--plat/mediatek/mt6795/scu.c3
-rw-r--r--plat/mediatek/mt8173/aarch64/platform_common.c15
-rw-r--r--plat/mediatek/mt8173/bl31_plat_setup.c17
-rw-r--r--plat/mediatek/mt8173/drivers/crypt/crypt.c11
-rw-r--r--plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c7
-rw-r--r--plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c8
-rw-r--r--plat/mediatek/mt8173/drivers/rtc/rtc.c7
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm.c8
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm_hotplug.c6
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm_mcdi.c11
-rw-r--r--plat/mediatek/mt8173/drivers/spm/spm_suspend.c10
-rw-r--r--plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c4
-rw-r--r--plat/mediatek/mt8173/include/mcucfg.h3
-rw-r--r--plat/mediatek/mt8173/include/plat_macros.S6
-rw-r--r--plat/mediatek/mt8173/include/platform_def.h7
-rw-r--r--plat/mediatek/mt8173/plat_mt_gic.c5
-rw-r--r--plat/mediatek/mt8173/plat_pm.c18
-rw-r--r--plat/mediatek/mt8173/plat_sip_calls.c8
-rw-r--r--plat/mediatek/mt8173/plat_topology.c5
-rw-r--r--plat/mediatek/mt8173/power_tracer.c3
-rw-r--r--plat/mediatek/mt8173/scu.c3
37 files changed, 182 insertions, 122 deletions
diff --git a/plat/mediatek/common/custom/oem_svc.c b/plat/mediatek/common/custom/oem_svc.c
index 18bda515a4..27ee6aa7bb 100644
--- a/plat/mediatek/common/custom/oem_svc.c
+++ b/plat/mediatek/common/custom/oem_svc.c
@@ -3,15 +3,18 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <assert.h>
+#include <stdint.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <plat/common/platform.h>
+#include <tools_share/uuid.h>
+
#include <oem_svc.h>
-#include <platform.h>
-#include <runtime_svc.h>
-#include <stdint.h>
-#include <uuid.h>
/* OEM Service UUID */
DEFINE_SVC_UUID2(oem_svc_uid,
diff --git a/plat/mediatek/common/mtk_plat_common.c b/plat/mediatek/common/mtk_plat_common.c
index bff83c7343..a07a2981ac 100644
--- a/plat/mediatek/common/mtk_plat_common.c
+++ b/plat/mediatek/common/mtk_plat_common.c
@@ -3,17 +3,19 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <console.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/platform.h>
+
#include <mtk_plat_common.h>
#include <mtk_sip_svc.h>
#include <plat_private.h>
-#include <platform.h>
-#include <xlat_tables.h>
struct atf_arg_t gteearg;
diff --git a/plat/mediatek/common/mtk_plat_common.h b/plat/mediatek/common/mtk_plat_common.h
index ff8e8c0374..55f4c516eb 100644
--- a/plat/mediatek/common/mtk_plat_common.h
+++ b/plat/mediatek/common/mtk_plat_common.h
@@ -6,10 +6,11 @@
#ifndef MTK_PLAT_COMMON_H
#define MTK_PLAT_COMMON_H
-#include <bl_common.h>
-#include <param_header.h>
#include <stdint.h>
+#include <common/bl_common.h>
+#include <common/param_header.h>
+
/*******************************************************************************
* Function and variable prototypes
******************************************************************************/
diff --git a/plat/mediatek/common/mtk_sip_svc.c b/plat/mediatek/common/mtk_sip_svc.c
index 71eddca310..dab0d4541c 100644
--- a/plat/mediatek/common/mtk_sip_svc.c
+++ b/plat/mediatek/common/mtk_sip_svc.c
@@ -3,15 +3,18 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <console.h>
-#include <debug.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <drivers/console.h>
+#include <lib/mmio.h>
+#include <tools_share/uuid.h>
+
#include <mtk_plat_common.h>
#include <mtk_sip_svc.h>
#include <plat_sip_calls.h>
-#include <runtime_svc.h>
-#include <uuid.h>
/* Mediatek SiP Service UUID */
DEFINE_SVC_UUID2(mtk_sip_svc_uid,
diff --git a/plat/mediatek/mt6795/bl31.ld.S b/plat/mediatek/mt6795/bl31.ld.S
index 8f391df7e8..6ec7a1ab4a 100644
--- a/plat/mediatek/mt6795/bl31.ld.S
+++ b/plat/mediatek/mt6795/bl31.ld.S
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <lib/xlat_tables/xlat_tables_defs.h>
#include <platform_def.h>
-#include <xlat_tables_defs.h>
OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
diff --git a/plat/mediatek/mt6795/bl31_plat_setup.c b/plat/mediatek/mt6795/bl31_plat_setup.c
index 8df7dada89..2051fe7630 100644
--- a/plat/mediatek/mt6795/bl31_plat_setup.c
+++ b/plat/mediatek/mt6795/bl31_plat_setup.c
@@ -3,25 +3,28 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
+
#include <assert.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <common_def.h>
-#include <console.h>
-#include <context_mgmt.h>
-#include <debug.h>
-#include <generic_delay_timer.h>
+#include <string.h>
+
+#include <arch_helpers.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/el3_runtime/context_mgmt.h>
+#include <lib/mmio.h>
+#include <lib/utils_def.h>
+#include <lib/xlat_tables/xlat_tables.h>
+#include <plat/common/common_def.h>
+#include <plat/common/platform.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <mt_cpuxgpt.h>
#include <mtk_plat_common.h>
#include <mtk_sip_svc.h>
#include <plat_private.h>
-#include <platform.h>
-#include <string.h>
-#include <utils_def.h>
-#include <xlat_tables.h>
/*******************************************************************************
* Declarations of linker defined symbols which will help us find the layout
diff --git a/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c b/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c
index b357972e41..3696f8eec7 100644
--- a/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c
+++ b/plat/mediatek/mt6795/drivers/timer/mt_cpuxgpt.c
@@ -4,13 +4,15 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
+#include <stdint.h>
#include <arch_helpers.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <mt_cpuxgpt.h>
-#include <platform.h>
-#include <stdint.h>
+
#define CPUXGPT_BASE 0x10200000
#define INDEX_BASE (CPUXGPT_BASE+0x0674)
#define CTL_BASE (CPUXGPT_BASE+0x0670)
diff --git a/plat/mediatek/mt6795/include/mcucfg.h b/plat/mediatek/mt6795/include/mcucfg.h
index 7f6a786555..21c539462e 100644
--- a/plat/mediatek/mt6795/include/mcucfg.h
+++ b/plat/mediatek/mt6795/include/mcucfg.h
@@ -7,9 +7,10 @@
#ifndef MCUCFG_H
#define MCUCFG_H
-#include <platform_def.h>
#include <stdint.h>
+#include <platform_def.h>
+
struct mt6795_mcucfg_regs {
uint32_t mp0_ca7l_cache_config;
struct {
diff --git a/plat/mediatek/mt6795/include/plat_macros.S b/plat/mediatek/mt6795/include/plat_macros.S
index 7485647f3f..d198fdc11f 100644
--- a/plat/mediatek/mt6795/include/plat_macros.S
+++ b/plat/mediatek/mt6795/include/plat_macros.S
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <cci.h>
+#include <drivers/arm/cci.h>
#include <platform_def.h>
.section .rodata.gic_reg_name, "aS"
diff --git a/plat/mediatek/mt6795/include/plat_private.h b/plat/mediatek/mt6795/include/plat_private.h
index 10baa23d98..f7450ca1ce 100644
--- a/plat/mediatek/mt6795/include/plat_private.h
+++ b/plat/mediatek/mt6795/include/plat_private.h
@@ -8,7 +8,8 @@
#define PLAT_PRIVATE_H
#include <stdint.h>
-#include <xlat_tables.h>
+
+#include <lib/xlat_tables/xlat_tables.h>
void plat_configure_mmu_el3(unsigned long total_base,
unsigned long total_size,
diff --git a/plat/mediatek/mt6795/include/platform_def.h b/plat/mediatek/mt6795/include/platform_def.h
index 0110e192dc..301610d4cf 100644
--- a/plat/mediatek/mt6795/include/platform_def.h
+++ b/plat/mediatek/mt6795/include/platform_def.h
@@ -7,7 +7,7 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <utils_def.h>
+#include <lib/utils_def.h>
#define PLAT_PRIMARY_CPU 0x0
diff --git a/plat/mediatek/mt6795/plat_delay_timer.c b/plat/mediatek/mt6795/plat_delay_timer.c
index 9df286771f..965b653488 100644
--- a/plat/mediatek/mt6795/plat_delay_timer.c
+++ b/plat/mediatek/mt6795/plat_delay_timer.c
@@ -4,10 +4,11 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
-#include <delay_timer.h>
#include <platform_def.h>
+#include <arch_helpers.h>
+#include <drivers/delay_timer.h>
+
static uint32_t plat_get_timer_value(void)
{
/*
diff --git a/plat/mediatek/mt6795/plat_mt_gic.c b/plat/mediatek/mt6795/plat_mt_gic.c
index 11282fc546..20cb26d5ee 100644
--- a/plat/mediatek/mt6795/plat_mt_gic.c
+++ b/plat/mediatek/mt6795/plat_mt_gic.c
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <gicv2.h>
-#include <interrupt_props.h>
-#include <platform.h>
#include <platform_def.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gicv2.h>
+#include <plat/common/platform.h>
+
static const interrupt_prop_t g0_interrupt_props[] = {
INTR_PROP_DESC(FIQ_SMP_CALL_SGI, GIC_HIGHEST_SEC_PRIORITY,
GICV2_INTR_GROUP0, GIC_INTR_CFG_LEVEL),
diff --git a/plat/mediatek/mt6795/plat_pm.c b/plat/mediatek/mt6795/plat_pm.c
index d0506645f4..0dfbd1846a 100644
--- a/plat/mediatek/mt6795/plat_pm.c
+++ b/plat/mediatek/mt6795/plat_pm.c
@@ -4,19 +4,22 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <cci.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
+
+#include <platform_def.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/console.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <plat_private.h>
-#include <platform_def.h>
#include <power_tracer.h>
-#include <psci.h>
#include <scu.h>
struct core_context {
diff --git a/plat/mediatek/mt6795/plat_topology.c b/plat/mediatek/mt6795/plat_topology.c
index 0a0cf8d78b..7425d2667e 100644
--- a/plat/mediatek/mt6795/plat_topology.c
+++ b/plat/mediatek/mt6795/plat_topology.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
#include <platform_def.h>
-#include <psci.h>
+
+#include <arch.h>
+#include <lib/psci/psci.h>
unsigned int plat_get_aff_count(unsigned int aff_lvl, unsigned long mpidr)
{
diff --git a/plat/mediatek/mt6795/power_tracer.c b/plat/mediatek/mt6795/power_tracer.c
index 56e22402f9..64d086d800 100644
--- a/plat/mediatek/mt6795/power_tracer.c
+++ b/plat/mediatek/mt6795/power_tracer.c
@@ -5,7 +5,8 @@
*/
#include <arch.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <power_tracer.h>
#define trace_log(...) INFO("psci: " __VA_ARGS__)
diff --git a/plat/mediatek/mt6795/scu.c b/plat/mediatek/mt6795/scu.c
index 9add19e5af..3b7452787d 100644
--- a/plat/mediatek/mt6795/scu.c
+++ b/plat/mediatek/mt6795/scu.c
@@ -5,8 +5,9 @@
*/
#include <arch.h>
+#include <lib/mmio.h>
+
#include <mcucfg.h>
-#include <mmio.h>
void disable_scu(unsigned long mpidr)
{
diff --git a/plat/mediatek/mt8173/aarch64/platform_common.c b/plat/mediatek/mt8173/aarch64/platform_common.c
index a7619926a1..a2dbe3e479 100644
--- a/plat/mediatek/mt8173/aarch64/platform_common.c
+++ b/plat/mediatek/mt8173/aarch64/platform_common.c
@@ -3,14 +3,17 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <platform_def.h>
+
#include <arch_helpers.h>
-#include <bl_common.h>
-#include <cci.h>
-#include <debug.h>
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <lib/utils.h>
+#include <lib/xlat_tables/xlat_tables.h>
+
#include <mt8173_def.h>
-#include <platform_def.h>
-#include <utils.h>
-#include <xlat_tables.h>
static const int cci_map[] = {
PLAT_MT_CCI_CLUSTER0_SL_IFACE_IX,
diff --git a/plat/mediatek/mt8173/bl31_plat_setup.c b/plat/mediatek/mt8173/bl31_plat_setup.c
index c27de8295d..bd384a1d41 100644
--- a/plat/mediatek/mt8173/bl31_plat_setup.c
+++ b/plat/mediatek/mt8173/bl31_plat_setup.c
@@ -3,19 +3,22 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <bl_common.h>
-#include <common_def.h>
-#include <console.h>
-#include <debug.h>
-#include <generic_delay_timer.h>
+
+#include <common/bl_common.h>
+#include <common/debug.h>
+#include <drivers/console.h>
+#include <drivers/generic_delay_timer.h>
+#include <lib/mmio.h>
+#include <plat/common/common_def.h>
+#include <plat/common/platform.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <mtcmos.h>
#include <mtk_plat_common.h>
#include <plat_arm.h>
#include <plat_private.h>
-#include <platform.h>
#include <spm.h>
static entry_point_info_t bl32_ep_info;
diff --git a/plat/mediatek/mt8173/drivers/crypt/crypt.c b/plat/mediatek/mt8173/drivers/crypt/crypt.c
index 74d7702ad3..bfb3082ba0 100644
--- a/plat/mediatek/mt8173/drivers/crypt/crypt.c
+++ b/plat/mediatek/mt8173/drivers/crypt/crypt.c
@@ -3,12 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <assert.h>
+
#include <arch.h>
#include <arch_helpers.h>
-#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <mtk_sip_svc.h>
diff --git a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
index 25f25097ed..452ac224c6 100644
--- a/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
+++ b/plat/mediatek/mt8173/drivers/mtcmos/mtcmos.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <mtcmos.h>
#include <spm.h>
diff --git a/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c b/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c
index c64fdf7c21..8120d99626 100644
--- a/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c
+++ b/plat/mediatek/mt8173/drivers/pmic/pmic_wrap_init.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <pmic_wrap_init.h>
diff --git a/plat/mediatek/mt8173/drivers/rtc/rtc.c b/plat/mediatek/mt8173/drivers/rtc/rtc.c
index 22fed9e640..2b9033ed91 100644
--- a/plat/mediatek/mt8173/drivers/rtc/rtc.c
+++ b/plat/mediatek/mt8173/drivers/rtc/rtc.c
@@ -3,9 +3,12 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <assert.h>
-#include <debug.h>
-#include <delay_timer.h>
+
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+
#include <mt8173_def.h>
#include <pmic_wrap_init.h>
#include <rtc.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm.c b/plat/mediatek/mt8173/drivers/spm/spm.c
index eb40072b9b..1caab3bdf1 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bakery_lock.h>
-#include <debug.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <spm.h>
#include <spm_suspend.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c b/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c
index 6d275d0438..b2b9adafe3 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm_hotplug.c
@@ -3,10 +3,12 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <arch.h>
-#include <mmio.h>
+#include <lib/mmio.h>
#include <mt8173_def.h>
-#include <platform.h>
+#include <plat/common/platform.h>
+
#include <spm.h>
#include <spm_hotplug.h>
#include <spm_mcdi.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
index de8d73a517..ea5f2bb14b 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm_mcdi.c
@@ -3,12 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <platform_def.h>
+
#include <arch.h>
-#include <debug.h>
-#include <mmio.h>
+#include <common/debug.h>
+#include <lib/mmio.h>
+#include <plat/common/platform.h>
+
#include <mt8173_def.h>
-#include <platform.h>
-#include <platform_def.h>
#include <spm.h>
#include <spm_hotplug.h>
#include <spm_mcdi.h>
diff --git a/plat/mediatek/mt8173/drivers/spm/spm_suspend.c b/plat/mediatek/mt8173/drivers/spm/spm_suspend.c
index 8c79b3b4e7..5021695db1 100644
--- a/plat/mediatek/mt8173/drivers/spm/spm_suspend.c
+++ b/plat/mediatek/mt8173/drivers/spm/spm_suspend.c
@@ -3,10 +3,12 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bakery_lock.h>
-#include <debug.h>
-#include <delay_timer.h>
-#include <mmio.h>
+
+#include <common/debug.h>
+#include <drivers/delay_timer.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+
#include <mt8173_def.h>
#include <spm.h>
#include <spm_suspend.h>
diff --git a/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c b/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c
index 8a30d8aefa..174a24d88f 100644
--- a/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c
+++ b/plat/mediatek/mt8173/drivers/timer/mt_cpuxgpt.c
@@ -3,9 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
#include <arch_helpers.h>
+#include <lib/mmio.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <mt8173_def.h>
#include <mt_cpuxgpt.h>
diff --git a/plat/mediatek/mt8173/include/mcucfg.h b/plat/mediatek/mt8173/include/mcucfg.h
index 49d7c3e180..dedbc082fd 100644
--- a/plat/mediatek/mt8173/include/mcucfg.h
+++ b/plat/mediatek/mt8173/include/mcucfg.h
@@ -6,9 +6,10 @@
#ifndef MCUCFG_H
#define MCUCFG_H
-#include <mt8173_def.h>
#include <stdint.h>
+#include <mt8173_def.h>
+
struct mt8173_mcucfg_regs {
uint32_t mp0_ca7l_cache_config;
struct {
diff --git a/plat/mediatek/mt8173/include/plat_macros.S b/plat/mediatek/mt8173/include/plat_macros.S
index 5eb4913f1f..ac9fb160d4 100644
--- a/plat/mediatek/mt8173/include/plat_macros.S
+++ b/plat/mediatek/mt8173/include/plat_macros.S
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <cci.h>
-#include <gic_common.h>
-#include <gicv2.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gic_common.h>
+#include <drivers/arm/gicv2.h>
#include <mt8173_def.h>
.section .rodata.gic_reg_name, "aS"
diff --git a/plat/mediatek/mt8173/include/platform_def.h b/plat/mediatek/mt8173/include/platform_def.h
index 9bbed3c3b9..205e263870 100644
--- a/plat/mediatek/mt8173/include/platform_def.h
+++ b/plat/mediatek/mt8173/include/platform_def.h
@@ -7,9 +7,10 @@
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
-#include <gic_common.h>
-#include <interrupt_props.h>
-#include <utils_def.h>
+#include <common/interrupt_props.h>
+#include <drivers/arm/gic_common.h>
+#include <lib/utils_def.h>
+
#include "mt8173_def.h"
/*******************************************************************************
diff --git a/plat/mediatek/mt8173/plat_mt_gic.c b/plat/mediatek/mt8173/plat_mt_gic.c
index 16e36afbf7..80b9010c1a 100644
--- a/plat/mediatek/mt8173/plat_mt_gic.c
+++ b/plat/mediatek/mt8173/plat_mt_gic.c
@@ -4,9 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <bl_common.h>
+#include <common/bl_common.h>
+#include <lib/utils.h>
+
#include <mt8173_def.h>
-#include <utils.h>
const unsigned int mt_irq_sec_array[] = {
MT_IRQ_SEC_SGI_0,
diff --git a/plat/mediatek/mt8173/plat_pm.c b/plat/mediatek/mt8173/plat_pm.c
index b19d3f307c..9673d2c289 100644
--- a/plat/mediatek/mt8173/plat_pm.c
+++ b/plat/mediatek/mt8173/plat_pm.c
@@ -4,22 +4,24 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch_helpers.h>
#include <assert.h>
-#include <bakery_lock.h>
-#include <cci.h>
-#include <console.h>
-#include <debug.h>
#include <errno.h>
-#include <gicv2.h>
+
+#include <arch_helpers.h>
+#include <common/debug.h>
+#include <drivers/arm/cci.h>
+#include <drivers/arm/gicv2.h>
+#include <drivers/console.h>
+#include <lib/bakery_lock.h>
+#include <lib/mmio.h>
+#include <lib/psci/psci.h>
+
#include <mcucfg.h>
-#include <mmio.h>
#include <mt8173_def.h>
#include <mt_cpuxgpt.h> /* generic_timer_backup() */
#include <plat_arm.h>
#include <plat_private.h>
#include <power_tracer.h>
-#include <psci.h>
#include <rtc.h>
#include <scu.h>
#include <spm_hotplug.h>
diff --git a/plat/mediatek/mt8173/plat_sip_calls.c b/plat/mediatek/mt8173/plat_sip_calls.c
index 1d51cb592f..102feb22a6 100644
--- a/plat/mediatek/mt8173/plat_sip_calls.c
+++ b/plat/mediatek/mt8173/plat_sip_calls.c
@@ -3,13 +3,15 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
+
+#include <common/debug.h>
+#include <common/runtime_svc.h>
+#include <lib/mmio.h>
+
#include <crypt.h>
-#include <debug.h>
-#include <mmio.h>
#include <mtcmos.h>
#include <mtk_sip_svc.h>
#include <plat_sip_calls.h>
-#include <runtime_svc.h>
/* Authorized secure register list */
enum {
diff --git a/plat/mediatek/mt8173/plat_topology.c b/plat/mediatek/mt8173/plat_topology.c
index d70fea5229..23e7d2d3b6 100644
--- a/plat/mediatek/mt8173/plat_topology.c
+++ b/plat/mediatek/mt8173/plat_topology.c
@@ -3,10 +3,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <arch.h>
+
#include <platform_def.h>
-#include <psci.h>
+#include <arch.h>
+#include <lib/psci/psci.h>
const unsigned char mtk_power_domain_tree_desc[] = {
/* No of root nodes */
diff --git a/plat/mediatek/mt8173/power_tracer.c b/plat/mediatek/mt8173/power_tracer.c
index 787dad13fa..d1fcf9f269 100644
--- a/plat/mediatek/mt8173/power_tracer.c
+++ b/plat/mediatek/mt8173/power_tracer.c
@@ -5,7 +5,8 @@
*/
#include <arch.h>
-#include <debug.h>
+#include <common/debug.h>
+
#include <power_tracer.h>
#define trace_log(...) INFO("psci: " __VA_ARGS__)
diff --git a/plat/mediatek/mt8173/scu.c b/plat/mediatek/mt8173/scu.c
index 4daa9e5ff9..2524d72e12 100644
--- a/plat/mediatek/mt8173/scu.c
+++ b/plat/mediatek/mt8173/scu.c
@@ -5,8 +5,9 @@
*/
#include <arch.h>
+#include <lib/mmio.h>
+
#include <mcucfg.h>
-#include <mmio.h>
void disable_scu(unsigned long mpidr)
{