linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] Clock changes for TI dts reg and node name issues
@ 2022-02-04  7:14 Tony Lindgren
  2022-02-04  7:14 ` [PATCH 1/8] clk: ti: Constify clkctrl_name Tony Lindgren
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Hi all,

Here are TI clock changes that allow us to update the devicetree files to
use clock-output-names instead of non-standard node names for clocks.

The related devicetree binding changes have been sent and are the
folloing patches:

[PATCHv2] dt-bindings: clock: Add binding for TI clksel
[PATCH 1/3] dt-bindings: omap: Add clock-output-names and #clock-cells

In addition to these changes, also devicetree changes are needed. Some
SoCs also need patches to unify the internal clock names. I'll be
sending those out separately.

Regards,

Tony


Tony Lindgren (8):
  clk: ti: Constify clkctrl_name
  clk: ti: Preserve node in ti_dt_clocks_register()
  clk: ti: Optionally parse IO address from parent clock node
  clk: ti: Add ti_find_clock_provider() to use clock-output-names
  clk: ti: Use clock-output-names for clkctrl
  clk: ti: Add ti_dt_clk_name() helper to use clock-output-names
  clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name()
  clk: ti: Update component clocks to use ti_dt_clk_name()

 drivers/clk/ti/apll.c         | 13 ++++--
 drivers/clk/ti/autoidle.c     |  2 +-
 drivers/clk/ti/clk-dra7-atl.c |  6 ++-
 drivers/clk/ti/clk.c          | 86 +++++++++++++++++++++++++++++++----
 drivers/clk/ti/clkctrl.c      | 24 ++++++++--
 drivers/clk/ti/clock.h        |  1 +
 drivers/clk/ti/clockdomain.c  |  2 +-
 drivers/clk/ti/composite.c    |  6 ++-
 drivers/clk/ti/divider.c      |  6 ++-
 drivers/clk/ti/dpll.c         |  8 ++--
 drivers/clk/ti/fapll.c        | 11 +++--
 drivers/clk/ti/fixed-factor.c |  2 +-
 drivers/clk/ti/gate.c         |  4 +-
 drivers/clk/ti/interface.c    |  4 +-
 drivers/clk/ti/mux.c          |  4 +-
 15 files changed, 143 insertions(+), 36 deletions(-)

-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/8] clk: ti: Constify clkctrl_name
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:30   ` Stephen Boyd
  2022-02-04  7:14 ` [PATCH 2/8] clk: ti: Preserve node in ti_dt_clocks_register() Tony Lindgren
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

We can constify clkctrl_name in preparation for making use of the
clock-output-names property.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clkctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -505,7 +505,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
 	struct omap_clkctrl_clk *clkctrl_clk = NULL;
 	const __be32 *addrp;
 	bool legacy_naming;
-	char *clkctrl_name;
+	const char *clkctrl_name;
 	u32 addr;
 	int ret;
 	char *c;
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 2/8] clk: ti: Preserve node in ti_dt_clocks_register()
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
  2022-02-04  7:14 ` [PATCH 1/8] clk: ti: Constify clkctrl_name Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:31   ` Stephen Boyd
  2022-02-04  7:14 ` [PATCH 3/8] clk: ti: Optionally parse IO address from parent clock node Tony Lindgren
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

In preparation for making use of the clock-output-names, we want to
keep node around in ti_dt_clocks_register().

This change should not needed as a fix currently.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clk.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -131,7 +131,7 @@ int ti_clk_setup_ll_ops(struct ti_clk_ll_ops *ops)
 void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
 {
 	struct ti_dt_clk *c;
-	struct device_node *node, *parent;
+	struct device_node *node, *parent, *child;
 	struct clk *clk;
 	struct of_phandle_args clkspec;
 	char buf[64];
@@ -171,10 +171,13 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
 		node = of_find_node_by_name(NULL, buf);
 		if (num_args && compat_mode) {
 			parent = node;
-			node = of_get_child_by_name(parent, "clock");
-			if (!node)
-				node = of_get_child_by_name(parent, "clk");
-			of_node_put(parent);
+			child = of_get_child_by_name(parent, "clock");
+			if (!child)
+				child = of_get_child_by_name(parent, "clk");
+			if (child) {
+				of_node_put(parent);
+				node = child;
+			}
 		}
 
 		clkspec.np = node;
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 3/8] clk: ti: Optionally parse IO address from parent clock node
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
  2022-02-04  7:14 ` [PATCH 1/8] clk: ti: Constify clkctrl_name Tony Lindgren
  2022-02-04  7:14 ` [PATCH 2/8] clk: ti: Preserve node in ti_dt_clocks_register() Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:31   ` Stephen Boyd
  2022-02-04  7:14 ` [PATCH 4/8] clk: ti: Add ti_find_clock_provider() to use clock-output-names Tony Lindgren
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

If no reg property is specified for a TI clock, let's try to use the
parent clock node IO address. This way we can avoid duplicate devicetree
reg properties that cause warnings for unique_unit_address.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clk.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -274,6 +274,8 @@ int ti_clk_get_reg_addr(struct device_node *node, int index,
 	for (i = 0; i < CLK_MAX_MEMMAPS; i++) {
 		if (clocks_node_ptr[i] == node->parent)
 			break;
+		if (clocks_node_ptr[i] == node->parent->parent)
+			break;
 	}
 
 	if (i == CLK_MAX_MEMMAPS) {
@@ -284,8 +286,12 @@ int ti_clk_get_reg_addr(struct device_node *node, int index,
 	reg->index = i;
 
 	if (of_property_read_u32_index(node, "reg", index, &val)) {
-		pr_err("%pOFn must have reg[%d]!\n", node, index);
-		return -EINVAL;
+		if (of_property_read_u32_index(node->parent, "reg",
+					       index, &val)) {
+			pr_err("%pOFn or parent must have reg[%d]!\n",
+			       node, index);
+			return -EINVAL;
+		}
 	}
 
 	reg->offset = val;
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 4/8] clk: ti: Add ti_find_clock_provider() to use clock-output-names
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
                   ` (2 preceding siblings ...)
  2022-02-04  7:14 ` [PATCH 3/8] clk: ti: Optionally parse IO address from parent clock node Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:31   ` Stephen Boyd
  2022-02-04  7:14 ` [PATCH 5/8] clk: ti: Use clock-output-names for clkctrl Tony Lindgren
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Let's add ti_find_clock_provider() so we can use clock-output-names
to name the clock provider instead of relying on non-standard devicetree
node names.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clk.c | 43 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -119,12 +119,51 @@ int ti_clk_setup_ll_ops(struct ti_clk_ll_ops *ops)
 	return 0;
 }
 
+/*
+ * Eventually we could standardize to using '_' for clk-*.c files to follow the
+ * TRM naming and leave out the tmp name here.
+ */
+static struct device_node *ti_find_clock_provider(struct device_node *from,
+						  const char *name)
+{
+	struct device_node *np;
+	bool found = false;
+	const char *n;
+	char *tmp;
+
+	tmp = kstrdup(name, GFP_KERNEL);
+	if (!tmp)
+		return NULL;
+	strreplace(tmp, '-', '_');
+
+	/* Node named "clock" with "clock-output-names" */
+	for_each_of_allnodes_from(from, np) {
+		if (of_property_read_string_index(np, "clock-output-names",
+						  0, &n))
+			continue;
+
+		if (!strncmp(n, tmp, strlen(tmp))) {
+			found = true;
+			break;
+		}
+	}
+	of_node_put(from);
+	kfree(tmp);
+
+	if (found)
+		return np;
+
+	/* Fall back to using old node name base provider name */
+	return of_find_node_by_name(from, name);
+}
+
 /**
  * ti_dt_clocks_register - register DT alias clocks during boot
  * @oclks: list of clocks to register
  *
  * Register alias or non-standard DT clock entries during boot. By
- * default, DT clocks are found based on their node name. If any
+ * default, DT clocks are found based on their clock-output-names
+ * property, or the clock node name for legacy cases. If any
  * additional con-id / dev-id -> clock mapping is required, use this
  * function to list these.
  */
@@ -168,7 +207,7 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
 		if (num_args && clkctrl_nodes_missing)
 			continue;
 
-		node = of_find_node_by_name(NULL, buf);
+		node = ti_find_clock_provider(NULL, buf);
 		if (num_args && compat_mode) {
 			parent = node;
 			child = of_get_child_by_name(parent, "clock");
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 5/8] clk: ti: Use clock-output-names for clkctrl
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
                   ` (3 preceding siblings ...)
  2022-02-04  7:14 ` [PATCH 4/8] clk: ti: Add ti_find_clock_provider() to use clock-output-names Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:31   ` Stephen Boyd
  2022-02-04  7:14 ` [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names Tony Lindgren
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Use clock-output-names devicetree property for clkctrl clocks if
available.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clkctrl.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -469,14 +469,32 @@ static void __init _clkctrl_add_provider(void *data,
 	of_clk_add_hw_provider(np, _ti_omap4_clkctrl_xlate, data);
 }
 
-/* Get clock name based on compatible string for clkctrl */
-static char * __init clkctrl_get_name(struct device_node *np)
+/*
+ * Get clock name based on "clock-output-names" property or the
+ * compatible property for clkctrl.
+ */
+static const char * __init clkctrl_get_name(struct device_node *np)
 {
 	struct property *prop;
 	const int prefix_len = 11;
 	const char *compat;
+	const char *output;
 	char *name;
 
+	if (!of_property_read_string_index(np, "clock-output-names", 0,
+					   &output)) {
+		const char *end;
+		int len;
+
+		len = strlen(output);
+		end = strstr(output, "_clkctrl");
+		if (end)
+			len -= strlen(end);
+		name = kstrndup(output, len, GFP_KERNEL);
+
+		return name;
+	}
+
 	of_property_for_each_string(np, "compatible", prop, compat) {
 		if (!strncmp("ti,clkctrl-", compat, prefix_len)) {
 			/* Two letter minimum name length for l3, l4 etc */
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
                   ` (4 preceding siblings ...)
  2022-02-04  7:14 ` [PATCH 5/8] clk: ti: Use clock-output-names for clkctrl Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:31   ` Stephen Boyd
  2022-02-04  7:14 ` [PATCH 7/8] clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() Tony Lindgren
  2022-02-04  7:14 ` [PATCH 8/8] clk: ti: Update component " Tony Lindgren
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Let's create the clock alias based on the clock-output-names property if
available. Also the component clock drivers can use ti_dt_clk_name() in
the following patches.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clk.c   | 20 +++++++++++++++++++-
 drivers/clk/ti/clock.h |  1 +
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -447,6 +447,24 @@ static const struct of_device_id simple_clk_match_table[] __initconst = {
 	{ }
 };
 
+/**
+ * ti_dt_clk_name - init clock name from first output name or node name
+ * @np: device node
+ *
+ * Use the first clock-output-name for the clock name if found. Fall back
+ * to legacy naming based on node name.
+ */
+const char *ti_dt_clk_name(struct device_node *np)
+{
+	const char *name;
+
+	if (!of_property_read_string_index(np, "clock-output-names", 0,
+					   &name))
+		return name;
+
+	return np->name;
+}
+
 /**
  * ti_clk_add_aliases - setup clock aliases
  *
@@ -463,7 +481,7 @@ void __init ti_clk_add_aliases(void)
 		clkspec.np = np;
 		clk = of_clk_get_from_provider(&clkspec);
 
-		ti_clk_add_alias(NULL, clk, np->name);
+		ti_clk_add_alias(NULL, clk, ti_dt_clk_name(np));
 	}
 }
 
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -211,6 +211,7 @@ struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
 			    const char *con);
 struct clk *ti_clk_register_omap_hw(struct device *dev, struct clk_hw *hw,
 				    const char *con);
+const char *ti_dt_clk_name(struct device_node *np);
 int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con);
 void ti_clk_add_aliases(void);
 
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 7/8] clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name()
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
                   ` (5 preceding siblings ...)
  2022-02-04  7:14 ` [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:31   ` Stephen Boyd
  2022-02-04  7:14 ` [PATCH 8/8] clk: ti: Update component " Tony Lindgren
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Let's update the TI pll and clockdomain clocks to use ti_dt_clk_name()
instead of devicetree node name if available.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/apll.c        | 13 +++++++++----
 drivers/clk/ti/clockdomain.c |  2 +-
 drivers/clk/ti/dpll.c        |  8 +++++---
 drivers/clk/ti/fapll.c       | 11 +++++++----
 4 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c
--- a/drivers/clk/ti/apll.c
+++ b/drivers/clk/ti/apll.c
@@ -139,6 +139,7 @@ static void __init omap_clk_register_apll(void *user,
 	struct clk_hw *hw = user;
 	struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
 	struct dpll_data *ad = clk_hw->dpll_data;
+	const char *name;
 	struct clk *clk;
 	const struct clk_init_data *init = clk_hw->hw.init;
 
@@ -166,7 +167,8 @@ static void __init omap_clk_register_apll(void *user,
 
 	ad->clk_bypass = __clk_get_hw(clk);
 
-	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
+	name = ti_dt_clk_name(node);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name);
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		kfree(init->parent_names);
@@ -198,7 +200,7 @@ static void __init of_dra7_apll_setup(struct device_node *node)
 	clk_hw->dpll_data = ad;
 	clk_hw->hw.init = init;
 
-	init->name = node->name;
+	init->name = ti_dt_clk_name(node);
 	init->ops = &apll_ck_ops;
 
 	init->num_parents = of_clk_get_parent_count(node);
@@ -347,6 +349,7 @@ static void __init of_omap2_apll_setup(struct device_node *node)
 	struct dpll_data *ad = NULL;
 	struct clk_hw_omap *clk_hw = NULL;
 	struct clk_init_data *init = NULL;
+	const char *name;
 	struct clk *clk;
 	const char *parent_name;
 	u32 val;
@@ -362,7 +365,8 @@ static void __init of_omap2_apll_setup(struct device_node *node)
 	clk_hw->dpll_data = ad;
 	clk_hw->hw.init = init;
 	init->ops = &omap2_apll_ops;
-	init->name = node->name;
+	name = ti_dt_clk_name(node);
+	init->name = name;
 	clk_hw->ops = &omap2_apll_hwops;
 
 	init->num_parents = of_clk_get_parent_count(node);
@@ -403,7 +407,8 @@ static void __init of_omap2_apll_setup(struct device_node *node)
 	if (ret)
 		goto cleanup;
 
-	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
+	name = ti_dt_clk_name(node);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name);
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		kfree(init);
diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c
--- a/drivers/clk/ti/clockdomain.c
+++ b/drivers/clk/ti/clockdomain.c
@@ -131,7 +131,7 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)
 {
 	struct clk *clk;
 	struct clk_hw *clk_hw;
-	const char *clkdm_name = node->name;
+	const char *clkdm_name = ti_dt_clk_name(node);
 	int i;
 	unsigned int num_clks;
 
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
--- a/drivers/clk/ti/dpll.c
+++ b/drivers/clk/ti/dpll.c
@@ -164,6 +164,7 @@ static void __init _register_dpll(void *user,
 	struct clk_hw *hw = user;
 	struct clk_hw_omap *clk_hw = to_clk_hw_omap(hw);
 	struct dpll_data *dd = clk_hw->dpll_data;
+	const char *name;
 	struct clk *clk;
 	const struct clk_init_data *init = hw->init;
 
@@ -193,7 +194,8 @@ static void __init _register_dpll(void *user,
 	dd->clk_bypass = __clk_get_hw(clk);
 
 	/* register the clock */
-	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
+	name = ti_dt_clk_name(node);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name);
 
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
@@ -227,7 +229,7 @@ static void _register_dpll_x2(struct device_node *node,
 	struct clk *clk;
 	struct clk_init_data init = { NULL };
 	struct clk_hw_omap *clk_hw;
-	const char *name = node->name;
+	const char *name = ti_dt_clk_name(node);
 	const char *parent_name;
 
 	parent_name = of_clk_get_parent_name(node, 0);
@@ -304,7 +306,7 @@ static void __init of_ti_dpll_setup(struct device_node *node,
 	clk_hw->ops = &clkhwops_omap3_dpll;
 	clk_hw->hw.init = init;
 
-	init->name = node->name;
+	init->name = ti_dt_clk_name(node);
 	init->ops = ops;
 
 	init->num_parents = of_clk_get_parent_count(node);
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
--- a/drivers/clk/ti/fapll.c
+++ b/drivers/clk/ti/fapll.c
@@ -19,6 +19,8 @@
 #include <linux/of_address.h>
 #include <linux/clk/ti.h>
 
+#include "clock.h"
+
 /* FAPLL Control Register PLL_CTRL */
 #define FAPLL_MAIN_MULT_N_SHIFT	16
 #define FAPLL_MAIN_DIV_P_SHIFT	8
@@ -542,6 +544,7 @@ static void __init ti_fapll_setup(struct device_node *node)
 	struct clk_init_data *init = NULL;
 	const char *parent_name[2];
 	struct clk *pll_clk;
+	const char *name;
 	int i;
 
 	fd = kzalloc(sizeof(*fd), GFP_KERNEL);
@@ -559,7 +562,8 @@ static void __init ti_fapll_setup(struct device_node *node)
 		goto free;
 
 	init->ops = &ti_fapll_ops;
-	init->name = node->name;
+	name = ti_dt_clk_name(node);
+	init->name = name;
 
 	init->num_parents = of_clk_get_parent_count(node);
 	if (init->num_parents != 2) {
@@ -591,7 +595,7 @@ static void __init ti_fapll_setup(struct device_node *node)
 	if (fapll_is_ddr_pll(fd->base))
 		fd->bypass_bit_inverted = true;
 
-	fd->name = node->name;
+	fd->name = name;
 	fd->hw.init = init;
 
 	/* Register the parent PLL */
@@ -638,8 +642,7 @@ static void __init ti_fapll_setup(struct device_node *node)
 				freq = NULL;
 		}
 		synth_clk = ti_fapll_synth_setup(fd, freq, div, output_instance,
-						 output_name, node->name,
-						 pll_clk);
+						 output_name, name, pll_clk);
 		if (IS_ERR(synth_clk))
 			continue;
 
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 8/8] clk: ti: Update component clocks to use ti_dt_clk_name()
  2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
                   ` (6 preceding siblings ...)
  2022-02-04  7:14 ` [PATCH 7/8] clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() Tony Lindgren
@ 2022-02-04  7:14 ` Tony Lindgren
  2022-03-11  3:32   ` Stephen Boyd
  7 siblings, 1 reply; 17+ messages in thread
From: Tony Lindgren @ 2022-02-04  7:14 UTC (permalink / raw)
  To: linux-clk; +Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Let's update all the TI component clocks to use ti_dt_clk_name() instead
of devicetree node name if available.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/autoidle.c     | 2 +-
 drivers/clk/ti/clk-dra7-atl.c | 6 ++++--
 drivers/clk/ti/composite.c    | 6 ++++--
 drivers/clk/ti/divider.c      | 6 ++++--
 drivers/clk/ti/fixed-factor.c | 2 +-
 drivers/clk/ti/gate.c         | 4 +++-
 drivers/clk/ti/interface.c    | 4 +++-
 drivers/clk/ti/mux.c          | 4 +++-
 8 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c
--- a/drivers/clk/ti/autoidle.c
+++ b/drivers/clk/ti/autoidle.c
@@ -205,7 +205,7 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node)
 		return -ENOMEM;
 
 	clk->shift = shift;
-	clk->name = node->name;
+	clk->name = ti_dt_clk_name(node);
 	ret = ti_clk_get_reg_addr(node, 0, &clk->reg);
 	if (ret) {
 		kfree(clk);
diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c
--- a/drivers/clk/ti/clk-dra7-atl.c
+++ b/drivers/clk/ti/clk-dra7-atl.c
@@ -173,6 +173,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 	struct dra7_atl_desc *clk_hw = NULL;
 	struct clk_init_data init = { NULL };
 	const char **parent_names = NULL;
+	const char *name;
 	struct clk *clk;
 
 	clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
@@ -183,7 +184,8 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 
 	clk_hw->hw.init = &init;
 	clk_hw->divider = 1;
-	init.name = node->name;
+	name = ti_dt_clk_name(node);
+	init.name = name;
 	init.ops = &atl_clk_ops;
 	init.flags = CLK_IGNORE_UNUSED;
 	init.num_parents = of_clk_get_parent_count(node);
@@ -203,7 +205,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 
 	init.parent_names = parent_names;
 
-	clk = ti_clk_register(NULL, &clk_hw->hw, node->name);
+	clk = ti_clk_register(NULL, &clk_hw->hw, name);
 
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c
--- a/drivers/clk/ti/composite.c
+++ b/drivers/clk/ti/composite.c
@@ -125,6 +125,7 @@ static void __init _register_composite(void *user,
 	struct component_clk *comp;
 	int num_parents = 0;
 	const char **parent_names = NULL;
+	const char *name;
 	int i;
 	int ret;
 
@@ -172,7 +173,8 @@ static void __init _register_composite(void *user,
 		goto cleanup;
 	}
 
-	clk = clk_register_composite(NULL, node->name,
+	name = ti_dt_clk_name(node);
+	clk = clk_register_composite(NULL, name,
 				     parent_names, num_parents,
 				     _get_hw(cclk, CLK_COMPONENT_TYPE_MUX),
 				     &ti_clk_mux_ops,
@@ -182,7 +184,7 @@ static void __init _register_composite(void *user,
 				     &ti_composite_gate_ops, 0);
 
 	if (!IS_ERR(clk)) {
-		ret = ti_clk_add_alias(NULL, clk, node->name);
+		ret = ti_clk_add_alias(NULL, clk, name);
 		if (ret) {
 			clk_unregister(clk);
 			goto cleanup;
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c
--- a/drivers/clk/ti/divider.c
+++ b/drivers/clk/ti/divider.c
@@ -320,10 +320,12 @@ static struct clk *_register_divider(struct device_node *node,
 	struct clk *clk;
 	struct clk_init_data init;
 	const char *parent_name;
+	const char *name;
 
 	parent_name = of_clk_get_parent_name(node, 0);
 
-	init.name = node->name;
+	name = ti_dt_clk_name(node);
+	init.name = name;
 	init.ops = &ti_clk_divider_ops;
 	init.flags = flags;
 	init.parent_names = (parent_name ? &parent_name : NULL);
@@ -332,7 +334,7 @@ static struct clk *_register_divider(struct device_node *node,
 	div->hw.init = &init;
 
 	/* register the clock */
-	clk = ti_clk_register(NULL, &div->hw, node->name);
+	clk = ti_clk_register(NULL, &div->hw, name);
 
 	if (IS_ERR(clk))
 		kfree(div);
diff --git a/drivers/clk/ti/fixed-factor.c b/drivers/clk/ti/fixed-factor.c
--- a/drivers/clk/ti/fixed-factor.c
+++ b/drivers/clk/ti/fixed-factor.c
@@ -36,7 +36,7 @@
 static void __init of_ti_fixed_factor_clk_setup(struct device_node *node)
 {
 	struct clk *clk;
-	const char *clk_name = node->name;
+	const char *clk_name = ti_dt_clk_name(node);
 	const char *parent_name;
 	u32 div, mult;
 	u32 flags = 0;
diff --git a/drivers/clk/ti/gate.c b/drivers/clk/ti/gate.c
--- a/drivers/clk/ti/gate.c
+++ b/drivers/clk/ti/gate.c
@@ -138,6 +138,7 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
 	struct clk *clk;
 	const char *parent_name;
 	struct clk_omap_reg reg;
+	const char *name;
 	u8 enable_bit = 0;
 	u32 val;
 	u32 flags = 0;
@@ -164,7 +165,8 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
 	if (of_property_read_bool(node, "ti,set-bit-to-disable"))
 		clk_gate_flags |= INVERT_ENABLE;
 
-	clk = _register_gate(NULL, node->name, parent_name, flags, &reg,
+	name = ti_dt_clk_name(node);
+	clk = _register_gate(NULL, name, parent_name, flags, &reg,
 			     enable_bit, clk_gate_flags, ops, hw_ops);
 
 	if (!IS_ERR(clk))
diff --git a/drivers/clk/ti/interface.c b/drivers/clk/ti/interface.c
--- a/drivers/clk/ti/interface.c
+++ b/drivers/clk/ti/interface.c
@@ -72,6 +72,7 @@ static void __init _of_ti_interface_clk_setup(struct device_node *node,
 	const char *parent_name;
 	struct clk_omap_reg reg;
 	u8 enable_bit = 0;
+	const char *name;
 	u32 val;
 
 	if (ti_clk_get_reg_addr(node, 0, &reg))
@@ -86,7 +87,8 @@ static void __init _of_ti_interface_clk_setup(struct device_node *node,
 		return;
 	}
 
-	clk = _register_interface(NULL, node->name, parent_name, &reg,
+	name = ti_dt_clk_name(node);
+	clk = _register_interface(NULL, name, parent_name, &reg,
 				  enable_bit, ops);
 
 	if (!IS_ERR(clk))
diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c
--- a/drivers/clk/ti/mux.c
+++ b/drivers/clk/ti/mux.c
@@ -176,6 +176,7 @@ static void of_mux_clk_setup(struct device_node *node)
 	struct clk_omap_reg reg;
 	unsigned int num_parents;
 	const char **parent_names;
+	const char *name;
 	u8 clk_mux_flags = 0;
 	u32 mask = 0;
 	u32 shift = 0;
@@ -213,7 +214,8 @@ static void of_mux_clk_setup(struct device_node *node)
 
 	mask = (1 << fls(mask)) - 1;
 
-	clk = _register_mux(NULL, node->name, parent_names, num_parents,
+	name = ti_dt_clk_name(node);
+	clk = _register_mux(NULL, name, parent_names, num_parents,
 			    flags, &reg, shift, mask, latch, clk_mux_flags,
 			    NULL);
 
-- 
2.35.1

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/8] clk: ti: Constify clkctrl_name
  2022-02-04  7:14 ` [PATCH 1/8] clk: ti: Constify clkctrl_name Tony Lindgren
@ 2022-03-11  3:30   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:30 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:42)
> We can constify clkctrl_name in preparation for making use of the
> clock-output-names property.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/8] clk: ti: Preserve node in ti_dt_clocks_register()
  2022-02-04  7:14 ` [PATCH 2/8] clk: ti: Preserve node in ti_dt_clocks_register() Tony Lindgren
@ 2022-03-11  3:31   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:31 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:43)
> In preparation for making use of the clock-output-names, we want to
> keep node around in ti_dt_clocks_register().
> 
> This change should not needed as a fix currently.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/8] clk: ti: Optionally parse IO address from parent clock node
  2022-02-04  7:14 ` [PATCH 3/8] clk: ti: Optionally parse IO address from parent clock node Tony Lindgren
@ 2022-03-11  3:31   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:31 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:44)
> If no reg property is specified for a TI clock, let's try to use the
> parent clock node IO address. This way we can avoid duplicate devicetree
> reg properties that cause warnings for unique_unit_address.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 4/8] clk: ti: Add ti_find_clock_provider() to use clock-output-names
  2022-02-04  7:14 ` [PATCH 4/8] clk: ti: Add ti_find_clock_provider() to use clock-output-names Tony Lindgren
@ 2022-03-11  3:31   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:31 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:45)
> Let's add ti_find_clock_provider() so we can use clock-output-names
> to name the clock provider instead of relying on non-standard devicetree
> node names.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/8] clk: ti: Use clock-output-names for clkctrl
  2022-02-04  7:14 ` [PATCH 5/8] clk: ti: Use clock-output-names for clkctrl Tony Lindgren
@ 2022-03-11  3:31   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:31 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:46)
> Use clock-output-names devicetree property for clkctrl clocks if
> available.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names
  2022-02-04  7:14 ` [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names Tony Lindgren
@ 2022-03-11  3:31   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:31 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:47)
> Let's create the clock alias based on the clock-output-names property if
> available. Also the component clock drivers can use ti_dt_clk_name() in
> the following patches.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 7/8] clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name()
  2022-02-04  7:14 ` [PATCH 7/8] clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() Tony Lindgren
@ 2022-03-11  3:31   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:31 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:48)
> Let's update the TI pll and clockdomain clocks to use ti_dt_clk_name()
> instead of devicetree node name if available.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 8/8] clk: ti: Update component clocks to use ti_dt_clk_name()
  2022-02-04  7:14 ` [PATCH 8/8] clk: ti: Update component " Tony Lindgren
@ 2022-03-11  3:32   ` Stephen Boyd
  0 siblings, 0 replies; 17+ messages in thread
From: Stephen Boyd @ 2022-03-11  3:32 UTC (permalink / raw)
  To: Tony Lindgren, linux-clk
  Cc: Michael Turquette, Stephen Boyd, Tero Kristo, linux-omap

Quoting Tony Lindgren (2022-02-03 23:14:49)
> Let's update all the TI component clocks to use ti_dt_clk_name() instead
> of devicetree node name if available.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-03-11  3:32 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
2022-02-04  7:14 ` [PATCH 1/8] clk: ti: Constify clkctrl_name Tony Lindgren
2022-03-11  3:30   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 2/8] clk: ti: Preserve node in ti_dt_clocks_register() Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 3/8] clk: ti: Optionally parse IO address from parent clock node Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 4/8] clk: ti: Add ti_find_clock_provider() to use clock-output-names Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 5/8] clk: ti: Use clock-output-names for clkctrl Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 7/8] clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 8/8] clk: ti: Update component " Tony Lindgren
2022-03-11  3:32   ` Stephen Boyd

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).