From e0541ec87439443fa9a09381d23a6ed4095f85a8 Mon Sep 17 00:00:00 2001 From: Rex-BC Chen Date: Wed, 8 Jun 2022 14:22:36 +0800 Subject: soc/mediatek: Make timer_prepare() a common function timer_prepare() is the same for MT8195 and MT8186, so move it to common folder. TEST=build pass BUG=b:233720142 Signed-off-by: Bo-Chen Chen Change-Id: I91a6f4ecc665a058cb7a0ba96c15b27d6dc97d13 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65602 Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) --- src/soc/mediatek/common/timer_prepare.c | 11 +++++++++++ src/soc/mediatek/mt8186/Makefile.inc | 2 +- src/soc/mediatek/mt8186/timer.c | 16 ---------------- src/soc/mediatek/mt8195/Makefile.inc | 2 +- src/soc/mediatek/mt8195/timer.c | 11 ----------- 5 files changed, 13 insertions(+), 29 deletions(-) create mode 100644 src/soc/mediatek/common/timer_prepare.c delete mode 100644 src/soc/mediatek/mt8186/timer.c delete mode 100644 src/soc/mediatek/mt8195/timer.c diff --git a/src/soc/mediatek/common/timer_prepare.c b/src/soc/mediatek/common/timer_prepare.c new file mode 100644 index 0000000000..3fb4be7f2d --- /dev/null +++ b/src/soc/mediatek/common/timer_prepare.c @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include + +void timer_prepare(void) +{ + clrbits32((void *)SYSTIMER_BASE, COMP_FEATURE_MASK); + setbits32((void *)SYSTIMER_BASE, COMP_25_MASK); +} diff --git a/src/soc/mediatek/mt8186/Makefile.inc b/src/soc/mediatek/mt8186/Makefile.inc index 37213bbad3..fa353ae2dc 100644 --- a/src/soc/mediatek/mt8186/Makefile.inc +++ b/src/soc/mediatek/mt8186/Makefile.inc @@ -5,7 +5,7 @@ all-y += ../common/flash_controller.c all-y += ../common/gpio.c gpio.c all-y += ../common/i2c.c i2c.c all-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c -all-y += ../common/timer.c timer.c +all-y += ../common/timer.c ../common/timer_prepare.c all-y += ../common/uart.c bootblock-y += bootblock.c diff --git a/src/soc/mediatek/mt8186/timer.c b/src/soc/mediatek/mt8186/timer.c deleted file mode 100644 index 7a289cd115..0000000000 --- a/src/soc/mediatek/mt8186/timer.c +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -/* - * This file is created based on MT8186 Functional Specification - * Chapter number: 5.13 - */ - -#include -#include -#include - -void timer_prepare(void) -{ - clrbits32((void *)SYSTIMER_BASE, COMP_FEATURE_MASK); - setbits32((void *)SYSTIMER_BASE, COMP_25_MASK); -} diff --git a/src/soc/mediatek/mt8195/Makefile.inc b/src/soc/mediatek/mt8195/Makefile.inc index 8262763ef1..b0d259e3a1 100644 --- a/src/soc/mediatek/mt8195/Makefile.inc +++ b/src/soc/mediatek/mt8195/Makefile.inc @@ -5,7 +5,7 @@ all-y += ../common/flash_controller.c all-y += ../common/gpio.c gpio.c all-y += ../common/i2c.c i2c.c all-$(CONFIG_SPI_FLASH) += ../common/spi.c spi.c -all-y += ../common/timer.c timer.c +all-y += ../common/timer.c ../common/timer_prepare.c all-y += ../common/uart.c bootblock-y += bootblock.c diff --git a/src/soc/mediatek/mt8195/timer.c b/src/soc/mediatek/mt8195/timer.c deleted file mode 100644 index 3fb4be7f2d..0000000000 --- a/src/soc/mediatek/mt8195/timer.c +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include -#include -#include - -void timer_prepare(void) -{ - clrbits32((void *)SYSTIMER_BASE, COMP_FEATURE_MASK); - setbits32((void *)SYSTIMER_BASE, COMP_25_MASK); -} -- cgit v1.2.3