Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1430340 > unrolled thread

[PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags

Started byJongsung Kim <neidhard.kim@lge.com>
First post2016-06-24 06:20 +0200
Last post2016-06-29 07:10 +0200
Articles 7 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags Jongsung Kim <neidhard.kim@lge.com> - 2016-06-24 06:20 +0200
    Re: [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags Rob Herring <robh@kernel.org> - 2016-06-28 23:00 +0200
      Re: [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags Michael Turquette <mturquette@baylibre.com> - 2016-06-28 23:20 +0200
        Re: [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags Jongsung Kim <neidhard.kim@lge.com> - 2016-06-29 09:30 +0200
          Re: [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags Stephen Boyd <sboyd@codeaurora.org> - 2016-07-02 02:30 +0200
            Re: [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags Jongsung Kim <neidhard.kim@lge.com> - 2016-07-04 03:50 +0200
      Re: [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags Jongsung Kim <neidhard.kim@lge.com> - 2016-06-29 07:10 +0200

#1430340 — [PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags

FromJongsung Kim <neidhard.kim@lge.com>
Date2016-06-24 06:20 +0200
Subject[PATCH v2] clk: fixed-factor: add optional dt-binding clock-flags
Message-ID<rNqKZ-3iw-3@gated-at.bofh.it>
There is no way to set additional flags for a DT-initialized fixed-
factor-clock, and it can be problematic i.e., when the clock rate
needs to be changed. [1][2]

This patch introduces an optional dt-binding named "clock-flags" to
be used for passing any needed flags from dts.

[1] http://www.spinics.net/lists/linux-clk/msg09040.html
[2] https://lkml.org/lkml/2016/6/20/1025

Changes since v1:
 - fix possible build failure when using gcc-5 or gcc-6

Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Mike Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
---
 .../bindings/clock/fixed-factor-clock.txt          |  4 ++++
 drivers/clk/clk-fixed-factor.c                     |  4 +++-
 include/dt-bindings/clk/clk.h                      | 22 ++++++++++++++++++++++
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 include/dt-bindings/clk/clk.h

diff --git a/Documentation/devicetree/bindings/clock/fixed-factor-clock.txt b/Documentation/devicetree/bindings/clock/fixed-factor-clock.txt
index 1bae8527..3e1b79e 100644
--- a/Documentation/devicetree/bindings/clock/fixed-factor-clock.txt
+++ b/Documentation/devicetree/bindings/clock/fixed-factor-clock.txt
@@ -13,12 +13,16 @@ Required properties:
 
 Optional properties:
 - clock-output-names : From common clock binding.
+- clock-flags : Additional flags to be used.
 
 Example:
+	#include <dt-bindings/clk/clk.h>
+
 	clock {
 		compatible = "fixed-factor-clock";
 		clocks = <&parentclk>;
 		#clock-cells = <0>;
 		clock-div = <2>;
 		clock-mult = <1>;
+		clock-flags = <CLK_SET_RATE_PARENT>;
 	};
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
index 75cd6c7..e626cad 100644
--- a/drivers/clk/clk-fixed-factor.c
+++ b/drivers/clk/clk-fixed-factor.c
@@ -150,6 +150,7 @@ void __init of_fixed_factor_clk_setup(struct device_node *node)
 	struct clk *clk;
 	const char *clk_name = node->name;
 	const char *parent_name;
+	u32 flags = 0;
 	u32 div, mult;
 
 	if (of_property_read_u32(node, "clock-div", &div)) {
@@ -166,8 +167,9 @@ void __init of_fixed_factor_clk_setup(struct device_node *node)
 
 	of_property_read_string(node, "clock-output-names", &clk_name);
 	parent_name = of_clk_get_parent_name(node, 0);
+	of_property_read_u32(node, "clock-flags", &flags);
 
-	clk = clk_register_fixed_factor(NULL, clk_name, parent_name, 0,
+	clk = clk_register_fixed_factor(NULL, clk_name, parent_name, flags,
 					mult, div);
 	if (!IS_ERR(clk))
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
diff --git a/include/dt-bindings/clk/clk.h b/include/dt-bindings/clk/clk.h
new file mode 100644
index 0000000..1834933
--- /dev/null
+++ b/include/dt-bindings/clk/clk.h
@@ -0,0 +1,22 @@
+/*
+ * See include/linux/clk-provider.h for more information.
+ */
+
+#ifndef __DT_BINDINGS_CLK_CLK_H
+#define __DT_BINDINGS_CLK_CLK_H
+
+#define BIT(nr)	(1UL << (nr))
+
+#define CLK_SET_RATE_GATE		BIT(0)
+#define CLK_SET_PARENT_GATE		BIT(1)
+#define CLK_SET_RATE_PARENT		BIT(2)
+#define CLK_IGNORE_UNUSED		BIT(3)
+#define CLK_IS_BASIC			BIT(5)
+#define CLK_GET_RATE_NOCACHE		BIT(6)
+#define CLK_SET_RATE_NO_REPARENT	BIT(7)
+#define CLK_GET_ACCURACY_NOCACHE	BIT(8)
+#define CLK_RECALC_NEW_RATES		BIT(9)
+#define CLK_SET_RATE_UNGATE		BIT(10)
+#define CLK_IS_CRITICAL			BIT(11)
+
+#endif
-- 
2.7.4

[toc] | [next] | [standalone]


#1433300

FromRob Herring <robh@kernel.org>
Date2016-06-28 23:00 +0200
Message-ID<rP8gV-3r9-17@gated-at.bofh.it>
In reply to#1430340
On Fri, Jun 24, 2016 at 01:12:52PM +0900, Jongsung Kim wrote:
> There is no way to set additional flags for a DT-initialized fixed-
> factor-clock, and it can be problematic i.e., when the clock rate
> needs to be changed. [1][2]
> 
> This patch introduces an optional dt-binding named "clock-flags" to
> be used for passing any needed flags from dts.

I don't think we want this in DT. If we did, the flags would need some 
documentation about what the flags mean.

Rob

[toc] | [prev] | [next] | [standalone]


#1433327

FromMichael Turquette <mturquette@baylibre.com>
Date2016-06-28 23:20 +0200
Message-ID<rP8Ah-3MT-5@gated-at.bofh.it>
In reply to#1433300
Quoting Rob Herring (2016-06-28 13:55:18)
> On Fri, Jun 24, 2016 at 01:12:52PM +0900, Jongsung Kim wrote:
> > There is no way to set additional flags for a DT-initialized fixed-
> > factor-clock, and it can be problematic i.e., when the clock rate
> > needs to be changed. [1][2]
> > 
> > This patch introduces an optional dt-binding named "clock-flags" to
> > be used for passing any needed flags from dts.
> 
> I don't think we want this in DT. If we did, the flags would need some 
> documentation about what the flags mean.

Flags are specific to Linux implementation, so I agree with Rob. Better
to create a compatible string for your hardware that bakes in the flags.

Regards,
Mike

> 
> Rob

[toc] | [prev] | [next] | [standalone]


#1433517

FromJongsung Kim <neidhard.kim@lge.com>
Date2016-06-29 09:30 +0200
Message-ID<rPi6C-1fN-27@gated-at.bofh.it>
In reply to#1433327
On 2016년 06월 29일 06:18, Michael Turquette wrote:
> Quoting Rob Herring (2016-06-28 13:55:18)
>> On Fri, Jun 24, 2016 at 01:12:52PM +0900, Jongsung Kim wrote:
>>> There is no way to set additional flags for a DT-initialized fixed-
>>> factor-clock, and it can be problematic i.e., when the clock rate
>>> needs to be changed. [1][2]
>>>
>>> This patch introduces an optional dt-binding named "clock-flags" to
>>> be used for passing any needed flags from dts.
>> I don't think we want this in DT. If we did, the flags would need some 
>> documentation about what the flags mean.
> Flags are specific to Linux implementation, so I agree with Rob. Better
> to create a compatible string for your hardware that bakes in the flags.

Thank you for your comment, Mike. This conversation starts from lacking method to set CLK_SET_RATE_PARENT from DT. I understand compatible string can be a solution. But.. if someone starts talking about lacking method to set another flag, i.e., CLK_SET_PARENT_GATE, then we'll need another compatible string list.
How do you think about defining possible required subset of the flags and using some more neutral flag-names acceptable in DT?

[toc] | [prev] | [next] | [standalone]


#1435698

FromStephen Boyd <sboyd@codeaurora.org>
Date2016-07-02 02:30 +0200
Message-ID<rQgYO-4Wp-19@gated-at.bofh.it>
In reply to#1433517
On 06/29, Jongsung Kim wrote:
> On 2016년 06월 29일 06:18, Michael Turquette wrote:
> > Quoting Rob Herring (2016-06-28 13:55:18)
> >> On Fri, Jun 24, 2016 at 01:12:52PM +0900, Jongsung Kim wrote:
> >>> There is no way to set additional flags for a DT-initialized fixed-
> >>> factor-clock, and it can be problematic i.e., when the clock rate
> >>> needs to be changed. [1][2]
> >>>
> >>> This patch introduces an optional dt-binding named "clock-flags" to
> >>> be used for passing any needed flags from dts.
> >> I don't think we want this in DT. If we did, the flags would need some 
> >> documentation about what the flags mean.
> > Flags are specific to Linux implementation, so I agree with Rob. Better
> > to create a compatible string for your hardware that bakes in the flags.
> 
> Thank you for your comment, Mike. This conversation starts from lacking method to set CLK_SET_RATE_PARENT from DT. I understand compatible string can be a solution. But.. if someone starts talking about lacking method to set another flag, i.e., CLK_SET_PARENT_GATE, then we'll need another compatible string list.
> How do you think about defining possible required subset of the flags and using some more neutral flag-names acceptable in DT?

Do you actually have an IC on the board that is doing some fixed
factor calculation? Or is this a clk driver design where we are
listing out each piece of an SoC's clk controller in DT?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [next] | [standalone]


#1436107

FromJongsung Kim <neidhard.kim@lge.com>
Date2016-07-04 03:50 +0200
Message-ID<rR1bj-7L2-1@gated-at.bofh.it>
In reply to#1435698
On 2016년 07월 02일 09:20, Stephen Boyd wrote:
> On 06/29, Jongsung Kim wrote:
>> On 2016년 06월 29일 06:18, Michael Turquette wrote:
>>> Quoting Rob Herring (2016-06-28 13:55:18)
>>>> On Fri, Jun 24, 2016 at 01:12:52PM +0900, Jongsung Kim wrote:
>>>>> There is no way to set additional flags for a DT-initialized fixed-
>>>>> factor-clock, and it can be problematic i.e., when the clock rate
>>>>> needs to be changed. [1][2]
>>>>>
>>>>> This patch introduces an optional dt-binding named "clock-flags" to
>>>>> be used for passing any needed flags from dts.
>>>> I don't think we want this in DT. If we did, the flags would need some 
>>>> documentation about what the flags mean.
>>> Flags are specific to Linux implementation, so I agree with Rob. Better
>>> to create a compatible string for your hardware that bakes in the flags.
>> Thank you for your comment, Mike. This conversation starts from lacking method to set CLK_SET_RATE_PARENT from DT. I understand compatible string can be a solution. But.. if someone starts talking about lacking method to set another flag, i.e., CLK_SET_PARENT_GATE, then we'll need another compatible string list.
>> How do you think about defining possible required subset of the flags and using some more neutral flag-names acceptable in DT?
> Do you actually have an IC on the board that is doing some fixed
> factor calculation? Or is this a clk driver design where we are
> listing out each piece of an SoC's clk controller in DT?
>
The SoC has several PLLs of identical design, and one of them is divided
to half and used for CPUs. The fixed-factor-clock represents the divider.

[toc] | [prev] | [next] | [standalone]


#1433445

FromJongsung Kim <neidhard.kim@lge.com>
Date2016-06-29 07:10 +0200
Message-ID<rPfV7-8oI-5@gated-at.bofh.it>
In reply to#1433300
On 2016년 06월 29일 05:55, Rob Herring wrote:
> On Fri, Jun 24, 2016 at 01:12:52PM +0900, Jongsung Kim wrote:
>> There is no way to set additional flags for a DT-initialized fixed-
>> factor-clock, and it can be problematic i.e., when the clock rate
>> needs to be changed. [1][2]
>>
>> This patch introduces an optional dt-binding named "clock-flags" to
>> be used for passing any needed flags from dts.
> I don't think we want this in DT. If we did, the flags would need some 
> documentation about what the flags mean.
Thanks for your comment. It looks not that big deal to provide a little documentation..? Some of the flags looks safe to be removed. Thinking of only fixed-factor-clock, most of them can be removed.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web