From e1a36c2601f782d8ef32698f1703382ad9632677 Mon Sep 17 00:00:00 2001
From: Anna Lyons <Anna.Lyons@data61.csiro.au>
Date: Tue, 9 Apr 2019 08:11:57 +1000
Subject: [PATCH] exynos: use declare_default_headers

- remove unused header files replaced by declare_default_headers
- move timer.h to drivers/timer/exynos5422-mct.h
- move mct.h to drivers/timer/mct.h
---
 .../timer/exynos4412-mct.h}                   | 10 ++++-----
 .../plat/machine => drivers/timer}/mct.h      |  6 ++---
 include/plat/exynos4/plat/machine.h           | 20 -----------------
 include/plat/exynos4/plat/machine/hardware.h  | 19 ----------------
 include/plat/exynos5/plat/machine.h           | 22 -------------------
 include/plat/exynos5/plat/machine/hardware.h  | 21 ------------------
 include/plat/exynos5/plat/machine/timer.h     | 20 -----------------
 src/drivers/timer/exynos4210-mct.c            |  2 +-
 src/drivers/timer/exynos4412-mct.c            |  2 +-
 src/plat/exynos4/config.cmake                 |  6 +++++
 src/plat/exynos5/config.cmake                 |  6 +++++
 11 files changed, 21 insertions(+), 113 deletions(-)
 rename include/{plat/exynos4/plat/machine/timer.h => drivers/timer/exynos4412-mct.h} (71%)
 rename include/{plat/exynos_common/plat/machine => drivers/timer}/mct.h (97%)
 delete mode 100644 include/plat/exynos4/plat/machine.h
 delete mode 100644 include/plat/exynos4/plat/machine/hardware.h
 delete mode 100644 include/plat/exynos5/plat/machine.h
 delete mode 100644 include/plat/exynos5/plat/machine/hardware.h
 delete mode 100644 include/plat/exynos5/plat/machine/timer.h

diff --git a/include/plat/exynos4/plat/machine/timer.h b/include/drivers/timer/exynos4412-mct.h
similarity index 71%
rename from include/plat/exynos4/plat/machine/timer.h
rename to include/drivers/timer/exynos4412-mct.h
index d9ff73e6c..fb325ca6c 100644
--- a/include/plat/exynos4/plat/machine/timer.h
+++ b/include/drivers/timer/exynos4412-mct.h
@@ -10,16 +10,14 @@
  * @TAG(DATA61_GPL)
  */
 
-#ifndef __PLAT_MACHINE_TIMER_H
-#define __PLAT_MACHINE_TIMER_H
+#ifndef __DRIVER_TIMER_MCT_EXYNOS4412_H
+#define __DRIVER_TIMER_MCT_EXYNOS4412_H
 
-#include <plat/machine/mct.h>
-
-#define TIMER_CLOCK_HZ 24000000llu
+#include <drivers/timer/mct.h>
 
 static inline void resetTimer(void)
 {
     mct_reset();
 }
 
-#endif /* !__PLAT_MACHINE_TIMER_H */
+#endif /* !__DRIVER_TIMER_MCT_EXYNOS4412_H */
diff --git a/include/plat/exynos_common/plat/machine/mct.h b/include/drivers/timer/mct.h
similarity index 97%
rename from include/plat/exynos_common/plat/machine/mct.h
rename to include/drivers/timer/mct.h
index d1ac48377..c6398a77b 100644
--- a/include/plat/exynos_common/plat/machine/mct.h
+++ b/include/drivers/timer/mct.h
@@ -7,8 +7,8 @@
  *
  * @TAG(GD_GPL)
  */
-#ifndef __PLAT_MACHINE_MCT_H
-#define __PLAT_MACHINE_MCT_H
+#ifndef __DRIVERS_TIMER_MCT_H
+#define __DRIVERS_TIMER_MCT_H
 
 #include <stdint.h>
 
@@ -128,4 +128,4 @@ static inline void mct_clear_write_status(void)
     mct->global.wstat = mct->global.wstat;
     mct->global.cnt_wstat = mct->global.cnt_wstat;
 }
-#endif /* __PLAT_MACHINE_MCT_H */
+#endif /* __DRIVERS_TIMER_MCT_H */
diff --git a/include/plat/exynos4/plat/machine.h b/include/plat/exynos4/plat/machine.h
deleted file mode 100644
index 0d3a823de..000000000
--- a/include/plat/exynos4/plat/machine.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014, General Dynamics C4 Systems
- *
- * This software may be distributed and modified according to the terms of
- * the GNU General Public License version 2. Note that NO WARRANTY is provided.
- * See "LICENSE_GPLv2.txt" for details.
- *
- * @TAG(GD_GPL)
- */
-
-#ifndef __PLAT_MACHINE_H
-#define __PLAT_MACHINE_H
-
-enum IRQConstants {
-    maxIRQ = 159
-} platform_interrupt_t;
-
-#include <arch/machine/gic_pl390.h>
-
-#endif /* !__PLAT_MACHINE_H */
diff --git a/include/plat/exynos4/plat/machine/hardware.h b/include/plat/exynos4/plat/machine/hardware.h
deleted file mode 100644
index 26e6abdfe..000000000
--- a/include/plat/exynos4/plat/machine/hardware.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2014, General Dynamics C4 Systems
- *
- * This software may be distributed and modified according to the terms of
- * the GNU General Public License version 2. Note that NO WARRANTY is provided.
- * See "LICENSE_GPLv2.txt" for details.
- *
- * @TAG(GD_GPL)
- */
-
-#ifndef __PLAT_MACHINE_HARDWARE_H
-#define __PLAT_MACHINE_HARDWARE_H
-
-#include <basic_types.h>
-#include <linker.h>
-#include <plat/machine.h>
-#include <plat/machine/devices_gen.h>
-
-#endif /* !__PLAT_MACHINE_HARDWARE_H */
diff --git a/include/plat/exynos5/plat/machine.h b/include/plat/exynos5/plat/machine.h
deleted file mode 100644
index d0418213f..000000000
--- a/include/plat/exynos5/plat/machine.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2014, General Dynamics C4 Systems
- *
- * This software may be distributed and modified according to the terms of
- * the GNU General Public License version 2. Note that NO WARRANTY is provided.
- * See "LICENSE_GPLv2.txt" for details.
- *
- * @TAG(GD_GPL)
- */
-
-#ifndef __PLAT_MACHINE_H
-#define __PLAT_MACHINE_H
-
-#include <config.h>
-
-enum IRQConstants {
-    maxIRQ = 232
-} platform_interrupt_t;
-
-#include <arch/machine/gic_pl390.h>
-
-#endif /* !__PLAT_MACHINE_H */
diff --git a/include/plat/exynos5/plat/machine/hardware.h b/include/plat/exynos5/plat/machine/hardware.h
deleted file mode 100644
index d7bfb62a4..000000000
--- a/include/plat/exynos5/plat/machine/hardware.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2014, General Dynamics C4 Systems
- *
- * This software may be distributed and modified according to the terms of
- * the GNU General Public License version 2. Note that NO WARRANTY is provided.
- * See "LICENSE_GPLv2.txt" for details.
- *
- * @TAG(GD_GPL)
- */
-
-#ifndef __PLAT_MACHINE_HARDWARE_H
-#define __PLAT_MACHINE_HARDWARE_H
-
-#include <config.h>
-#include <basic_types.h>
-#include <linker.h>
-#include <arch/object/vcpu.h>
-#include <plat/machine.h>
-#include <plat/machine/devices_gen.h>
-
-#endif /* !__PLAT_MACHINE_HARDWARE_H */
diff --git a/include/plat/exynos5/plat/machine/timer.h b/include/plat/exynos5/plat/machine/timer.h
deleted file mode 100644
index 5e0eb5b29..000000000
--- a/include/plat/exynos5/plat/machine/timer.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2017, Data61
- * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
- * ABN 41 687 119 230.
- *
- * This software may be distributed and modified according to the terms of
- * the GNU General Public License version 2. Note that NO WARRANTY is provided.
- * See "LICENSE_GPLv2.txt" for details.
- *
- * @TAG(DATA61_GPL)
- */
-
-#ifndef __PLAT_MACHINE_TIMER_H
-#define __PLAT_MACHINE_TIMER_H
-
-#define TIMER_CLOCK_HZ 24000000llu
-
-#include <arch/machine/generic_timer.h>
-
-#endif /* !__PLAT_MACHINE_TIMER_H */
diff --git a/src/drivers/timer/exynos4210-mct.c b/src/drivers/timer/exynos4210-mct.c
index a9001508f..20886be1c 100644
--- a/src/drivers/timer/exynos4210-mct.c
+++ b/src/drivers/timer/exynos4210-mct.c
@@ -19,7 +19,7 @@
 #include <plat/machine/devices_gen.h>
 #include <plat/machine/hardware.h>
 #include <arch/machine/generic_timer.h>
-#include <plat/machine/mct.h>
+#include <drivers/timer/mct.h>
 
 timer_t *mct = (timer_t *) EXYNOS_MCT_PPTR;
 
diff --git a/src/drivers/timer/exynos4412-mct.c b/src/drivers/timer/exynos4412-mct.c
index 7249fe12f..4ab3e7572 100644
--- a/src/drivers/timer/exynos4412-mct.c
+++ b/src/drivers/timer/exynos4412-mct.c
@@ -14,7 +14,7 @@
 #include <plat/machine.h>
 #include <linker.h>
 #include <plat/machine/timer.h>
-#include <plat/machine/mct.h>
+#include <drivers/timer/mct.h>
 
 timer_t *mct = (timer_t *) EXYNOS_MCT_PPTR;
 
diff --git a/src/plat/exynos4/config.cmake b/src/plat/exynos4/config.cmake
index f3f4d29fc..ac50c124b 100644
--- a/src/plat/exynos4/config.cmake
+++ b/src/plat/exynos4/config.cmake
@@ -18,6 +18,12 @@ if(KernelPlatformExynos4)
     config_set(KernelPlatform PLAT "exynos4")
     config_set(KernelArmMach MACH "exynos")
     list(APPEND KernelDTSList "tools/dts/exynos4.dts")
+    declare_default_headers(
+        TIMER_FREQUENCY 24000000llu
+        MAX_IRQ 159
+        TIMER drivers/timer/exynos4412-mct.h
+        INTERRUPT_CONTROLLER arch/machine/gic_pl390.h
+    )
 endif()
 
 add_sources(
diff --git a/src/plat/exynos5/config.cmake b/src/plat/exynos5/config.cmake
index d813ccbc8..d64af0f71 100644
--- a/src/plat/exynos5/config.cmake
+++ b/src/plat/exynos5/config.cmake
@@ -26,6 +26,12 @@ if(KernelPlatformExynos5250 OR KernelPlatformExynos5410 OR KernelPlatformExynos5
 
     list(APPEND KernelDTSList "tools/dts/${KernelARMPlatform}.dts")
     list(APPEND KernelDTSList "src/plat/exynos5/overlay-${KernelARMPlatform}.dts")
+    declare_default_headers(
+        TIMER_FREQUENCY 24000000llu
+        MAX_IRQ 232
+        TIMER arch/machine/generic_timer.h
+        INTERRUPT_CONTROLLER arch/machine/gic_pl390.h
+    )
 else()
     config_set(KernelPlatExynos5 PLAT_EXYNOS5 OFF)
     config_set(KernelPlatExynos54xx PLAT_EXYNOS54XX OFF)
-- 
GitLab