linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
@ 2019-01-15  9:15 Tero Kristo
  2019-01-15  9:15 ` [PATCH 1/4] clk: ti: move clk_hw_omap list handling under generic part of the driver Tero Kristo
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Tero Kristo @ 2019-01-15  9:15 UTC (permalink / raw)
  To: linux-clk, sboyd, mturquette; +Cc: linux-omap, tony

Hi Stephen,

As requested, this series gets rid of CLK_IS_BASIC flag usage from
TI clock drivers.

Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
suspend/resume test on omap3/omap4/am5.

-Tero

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* [PATCH 1/4] clk: ti: move clk_hw_omap list handling under generic part of the driver
  2019-01-15  9:15 [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tero Kristo
@ 2019-01-15  9:15 ` Tero Kristo
  2019-01-15  9:15 ` [PATCH 2/4] clk: ti: add new API for checking if a provided clock is an OMAP clock Tero Kristo
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Tero Kristo @ 2019-01-15  9:15 UTC (permalink / raw)
  To: linux-clk, sboyd, mturquette; +Cc: linux-omap, tony

Currently the clk_hw_omap list is handled under the autoidle code, but
it should be accessible generically. Add a few APIs towards this, and
update the autoidle code to use the generic implementations.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/clk/ti/autoidle.c | 65 +++++++++++++++++++----------------------------
 drivers/clk/ti/clk.c      | 42 ++++++++++++++++++++++++++++++
 drivers/clk/ti/clock.h    |  1 +
 3 files changed, 69 insertions(+), 39 deletions(-)

diff --git a/drivers/clk/ti/autoidle.c b/drivers/clk/ti/autoidle.c
index 7bb9afb..a129b4b 100644
--- a/drivers/clk/ti/autoidle.c
+++ b/drivers/clk/ti/autoidle.c
@@ -35,7 +35,20 @@ struct clk_ti_autoidle {
 #define AUTOIDLE_LOW		0x1
 
 static LIST_HEAD(autoidle_clks);
-static LIST_HEAD(clk_hw_omap_clocks);
+
+static int _omap2_clk_deny_idle(struct clk_hw_omap *clk)
+{
+	if (clk->ops && clk->ops->deny_idle)
+		clk->ops->deny_idle(clk);
+	return 0;
+}
+
+static int _omap2_clk_allow_idle(struct clk_hw_omap *clk)
+{
+	if (clk->ops && clk->ops->allow_idle)
+		clk->ops->allow_idle(clk);
+	return 0;
+}
 
 /**
  * omap2_clk_deny_idle - disable autoidle on an OMAP clock
@@ -45,12 +58,9 @@ struct clk_ti_autoidle {
  */
 int omap2_clk_deny_idle(struct clk *clk)
 {
-	struct clk_hw_omap *c;
+	struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk));
 
-	c = to_clk_hw_omap(__clk_get_hw(clk));
-	if (c->ops && c->ops->deny_idle)
-		c->ops->deny_idle(c);
-	return 0;
+	return _omap2_clk_deny_idle(c);
 }
 
 /**
@@ -61,12 +71,9 @@ int omap2_clk_deny_idle(struct clk *clk)
  */
 int omap2_clk_allow_idle(struct clk *clk)
 {
-	struct clk_hw_omap *c;
+	struct clk_hw_omap *c = to_clk_hw_omap(__clk_get_hw(clk));
 
-	c = to_clk_hw_omap(__clk_get_hw(clk));
-	if (c->ops && c->ops->allow_idle)
-		c->ops->allow_idle(c);
-	return 0;
+	return _omap2_clk_allow_idle(c);
 }
 
 static void _allow_autoidle(struct clk_ti_autoidle *clk)
@@ -168,26 +175,6 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node)
 }
 
 /**
- * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
- * @hw: struct clk_hw * to initialize
- *
- * Add an OMAP clock @clk to the internal list of OMAP clocks.  Used
- * temporarily for autoidle handling, until this support can be
- * integrated into the common clock framework code in some way.  No
- * return value.
- */
-void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw)
-{
-	struct clk_hw_omap *c;
-
-	if (clk_hw_get_flags(hw) & CLK_IS_BASIC)
-		return;
-
-	c = to_clk_hw_omap(hw);
-	list_add(&c->node, &clk_hw_omap_clocks);
-}
-
-/**
  * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
  * support it
  *
@@ -198,11 +185,11 @@ void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw)
  */
 int omap2_clk_enable_autoidle_all(void)
 {
-	struct clk_hw_omap *c;
+	int ret;
 
-	list_for_each_entry(c, &clk_hw_omap_clocks, node)
-		if (c->ops && c->ops->allow_idle)
-			c->ops->allow_idle(c);
+	ret = omap2_clk_for_each(_omap2_clk_allow_idle);
+	if (ret)
+		return ret;
 
 	_clk_generic_allow_autoidle_all();
 
@@ -220,11 +207,11 @@ int omap2_clk_enable_autoidle_all(void)
  */
 int omap2_clk_disable_autoidle_all(void)
 {
-	struct clk_hw_omap *c;
+	int ret;
 
-	list_for_each_entry(c, &clk_hw_omap_clocks, node)
-		if (c->ops && c->ops->deny_idle)
-			c->ops->deny_idle(c);
+	ret = omap2_clk_for_each(_omap2_clk_deny_idle);
+	if (ret)
+		return ret;
 
 	_clk_generic_deny_autoidle_all();
 
diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index d0cd585..8172843 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -31,6 +31,7 @@
 #undef pr_fmt
 #define pr_fmt(fmt) "%s: " fmt, __func__
 
+static LIST_HEAD(clk_hw_omap_clocks);
 struct ti_clk_ll_ops *ti_clk_ll_ops;
 static struct device_node *clocks_node_ptr[CLK_MAX_MEMMAPS];
 
@@ -517,3 +518,44 @@ struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
 
 	return clk;
 }
+
+/**
+ * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
+ * @hw: struct clk_hw * to initialize
+ *
+ * Add an OMAP clock @clk to the internal list of OMAP clocks.  Used
+ * temporarily for autoidle handling, until this support can be
+ * integrated into the common clock framework code in some way.  No
+ * return value.
+ */
+void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw)
+{
+	struct clk_hw_omap *c;
+
+	c = to_clk_hw_omap(hw);
+	list_add(&c->node, &clk_hw_omap_clocks);
+}
+
+/**
+ * omap2_clk_for_each - call function for each registered clk_hw_omap
+ * @fn: pointer to a callback function
+ *
+ * Call @fn for each registered clk_hw_omap, passing @hw to each
+ * function.  @fn must return 0 for success or any other value for
+ * failure.  If @fn returns non-zero, the iteration across clocks
+ * will stop and the non-zero return value will be passed to the
+ * caller of omap2_clk_for_each().
+ */
+int omap2_clk_for_each(int (*fn)(struct clk_hw_omap *hw))
+{
+	int ret;
+	struct clk_hw_omap *hw;
+
+	list_for_each_entry(hw, &clk_hw_omap_clocks, node) {
+		ret = (*fn)(hw);
+		if (ret)
+			break;
+	}
+
+	return ret;
+}
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
index 9f312a2..e5b8af3 100644
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -301,6 +301,7 @@ long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
 				    unsigned long *parent_rate);
 int omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw,
 				       struct clk_rate_request *req);
+int omap2_clk_for_each(int (*fn)(struct clk_hw_omap *hw));
 
 extern struct ti_clk_ll_ops *ti_clk_ll_ops;
 
-- 
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* [PATCH 2/4] clk: ti: add new API for checking if a provided clock is an OMAP clock
  2019-01-15  9:15 [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tero Kristo
  2019-01-15  9:15 ` [PATCH 1/4] clk: ti: move clk_hw_omap list handling under generic part of the driver Tero Kristo
@ 2019-01-15  9:15 ` Tero Kristo
  2019-01-15  9:15 ` [PATCH 3/4] clk: ti: remove usage of CLK_IS_BASIC Tero Kristo
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Tero Kristo @ 2019-01-15  9:15 UTC (permalink / raw)
  To: linux-clk, sboyd, mturquette; +Cc: linux-omap, tony

omap2_clk_is_hw_omap can now be used to verify if the provided clk_hw
is an omap HW clock or not. This is done to replace the usage of CLK_IS_BASIC
flag within the TI clock drivers.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/clk/ti/clk.c   | 18 ++++++++++++++++++
 drivers/clk/ti/clock.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index 8172843..05f9d1a 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -559,3 +559,22 @@ int omap2_clk_for_each(int (*fn)(struct clk_hw_omap *hw))
 
 	return ret;
 }
+
+/**
+ * omap2_clk_is_hw_omap - check if the provided clk_hw is OMAP clock
+ * @hw: clk_hw to check if it is an omap clock or not
+ *
+ * Checks if the provided clk_hw is OMAP clock or not. Returns true if
+ * it is, false otherwise.
+ */
+bool omap2_clk_is_hw_omap(struct clk_hw *hw)
+{
+	struct clk_hw_omap *oclk;
+
+	list_for_each_entry(oclk, &clk_hw_omap_clocks, node) {
+		if (&oclk->hw == hw)
+			return true;
+	}
+
+	return false;
+}
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
index e5b8af3..034ff6a 100644
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -302,6 +302,7 @@ long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
 int omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw,
 				       struct clk_rate_request *req);
 int omap2_clk_for_each(int (*fn)(struct clk_hw_omap *hw));
+bool omap2_clk_is_hw_omap(struct clk_hw *hw);
 
 extern struct ti_clk_ll_ops *ti_clk_ll_ops;
 
-- 
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* [PATCH 3/4] clk: ti: remove usage of CLK_IS_BASIC
  2019-01-15  9:15 [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tero Kristo
  2019-01-15  9:15 ` [PATCH 1/4] clk: ti: move clk_hw_omap list handling under generic part of the driver Tero Kristo
  2019-01-15  9:15 ` [PATCH 2/4] clk: ti: add new API for checking if a provided clock is an OMAP clock Tero Kristo
@ 2019-01-15  9:15 ` Tero Kristo
  2019-01-15  9:15 ` [PATCH 4/4] clk: ti: generalize the init sequence of clk_hw_omap clocks Tero Kristo
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Tero Kristo @ 2019-01-15  9:15 UTC (permalink / raw)
  To: linux-clk, sboyd, mturquette; +Cc: linux-omap, tony

Remove the usage of CLK_IS_BASIC flag completely from TI clock driver.
In most cases, the use is completely redundant, but in some cases
we need to use the new API to check if the clock is an OMAP clock or not.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/clk/ti/adpll.c       | 2 +-
 drivers/clk/ti/clkctrl.c     | 2 +-
 drivers/clk/ti/clockdomain.c | 2 +-
 drivers/clk/ti/divider.c     | 2 +-
 drivers/clk/ti/dpll3xxx.c    | 2 +-
 drivers/clk/ti/mux.c         | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/ti/adpll.c b/drivers/clk/ti/adpll.c
index 688e403..0c21098 100644
--- a/drivers/clk/ti/adpll.c
+++ b/drivers/clk/ti/adpll.c
@@ -614,7 +614,7 @@ static int ti_adpll_init_clkout(struct ti_adpll_data *d,
 
 	init.name = child_name;
 	init.ops = ops;
-	init.flags = CLK_IS_BASIC;
+	init.flags = 0;
 	co->hw.init = &init;
 	parent_names[0] = __clk_get_name(clk0);
 	parent_names[1] = __clk_get_name(clk1);
diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 40630eb..bf32d99 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -276,7 +276,7 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec,
 	init.parent_names = parents;
 	init.num_parents = num_parents;
 	init.ops = ops;
-	init.flags = CLK_IS_BASIC;
+	init.flags = 0;
 
 	clk = ti_clk_register(NULL, clk_hw, init.name);
 	if (IS_ERR_OR_NULL(clk)) {
diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c
index 07a8051..423a99b 100644
--- a/drivers/clk/ti/clockdomain.c
+++ b/drivers/clk/ti/clockdomain.c
@@ -143,7 +143,7 @@ static void __init of_ti_clockdomain_setup(struct device_node *node)
 			continue;
 		}
 		clk_hw = __clk_get_hw(clk);
-		if (clk_hw_get_flags(clk_hw) & CLK_IS_BASIC) {
+		if (!omap2_clk_is_hw_omap(clk_hw)) {
 			pr_warn("can't setup clkdm for basic clk %s\n",
 				__clk_get_name(clk));
 			continue;
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c
index 8d77090..cb5a819 100644
--- a/drivers/clk/ti/divider.c
+++ b/drivers/clk/ti/divider.c
@@ -336,7 +336,7 @@ static struct clk *_register_divider(struct device *dev, const char *name,
 
 	init.name = name;
 	init.ops = &ti_clk_divider_ops;
-	init.flags = flags | CLK_IS_BASIC;
+	init.flags = flags;
 	init.parent_names = (parent_name ? &parent_name : NULL);
 	init.num_parents = (parent_name ? 1 : 0);
 
diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c
index 44b6b64..3dde6c8 100644
--- a/drivers/clk/ti/dpll3xxx.c
+++ b/drivers/clk/ti/dpll3xxx.c
@@ -731,7 +731,7 @@ static struct clk_hw_omap *omap3_find_clkoutx2_dpll(struct clk_hw *hw)
 	do {
 		do {
 			hw = clk_hw_get_parent(hw);
-		} while (hw && (clk_hw_get_flags(hw) & CLK_IS_BASIC));
+		} while (hw && (!omap2_clk_is_hw_omap(hw)));
 		if (!hw)
 			break;
 		pclk = to_clk_hw_omap(hw);
diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c
index 883bdde..b7f9a4f 100644
--- a/drivers/clk/ti/mux.c
+++ b/drivers/clk/ti/mux.c
@@ -143,7 +143,7 @@ static struct clk *_register_mux(struct device *dev, const char *name,
 
 	init.name = name;
 	init.ops = &ti_clk_mux_ops;
-	init.flags = flags | CLK_IS_BASIC;
+	init.flags = flags;
 	init.parent_names = parent_names;
 	init.num_parents = num_parents;
 
-- 
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* [PATCH 4/4] clk: ti: generalize the init sequence of clk_hw_omap clocks
  2019-01-15  9:15 [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tero Kristo
                   ` (2 preceding siblings ...)
  2019-01-15  9:15 ` [PATCH 3/4] clk: ti: remove usage of CLK_IS_BASIC Tero Kristo
@ 2019-01-15  9:15 ` Tero Kristo
  2019-01-15 18:20 ` [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tony Lindgren
  2019-02-22 19:50 ` Stephen Boyd
  5 siblings, 0 replies; 13+ messages in thread
From: Tero Kristo @ 2019-01-15  9:15 UTC (permalink / raw)
  To: linux-clk, sboyd, mturquette; +Cc: linux-omap, tony

Add a generic API for initializing clocks of clk_hw_omap type clocks,
and convert the whole TI clock driver suite to use this for registering
the clocks. Also, get rid of the now redundant API for adding the clocks
to the OMAP HW clocks list; instead this is used directly from the
register API.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
---
 drivers/clk/ti/apll.c      |  4 ++--
 drivers/clk/ti/clk.c       | 31 +++++++++++++++++++++----------
 drivers/clk/ti/clock.h     |  3 ++-
 drivers/clk/ti/dpll.c      | 11 ++++-------
 drivers/clk/ti/gate.c      |  2 +-
 drivers/clk/ti/interface.c |  4 +---
 6 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c
index 222f68b..015a657 100644
--- a/drivers/clk/ti/apll.c
+++ b/drivers/clk/ti/apll.c
@@ -165,7 +165,7 @@ static void __init omap_clk_register_apll(void *user,
 
 	ad->clk_bypass = __clk_get_hw(clk);
 
-	clk = ti_clk_register(NULL, &clk_hw->hw, node->name);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		kfree(clk_hw->hw.init->parent_names);
@@ -402,7 +402,7 @@ static void __init of_omap2_apll_setup(struct device_node *node)
 	if (ret)
 		goto cleanup;
 
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		kfree(init);
diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index 05f9d1a..e26cd1d 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -520,20 +520,31 @@ struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
 }
 
 /**
- * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
- * @hw: struct clk_hw * to initialize
+ * ti_clk_register_omap_hw - register a clk_hw_omap to the clock framework
+ * @dev: device for this clock
+ * @hw: hardware clock handle
+ * @con: connection ID for this clock
  *
- * Add an OMAP clock @clk to the internal list of OMAP clocks.  Used
- * temporarily for autoidle handling, until this support can be
- * integrated into the common clock framework code in some way.  No
- * return value.
+ * Registers a clk_hw_omap clock to the clock framewor, adds a clock alias
+ * for it, and adds the list to the available clk_hw_omap type clocks.
+ * Returns a handle to the registered clock if successful, ERR_PTR value
+ * in failure.
  */
-void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw)
+struct clk *ti_clk_register_omap_hw(struct device *dev, struct clk_hw *hw,
+				    const char *con)
 {
-	struct clk_hw_omap *c;
+	struct clk *clk;
+	struct clk_hw_omap *oclk;
 
-	c = to_clk_hw_omap(hw);
-	list_add(&c->node, &clk_hw_omap_clocks);
+	clk = ti_clk_register(dev, hw, con);
+	if (IS_ERR(clk))
+		return clk;
+
+	oclk = to_clk_hw_omap(hw);
+
+	list_add(&oclk->node, &clk_hw_omap_clocks);
+
+	return clk;
 }
 
 /**
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
index 034ff6a..1c0fac5 100644
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -203,6 +203,8 @@ struct omap_clkctrl_data {
 
 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);
 int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con);
 void ti_clk_add_aliases(void);
 
@@ -221,7 +223,6 @@ int ti_clk_retry_init(struct device_node *node, void *user,
 		      ti_of_clk_init_cb_t func);
 int ti_clk_add_component(struct device_node *node, struct clk_hw *hw, int type);
 
-void omap2_init_clk_hw_omap_clocks(struct clk_hw *hw);
 int of_ti_clk_autoidle_setup(struct device_node *node);
 void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
 
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
index 6c3329b..659dadb 100644
--- a/drivers/clk/ti/dpll.c
+++ b/drivers/clk/ti/dpll.c
@@ -192,10 +192,9 @@ static void __init _register_dpll(void *user,
 	dd->clk_bypass = __clk_get_hw(clk);
 
 	/* register the clock */
-	clk = ti_clk_register(NULL, &clk_hw->hw, node->name);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, node->name);
 
 	if (!IS_ERR(clk)) {
-		omap2_init_clk_hw_omap_clocks(&clk_hw->hw);
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		kfree(clk_hw->hw.init->parent_names);
 		kfree(clk_hw->hw.init);
@@ -265,14 +264,12 @@ static void _register_dpll_x2(struct device_node *node,
 #endif
 
 	/* register the clock */
-	clk = ti_clk_register(NULL, &clk_hw->hw, name);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name);
 
-	if (IS_ERR(clk)) {
+	if (IS_ERR(clk))
 		kfree(clk_hw);
-	} else {
-		omap2_init_clk_hw_omap_clocks(&clk_hw->hw);
+	else
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
-	}
 }
 #endif
 
diff --git a/drivers/clk/ti/gate.c b/drivers/clk/ti/gate.c
index 1c78fff..504c0e9 100644
--- a/drivers/clk/ti/gate.c
+++ b/drivers/clk/ti/gate.c
@@ -123,7 +123,7 @@ static struct clk *_register_gate(struct device *dev, const char *name,
 
 	init.flags = flags;
 
-	clk = ti_clk_register(NULL, &clk_hw->hw, name);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name);
 
 	if (IS_ERR(clk))
 		kfree(clk_hw);
diff --git a/drivers/clk/ti/interface.c b/drivers/clk/ti/interface.c
index 87e00c2..83e3442 100644
--- a/drivers/clk/ti/interface.c
+++ b/drivers/clk/ti/interface.c
@@ -57,12 +57,10 @@ static struct clk *_register_interface(struct device *dev, const char *name,
 	init.num_parents = 1;
 	init.parent_names = &parent_name;
 
-	clk = ti_clk_register(NULL, &clk_hw->hw, name);
+	clk = ti_clk_register_omap_hw(NULL, &clk_hw->hw, name);
 
 	if (IS_ERR(clk))
 		kfree(clk_hw);
-	else
-		omap2_init_clk_hw_omap_clocks(&clk_hw->hw);
 
 	return clk;
 }
-- 
1.9.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-01-15  9:15 [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tero Kristo
                   ` (3 preceding siblings ...)
  2019-01-15  9:15 ` [PATCH 4/4] clk: ti: generalize the init sequence of clk_hw_omap clocks Tero Kristo
@ 2019-01-15 18:20 ` Tony Lindgren
  2019-01-15 18:31   ` Tero Kristo
  2019-02-22 19:50 ` Stephen Boyd
  5 siblings, 1 reply; 13+ messages in thread
From: Tony Lindgren @ 2019-01-15 18:20 UTC (permalink / raw)
  To: Tero Kristo; +Cc: linux-clk, sboyd, mturquette, linux-omap, Andreas Kemnade

* Tero Kristo <t-kristo@ti.com> [190115 09:15]:
> Hi Stephen,
> 
> As requested, this series gets rid of CLK_IS_BASIC flag usage from
> TI clock drivers.
> 
> Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
> suspend/resume test on omap3/omap4/am5.

Does this also fix the issue Andreas was fixing earlier
or is this separate clean-up?

Regards,

Tony

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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-01-15 18:20 ` [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tony Lindgren
@ 2019-01-15 18:31   ` Tero Kristo
  2019-01-15 20:24     ` Andreas Kemnade
  2019-01-21 19:58     ` Tony Lindgren
  0 siblings, 2 replies; 13+ messages in thread
From: Tero Kristo @ 2019-01-15 18:31 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-clk, sboyd, mturquette, linux-omap, Andreas Kemnade

On 15/01/2019 20:20, Tony Lindgren wrote:
> * Tero Kristo <t-kristo@ti.com> [190115 09:15]:
>> Hi Stephen,
>>
>> As requested, this series gets rid of CLK_IS_BASIC flag usage from
>> TI clock drivers.
>>
>> Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
>> suspend/resume test on omap3/omap4/am5.
> 
> Does this also fix the issue Andreas was fixing earlier
> or is this separate clean-up?

The series from Andreas would be needed on top of this.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-01-15 18:31   ` Tero Kristo
@ 2019-01-15 20:24     ` Andreas Kemnade
  2019-01-21 19:58     ` Tony Lindgren
  1 sibling, 0 replies; 13+ messages in thread
From: Andreas Kemnade @ 2019-01-15 20:24 UTC (permalink / raw)
  To: Tero Kristo; +Cc: Tony Lindgren, linux-clk, sboyd, mturquette, linux-omap

[-- Attachment #1: Type: text/plain, Size: 705 bytes --]

Hi Tero,

On Tue, 15 Jan 2019 20:31:54 +0200
Tero Kristo <t-kristo@ti.com> wrote:

> On 15/01/2019 20:20, Tony Lindgren wrote:
> > * Tero Kristo <t-kristo@ti.com> [190115 09:15]:  
> >> Hi Stephen,
> >>
> >> As requested, this series gets rid of CLK_IS_BASIC flag usage from
> >> TI clock drivers.
> >>
> >> Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
> >> suspend/resume test on omap3/omap4/am5.  
> > 
> > Does this also fix the issue Andreas was fixing earlier
> > or is this separate clean-up?  
> 
> The series from Andreas would be needed on top of this.
> 
thanks for this cleanup. I will rebase my work upon it the next days.

Regards,
Andreas

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-01-15 18:31   ` Tero Kristo
  2019-01-15 20:24     ` Andreas Kemnade
@ 2019-01-21 19:58     ` Tony Lindgren
  2019-02-15 19:19       ` Tero Kristo
  1 sibling, 1 reply; 13+ messages in thread
From: Tony Lindgren @ 2019-01-21 19:58 UTC (permalink / raw)
  To: Tero Kristo; +Cc: linux-clk, sboyd, mturquette, linux-omap, Andreas Kemnade

* Tero Kristo <t-kristo@ti.com> [190115 18:32]:
> On 15/01/2019 20:20, Tony Lindgren wrote:
> > * Tero Kristo <t-kristo@ti.com> [190115 09:15]:
> > > Hi Stephen,
> > > 
> > > As requested, this series gets rid of CLK_IS_BASIC flag usage from
> > > TI clock drivers.
> > > 
> > > Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
> > > suspend/resume test on omap3/omap4/am5.
> > 
> > Does this also fix the issue Andreas was fixing earlier
> > or is this separate clean-up?
> 
> The series from Andreas would be needed on top of this.

OK so I acked Andreas' series, and here's an ack for
this series too:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-01-21 19:58     ` Tony Lindgren
@ 2019-02-15 19:19       ` Tero Kristo
  0 siblings, 0 replies; 13+ messages in thread
From: Tero Kristo @ 2019-02-15 19:19 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-clk, sboyd, mturquette, linux-omap, Andreas Kemnade

On 21/01/2019 21:58, Tony Lindgren wrote:
> * Tero Kristo <t-kristo@ti.com> [190115 18:32]:
>> On 15/01/2019 20:20, Tony Lindgren wrote:
>>> * Tero Kristo <t-kristo@ti.com> [190115 09:15]:
>>>> Hi Stephen,
>>>>
>>>> As requested, this series gets rid of CLK_IS_BASIC flag usage from
>>>> TI clock drivers.
>>>>
>>>> Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
>>>> suspend/resume test on omap3/omap4/am5.
>>>
>>> Does this also fix the issue Andreas was fixing earlier
>>> or is this separate clean-up?
>>
>> The series from Andreas would be needed on top of this.
> 
> OK so I acked Andreas' series, and here's an ack for
> this series too:
> 
> Acked-by: Tony Lindgren <tony@atomide.com>
> 

Queued up for 5.1, thanks.

-Tero
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-01-15  9:15 [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tero Kristo
                   ` (4 preceding siblings ...)
  2019-01-15 18:20 ` [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tony Lindgren
@ 2019-02-22 19:50 ` Stephen Boyd
  2019-02-25  7:18   ` Tero Kristo
  5 siblings, 1 reply; 13+ messages in thread
From: Stephen Boyd @ 2019-02-22 19:50 UTC (permalink / raw)
  To: Tero Kristo, linux-clk, mturquette; +Cc: linux-omap, tony

Quoting Tero Kristo (2019-01-15 01:15:11)
> Hi Stephen,
> 
> As requested, this series gets rid of CLK_IS_BASIC flag usage from
> TI clock drivers.
> 
> Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
> suspend/resume test on omap3/omap4/am5.
> 

I'm looking at clk-next now that this is all merged in and I still see
one usage of CLK_IS_BASIC in the omap2 hwmod code.

arch/arm/mach-omap2/omap_hwmod.c:               if (__clk_get_flags(oh->_clk) & CLK_IS_BASIC)

Can that also be removed? If not, what clk types are on this platform?
Maybe I can remove CLK_IS_BASIC from every clk type except for the ones
that this code is checking for.


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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-02-22 19:50 ` Stephen Boyd
@ 2019-02-25  7:18   ` Tero Kristo
  2019-02-25 17:12     ` Stephen Boyd
  0 siblings, 1 reply; 13+ messages in thread
From: Tero Kristo @ 2019-02-25  7:18 UTC (permalink / raw)
  To: Stephen Boyd, linux-clk, mturquette; +Cc: linux-omap, tony

On 22/02/2019 21:50, Stephen Boyd wrote:
> Quoting Tero Kristo (2019-01-15 01:15:11)
>> Hi Stephen,
>>
>> As requested, this series gets rid of CLK_IS_BASIC flag usage from
>> TI clock drivers.
>>
>> Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
>> suspend/resume test on omap3/omap4/am5.
>>
> 
> I'm looking at clk-next now that this is all merged in and I still see
> one usage of CLK_IS_BASIC in the omap2 hwmod code.
> 
> arch/arm/mach-omap2/omap_hwmod.c:               if (__clk_get_flags(oh->_clk) & CLK_IS_BASIC)
> 
> Can that also be removed? If not, what clk types are on this platform?
> Maybe I can remove CLK_IS_BASIC from every clk type except for the ones
> that this code is checking for.
> 

Hmm, I missed this in my update, only looked at the drivers/clk/ti 
portion of code. However, this can be fixed with the following patch, I 
would need to export the omap2_clk_is_hw_omap() func from the driver and 
call it from the omap2 platform code. What do you think? Shall I post 
this as an official change? This one still has the issue that I am 
calling __clk_get_hw() though.

---


diff --git a/arch/arm/mach-omap2/omap_hwmod.c 
b/arch/arm/mach-omap2/omap_hwmod.c
index 3a04c73..baadddf 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -648,10 +648,10 @@ static struct clockdomain *_get_clkdm(struct 
omap_hwmod *oh)
  	if (oh->clkdm) {
  		return oh->clkdm;
  	} else if (oh->_clk) {
-		if (__clk_get_flags(oh->_clk) & CLK_IS_BASIC)
+		if (!omap2_clk_is_hw_omap(__clk_get_hw(oh->_clk)))
  			return NULL;
  		clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
-		return  clk->clkdm;
+		return clk->clkdm;
  	}
  	return NULL;
  }
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
index 1c0fac5..4223a39 100644
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -303,7 +303,6 @@ long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
  int omap4_dpll_regm4xen_determine_rate(struct clk_hw *hw,
  				       struct clk_rate_request *req);
  int omap2_clk_for_each(int (*fn)(struct clk_hw_omap *hw));
-bool omap2_clk_is_hw_omap(struct clk_hw *hw);

  extern struct ti_clk_ll_ops *ti_clk_ll_ops;

diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h
index 78872ef..2821f7c 100644
--- a/include/linux/clk/ti.h
+++ b/include/linux/clk/ti.h
@@ -243,6 +243,7 @@ struct ti_clk_ll_ops {

  #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)

+bool omap2_clk_is_hw_omap(struct clk_hw *hw);
  int omap2_clk_disable_autoidle_all(void);
  int omap2_clk_enable_autoidle_all(void);
  int omap2_clk_allow_idle(struct clk *clk);
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC
  2019-02-25  7:18   ` Tero Kristo
@ 2019-02-25 17:12     ` Stephen Boyd
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Boyd @ 2019-02-25 17:12 UTC (permalink / raw)
  To: Tero Kristo, linux-clk, mturquette; +Cc: linux-omap, tony

Quoting Tero Kristo (2019-02-24 23:18:57)
> On 22/02/2019 21:50, Stephen Boyd wrote:
> > Quoting Tero Kristo (2019-01-15 01:15:11)
> >> Hi Stephen,
> >>
> >> As requested, this series gets rid of CLK_IS_BASIC flag usage from
> >> TI clock drivers.
> >>
> >> Boot tested on am3/am4/am5/omap3/omap4 series of SoCs. Also, ran a quick
> >> suspend/resume test on omap3/omap4/am5.
> >>
> > 
> > I'm looking at clk-next now that this is all merged in and I still see
> > one usage of CLK_IS_BASIC in the omap2 hwmod code.
> > 
> > arch/arm/mach-omap2/omap_hwmod.c:               if (__clk_get_flags(oh->_clk) & CLK_IS_BASIC)
> > 
> > Can that also be removed? If not, what clk types are on this platform?
> > Maybe I can remove CLK_IS_BASIC from every clk type except for the ones
> > that this code is checking for.
> > 
> 
> Hmm, I missed this in my update, only looked at the drivers/clk/ti 
> portion of code. However, this can be fixed with the following patch, I 
> would need to export the omap2_clk_is_hw_omap() func from the driver and 
> call it from the omap2 platform code. What do you think? Shall I post 
> this as an official change? This one still has the issue that I am 
> calling __clk_get_hw() though.

Looks ok to me. Please post it as an official change. I think we should
look into making clk domains with genpds and plumb that through the clk
framework so that devices calling clk_get() can have their domains
attached automatically on clk_get(). Maybe that would help here. Not
sure.


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

end of thread, other threads:[~2019-02-25 17:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15  9:15 [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tero Kristo
2019-01-15  9:15 ` [PATCH 1/4] clk: ti: move clk_hw_omap list handling under generic part of the driver Tero Kristo
2019-01-15  9:15 ` [PATCH 2/4] clk: ti: add new API for checking if a provided clock is an OMAP clock Tero Kristo
2019-01-15  9:15 ` [PATCH 3/4] clk: ti: remove usage of CLK_IS_BASIC Tero Kristo
2019-01-15  9:15 ` [PATCH 4/4] clk: ti: generalize the init sequence of clk_hw_omap clocks Tero Kristo
2019-01-15 18:20 ` [PATCH 0/4] clk: ti: get rid of CLK_IS_BASIC Tony Lindgren
2019-01-15 18:31   ` Tero Kristo
2019-01-15 20:24     ` Andreas Kemnade
2019-01-21 19:58     ` Tony Lindgren
2019-02-15 19:19       ` Tero Kristo
2019-02-22 19:50 ` Stephen Boyd
2019-02-25  7:18   ` Tero Kristo
2019-02-25 17:12     ` 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).