soc/mediatek/mt8186: Add timer support

Add timer drivers to use timer function.

TEST=build pass
BUG=b:202871018

Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Change-Id: I6524e4dec4cbe7f7eb75a7940c329416559a03c8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58937
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
diff --git a/src/soc/mediatek/mt8186/Makefile.inc b/src/soc/mediatek/mt8186/Makefile.inc
index cba4ccf..427b3a18 100644
--- a/src/soc/mediatek/mt8186/Makefile.inc
+++ b/src/soc/mediatek/mt8186/Makefile.inc
@@ -6,14 +6,14 @@
 bootblock-y += ../common/mmu_operations.c
 bootblock-y += ../common/pll.c pll.c
 bootblock-$(CONFIG_SPI_FLASH) += spi.c
-bootblock-y += ../common/timer.c
+bootblock-y += ../common/timer.c timer.c
 bootblock-y += ../common/uart.c
 bootblock-y += ../common/wdt.c wdt.c
 
 verstage-y += ../common/flash_controller.c
 verstage-y += ../common/gpio.c gpio.c
 verstage-$(CONFIG_SPI_FLASH) += spi.c
-verstage-y += ../common/timer.c
+verstage-y += ../common/timer.c timer.c
 verstage-y += ../common/uart.c
 verstage-y += ../common/wdt.c wdt.c
 
@@ -22,7 +22,7 @@
 romstage-y += ../common/flash_controller.c
 romstage-y += ../common/gpio.c gpio.c
 romstage-$(CONFIG_SPI_FLASH) += spi.c
-romstage-y += ../common/timer.c
+romstage-y += ../common/timer.c timer.c
 romstage-y += ../common/uart.c
 romstage-y += ../common/wdt.c wdt.c
 
@@ -31,7 +31,7 @@
 ramstage-y += ../common/gpio.c gpio.c
 ramstage-$(CONFIG_SPI_FLASH) += spi.c
 ramstage-y += soc.c
-ramstage-y += ../common/timer.c
+ramstage-y += ../common/timer.c timer.c
 ramstage-y += ../common/uart.c
 ramstage-y += ../common/wdt.c wdt.c
 
diff --git a/src/soc/mediatek/mt8186/timer.c b/src/soc/mediatek/mt8186/timer.c
new file mode 100644
index 0000000..7a289cd
--- /dev/null
+++ b/src/soc/mediatek/mt8186/timer.c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * This file is created based on MT8186 Functional Specification
+ * Chapter number: 5.13
+ */
+
+#include <device/mmio.h>
+#include <soc/addressmap.h>
+#include <soc/timer.h>
+
+void timer_prepare(void)
+{
+	clrbits32((void *)SYSTIMER_BASE, COMP_FEATURE_MASK);
+	setbits32((void *)SYSTIMER_BASE, COMP_25_MASK);
+}