* [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock
@ 2020-10-17 15:38 Fabien Parent
2020-10-17 15:38 ` [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support Fabien Parent
2020-10-26 13:30 ` [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock Rob Herring
0 siblings, 2 replies; 5+ messages in thread
From: Fabien Parent @ 2020-10-17 15:38 UTC (permalink / raw)
To: linux-mediatek, linux-arm-kernel, devicetree, linux-kernel
Cc: matthias.bgg, Fabien Parent, tglx, robh+dt, daniel.lezcano
The timer IP on MT8516 requires two clocks to be enabled. Add both
clocks.
Signed-off-by: Fabien Parent <fparent@baylibre.com>
---
.../devicetree/bindings/timer/mediatek,mtk-timer.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt b/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
index 690a9c0966ac..3f9bfd246f19 100644
--- a/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
+++ b/Documentation/devicetree/bindings/timer/mediatek,mtk-timer.txt
@@ -29,6 +29,11 @@ Required properties:
- reg: Should contain location and length for timer register.
- clocks: Should contain system clock.
+Optional properties:
+- clock-names: May contain:
+ * "clk13m": 13MHz clock system clock
+ * "bus": Bus clock
+
Examples:
timer@10008000 {
--
2.28.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support
2020-10-17 15:38 [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock Fabien Parent
@ 2020-10-17 15:38 ` Fabien Parent
2020-10-26 13:30 ` Rob Herring
2020-10-26 13:30 ` [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock Rob Herring
1 sibling, 1 reply; 5+ messages in thread
From: Fabien Parent @ 2020-10-17 15:38 UTC (permalink / raw)
To: linux-mediatek, linux-arm-kernel, devicetree, linux-kernel
Cc: matthias.bgg, Fabien Parent, tglx, robh+dt, daniel.lezcano
Some MediaTek SoC like MT8516 need to enable additional clocks
for the GPT timer. Enable them if present.
Signed-off-by: Fabien Parent <fparent@baylibre.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
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support
2020-10-17 15:38 ` [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support Fabien Parent
@ 2020-10-26 13:30 ` Rob Herring
2020-10-26 18:08 ` Fabien Parent
0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2020-10-26 13:30 UTC (permalink / raw)
To: Fabien Parent
Cc: devicetree, daniel.lezcano, linux-kernel, linux-mediatek,
matthias.bgg, tglx, linux-arm-kernel
On Sat, Oct 17, 2020 at 05:38:57PM +0200, Fabien Parent wrote:
> Some MediaTek SoC like MT8516 need to enable additional clocks
> for the GPT timer. Enable them if present.
>
> Signed-off-by: Fabien Parent <fparent@baylibre.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*/
Then use the optional api variant.
> + clk_13m = of_clk_get_by_name(node, "clk13m");
> + if (!IS_ERR(clk_13m))
And then you can drop this check (or handle it for any error other than
clock is not present).
> + 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
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support
2020-10-26 13:30 ` Rob Herring
@ 2020-10-26 18:08 ` Fabien Parent
0 siblings, 0 replies; 5+ messages in thread
From: Fabien Parent @ 2020-10-26 18:08 UTC (permalink / raw)
To: Rob Herring
Cc: DTML, Daniel Lezcano, linux-kernel,
moderated list:ARM/Mediatek SoC support, Matthias Brugger, tglx,
Linux ARM
Hi Rob,
On Mon, Oct 26, 2020 at 2:30 PM Rob Herring <robh@kernel.org> wrote:
>
> On Sat, Oct 17, 2020 at 05:38:57PM +0200, Fabien Parent wrote:
> > Some MediaTek SoC like MT8516 need to enable additional clocks
> > for the GPT timer. Enable them if present.
> >
> > Signed-off-by: Fabien Parent <fparent@baylibre.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*/
>
> Then use the optional api variant.
I looked for optional API variant but could only find these:
* struct clk *devm_clk_get_optional(struct device *dev, const char *id);
* struct clk *devm_clk_get_optional(struct device *dev, const char *id);
These two require a "struct device" parameter but in the function
mtk_gpt_init, we only have a "struct device_node" I didn't see any way
to get a "struct device" from a "struct device_node".
>
> > + clk_13m = of_clk_get_by_name(node, "clk13m");
> > + if (!IS_ERR(clk_13m))
>
> And then you can drop this check (or handle it for any error other than
> clock is not present).
>
> > + 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
> >
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock
2020-10-17 15:38 [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock Fabien Parent
2020-10-17 15:38 ` [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support Fabien Parent
@ 2020-10-26 13:30 ` Rob Herring
1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2020-10-26 13:30 UTC (permalink / raw)
To: Fabien Parent
Cc: devicetree, daniel.lezcano, linux-kernel, robh+dt,
linux-mediatek, matthias.bgg, tglx, linux-arm-kernel
On Sat, 17 Oct 2020 17:38:56 +0200, Fabien Parent wrote:
> The timer IP on MT8516 requires two clocks to be enabled. Add both
> clocks.
>
> Signed-off-by: Fabien Parent <fparent@baylibre.com>
> ---
> .../devicetree/bindings/timer/mediatek,mtk-timer.txt | 5 +++++
> 1 file changed, 5 insertions(+)
>
Acked-by: Rob Herring <robh@kernel.org>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-26 18:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-17 15:38 [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock Fabien Parent
2020-10-17 15:38 ` [PATCH 2/2] clocksource: mediatek: add clk13m and bus clock support Fabien Parent
2020-10-26 13:30 ` Rob Herring
2020-10-26 18:08 ` Fabien Parent
2020-10-26 13:30 ` [PATCH 1/2] dt-bindings: timer: mtk-timer: add optional 13m and bus clock Rob Herring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).