[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201017153857.2494845-2-fparent@baylibre.com>
Date: Sat, 17 Oct 2020 17:38:57 +0200
From: Fabien Parent <fparent@...libre.com>
To: linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: matthias.bgg@...il.com, robh+dt@...nel.org, tglx@...utronix.de,
daniel.lezcano@...aro.org, Fabien Parent <fparent@...libre.com>
Subject: [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support
Some MediaTek SoC like MT8516 need to enable additional clocks
for the GPT timer. Enable them if present.
Signed-off-by: Fabien Parent <fparent@...libre.com>
---
drivers/clocksource/timer-mediatek.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index 9318edcd8963..42e2d2090484 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/clocksource.h>
#include <linux/interrupt.h>
@@ -278,8 +279,19 @@ static int __init mtk_syst_init(struct device_node *node)
static int __init mtk_gpt_init(struct device_node *node)
{
+ struct clk *clk_13m, *clk_bus;
int ret;
+ /* Optional clock*/
+ clk_13m = of_clk_get_by_name(node, "clk13m");
+ if (!IS_ERR(clk_13m))
+ clk_prepare_enable(clk_13m);
+
+ /* Optional clock*/
+ clk_bus = of_clk_get_by_name(node, "bus");
+ if (!IS_ERR(clk_bus))
+ clk_prepare_enable(clk_bus);
+
to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown;
to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic;
--
2.28.0
Powered by blists - more mailing lists