mediatek: mt8195: add sys_cirq support

MT8192 cirq driver can be shared with MT8195. Move cirq driver to common
common folder.

Change-Id: Iba5cdcfd2116f0bd07e0497250f2da45613e3a4f
diff --git a/plat/mediatek/mt8192/plat_mt_cirq.c b/plat/mediatek/common/mtk_cirq.c
similarity index 99%
rename from plat/mediatek/mt8192/plat_mt_cirq.c
rename to plat/mediatek/common/mtk_cirq.c
index 9002b7e..de37986 100644
--- a/plat/mediatek/mt8192/plat_mt_cirq.c
+++ b/plat/mediatek/common/mtk_cirq.c
@@ -10,8 +10,7 @@
 #include <lib/mmio.h>
 
 #include <mt_gic_v3.h>
-#include <plat_mt_cirq.h>
-#include <platform_def.h>
+#include <mtk_cirq.h>
 
 static struct cirq_events cirq_all_events = {
 	.spi_start = CIRQ_SPI_START,
diff --git a/plat/mediatek/mt8192/include/plat_mt_cirq.h b/plat/mediatek/common/mtk_cirq.h
similarity index 93%
rename from plat/mediatek/mt8192/include/plat_mt_cirq.h
rename to plat/mediatek/common/mtk_cirq.h
index bb8b457..6e63bb8 100644
--- a/plat/mediatek/mt8192/include/plat_mt_cirq.h
+++ b/plat/mediatek/common/mtk_cirq.h
@@ -8,6 +8,7 @@
 #define PLAT_MT_CIRQ_H
 
 #include <stdint.h>
+#include <platform_def.h>
 
 enum {
 	IRQ_MASK_HEADER = 0xF1F1F1F1,
@@ -35,13 +36,6 @@
 /*
  * Define hardware register
  */
-
-#define  SYS_CIRQ_BASE         U(0x10204000)
-#define  CIRQ_REG_NUM          U(14)
-#define  CIRQ_IRQ_NUM          U(439)
-#define  CIRQ_SPI_START        U(64)
-#define  MD_WDT_IRQ_BIT_ID     U(110)
-
 #define  CIRQ_STA_BASE         (SYS_CIRQ_BASE + U(0x000))
 #define  CIRQ_ACK_BASE         (SYS_CIRQ_BASE + U(0x080))
 #define  CIRQ_MASK_BASE        (SYS_CIRQ_BASE + U(0x100))
diff --git a/plat/mediatek/mt8192/drivers/mcdi/mt_lp_irqremain.c b/plat/mediatek/mt8192/drivers/mcdi/mt_lp_irqremain.c
index 809518f..e74d3e7 100644
--- a/plat/mediatek/mt8192/drivers/mcdi/mt_lp_irqremain.c
+++ b/plat/mediatek/mt8192/drivers/mcdi/mt_lp_irqremain.c
@@ -6,8 +6,8 @@
 
 #include <mt_lp_rm.h>
 #include <mt_lp_irqremain.h>
+#include <mtk_cirq.h>
 #include <plat_mtk_lpm.h>
-#include <plat_mt_cirq.h>
 
 #define EDMA0_IRQ_ID		U(448)
 #define MDLA_IRQ_ID		U(446)
diff --git a/plat/mediatek/mt8192/drivers/spm/constraints/mt_spm_rc_bus26m.c b/plat/mediatek/mt8192/drivers/spm/constraints/mt_spm_rc_bus26m.c
index 92fd25f..f66b8ec 100644
--- a/plat/mediatek/mt8192/drivers/spm/constraints/mt_spm_rc_bus26m.c
+++ b/plat/mediatek/mt8192/drivers/spm/constraints/mt_spm_rc_bus26m.c
@@ -24,7 +24,7 @@
 
 #ifndef ATF_PLAT_CIRQ_UNSUPPORT
 #include <mt_gic_v3.h>
-#include <plat_mt_cirq.h>
+#include <mtk_cirq.h>
 #endif
 
 #define CONSTRAINT_BUS26M_ALLOW			\
diff --git a/plat/mediatek/mt8192/include/platform_def.h b/plat/mediatek/mt8192/include/platform_def.h
index 2468dd6..76a9c24 100644
--- a/plat/mediatek/mt8192/include/platform_def.h
+++ b/plat/mediatek/mt8192/include/platform_def.h
@@ -68,6 +68,12 @@
 #define BASE_GICD_BASE        MT_GIC_BASE
 #define MT_GIC_RDIST_BASE     (MT_GIC_BASE + 0x40000)
 
+#define SYS_CIRQ_BASE         (IO_PHYS + 0x204000)
+#define CIRQ_REG_NUM          14
+#define CIRQ_IRQ_NUM          439
+#define CIRQ_SPI_START        64
+#define MD_WDT_IRQ_BIT_ID     110
+
 /*******************************************************************************
  * Platform binary types for linking
  ******************************************************************************/
diff --git a/plat/mediatek/mt8192/platform.mk b/plat/mediatek/mt8192/platform.mk
index 109dac0..e1657a7 100644
--- a/plat/mediatek/mt8192/platform.mk
+++ b/plat/mediatek/mt8192/platform.mk
@@ -46,6 +46,7 @@
                    ${MTK_PLAT}/common/drivers/rtc/rtc_common.c           \
                    ${MTK_PLAT}/common/drivers/uart/uart.c                \
                    ${MTK_PLAT}/common/lpm/mt_lp_rm.c                     \
+                   ${MTK_PLAT}/common/mtk_cirq.c                         \
                    ${MTK_PLAT}/common/mtk_plat_common.c                  \
                    ${MTK_PLAT}/common/mtk_sip_svc.c                      \
                    ${MTK_PLAT}/common/params_setup.c                     \
@@ -56,7 +57,6 @@
                    ${MTK_PLAT_SOC}/drivers/rtc/rtc.c                     \
                    ${MTK_PLAT_SOC}/plat_pm.c                             \
                    ${MTK_PLAT_SOC}/plat_topology.c                       \
-                   ${MTK_PLAT_SOC}/plat_mt_cirq.c                        \
                    ${MTK_PLAT_SOC}/plat_sip_calls.c                      \
                    ${MTK_PLAT_SOC}/drivers/dcm/mtk_dcm.c                 \
                    ${MTK_PLAT_SOC}/drivers/dcm/mtk_dcm_utils.c           \
diff --git a/plat/mediatek/mt8195/include/platform_def.h b/plat/mediatek/mt8195/include/platform_def.h
index 59f0284..dd1e99d 100644
--- a/plat/mediatek/mt8195/include/platform_def.h
+++ b/plat/mediatek/mt8195/include/platform_def.h
@@ -43,6 +43,11 @@
 #define BASE_GICD_BASE			MT_GIC_BASE
 #define MT_GIC_RDIST_BASE		(MT_GIC_BASE + 0x40000)
 
+#define SYS_CIRQ_BASE			(IO_PHYS + 0x204000)
+#define CIRQ_REG_NUM			23
+#define CIRQ_IRQ_NUM			730
+#define CIRQ_SPI_START			96
+#define MD_WDT_IRQ_BIT_ID		141
 /*******************************************************************************
  * Platform binary types for linking
  ******************************************************************************/
diff --git a/plat/mediatek/mt8195/platform.mk b/plat/mediatek/mt8195/platform.mk
index 08dcfa2..f7cd29e 100644
--- a/plat/mediatek/mt8195/platform.mk
+++ b/plat/mediatek/mt8195/platform.mk
@@ -28,6 +28,7 @@
                 lib/cpus/aarch64/cortex_a78.S                         \
                 plat/common/plat_gicv3.c                              \
                 ${MTK_PLAT}/common/drivers/gic600/mt_gic_v3.c         \
+                ${MTK_PLAT}/common/mtk_cirq.c                         \
                 ${MTK_PLAT}/common/mtk_plat_common.c                  \
                 ${MTK_PLAT}/common/params_setup.c                     \
                 ${MTK_PLAT_SOC}/aarch64/platform_common.c             \