summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRex-BC Chen <rex-bc.chen@mediatek.corp-partner.google.com>2021-09-27 14:12:00 +0800
committerPatrick Georgi <pgeorgi@google.com>2021-11-05 13:03:28 +0000
commita74f443d5159dc8c0f3abccabf95cd59a113703a (patch)
treeabc690080bde3b756530608fb16b5a4258bc3557
parent76e0b9d710092f1ad73115643b8bb0dd29f46e59 (diff)
downloadcoreboot-a74f443d5159dc8c0f3abccabf95cd59a113703a.tar.gz
coreboot-a74f443d5159dc8c0f3abccabf95cd59a113703a.tar.bz2
coreboot-a74f443d5159dc8c0f3abccabf95cd59a113703a.zip
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>
-rw-r--r--src/soc/mediatek/mt8186/Makefile.inc8
-rw-r--r--src/soc/mediatek/mt8186/timer.c16
2 files changed, 20 insertions, 4 deletions
diff --git a/src/soc/mediatek/mt8186/Makefile.inc b/src/soc/mediatek/mt8186/Makefile.inc
index cba4ccfe4020..427b3a18a795 100644
--- a/src/soc/mediatek/mt8186/Makefile.inc
+++ b/src/soc/mediatek/mt8186/Makefile.inc
@@ -6,14 +6,14 @@ bootblock-y += ../common/gpio.c gpio.c
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 += emi.c
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/flash_controller.c
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 000000000000..7a289cd115b5
--- /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);
+}