Skip to contentSkip to conversation

clk: ti: cleanups for 4.12 merge window

PATCH New Tero Kristo 3 participants 29 messages Mar 11, 2017 – Jan 22, 2018

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover clk: ti: cleanups for 4.12 merge window

Hi,

This series is basically just a rebase of v1 of the same, with Tony's acks added.

https://www.spinics.net/lists/arm-kernel/msg562362.html

Boot tested on the omap2+ boards I have access to, no issues seen caused by this series.

am335x-evm : boot ok
am335x-evmsk : boot ok
am37x-evm : boot ok
am437x-sk : boot ok
am437x-gp-evm : boot ok
am57xx-evm : boot ok
omap3-beagle-xm : boot ok
omap3-beagle : boot ok
am335x-boneblack: boot ok
am335x-bone : boot ok
dra72x-evm : BOOT FAIL! (farm issue, failed to mount NFS rootfs)
dra7xx-evm : boot ok
ldp3430 : BOOT FAIL! (farm issue, bootloader ethernet failure)
omap3-n900 : boot ok
omap5-uevm : boot ok
omap4-panda-es : boot ok
omap4-panda : boot ok
omap2430-sdp : boot ok
omap3430-sdp : boot ok
omap4-sdp-es23plus: boot ok

Branch available on top of 4.11-rc1 here:

tree: https://github.com/t-kristo/linux-pm.git
branch: for-4.12-ti-clk-cleanups

-Tero

#1 lore raw

PATCH v2 1/15 clk: ti: remove un-used definitions from public clk_hw_omap struct

Clksel support has been deprecated a while back, so remove these from the struct also.

---
 include/linux/clk/ti.h | 4 ----
 1 file changed, 4 deletions(-)
include/linux/clk/ti.h +0 -4
index 6110fe0..07308db 100644
@@ -129,8 +129,6 @@ struct clk_hw_omap_ops {
  * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
  * @flags: see "struct clk.flags possibilities" above
  * @clksel_reg: for clksel clks, register va containing src/divisor select
- * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
- * @clksel: for clksel clks, pointer to struct clksel for this clock
  * @dpll_data: for DPLLs, pointer to struct dpll_data for this clock
  * @clkdm_name: clockdomain name that this clock is contained in
  * @clkdm: pointer to struct clockdomain, resolved from @clkdm_name at runtime
@@ -145,8 +143,6 @@ struct clk_hw_omap {
 	u8			enable_bit;
 	u8			flags;
 	void __iomem		*clksel_reg;
-	u32			clksel_mask;
-	const struct clksel	*clksel;
 	struct dpll_data	*dpll_data;
 	const char		*clkdm_name;
 	struct clockdomain	*clkdm;
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/15 clk: ti: add support for automatic clock alias generation

In reply to Tero Kristo

Large portions of the OMAP framework still depend on the support of having clock aliases in place, so add support functions for generating these automatically.

---
 drivers/clk/ti/clk.c   | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/ti/clock.h |  3 +++
 2 files changed, 67 insertions(+)
drivers/clk/ti/clk.c +64 -0
index 5fcf247..91bad55 100644
@@ -24,6 +24,7 @@
 #include <linux/list.h>
 #include <linux/regmap.h>
 #include <linux/bootmem.h>
+#include <linux/device.h>
 
 #include "clock.h"
 
@@ -453,3 +454,66 @@ void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
 		clk_prepare_enable(init_clk);
 	}
 }
+
+/**
+ * ti_clk_add_alias - add a clock alias for a TI clock
+ * @dev: device alias for this clock
+ * @clk: clock handle to create alias for
+ * @con: connection ID for this clock
+ *
+ * Creates a clock alias for a TI clock. Allocates the clock lookup entry
+ * and assigns the data to it. Returns 0 if successful, negative error
+ * value otherwise.
+ */
+int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con)
+{
+	struct clk_lookup *cl;
+
+	if (!clk)
+		return 0;
+
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
+
+	cl = kzalloc(sizeof(*cl), GFP_KERNEL);
+	if (!cl)
+		return -ENOMEM;
+
+	if (dev)
+		cl->dev_id = dev_name(dev);
+	cl->con_id = con;
+	cl->clk = clk;
+
+	clkdev_add(cl);
+
+	return 0;
+}
+
+/**
+ * ti_clk_register - register a TI clock to the common clock framework
+ * @dev: device for this clock
+ * @hw: hardware clock handle
+ * @con: connection ID for this clock
+ *
+ * Registers a TI clock to the common clock framework, and adds a clock
+ * alias for it. Returns a handle to the registered clock if successful,
+ * ERR_PTR value in failure.
+ */
+struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
+			    const char *con)
+{
+	struct clk *clk;
+	int ret;
+
+	clk = clk_register(dev, hw);
+	if (IS_ERR(clk))
+		return clk;
+
+	ret = ti_clk_add_alias(dev, clk, con);
+	if (ret) {
+		clk_unregister(clk);
+		return ERR_PTR(ret);
+	}
+
+	return clk;
+}
drivers/clk/ti/clock.h +3 -0
index 13c37f4..c38de6d 100644
@@ -189,6 +189,9 @@ struct ti_dt_clk {
 struct clk *ti_clk_register_divider(struct ti_clk *setup);
 struct clk *ti_clk_register_composite(struct ti_clk *setup);
 struct clk *ti_clk_register_dpll(struct ti_clk *setup);
+struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
+			    const char *con);
+int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con);
 
 struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup);
 struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup);
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 3/15 clk: ti: add API for creating aliases automatically for simple clock types

In reply to Tero Kristo

This API generates clock aliases automatically for simple clock types (fixed-clock, fixed-factor-clock), so that we don't need to add the data for these statically into tables. Shall be called from the SoC specific clock init.

---
 drivers/clk/ti/clk.c   | 26 ++++++++++++++++++++++++++
 drivers/clk/ti/clock.h |  1 +
 2 files changed, 27 insertions(+)
drivers/clk/ti/clk.c +26 -0
index 91bad55..193862e 100644
@@ -355,6 +355,12 @@ struct clk __init *ti_clk_register_clk(struct ti_clk *setup)
 	return clk;
 }
 
+static const struct of_device_id simple_clk_match_table[] __initconst = {
+	{ .compatible = "fixed-clock" },
+	{ .compatible = "fixed-factor-clock" },
+	{ }
+};
+
 int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
 {
 	struct clk *clk;
@@ -409,6 +415,26 @@ int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
 #endif
 
 /**
+ * ti_clk_add_aliases - setup clock aliases
+ *
+ * Sets up any missing clock aliases. No return value.
+ */
+void __init ti_clk_add_aliases(void)
+{
+	struct device_node *np;
+	struct clk *clk;
+
+	for_each_matching_node(np, simple_clk_match_table) {
+		struct of_phandle_args clkspec;
+
+		clkspec.np = np;
+		clk = of_clk_get_from_provider(&clkspec);
+
+		ti_clk_add_alias(NULL, clk, np->name);
+	}
+}
+
+/**
  * ti_clk_setup_features - setup clock features flags
  * @features: features definition to use
  *
drivers/clk/ti/clock.h +1 -0
index c38de6d..ee6d225 100644
@@ -192,6 +192,7 @@ struct ti_dt_clk {
 struct clk *ti_clk_register(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);
 
 struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup);
 struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup);
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 4/15 clk: ti: use automatic clock alias generation framework

In reply to Tero Kristo

Generate clock aliases automatically for all TI clock drivers.

---
 drivers/clk/ti/apll.c         |  2 +-
 drivers/clk/ti/clk-dra7-atl.c | 11 ++++++++++-
 drivers/clk/ti/clk.c          | 20 +++++++++++++++-----
 drivers/clk/ti/composite.c    | 16 +++++++++++++++-
 drivers/clk/ti/divider.c      |  2 +-
 drivers/clk/ti/dpll.c         |  6 +++---
 drivers/clk/ti/fixed-factor.c |  1 +
 drivers/clk/ti/gate.c         |  2 +-
 drivers/clk/ti/interface.c    |  2 +-
 drivers/clk/ti/mux.c          |  2 +-
 10 files changed, 49 insertions(+), 15 deletions(-)
drivers/clk/ti/apll.c +1 -1
index 6411e13..62b5db7 100644
@@ -164,7 +164,7 @@ static void __init omap_clk_register_apll(struct clk_hw *hw,
 
 	ad->clk_bypass = __clk_get_hw(clk);
 
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register(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);
drivers/clk/ti/clk-dra7-atl.c +10 -1
index 45d0533..13eb04f7 100644
@@ -24,6 +24,9 @@
 #include <linux/of_address.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/clk/ti.h>
+
+#include "clock.h"
 
 #define DRA7_ATL_INSTANCES	4
 
@@ -171,6 +174,7 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 	struct clk_init_data init = { NULL };
 	const char **parent_names = NULL;
 	struct clk *clk;
+	int ret;
 
 	clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
 	if (!clk_hw) {
@@ -200,9 +204,14 @@ static void __init of_dra7_atl_clock_setup(struct device_node *node)
 
 	init.parent_names = parent_names;
 
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register(NULL, &clk_hw->hw, node->name);
 
 	if (!IS_ERR(clk)) {
+		ret = ti_clk_add_alias(NULL, clk, node->name);
+		if (ret) {
+			clk_unregister(clk);
+			goto cleanup;
+		}
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		kfree(parent_names);
 		return;
drivers/clk/ti/clk.c +15 -5
index 193862e..024123f 100644
@@ -298,6 +298,7 @@ struct clk __init *ti_clk_register_clk(struct ti_clk *setup)
 	struct ti_clk_fixed *fixed;
 	struct ti_clk_fixed_factor *fixed_factor;
 	struct clk_hw *clk_hw;
+	int ret;
 
 	if (setup->clk)
 		return setup->clk;
@@ -308,6 +309,13 @@ struct clk __init *ti_clk_register_clk(struct ti_clk *setup)
 
 		clk = clk_register_fixed_rate(NULL, setup->name, NULL, 0,
 					      fixed->frequency);
+		if (!IS_ERR(clk)) {
+			ret = ti_clk_add_alias(NULL, clk, setup->name);
+			if (ret) {
+				clk_unregister(clk);
+				clk = ERR_PTR(ret);
+			}
+		}
 		break;
 	case TI_CLK_MUX:
 		clk = ti_clk_register_mux(setup);
@@ -325,6 +333,13 @@ struct clk __init *ti_clk_register_clk(struct ti_clk *setup)
 						fixed_factor->parent,
 						0, fixed_factor->mult,
 						fixed_factor->div);
+		if (!IS_ERR(clk)) {
+			ret = ti_clk_add_alias(NULL, clk, setup->name);
+			if (ret) {
+				clk_unregister(clk);
+				clk = ERR_PTR(ret);
+			}
+		}
 		break;
 	case TI_CLK_GATE:
 		clk = ti_clk_register_gate(setup);
@@ -378,9 +393,6 @@ int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
 				       clks->clk->name, PTR_ERR(clk));
 				return PTR_ERR(clk);
 			}
-		} else {
-			clks->lk.clk = clk;
-			clkdev_add(&clks->lk);
 		}
 		clks++;
 	}
@@ -403,8 +415,6 @@ int __init ti_clk_register_legacy_clks(struct ti_clk_alias *clks)
 				}
 			} else {
 				retry = true;
-				retry_clk->lk.clk = clk;
-				clkdev_add(&retry_clk->lk);
 				list_del(&retry_clk->link);
 			}
 		}
drivers/clk/ti/composite.c +15 -1
index 1cf70f4..3f60f99 100644
@@ -126,6 +126,7 @@ struct clk *ti_clk_register_composite(struct ti_clk *setup)
 	int num_parents = 1;
 	const char **parent_names = NULL;
 	struct clk *clk;
+	int ret;
 
 	comp = setup->data;
 
@@ -150,6 +151,12 @@ struct clk *ti_clk_register_composite(struct ti_clk *setup)
 				     &ti_composite_divider_ops, gate,
 				     &ti_composite_gate_ops, 0);
 
+	ret = ti_clk_add_alias(NULL, clk, setup->name);
+	if (ret) {
+		clk_unregister(clk);
+		return ERR_PTR(ret);
+	}
+
 	return clk;
 }
 #endif
@@ -163,6 +170,7 @@ static void __init _register_composite(struct clk_hw *hw,
 	int num_parents = 0;
 	const char **parent_names = NULL;
 	int i;
+	int ret;
 
 	/* Check for presence of each component clock */
 	for (i = 0; i < CLK_COMPONENT_TYPE_MAX; i++) {
@@ -217,8 +225,14 @@ static void __init _register_composite(struct clk_hw *hw,
 				     _get_hw(cclk, CLK_COMPONENT_TYPE_GATE),
 				     &ti_composite_gate_ops, 0);
 
-	if (!IS_ERR(clk))
+	if (!IS_ERR(clk)) {
+		ret = ti_clk_add_alias(NULL, clk, node->name);
+		if (ret) {
+			clk_unregister(clk);
+			goto cleanup;
+		}
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
+	}
 
 cleanup:
 	/* Free component clock list entries */
drivers/clk/ti/divider.c +1 -1
index 6bb8778..0e8c136 100644
@@ -311,7 +311,7 @@ static struct clk *_register_divider(struct device *dev, const char *name,
 	div->table = table;
 
 	/* register the clock */
-	clk = clk_register(dev, &div->hw);
+	clk = ti_clk_register(dev, &div->hw, name);
 
 	if (IS_ERR(clk))
 		kfree(div);
drivers/clk/ti/dpll.c +3 -3
index 4b9a419..37624e1 100644
@@ -185,7 +185,7 @@ static void __init _register_dpll(struct clk_hw *hw,
 	dd->clk_bypass = __clk_get_hw(clk);
 
 	/* register the clock */
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register(NULL, &clk_hw->hw, node->name);
 
 	if (!IS_ERR(clk)) {
 		omap2_init_clk_hw_omap_clocks(&clk_hw->hw);
@@ -288,7 +288,7 @@ struct clk *ti_clk_register_dpll(struct ti_clk *setup)
 	if (dpll->flags & CLKF_J_TYPE)
 		dd->flags |= DPLL_J_TYPE;
 
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register(NULL, &clk_hw->hw, setup->name);
 
 	if (!IS_ERR(clk))
 		return clk;
@@ -340,7 +340,7 @@ static void _register_dpll_x2(struct device_node *node,
 	init.num_parents = 1;
 
 	/* register the clock */
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register(NULL, &clk_hw->hw, name);
 
 	if (IS_ERR(clk)) {
 		kfree(clk_hw);
drivers/clk/ti/fixed-factor.c +1 -0
index 3cd4067..0174a51 100644
@@ -62,6 +62,7 @@ static void __init of_ti_fixed_factor_clk_setup(struct device_node *node)
 	if (!IS_ERR(clk)) {
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 		of_ti_clk_autoidle_setup(node);
+		ti_clk_add_alias(NULL, clk, clk_name);
 	}
 }
 CLK_OF_DECLARE(ti_fixed_factor_clk, "ti,fixed-factor-clock",
drivers/clk/ti/gate.c +1 -1
index bc05f27..b3291db 100644
@@ -120,7 +120,7 @@ static struct clk *_register_gate(struct device *dev, const char *name,
 
 	init.flags = flags;
 
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register(NULL, &clk_hw->hw, name);
 
 	if (IS_ERR(clk))
 		kfree(clk_hw);
drivers/clk/ti/interface.c +1 -1
index e505e6f..7927e1a 100644
@@ -58,7 +58,7 @@ static struct clk *_register_interface(struct device *dev, const char *name,
 	init.num_parents = 1;
 	init.parent_names = &parent_name;
 
-	clk = clk_register(NULL, &clk_hw->hw);
+	clk = ti_clk_register(NULL, &clk_hw->hw, name);
 
 	if (IS_ERR(clk))
 		kfree(clk_hw);
drivers/clk/ti/mux.c +1 -1
index 44777ab..0da149e 100644
@@ -127,7 +127,7 @@ static struct clk *_register_mux(struct device *dev, const char *name,
 	mux->table = table;
 	mux->hw.init = &init;
 
-	clk = clk_register(dev, &mux->hw);
+	clk = ti_clk_register(dev, &mux->hw, name);
 
 	if (IS_ERR(clk))
 		kfree(mux);
Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 5/15 clk: ti: add clkdm_lookup to the exported functions

In reply to Tero Kristo

This will be needed to move some additional clockdomain functionality under clock driver.

---
 arch/arm/mach-omap2/clock.c | 1 +
 include/linux/clk/ti.h      | 2 ++
 2 files changed, 3 insertions(+)
arch/arm/mach-omap2/clock.c +1 -0
index 1270afd..6fac826 100644
@@ -57,6 +57,7 @@
 static struct ti_clk_ll_ops omap_clk_ll_ops = {
 	.clkdm_clk_enable = clkdm_clk_enable,
 	.clkdm_clk_disable = clkdm_clk_disable,
+	.clkdm_lookup = clkdm_lookup,
 	.cm_wait_module_ready = omap_cm_wait_module_ready,
 	.cm_split_idlest_reg = cm_split_idlest_reg,
 };
include/linux/clk/ti.h +2 -0
index 07308db..bc7fd8f 100644
@@ -213,6 +213,7 @@ struct clk_omap_reg {
  * @clk_writel: pointer to register write function
  * @clkdm_clk_enable: pointer to clockdomain enable function
  * @clkdm_clk_disable: pointer to clockdomain disable function
+ * @clkdm_lookup: pointer to clockdomain lookup function
  * @cm_wait_module_ready: pointer to CM module wait ready function
  * @cm_split_idlest_reg: pointer to CM module function to split idlest reg
  *
@@ -228,6 +229,7 @@ struct ti_clk_ll_ops {
 	int	(*clkdm_clk_enable)(struct clockdomain *clkdm, struct clk *clk);
 	int	(*clkdm_clk_disable)(struct clockdomain *clkdm,
 				     struct clk *clk);
+	struct clockdomain * (*clkdm_lookup)(const char *name);
 	int	(*cm_wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
 					u8 idlest_shift);
 	int	(*cm_split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 6/15 clk: ti: move omap2_init_clk_clkdm under TI clock driver

In reply to Tero Kristo

This is not needed outside the driver, so move it inside it and remove the prototype from the public header also.

---
 arch/arm/mach-omap2/clock.c  | 32 --------------------------------
 drivers/clk/ti/clock.h       |  1 +
 drivers/clk/ti/clockdomain.c | 30 ++++++++++++++++++++++++++++++
 include/linux/clk/ti.h       |  1 -
 4 files changed, 31 insertions(+), 33 deletions(-)
arch/arm/mach-omap2/clock.c +0 -32
index 6fac826..ae5b23c 100644
@@ -79,38 +79,6 @@ int __init omap2_clk_setup_ll_ops(void)
  * OMAP2+ specific clock functions
  */
 
-/* Public functions */
-
-/**
- * omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk
- * @clk: OMAP clock struct ptr to use
- *
- * Convert a clockdomain name stored in a struct clk 'clk' into a
- * clockdomain pointer, and save it into the struct clk.  Intended to be
- * called during clk_register().  No return value.
- */
-void omap2_init_clk_clkdm(struct clk_hw *hw)
-{
-	struct clk_hw_omap *clk = to_clk_hw_omap(hw);
-	struct clockdomain *clkdm;
-	const char *clk_name;
-
-	if (!clk->clkdm_name)
-		return;
-
-	clk_name = __clk_get_name(hw->clk);
-
-	clkdm = clkdm_lookup(clk->clkdm_name);
-	if (clkdm) {
-		pr_debug("clock: associated clk %s to clkdm %s\n",
-			 clk_name, clk->clkdm_name);
-		clk->clkdm = clkdm;
-	} else {
-		pr_debug("clock: could not associate clk %s to clkdm %s\n",
-			 clk_name, clk->clkdm_name);
-	}
-}
-
 /**
  * ti_clk_init_features - init clock features struct for the SoC
  *
drivers/clk/ti/clock.h +1 -0
index ee6d225..ecf82d8 100644
@@ -228,6 +228,7 @@ int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
 extern const struct clk_ops ti_clk_divider_ops;
 extern const struct clk_ops ti_clk_mux_ops;
 
+void omap2_init_clk_clkdm(struct clk_hw *hw);
 int omap2_clkops_enable_clkdm(struct clk_hw *hw);
 void omap2_clkops_disable_clkdm(struct clk_hw *hw);
 
drivers/clk/ti/clockdomain.c +30 -0
index 6cf9dd1..704157d 100644
@@ -103,6 +103,36 @@ void omap2_clkops_disable_clkdm(struct clk_hw *hw)
 	ti_clk_ll_ops->clkdm_clk_disable(clk->clkdm, hw->clk);
 }
 
+/**
+ * omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk
+ * @clk: OMAP clock struct ptr to use
+ *
+ * Convert a clockdomain name stored in a struct clk 'clk' into a
+ * clockdomain pointer, and save it into the struct clk.  Intended to be
+ * called during clk_register().  No return value.
+ */
+void omap2_init_clk_clkdm(struct clk_hw *hw)
+{
+	struct clk_hw_omap *clk = to_clk_hw_omap(hw);
+	struct clockdomain *clkdm;
+	const char *clk_name;
+
+	if (!clk->clkdm_name)
+		return;
+
+	clk_name = __clk_get_name(hw->clk);
+
+	clkdm = ti_clk_ll_ops->clkdm_lookup(clk->clkdm_name);
+	if (clkdm) {
+		pr_debug("clock: associated clk %s to clkdm %s\n",
+			 clk_name, clk->clkdm_name);
+		clk->clkdm = clkdm;
+	} else {
+		pr_debug("clock: could not associate clk %s to clkdm %s\n",
+			 clk_name, clk->clkdm_name);
+	}
+}
+
 static void __init of_ti_clockdomain_setup(struct device_node *node)
 {
 	struct clk *clk;
include/linux/clk/ti.h +0 -1
index bc7fd8f..626ae94 100644
@@ -238,7 +238,6 @@ struct ti_clk_ll_ops {
 
 #define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
 
-void omap2_init_clk_clkdm(struct clk_hw *clk);
 int omap2_clk_disable_autoidle_all(void);
 int omap2_clk_enable_autoidle_all(void);
 int omap2_clk_allow_idle(struct clk *clk);
Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 7/15 clk: ti: enforce const types on string arrays

In reply to Tero Kristo

Constant string arrays should use const char * const instead of just const char *. Change the implementations using these to proper type.

---
 drivers/clk/ti/clock.h     | 2 +-
 drivers/clk/ti/composite.c | 2 +-
 drivers/clk/ti/mux.c       | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/clk/ti/clock.h +1 -1
index ecf82d8..cb906a1 100644
@@ -86,7 +86,7 @@ struct ti_clk_mux {
 	int num_parents;
 	u16 reg;
 	u8 module;
-	const char **parents;
+	const char * const *parents;
 	u16 flags;
 };
 
drivers/clk/ti/composite.c +1 -1
index 3f60f99..beea894 100644
@@ -124,7 +124,7 @@ struct clk *ti_clk_register_composite(struct ti_clk *setup)
 	struct clk_hw *mux;
 	struct clk_hw *div;
 	int num_parents = 1;
-	const char **parent_names = NULL;
+	const char * const *parent_names = NULL;
 	struct clk *clk;
 	int ret;
 
drivers/clk/ti/mux.c +4 -4
index 0da149e..3cc6db4 100644
@@ -97,10 +97,10 @@ static int ti_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 };
 
 static struct clk *_register_mux(struct device *dev, const char *name,
-				 const char **parent_names, u8 num_parents,
-				 unsigned long flags, void __iomem *reg,
-				 u8 shift, u32 mask, u8 clk_mux_flags,
-				 u32 *table)
+				 const char * const *parent_names,
+				 u8 num_parents, unsigned long flags,
+				 void __iomem *reg, u8 shift, u32 mask,
+				 u8 clk_mux_flags, u32 *table)
 {
 	struct clk_mux *mux;
 	struct clk *clk;
Signature · 1 line
1.9.1
#8 lore raw

PATCH v2 8/15 clk: ti: omap4: cleanup unnecessary clock aliases

In reply to Tero Kristo

Cleanup any unnecessary DT_CLK() alias entries from the OMAP4 clock file. Most of these are now handled dynamically by the driver code.

---
 drivers/clk/ti/clk-44xx.c | 188 +---------------------------------------------
 1 file changed, 2 insertions(+), 186 deletions(-)
drivers/clk/ti/clk-44xx.c +2 -186
index 7a8b51b..1c8bb83 100644
@@ -34,196 +34,13 @@
 #define OMAP4_DPLL_USB_DEFFREQ				960000000
 
 static struct ti_dt_clk omap44xx_clks[] = {
-	DT_CLK(NULL, "extalt_clkin_ck", "extalt_clkin_ck"),
-	DT_CLK(NULL, "pad_clks_src_ck", "pad_clks_src_ck"),
-	DT_CLK(NULL, "pad_clks_ck", "pad_clks_ck"),
-	DT_CLK(NULL, "pad_slimbus_core_clks_ck", "pad_slimbus_core_clks_ck"),
-	DT_CLK(NULL, "secure_32k_clk_src_ck", "secure_32k_clk_src_ck"),
-	DT_CLK(NULL, "slimbus_src_clk", "slimbus_src_clk"),
-	DT_CLK(NULL, "slimbus_clk", "slimbus_clk"),
-	DT_CLK(NULL, "sys_32k_ck", "sys_32k_ck"),
-	DT_CLK(NULL, "virt_12000000_ck", "virt_12000000_ck"),
-	DT_CLK(NULL, "virt_13000000_ck", "virt_13000000_ck"),
-	DT_CLK(NULL, "virt_16800000_ck", "virt_16800000_ck"),
-	DT_CLK(NULL, "virt_19200000_ck", "virt_19200000_ck"),
-	DT_CLK(NULL, "virt_26000000_ck", "virt_26000000_ck"),
-	DT_CLK(NULL, "virt_27000000_ck", "virt_27000000_ck"),
-	DT_CLK(NULL, "virt_38400000_ck", "virt_38400000_ck"),
-	DT_CLK(NULL, "sys_clkin_ck", "sys_clkin_ck"),
-	DT_CLK(NULL, "tie_low_clock_ck", "tie_low_clock_ck"),
-	DT_CLK(NULL, "utmi_phy_clkout_ck", "utmi_phy_clkout_ck"),
-	DT_CLK(NULL, "xclk60mhsp1_ck", "xclk60mhsp1_ck"),
-	DT_CLK(NULL, "xclk60mhsp2_ck", "xclk60mhsp2_ck"),
-	DT_CLK(NULL, "xclk60motg_ck", "xclk60motg_ck"),
-	DT_CLK(NULL, "abe_dpll_bypass_clk_mux_ck", "abe_dpll_bypass_clk_mux_ck"),
-	DT_CLK(NULL, "abe_dpll_refclk_mux_ck", "abe_dpll_refclk_mux_ck"),
-	DT_CLK(NULL, "dpll_abe_ck", "dpll_abe_ck"),
-	DT_CLK(NULL, "dpll_abe_x2_ck", "dpll_abe_x2_ck"),
-	DT_CLK(NULL, "dpll_abe_m2x2_ck", "dpll_abe_m2x2_ck"),
-	DT_CLK(NULL, "abe_24m_fclk", "abe_24m_fclk"),
-	DT_CLK(NULL, "abe_clk", "abe_clk"),
-	DT_CLK(NULL, "aess_fclk", "aess_fclk"),
-	DT_CLK(NULL, "dpll_abe_m3x2_ck", "dpll_abe_m3x2_ck"),
-	DT_CLK(NULL, "core_hsd_byp_clk_mux_ck", "core_hsd_byp_clk_mux_ck"),
-	DT_CLK(NULL, "dpll_core_ck", "dpll_core_ck"),
-	DT_CLK(NULL, "dpll_core_x2_ck", "dpll_core_x2_ck"),
-	DT_CLK(NULL, "dpll_core_m6x2_ck", "dpll_core_m6x2_ck"),
-	DT_CLK(NULL, "dbgclk_mux_ck", "dbgclk_mux_ck"),
-	DT_CLK(NULL, "dpll_core_m2_ck", "dpll_core_m2_ck"),
-	DT_CLK(NULL, "ddrphy_ck", "ddrphy_ck"),
-	DT_CLK(NULL, "dpll_core_m5x2_ck", "dpll_core_m5x2_ck"),
-	DT_CLK(NULL, "div_core_ck", "div_core_ck"),
-	DT_CLK(NULL, "div_iva_hs_clk", "div_iva_hs_clk"),
-	DT_CLK(NULL, "div_mpu_hs_clk", "div_mpu_hs_clk"),
-	DT_CLK(NULL, "dpll_core_m4x2_ck", "dpll_core_m4x2_ck"),
-	DT_CLK(NULL, "dll_clk_div_ck", "dll_clk_div_ck"),
-	DT_CLK(NULL, "dpll_abe_m2_ck", "dpll_abe_m2_ck"),
-	DT_CLK(NULL, "dpll_core_m3x2_ck", "dpll_core_m3x2_ck"),
-	DT_CLK(NULL, "dpll_core_m7x2_ck", "dpll_core_m7x2_ck"),
-	DT_CLK(NULL, "iva_hsd_byp_clk_mux_ck", "iva_hsd_byp_clk_mux_ck"),
-	DT_CLK(NULL, "dpll_iva_ck", "dpll_iva_ck"),
-	DT_CLK(NULL, "dpll_iva_x2_ck", "dpll_iva_x2_ck"),
-	DT_CLK(NULL, "dpll_iva_m4x2_ck", "dpll_iva_m4x2_ck"),
-	DT_CLK(NULL, "dpll_iva_m5x2_ck", "dpll_iva_m5x2_ck"),
-	DT_CLK(NULL, "dpll_mpu_ck", "dpll_mpu_ck"),
-	DT_CLK(NULL, "dpll_mpu_m2_ck", "dpll_mpu_m2_ck"),
-	DT_CLK(NULL, "per_hs_clk_div_ck", "per_hs_clk_div_ck"),
-	DT_CLK(NULL, "per_hsd_byp_clk_mux_ck", "per_hsd_byp_clk_mux_ck"),
-	DT_CLK(NULL, "dpll_per_ck", "dpll_per_ck"),
-	DT_CLK(NULL, "dpll_per_m2_ck", "dpll_per_m2_ck"),
-	DT_CLK(NULL, "dpll_per_x2_ck", "dpll_per_x2_ck"),
-	DT_CLK(NULL, "dpll_per_m2x2_ck", "dpll_per_m2x2_ck"),
-	DT_CLK(NULL, "dpll_per_m3x2_ck", "dpll_per_m3x2_ck"),
-	DT_CLK(NULL, "dpll_per_m4x2_ck", "dpll_per_m4x2_ck"),
-	DT_CLK(NULL, "dpll_per_m5x2_ck", "dpll_per_m5x2_ck"),
-	DT_CLK(NULL, "dpll_per_m6x2_ck", "dpll_per_m6x2_ck"),
-	DT_CLK(NULL, "dpll_per_m7x2_ck", "dpll_per_m7x2_ck"),
-	DT_CLK(NULL, "usb_hs_clk_div_ck", "usb_hs_clk_div_ck"),
-	DT_CLK(NULL, "dpll_usb_ck", "dpll_usb_ck"),
-	DT_CLK(NULL, "dpll_usb_clkdcoldo_ck", "dpll_usb_clkdcoldo_ck"),
-	DT_CLK(NULL, "dpll_usb_m2_ck", "dpll_usb_m2_ck"),
-	DT_CLK(NULL, "ducati_clk_mux_ck", "ducati_clk_mux_ck"),
-	DT_CLK(NULL, "func_12m_fclk", "func_12m_fclk"),
-	DT_CLK(NULL, "func_24m_clk", "func_24m_clk"),
-	DT_CLK(NULL, "func_24mc_fclk", "func_24mc_fclk"),
-	DT_CLK(NULL, "func_48m_fclk", "func_48m_fclk"),
-	DT_CLK(NULL, "func_48mc_fclk", "func_48mc_fclk"),
-	DT_CLK(NULL, "func_64m_fclk", "func_64m_fclk"),
-	DT_CLK(NULL, "func_96m_fclk", "func_96m_fclk"),
-	DT_CLK(NULL, "init_60m_fclk", "init_60m_fclk"),
-	DT_CLK(NULL, "l3_div_ck", "l3_div_ck"),
-	DT_CLK(NULL, "l4_div_ck", "l4_div_ck"),
-	DT_CLK(NULL, "lp_clk_div_ck", "lp_clk_div_ck"),
-	DT_CLK(NULL, "l4_wkup_clk_mux_ck", "l4_wkup_clk_mux_ck"),
 	DT_CLK("smp_twd", NULL, "mpu_periphclk"),
-	DT_CLK(NULL, "ocp_abe_iclk", "ocp_abe_iclk"),
-	DT_CLK(NULL, "per_abe_24m_fclk", "per_abe_24m_fclk"),
-	DT_CLK(NULL, "per_abe_nc_fclk", "per_abe_nc_fclk"),
-	DT_CLK(NULL, "syc_clk_div_ck", "syc_clk_div_ck"),
-	DT_CLK(NULL, "aes1_fck", "aes1_fck"),
-	DT_CLK(NULL, "aes2_fck", "aes2_fck"),
-	DT_CLK(NULL, "dmic_sync_mux_ck", "dmic_sync_mux_ck"),
-	DT_CLK(NULL, "func_dmic_abe_gfclk", "func_dmic_abe_gfclk"),
-	DT_CLK(NULL, "dss_sys_clk", "dss_sys_clk"),
-	DT_CLK(NULL, "dss_tv_clk", "dss_tv_clk"),
-	DT_CLK(NULL, "dss_dss_clk", "dss_dss_clk"),
-	DT_CLK(NULL, "dss_48mhz_clk", "dss_48mhz_clk"),
-	DT_CLK(NULL, "dss_fck", "dss_fck"),
 	DT_CLK("omapdss_dss", "ick", "dss_fck"),
-	DT_CLK(NULL, "fdif_fck", "fdif_fck"),
-	DT_CLK(NULL, "gpio1_dbclk", "gpio1_dbclk"),
-	DT_CLK(NULL, "gpio2_dbclk", "gpio2_dbclk"),
-	DT_CLK(NULL, "gpio3_dbclk", "gpio3_dbclk"),
-	DT_CLK(NULL, "gpio4_dbclk", "gpio4_dbclk"),
-	DT_CLK(NULL, "gpio5_dbclk", "gpio5_dbclk"),
-	DT_CLK(NULL, "gpio6_dbclk", "gpio6_dbclk"),
-	DT_CLK(NULL, "sgx_clk_mux", "sgx_clk_mux"),
-	DT_CLK(NULL, "hsi_fck", "hsi_fck"),
-	DT_CLK(NULL, "iss_ctrlclk", "iss_ctrlclk"),
-	DT_CLK(NULL, "mcasp_sync_mux_ck", "mcasp_sync_mux_ck"),
-	DT_CLK(NULL, "func_mcasp_abe_gfclk", "func_mcasp_abe_gfclk"),
-	DT_CLK(NULL, "mcbsp1_sync_mux_ck", "mcbsp1_sync_mux_ck"),
-	DT_CLK(NULL, "func_mcbsp1_gfclk", "func_mcbsp1_gfclk"),
-	DT_CLK(NULL, "mcbsp2_sync_mux_ck", "mcbsp2_sync_mux_ck"),
-	DT_CLK(NULL, "func_mcbsp2_gfclk", "func_mcbsp2_gfclk"),
-	DT_CLK(NULL, "mcbsp3_sync_mux_ck", "mcbsp3_sync_mux_ck"),
-	DT_CLK(NULL, "func_mcbsp3_gfclk", "func_mcbsp3_gfclk"),
-	DT_CLK(NULL, "mcbsp4_sync_mux_ck", "mcbsp4_sync_mux_ck"),
-	DT_CLK(NULL, "per_mcbsp4_gfclk", "per_mcbsp4_gfclk"),
-	DT_CLK(NULL, "hsmmc1_fclk", "hsmmc1_fclk"),
-	DT_CLK(NULL, "hsmmc2_fclk", "hsmmc2_fclk"),
-	DT_CLK(NULL, "ocp2scp_usb_phy_phy_48m", "ocp2scp_usb_phy_phy_48m"),
-	DT_CLK(NULL, "sha2md5_fck", "sha2md5_fck"),
-	DT_CLK(NULL, "slimbus1_fclk_1", "slimbus1_fclk_1"),
-	DT_CLK(NULL, "slimbus1_fclk_0", "slimbus1_fclk_0"),
-	DT_CLK(NULL, "slimbus1_fclk_2", "slimbus1_fclk_2"),
-	DT_CLK(NULL, "slimbus1_slimbus_clk", "slimbus1_slimbus_clk"),
-	DT_CLK(NULL, "slimbus2_fclk_1", "slimbus2_fclk_1"),
-	DT_CLK(NULL, "slimbus2_fclk_0", "slimbus2_fclk_0"),
-	DT_CLK(NULL, "slimbus2_slimbus_clk", "slimbus2_slimbus_clk"),
-	DT_CLK(NULL, "smartreflex_core_fck", "smartreflex_core_fck"),
-	DT_CLK(NULL, "smartreflex_iva_fck", "smartreflex_iva_fck"),
-	DT_CLK(NULL, "smartreflex_mpu_fck", "smartreflex_mpu_fck"),
-	DT_CLK(NULL, "dmt1_clk_mux", "dmt1_clk_mux"),
-	DT_CLK(NULL, "cm2_dm10_mux", "cm2_dm10_mux"),
-	DT_CLK(NULL, "cm2_dm11_mux", "cm2_dm11_mux"),
-	DT_CLK(NULL, "cm2_dm2_mux", "cm2_dm2_mux"),
-	DT_CLK(NULL, "cm2_dm3_mux", "cm2_dm3_mux"),
-	DT_CLK(NULL, "cm2_dm4_mux", "cm2_dm4_mux"),
-	DT_CLK(NULL, "timer5_sync_mux", "timer5_sync_mux"),
-	DT_CLK(NULL, "timer6_sync_mux", "timer6_sync_mux"),
-	DT_CLK(NULL, "timer7_sync_mux", "timer7_sync_mux"),
-	DT_CLK(NULL, "timer8_sync_mux", "timer8_sync_mux"),
-	DT_CLK(NULL, "cm2_dm9_mux", "cm2_dm9_mux"),
-	DT_CLK(NULL, "usb_host_fs_fck", "usb_host_fs_fck"),
 	DT_CLK("usbhs_omap", "fs_fck", "usb_host_fs_fck"),
-	DT_CLK(NULL, "utmi_p1_gfclk", "utmi_p1_gfclk"),
-	DT_CLK(NULL, "usb_host_hs_utmi_p1_clk", "usb_host_hs_utmi_p1_clk"),
-	DT_CLK(NULL, "utmi_p2_gfclk", "utmi_p2_gfclk"),
-	DT_CLK(NULL, "usb_host_hs_utmi_p2_clk", "usb_host_hs_utmi_p2_clk"),
-	DT_CLK(NULL, "usb_host_hs_utmi_p3_clk", "usb_host_hs_utmi_p3_clk"),
-	DT_CLK(NULL, "usb_host_hs_hsic480m_p1_clk", "usb_host_hs_hsic480m_p1_clk"),
-	DT_CLK(NULL, "usb_host_hs_hsic60m_p1_clk", "usb_host_hs_hsic60m_p1_clk"),
-	DT_CLK(NULL, "usb_host_hs_hsic60m_p2_clk", "usb_host_hs_hsic60m_p2_clk"),
-	DT_CLK(NULL, "usb_host_hs_hsic480m_p2_clk", "usb_host_hs_hsic480m_p2_clk"),
-	DT_CLK(NULL, "usb_host_hs_func48mclk", "usb_host_hs_func48mclk"),
-	DT_CLK(NULL, "usb_host_hs_fck", "usb_host_hs_fck"),
 	DT_CLK("usbhs_omap", "hs_fck", "usb_host_hs_fck"),
-	DT_CLK(NULL, "otg_60m_gfclk", "otg_60m_gfclk"),
-	DT_CLK(NULL, "usb_otg_hs_xclk", "usb_otg_hs_xclk"),
-	DT_CLK(NULL, "usb_otg_hs_ick", "usb_otg_hs_ick"),
 	DT_CLK("musb-omap2430", "ick", "usb_otg_hs_ick"),
-	DT_CLK(NULL, "usb_phy_cm_clk32k", "usb_phy_cm_clk32k"),
-	DT_CLK(NULL, "usb_tll_hs_usb_ch2_clk", "usb_tll_hs_usb_ch2_clk"),
-	DT_CLK(NULL, "usb_tll_hs_usb_ch0_clk", "usb_tll_hs_usb_ch0_clk"),
-	DT_CLK(NULL, "usb_tll_hs_usb_ch1_clk", "usb_tll_hs_usb_ch1_clk"),
-	DT_CLK(NULL, "usb_tll_hs_ick", "usb_tll_hs_ick"),
 	DT_CLK("usbhs_omap", "usbtll_ick", "usb_tll_hs_ick"),
 	DT_CLK("usbhs_tll", "usbtll_ick", "usb_tll_hs_ick"),
-	DT_CLK(NULL, "usim_ck", "usim_ck"),
-	DT_CLK(NULL, "usim_fclk", "usim_fclk"),
-	DT_CLK(NULL, "pmd_stm_clock_mux_ck", "pmd_stm_clock_mux_ck"),
-	DT_CLK(NULL, "pmd_trace_clk_mux_ck", "pmd_trace_clk_mux_ck"),
-	DT_CLK(NULL, "stm_clk_div_ck", "stm_clk_div_ck"),
-	DT_CLK(NULL, "trace_clk_div_ck", "trace_clk_div_ck"),
-	DT_CLK(NULL, "auxclk0_src_ck", "auxclk0_src_ck"),
-	DT_CLK(NULL, "auxclk0_ck", "auxclk0_ck"),
-	DT_CLK(NULL, "auxclkreq0_ck", "auxclkreq0_ck"),
-	DT_CLK(NULL, "auxclk1_src_ck", "auxclk1_src_ck"),
-	DT_CLK(NULL, "auxclk1_ck", "auxclk1_ck"),
-	DT_CLK(NULL, "auxclkreq1_ck", "auxclkreq1_ck"),
-	DT_CLK(NULL, "auxclk2_src_ck", "auxclk2_src_ck"),
-	DT_CLK(NULL, "auxclk2_ck", "auxclk2_ck"),
-	DT_CLK(NULL, "auxclkreq2_ck", "auxclkreq2_ck"),
-	DT_CLK(NULL, "auxclk3_src_ck", "auxclk3_src_ck"),
-	DT_CLK(NULL, "auxclk3_ck", "auxclk3_ck"),
-	DT_CLK(NULL, "auxclkreq3_ck", "auxclkreq3_ck"),
-	DT_CLK(NULL, "auxclk4_src_ck", "auxclk4_src_ck"),
-	DT_CLK(NULL, "auxclk4_ck", "auxclk4_ck"),
-	DT_CLK(NULL, "auxclkreq4_ck", "auxclkreq4_ck"),
-	DT_CLK(NULL, "auxclk5_src_ck", "auxclk5_src_ck"),
-	DT_CLK(NULL, "auxclk5_ck", "auxclk5_ck"),
-	DT_CLK(NULL, "auxclkreq5_ck", "auxclkreq5_ck"),
 	DT_CLK("omap_i2c.1", "ick", "dummy_ck"),
 	DT_CLK("omap_i2c.2", "ick", "dummy_ck"),
 	DT_CLK("omap_i2c.3", "ick", "dummy_ck"),
@@ -263,9 +80,6 @@
 	DT_CLK("4013c000.timer", "timer_sys_ck", "syc_clk_div_ck"),
 	DT_CLK("4013e000.timer", "timer_sys_ck", "syc_clk_div_ck"),
 	DT_CLK(NULL, "cpufreq_ck", "dpll_mpu_ck"),
-	DT_CLK(NULL, "bandgap_fclk", "bandgap_fclk"),
-	DT_CLK(NULL, "div_ts_ck", "div_ts_ck"),
-	DT_CLK(NULL, "bandgap_ts_fclk", "bandgap_ts_fclk"),
 	{ .node_name = NULL },
 };
 
@@ -278,6 +92,8 @@ int __init omap4xxx_dt_clk_init(void)
 
 	omap2_clk_disable_autoidle_all();
 
+	ti_clk_add_aliases();
+
 	/*
 	 * Lock USB DPLL on OMAP4 devices so that the L3INIT power
 	 * domain can transition to retention state when not in use.
Signature · 1 line
1.9.1
#9 lore raw

PATCH v2 9/15 clk: ti: drop unnecessary MEMMAP_ADDRESSING flag

In reply to Tero Kristo

This has been superceded by the usage of ti_clk_ll_ops for now.

---
 drivers/clk/ti/apll.c      | 1 -
 drivers/clk/ti/dpll.c      | 2 --
 drivers/clk/ti/gate.c      | 4 +---
 drivers/clk/ti/interface.c | 1 -
 include/linux/clk/ti.h     | 2 --
 5 files changed, 1 insertion(+), 9 deletions(-)
drivers/clk/ti/apll.c +0 -1
index 62b5db7..5cba28c 100644
@@ -194,7 +194,6 @@ static void __init of_dra7_apll_setup(struct device_node *node)
 
 	clk_hw->dpll_data = ad;
 	clk_hw->hw.init = init;
-	clk_hw->flags = MEMMAP_ADDRESSING;
 
 	init->name = node->name;
 	init->ops = &apll_ck_ops;
drivers/clk/ti/dpll.c +0 -2
index 37624e1..c149bd1 100644
@@ -248,7 +248,6 @@ struct clk *ti_clk_register_dpll(struct ti_clk *setup)
 	clk_hw->dpll_data = dd;
 	clk_hw->ops = &clkhwops_omap3_dpll;
 	clk_hw->hw.init = &init;
-	clk_hw->flags = MEMMAP_ADDRESSING;
 
 	init.name = setup->name;
 	init.ops = ops;
@@ -380,7 +379,6 @@ static void __init of_ti_dpll_setup(struct device_node *node,
 	clk_hw->dpll_data = dd;
 	clk_hw->ops = &clkhwops_omap3_dpll;
 	clk_hw->hw.init = init;
-	clk_hw->flags = MEMMAP_ADDRESSING;
 
 	init->name = node->name;
 	init->ops = ops;
drivers/clk/ti/gate.c +1 -3
index b3291db..5ff62e2 100644
@@ -113,7 +113,7 @@ static struct clk *_register_gate(struct device *dev, const char *name,
 	clk_hw->enable_bit = bit_idx;
 	clk_hw->ops = hw_ops;
 
-	clk_hw->flags = MEMMAP_ADDRESSING | clk_gate_flags;
+	clk_hw->flags = clk_gate_flags;
 
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
@@ -203,7 +203,6 @@ struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup)
 		ops = &clkhwops_iclk_wait;
 
 	gate->ops = ops;
-	gate->flags = MEMMAP_ADDRESSING;
 
 	return &gate->hw;
 }
@@ -269,7 +268,6 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
 
 	gate->enable_bit = val;
 	gate->ops = hw_ops;
-	gate->flags = MEMMAP_ADDRESSING;
 
 	if (!ti_clk_add_component(node, &gate->hw, CLK_COMPONENT_TYPE_GATE))
 		return;
drivers/clk/ti/interface.c +0 -1
index 7927e1a..42d9fd4 100644
@@ -47,7 +47,6 @@ static struct clk *_register_interface(struct device *dev, const char *name,
 
 	clk_hw->hw.init = &init;
 	clk_hw->ops = ops;
-	clk_hw->flags = MEMMAP_ADDRESSING;
 	clk_hw->enable_reg = reg;
 	clk_hw->enable_bit = bit_idx;
 
include/linux/clk/ti.h +0 -2
index 626ae94..affdabd 100644
@@ -168,7 +168,6 @@ struct clk_hw_omap {
  *     should be used.  This is a temporary solution - a better approach
  *     would be to associate clock type-specific data with the clock,
  *     similar to the struct dpll_data approach.
- * MEMMAP_ADDRESSING: Use memmap addressing to access clock registers.
  */
 #define ENABLE_REG_32BIT	(1 << 0)	/* Use 32-bit access */
 #define CLOCK_IDLE_CONTROL	(1 << 1)
@@ -176,7 +175,6 @@ struct clk_hw_omap {
 #define ENABLE_ON_INIT		(1 << 3)	/* Enable upon framework init */
 #define INVERT_ENABLE		(1 << 4)	/* 0 enables, 1 disables */
 #define CLOCK_CLKOUTX2		(1 << 5)
-#define MEMMAP_ADDRESSING	(1 << 6)
 
 /* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */
 #define DPLL_LOW_POWER_STOP	0x1
Signature · 1 line
1.9.1
#10 lore raw

PATCH v2 10/15 clk: ti: mux: convert TI mux clock to use its internal data representation

In reply to Tero Kristo

Instead of using the generic clock driver data struct, use one internal for the TI clock driver itself. This allows modifying the register access parts in subsequent patch.

---
 drivers/clk/ti/clock.h | 11 +++++++++++
 drivers/clk/ti/mux.c   | 10 +++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)
drivers/clk/ti/clock.h +11 -0
index cb906a1..41913bf 100644
@@ -16,6 +16,17 @@
 #ifndef __DRIVERS_CLK_TI_CLOCK__
 #define __DRIVERS_CLK_TI_CLOCK__
 
+struct clk_omap_mux {
+	struct clk_hw		hw;
+	void __iomem		*reg;
+	u32			*table;
+	u32			mask;
+	u8			shift;
+	u8			flags;
+};
+
+#define to_clk_omap_mux(_hw) container_of(_hw, struct clk_omap_mux, hw)
+
 enum {
 	TI_CLK_FIXED,
 	TI_CLK_MUX,
drivers/clk/ti/mux.c +5 -5
index 3cc6db4..daa2dee 100644
@@ -28,7 +28,7 @@
 
 static u8 ti_clk_mux_get_parent(struct clk_hw *hw)
 {
-	struct clk_mux *mux = to_clk_mux(hw);
+	struct clk_omap_mux *mux = to_clk_omap_mux(hw);
 	int num_parents = clk_hw_get_num_parents(hw);
 	u32 val;
 
@@ -65,7 +65,7 @@ static u8 ti_clk_mux_get_parent(struct clk_hw *hw)
 
 static int ti_clk_mux_set_parent(struct clk_hw *hw, u8 index)
 {
-	struct clk_mux *mux = to_clk_mux(hw);
+	struct clk_omap_mux *mux = to_clk_omap_mux(hw);
 	u32 val;
 
 	if (mux->table) {
@@ -102,7 +102,7 @@ static struct clk *_register_mux(struct device *dev, const char *name,
 				 void __iomem *reg, u8 shift, u32 mask,
 				 u8 clk_mux_flags, u32 *table)
 {
-	struct clk_mux *mux;
+	struct clk_omap_mux *mux;
 	struct clk *clk;
 	struct clk_init_data init;
 
@@ -229,7 +229,7 @@ static void of_mux_clk_setup(struct device_node *node)
 
 struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup)
 {
-	struct clk_mux *mux;
+	struct clk_omap_mux *mux;
 	struct clk_omap_reg *reg;
 	int num_parents;
 
@@ -260,7 +260,7 @@ struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup)
 
 static void __init of_ti_composite_mux_clk_setup(struct device_node *node)
 {
-	struct clk_mux *mux;
+	struct clk_omap_mux *mux;
 	unsigned int num_parents;
 	u32 val;
 
Signature · 1 line
1.9.1
#11 lore raw

PATCH v2 11/15 clk: ti: divider: convert TI divider clock to use its own data representation

In reply to Tero Kristo

Instead of using the generic clock driver data struct, use one internal for the TI clock driver itself. This allows modifying the register access parts in subsequent patch.

---
 drivers/clk/ti/clock.h   | 11 +++++++++++
 drivers/clk/ti/divider.c | 22 +++++++++++-----------
 drivers/clk/ti/gate.c    |  4 ++--
 3 files changed, 24 insertions(+), 13 deletions(-)
drivers/clk/ti/clock.h +11 -0
index 41913bf..11d3f6a 100644
@@ -16,6 +16,17 @@
 #ifndef __DRIVERS_CLK_TI_CLOCK__
 #define __DRIVERS_CLK_TI_CLOCK__
 
+struct clk_omap_divider {
+	struct clk_hw		hw;
+	void __iomem		*reg;
+	u8			shift;
+	u8			width;
+	u8			flags;
+	const struct clk_div_table	*table;
+};
+
+#define to_clk_omap_divider(_hw) container_of(_hw, struct clk_omap_divider, hw)
+
 struct clk_omap_mux {
 	struct clk_hw		hw;
 	void __iomem		*reg;
drivers/clk/ti/divider.c +11 -11
index 0e8c136..a07652e 100644
@@ -39,7 +39,7 @@ static unsigned int _get_table_maxdiv(const struct clk_div_table *table)
 	return maxdiv;
 }
 
-static unsigned int _get_maxdiv(struct clk_divider *divider)
+static unsigned int _get_maxdiv(struct clk_omap_divider *divider)
 {
 	if (divider->flags & CLK_DIVIDER_ONE_BASED)
 		return div_mask(divider);
@@ -61,7 +61,7 @@ static unsigned int _get_table_div(const struct clk_div_table *table,
 	return 0;
 }
 
-static unsigned int _get_div(struct clk_divider *divider, unsigned int val)
+static unsigned int _get_div(struct clk_omap_divider *divider, unsigned int val)
 {
 	if (divider->flags & CLK_DIVIDER_ONE_BASED)
 		return val;
@@ -83,7 +83,7 @@ static unsigned int _get_table_val(const struct clk_div_table *table,
 	return 0;
 }
 
-static unsigned int _get_val(struct clk_divider *divider, u8 div)
+static unsigned int _get_val(struct clk_omap_divider *divider, u8 div)
 {
 	if (divider->flags & CLK_DIVIDER_ONE_BASED)
 		return div;
@@ -97,7 +97,7 @@ static unsigned int _get_val(struct clk_divider *divider, u8 div)
 static unsigned long ti_clk_divider_recalc_rate(struct clk_hw *hw,
 						unsigned long parent_rate)
 {
-	struct clk_divider *divider = to_clk_divider(hw);
+	struct clk_omap_divider *divider = to_clk_omap_divider(hw);
 	unsigned int div, val;
 
 	val = ti_clk_ll_ops->clk_readl(divider->reg) >> divider->shift;
@@ -131,7 +131,7 @@ static bool _is_valid_table_div(const struct clk_div_table *table,
 	return false;
 }
 
-static bool _is_valid_div(struct clk_divider *divider, unsigned int div)
+static bool _is_valid_div(struct clk_omap_divider *divider, unsigned int div)
 {
 	if (divider->flags & CLK_DIVIDER_POWER_OF_TWO)
 		return is_power_of_2(div);
@@ -172,7 +172,7 @@ static int _div_round(const struct clk_div_table *table,
 static int ti_clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
 				  unsigned long *best_parent_rate)
 {
-	struct clk_divider *divider = to_clk_divider(hw);
+	struct clk_omap_divider *divider = to_clk_omap_divider(hw);
 	int i, bestdiv = 0;
 	unsigned long parent_rate, best = 0, now, maxdiv;
 	unsigned long parent_rate_saved = *best_parent_rate;
@@ -239,14 +239,14 @@ static long ti_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
 static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 				   unsigned long parent_rate)
 {
-	struct clk_divider *divider;
+	struct clk_omap_divider *divider;
 	unsigned int div, value;
 	u32 val;
 
 	if (!hw || !rate)
 		return -EINVAL;
 
-	divider = to_clk_divider(hw);
+	divider = to_clk_omap_divider(hw);
 
 	div = DIV_ROUND_UP(parent_rate, rate);
 	value = _get_val(divider, div);
@@ -278,7 +278,7 @@ static struct clk *_register_divider(struct device *dev, const char *name,
 				     u8 shift, u8 width, u8 clk_divider_flags,
 				     const struct clk_div_table *table)
 {
-	struct clk_divider *div;
+	struct clk_omap_divider *div;
 	struct clk *clk;
 	struct clk_init_data init;
 
@@ -379,7 +379,7 @@ static struct clk *_register_divider(struct device *dev, const char *name,
 
 struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup)
 {
-	struct clk_divider *div;
+	struct clk_omap_divider *div;
 	struct clk_omap_reg *reg;
 
 	if (!setup)
@@ -617,7 +617,7 @@ static void __init of_ti_divider_clk_setup(struct device_node *node)
 
 static void __init of_ti_composite_divider_clk_setup(struct device_node *node)
 {
-	struct clk_divider *div;
+	struct clk_omap_divider *div;
 	u32 val;
 
 	div = kzalloc(sizeof(*div), GFP_KERNEL);
drivers/clk/ti/gate.c +2 -2
index 5ff62e2..a65f082 100644
@@ -62,7 +62,7 @@
  */
 static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw)
 {
-	struct clk_divider *parent;
+	struct clk_omap_divider *parent;
 	struct clk_hw *parent_hw;
 	u32 dummy_v, orig_v;
 	int ret;
@@ -72,7 +72,7 @@ static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw)
 
 	/* Parent is the x2 node, get parent of parent for the m2 div */
 	parent_hw = clk_hw_get_parent(clk_hw_get_parent(hw));
-	parent = to_clk_divider(parent_hw);
+	parent = to_clk_omap_divider(parent_hw);
 
 	/* Restore the dividers */
 	if (!ret) {
Signature · 1 line
1.9.1
#12 lore raw

PATCH v2 12/15 clk: ti: divider: add driver internal API for parsing divider data

In reply to Tero Kristo

This can be used from the divider itself, and also from the clkctrl clocks once this is introduced.

---
 drivers/clk/ti/clock.h   |  4 +++
 drivers/clk/ti/divider.c | 63 +++++++++++++++++++++++++++++++-----------------
 2 files changed, 45 insertions(+), 22 deletions(-)
drivers/clk/ti/clock.h +4 -0
index 11d3f6a..bdfdf26 100644
@@ -220,6 +220,10 @@ struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
 struct clk_hw *ti_clk_build_component_gate(struct ti_clk_gate *setup);
 struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup);
 
+int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
+			      u8 flags, u8 *width,
+			      const struct clk_div_table **table);
+
 void ti_clk_patch_legacy_clks(struct ti_clk **patch);
 struct clk *ti_clk_register_clk(struct ti_clk *setup);
 int ti_clk_register_legacy_clks(struct ti_clk_alias *clks);
drivers/clk/ti/divider.c +41 -22

105 lines not on this page · raw message

Signature · 1 line
1.9.1
#13 lore raw

PATCH v2 13/15 clk: ti: gate: export gate_clk_ops locally

In reply to Tero Kristo

These are going to be used by the clkctrl support that will be introduced later.

---
 drivers/clk/ti/clock.h | 1 +
 drivers/clk/ti/gate.c  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/clk/ti/clock.h +1 -0
index bdfdf26..437ea76 100644
@@ -253,6 +253,7 @@ int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
 
 extern const struct clk_ops ti_clk_divider_ops;
 extern const struct clk_ops ti_clk_mux_ops;
+extern const struct clk_ops omap_gate_clk_ops;
 
 void omap2_init_clk_clkdm(struct clk_hw *hw);
 int omap2_clkops_enable_clkdm(struct clk_hw *hw);
drivers/clk/ti/gate.c +1 -1
index a65f082..77f0920 100644
@@ -35,7 +35,7 @@
 	.disable	= &omap2_clkops_disable_clkdm,
 };
 
-static const struct clk_ops omap_gate_clk_ops = {
+const struct clk_ops omap_gate_clk_ops = {
 	.init		= &omap2_init_clk_clkdm,
 	.enable		= &omap2_dflt_clk_enable,
 	.disable	= &omap2_dflt_clk_disable,
Signature · 1 line
1.9.1
#14 lore raw

PATCH v2 14/15 clk: ti: dpll44xx: fix clksel register initialization

In reply to Tero Kristo

clksel register pointer should be used for the DPLL-MX autoidle handling. Currently this is not setup at all. Fix by adding proper handling for the register.

---
 drivers/clk/ti/dpll.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/clk/ti/dpll.c +15 -0
index c149bd1..778bc90 100644
@@ -319,6 +319,7 @@ static void _register_dpll_x2(struct device_node *node,
 	struct clk_hw_omap *clk_hw;
 	const char *name = node->name;
 	const char *parent_name;
+	int ret;
 
 	parent_name = of_clk_get_parent_name(node, 0);
 	if (!parent_name) {
@@ -338,6 +339,20 @@ static void _register_dpll_x2(struct device_node *node,
 	init.parent_names = &parent_name;
 	init.num_parents = 1;
 
+	if (hw_ops == &clkhwops_omap4_dpllmx) {
+		/* Check if register defined, if not, drop hw-ops */
+		ret = of_property_count_elems_of_size(node, "reg", 1);
+		if (ret <= 0) {
+			hw_ops = NULL;
+		} else {
+			clk_hw->clksel_reg = ti_clk_get_reg_addr(node, 0);
+			if (IS_ERR(clk_hw->clksel_reg)) {
+				kfree(clk_hw);
+				return;
+			}
+		}
+	}
+
 	/* register the clock */
 	clk = ti_clk_register(NULL, &clk_hw->hw, name);
 
Signature · 1 line
1.9.1
#15 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

In reply to Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

---
 arch/arm/mach-omap2/clkt2xxx_dpllcore.c |  3 +-
 arch/arm/mach-omap2/clock.c             |  2 +-
 arch/arm/mach-omap2/clock.h             |  2 ++
 arch/arm/mach-omap2/cm.h                |  5 +--
 arch/arm/mach-omap2/cm2xxx.c            |  9 ++---
 arch/arm/mach-omap2/cm3xxx.c            | 10 ++----
 arch/arm/mach-omap2/cm_common.c         |  2 +-
 drivers/clk/ti/apll.c                   | 47 ++++++++++++-------------
 drivers/clk/ti/autoidle.c               | 18 +++++-----
 drivers/clk/ti/clk-3xxx.c               | 55 +++++++++++++++--------------
 drivers/clk/ti/clk.c                    | 47 ++++++++++++-------------
 drivers/clk/ti/clkt_dflt.c              | 61 ++++++++++++---------------------
 drivers/clk/ti/clkt_dpll.c              |  6 ++--
 drivers/clk/ti/clkt_iclk.c              | 29 ++++++++--------
 drivers/clk/ti/clock.h                  | 11 +++---
 drivers/clk/ti/clockdomain.c            |  8 -----
 drivers/clk/ti/divider.c                | 24 +++++++------
 drivers/clk/ti/dpll.c                   | 48 ++++++++++----------------
 drivers/clk/ti/dpll3xxx.c               | 38 ++++++++++----------
 drivers/clk/ti/dpll44xx.c               | 14 ++++----
 drivers/clk/ti/gate.c                   | 32 ++++++++---------
 drivers/clk/ti/interface.c              | 22 ++++++------
 drivers/clk/ti/mux.c                    | 41 +++++++++-------------
 include/linux/clk/ti.h                  | 46 +++++++++++++------------
 24 files changed, 264 insertions(+), 316 deletions(-)
arch/arm/mach-omap2/clkt2xxx_dpllcore.c +2 -1
index 59cf310..e8d4173 100644
@@ -138,7 +138,8 @@ int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
 		if (!dd)
 			return -EINVAL;
 
-		tmpset.cm_clksel1_pll = readl_relaxed(dd->mult_div1_reg);
+		tmpset.cm_clksel1_pll =
+			omap_clk_ll_ops.clk_readl(&dd->mult_div1_reg);
 		tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
 					   dd->div1_mask);
 		div = ((curr_prcm_set->xtal_speed / 1000000) - 1);
arch/arm/mach-omap2/clock.c +1 -1
index ae5b23c..42881f2 100644
@@ -54,7 +54,7 @@
 #define OMAP3PLUS_DPLL_FINT_MIN		32000
 #define OMAP3PLUS_DPLL_FINT_MAX		52000000
 
-static struct ti_clk_ll_ops omap_clk_ll_ops = {
+struct ti_clk_ll_ops omap_clk_ll_ops = {
 	.clkdm_clk_enable = clkdm_clk_enable,
 	.clkdm_clk_disable = clkdm_clk_disable,
 	.clkdm_lookup = clkdm_lookup,
arch/arm/mach-omap2/clock.h +2 -0
index 4e66295..cf45550 100644
@@ -64,6 +64,8 @@
 #define OMAP4XXX_EN_DPLL_FRBYPASS		0x6
 #define OMAP4XXX_EN_DPLL_LOCKED			0x7
 
+extern struct ti_clk_ll_ops omap_clk_ll_ops;
+
 extern u16 cpu_mask;
 
 extern const struct clkops clkops_omap2_dflt_wait;
arch/arm/mach-omap2/cm.h +3 -2
index 1fe3e6b..de75cbc 100644
@@ -23,6 +23,7 @@
 #define MAX_MODULE_READY_TIME		2000
 
 # ifndef __ASSEMBLER__
+#include <linux/clk/ti.h>
 extern void __iomem *cm_base;
 extern void __iomem *cm2_base;
 extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
@@ -50,7 +51,7 @@
  * @module_disable: ptr to the SoC CM-specific module_disable impl
  */
 struct cm_ll_data {
-	int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
+	int (*split_idlest_reg)(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
 				u8 *idlest_reg_id);
 	int (*wait_module_ready)(u8 part, s16 prcm_mod, u16 idlest_reg,
 				 u8 idlest_shift);
@@ -60,7 +61,7 @@ struct cm_ll_data {
 	void (*module_disable)(u8 part, u16 inst, u16 clkctrl_offs);
 };
 
-extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
+extern int cm_split_idlest_reg(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
 			       u8 *idlest_reg_id);
 int omap_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_reg,
 			      u8 idlest_shift);
arch/arm/mach-omap2/cm2xxx.c +3 -6
index 3e5fd35..cd90b4c 100644
@@ -204,7 +204,7 @@ void omap2xxx_cm_apll96_disable(void)
  * XXX This function is only needed until absolute register addresses are
  * removed from the OMAP struct clk records.
  */
-static int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
+static int omap2xxx_cm_split_idlest_reg(struct clk_omap_reg *idlest_reg,
 					s16 *prcm_inst,
 					u8 *idlest_reg_id)
 {
@@ -212,10 +212,7 @@ static int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
 	u8 idlest_offs;
 	int i;
 
-	if (idlest_reg < cm_base || idlest_reg > (cm_base + 0x0fff))
-		return -EINVAL;
-
-	idlest_offs = (unsigned long)idlest_reg & 0xff;
+	idlest_offs = idlest_reg->offset & 0xff;
 	for (i = 0; i < ARRAY_SIZE(omap2xxx_cm_idlest_offs); i++) {
 		if (idlest_offs == omap2xxx_cm_idlest_offs[i]) {
 			*idlest_reg_id = i + 1;
@@ -226,7 +223,7 @@ static int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
 	if (i == ARRAY_SIZE(omap2xxx_cm_idlest_offs))
 		return -EINVAL;
 
-	offs = idlest_reg - cm_base;
+	offs = idlest_reg->offset;
 	offs &= 0xff00;
 	*prcm_inst = offs;
 
arch/arm/mach-omap2/cm3xxx.c +3 -7
index d91ae82..55b046a 100644
@@ -118,7 +118,7 @@ static int omap3xxx_cm_wait_module_ready(u8 part, s16 prcm_mod, u16 idlest_id,
  * XXX This function is only needed until absolute register addresses are
  * removed from the OMAP struct clk records.
  */
-static int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
+static int omap3xxx_cm_split_idlest_reg(struct clk_omap_reg *idlest_reg,
 					s16 *prcm_inst,
 					u8 *idlest_reg_id)
 {
@@ -126,11 +126,7 @@ static int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
 	u8 idlest_offs;
 	int i;
 
-	if (idlest_reg < (cm_base + OMAP3430_IVA2_MOD) ||
-	    idlest_reg > (cm_base + 0x1ffff))
-		return -EINVAL;
-
-	idlest_offs = (unsigned long)idlest_reg & 0xff;
+	idlest_offs = idlest_reg->offset & 0xff;
 	for (i = 0; i < ARRAY_SIZE(omap3xxx_cm_idlest_offs); i++) {
 		if (idlest_offs == omap3xxx_cm_idlest_offs[i]) {
 			*idlest_reg_id = i + 1;
@@ -141,7 +137,7 @@ static int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
 	if (i == ARRAY_SIZE(omap3xxx_cm_idlest_offs))
 		return -EINVAL;
 
-	offs = idlest_reg - cm_base;
+	offs = idlest_reg->offset;
 	offs &= 0xff00;
 	*prcm_inst = offs;
 
arch/arm/mach-omap2/cm_common.c +1 -1
index 23e8bce..bbe41f4 100644
@@ -65,7 +65,7 @@ void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
  * or 0 upon success.  XXX This function is only needed until absolute
  * register addresses are removed from the OMAP struct clk records.
  */
-int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
+int cm_split_idlest_reg(struct clk_omap_reg *idlest_reg, s16 *prcm_inst,
 			u8 *idlest_reg_id)
 {
 	if (!cm_ll_data->split_idlest_reg) {
drivers/clk/ti/apll.c +24 -23

135 lines not on this page · raw message

drivers/clk/ti/autoidle.c +9 -9
index 345af43..7bb9afb 100644
@@ -25,7 +25,7 @@
 #include "clock.h"
 
 struct clk_ti_autoidle {
-	void __iomem		*reg;
+	struct clk_omap_reg	reg;
 	u8			shift;
 	u8			flags;
 	const char		*name;
@@ -73,28 +73,28 @@ static void _allow_autoidle(struct clk_ti_autoidle *clk)
 {
 	u32 val;
 
-	val = ti_clk_ll_ops->clk_readl(clk->reg);
+	val = ti_clk_ll_ops->clk_readl(&clk->reg);
 
 	if (clk->flags & AUTOIDLE_LOW)
 		val &= ~(1 << clk->shift);
 	else
 		val |= (1 << clk->shift);
 
-	ti_clk_ll_ops->clk_writel(val, clk->reg);
+	ti_clk_ll_ops->clk_writel(val, &clk->reg);
 }
 
 static void _deny_autoidle(struct clk_ti_autoidle *clk)
 {
 	u32 val;
 
-	val = ti_clk_ll_ops->clk_readl(clk->reg);
+	val = ti_clk_ll_ops->clk_readl(&clk->reg);
 
 	if (clk->flags & AUTOIDLE_LOW)
 		val |= (1 << clk->shift);
 	else
 		val &= ~(1 << clk->shift);
 
-	ti_clk_ll_ops->clk_writel(val, clk->reg);
+	ti_clk_ll_ops->clk_writel(val, &clk->reg);
 }
 
 /**
@@ -140,6 +140,7 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node)
 {
 	u32 shift;
 	struct clk_ti_autoidle *clk;
+	int ret;
 
 	/* Check if this clock has autoidle support or not */
 	if (of_property_read_u32(node, "ti,autoidle-shift", &shift))
@@ -152,11 +153,10 @@ int __init of_ti_clk_autoidle_setup(struct device_node *node)
 
 	clk->shift = shift;
 	clk->name = node->name;
-	clk->reg = ti_clk_get_reg_addr(node, 0);
-
-	if (IS_ERR(clk->reg)) {
+	ret = ti_clk_get_reg_addr(node, 0, &clk->reg);
+	if (ret) {
 		kfree(clk);
-		return -EINVAL;
+		return ret;
 	}
 
 	if (of_property_read_bool(node, "ti,invert-autoidle-bit"))
drivers/clk/ti/clk-3xxx.c +27 -28

106 lines not on this page · raw message

drivers/clk/ti/clk.c +24 -23

90 lines not on this page · raw message

drivers/clk/ti/clkt_dflt.c +21 -40

142 lines not on this page · raw message

drivers/clk/ti/clkt_dpll.c +3 -3
index b919fdf..ce98da2 100644
@@ -213,7 +213,7 @@ u8 omap2_init_dpll_parent(struct clk_hw *hw)
 	if (!dd)
 		return -EINVAL;
 
-	v = ti_clk_ll_ops->clk_readl(dd->control_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->control_reg);
 	v &= dd->enable_mask;
 	v >>= __ffs(dd->enable_mask);
 
@@ -249,14 +249,14 @@ unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
 		return 0;
 
 	/* Return bypass rate if DPLL is bypassed */
-	v = ti_clk_ll_ops->clk_readl(dd->control_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->control_reg);
 	v &= dd->enable_mask;
 	v >>= __ffs(dd->enable_mask);
 
 	if (_omap2_dpll_is_in_bypass(v))
 		return clk_hw_get_rate(dd->clk_bypass);
 
-	v = ti_clk_ll_ops->clk_readl(dd->mult_div1_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->mult_div1_reg);
 	dpll_mult = v & dd->mult_mask;
 	dpll_mult >>= __ffs(dd->mult_mask);
 	dpll_div = v & dd->div1_mask;
drivers/clk/ti/clkt_iclk.c +14 -15
index 38c3690..60b583d 100644
@@ -31,28 +31,29 @@
 void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
 {
 	u32 v;
-	void __iomem *r;
+	struct clk_omap_reg r;
 
-	r = (__force void __iomem *)
-		((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN));
+	memcpy(&r, &clk->enable_reg, sizeof(r));
+	r.offset ^= (CM_AUTOIDLE ^ CM_ICLKEN);
 
-	v = ti_clk_ll_ops->clk_readl(r);
+	v = ti_clk_ll_ops->clk_readl(&r);
 	v |= (1 << clk->enable_bit);
-	ti_clk_ll_ops->clk_writel(v, r);
+	ti_clk_ll_ops->clk_writel(v, &r);
 }
 
 /* XXX */
 void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
 {
 	u32 v;
-	void __iomem *r;
+	struct clk_omap_reg r;
 
-	r = (__force void __iomem *)
-		((__force u32)clk->enable_reg ^ (CM_AUTOIDLE ^ CM_ICLKEN));
+	memcpy(&r, &clk->enable_reg, sizeof(r));
 
-	v = ti_clk_ll_ops->clk_readl(r);
+	r.offset ^= (CM_AUTOIDLE ^ CM_ICLKEN);
+
+	v = ti_clk_ll_ops->clk_readl(&r);
 	v &= ~(1 << clk->enable_bit);
-	ti_clk_ll_ops->clk_writel(v, r);
+	ti_clk_ll_ops->clk_writel(v, &r);
 }
 
 /**
@@ -68,14 +69,12 @@ void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
  * modules.  No return value.
  */
 static void omap2430_clk_i2chs_find_idlest(struct clk_hw_omap *clk,
-					   void __iomem **idlest_reg,
+					   struct clk_omap_reg *idlest_reg,
 					   u8 *idlest_bit,
 					   u8 *idlest_val)
 {
-	u32 r;
-
-	r = ((__force u32)clk->enable_reg ^ (OMAP24XX_CM_FCLKEN2 ^ CM_IDLEST));
-	*idlest_reg = (__force void __iomem *)r;
+	memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
+	idlest_reg->offset ^= (OMAP24XX_CM_FCLKEN2 ^ CM_IDLEST);
 	*idlest_bit = clk->enable_bit;
 	*idlest_val = OMAP24XX_CM_IDLEST_VAL;
 }
drivers/clk/ti/clock.h +6 -5
index 437ea76..3f7b265 100644
@@ -18,7 +18,7 @@
 
 struct clk_omap_divider {
 	struct clk_hw		hw;
-	void __iomem		*reg;
+	struct clk_omap_reg	reg;
 	u8			shift;
 	u8			width;
 	u8			flags;
@@ -29,7 +29,7 @@ struct clk_omap_divider {
 
 struct clk_omap_mux {
 	struct clk_hw		hw;
-	void __iomem		*reg;
+	struct clk_omap_reg	reg;
 	u32			*table;
 	u32			mask;
 	u8			shift;
@@ -228,7 +228,8 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
 struct clk *ti_clk_register_clk(struct ti_clk *setup);
 int ti_clk_register_legacy_clks(struct ti_clk_alias *clks);
 
-void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index);
+int ti_clk_get_reg_addr(struct device_node *node, int index,
+			struct clk_omap_reg *reg);
 void ti_dt_clocks_register(struct ti_dt_clk *oclks);
 int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
 		      ti_of_clk_init_cb_t func);
@@ -263,10 +264,10 @@ int ti_clk_retry_init(struct device_node *node, struct clk_hw *hw,
 void omap2_dflt_clk_disable(struct clk_hw *hw);
 int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
 void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
-				   void __iomem **other_reg,
+				   struct clk_omap_reg *other_reg,
 				   u8 *other_bit);
 void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
-				void __iomem **idlest_reg,
+				struct clk_omap_reg *idlest_reg,
 				u8 *idlest_bit, u8 *idlest_val);
 
 void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk);
drivers/clk/ti/clockdomain.c +0 -8
index 704157d..fbedc6a 100644
@@ -52,10 +52,6 @@ int omap2_clkops_enable_clkdm(struct clk_hw *hw)
 		return -EINVAL;
 	}
 
-	if (unlikely(clk->enable_reg))
-		pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
-		       clk_hw_get_name(hw));
-
 	if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
 		pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
 		       __func__, clk_hw_get_name(hw));
@@ -90,10 +86,6 @@ void omap2_clkops_disable_clkdm(struct clk_hw *hw)
 		return;
 	}
 
-	if (unlikely(clk->enable_reg))
-		pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
-		       clk_hw_get_name(hw));
-
 	if (ti_clk_get_features()->flags & TI_CLK_DISABLE_CLKDM_CONTROL) {
 		pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
 		       __func__, clk_hw_get_name(hw));
drivers/clk/ti/divider.c +13 -11
index 1cc0242..d6dcb28 100644
@@ -100,7 +100,7 @@ static unsigned long ti_clk_divider_recalc_rate(struct clk_hw *hw,
 	struct clk_omap_divider *divider = to_clk_omap_divider(hw);
 	unsigned int div, val;
 
-	val = ti_clk_ll_ops->clk_readl(divider->reg) >> divider->shift;
+	val = ti_clk_ll_ops->clk_readl(&divider->reg) >> divider->shift;
 	val &= div_mask(divider);
 
 	div = _get_div(divider, val);
@@ -257,11 +257,11 @@ static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 	if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
 		val = div_mask(divider) << (divider->shift + 16);
 	} else {
-		val = ti_clk_ll_ops->clk_readl(divider->reg);
+		val = ti_clk_ll_ops->clk_readl(&divider->reg);
 		val &= ~(div_mask(divider) << divider->shift);
 	}
 	val |= value << divider->shift;
-	ti_clk_ll_ops->clk_writel(val, divider->reg);
+	ti_clk_ll_ops->clk_writel(val, &divider->reg);
 
 	return 0;
 }
@@ -274,7 +274,8 @@ static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
 
 static struct clk *_register_divider(struct device *dev, const char *name,
 				     const char *parent_name,
-				     unsigned long flags, void __iomem *reg,
+				     unsigned long flags,
+				     struct clk_omap_reg *reg,
 				     u8 shift, u8 width, u8 clk_divider_flags,
 				     const struct clk_div_table *table)
 {
@@ -303,7 +304,7 @@ static struct clk *_register_divider(struct device *dev, const char *name,
 	init.num_parents = (parent_name ? 1 : 0);
 
 	/* struct clk_divider assignments */
-	div->reg = reg;
+	memcpy(&div->reg, reg, sizeof(*reg));
 	div->shift = shift;
 	div->width = width;
 	div->flags = clk_divider_flags;
@@ -561,14 +562,15 @@ static int _get_divider_width(struct device_node *node,
 }
 
 static int __init ti_clk_divider_populate(struct device_node *node,
-	void __iomem **reg, const struct clk_div_table **table,
+	struct clk_omap_reg *reg, const struct clk_div_table **table,
 	u32 *flags, u8 *div_flags, u8 *width, u8 *shift)
 {
 	u32 val;
+	int ret;
 
-	*reg = ti_clk_get_reg_addr(node, 0);
-	if (IS_ERR(*reg))
-		return PTR_ERR(*reg);
+	ret = ti_clk_get_reg_addr(node, 0, reg);
+	if (ret)
+		return ret;
 
 	if (!of_property_read_u32(node, "ti,bit-shift", &val))
 		*shift = val;
@@ -607,7 +609,7 @@ static void __init of_ti_divider_clk_setup(struct device_node *node)
 {
 	struct clk *clk;
 	const char *parent_name;
-	void __iomem *reg;
+	struct clk_omap_reg reg;
 	u8 clk_divider_flags = 0;
 	u8 width = 0;
 	u8 shift = 0;
@@ -620,7 +622,7 @@ static void __init of_ti_divider_clk_setup(struct device_node *node)
 				    &clk_divider_flags, &width, &shift))
 		goto cleanup;
 
-	clk = _register_divider(NULL, node->name, parent_name, flags, reg,
+	clk = _register_divider(NULL, node->name, parent_name, flags, &reg,
 				shift, width, clk_divider_flags, table);
 
 	if (!IS_ERR(clk)) {
drivers/clk/ti/dpll.c +18 -30

89 lines not on this page · raw message

drivers/clk/ti/dpll3xxx.c +19 -19
index 4cdd28a..4534de2 100644
@@ -54,10 +54,10 @@ static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits)
 
 	dd = clk->dpll_data;
 
-	v = ti_clk_ll_ops->clk_readl(dd->control_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->control_reg);
 	v &= ~dd->enable_mask;
 	v |= clken_bits << __ffs(dd->enable_mask);
-	ti_clk_ll_ops->clk_writel(v, dd->control_reg);
+	ti_clk_ll_ops->clk_writel(v, &dd->control_reg);
 }
 
 /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
@@ -73,7 +73,7 @@ static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state)
 
 	state <<= __ffs(dd->idlest_mask);
 
-	while (((ti_clk_ll_ops->clk_readl(dd->idlest_reg) & dd->idlest_mask)
+	while (((ti_clk_ll_ops->clk_readl(&dd->idlest_reg) & dd->idlest_mask)
 		!= state) && i < MAX_DPLL_WAIT_TRIES) {
 		i++;
 		udelay(1);
@@ -151,7 +151,7 @@ static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk)
 	state <<= __ffs(dd->idlest_mask);
 
 	/* Check if already locked */
-	if ((ti_clk_ll_ops->clk_readl(dd->idlest_reg) & dd->idlest_mask) ==
+	if ((ti_clk_ll_ops->clk_readl(&dd->idlest_reg) & dd->idlest_mask) ==
 	    state)
 		goto done;
 
@@ -317,14 +317,14 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
 	 * only since freqsel field is no longer present on other devices.
 	 */
 	if (ti_clk_get_features()->flags & TI_CLK_DPLL_HAS_FREQSEL) {
-		v = ti_clk_ll_ops->clk_readl(dd->control_reg);
+		v = ti_clk_ll_ops->clk_readl(&dd->control_reg);
 		v &= ~dd->freqsel_mask;
 		v |= freqsel << __ffs(dd->freqsel_mask);
-		ti_clk_ll_ops->clk_writel(v, dd->control_reg);
+		ti_clk_ll_ops->clk_writel(v, &dd->control_reg);
 	}
 
 	/* Set DPLL multiplier, divider */
-	v = ti_clk_ll_ops->clk_readl(dd->mult_div1_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->mult_div1_reg);
 
 	/* Handle Duty Cycle Correction */
 	if (dd->dcc_mask) {
@@ -370,11 +370,11 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
 		}
 	}
 
-	ti_clk_ll_ops->clk_writel(v, dd->mult_div1_reg);
+	ti_clk_ll_ops->clk_writel(v, &dd->mult_div1_reg);
 
 	/* Set 4X multiplier and low-power mode */
 	if (dd->m4xen_mask || dd->lpmode_mask) {
-		v = ti_clk_ll_ops->clk_readl(dd->control_reg);
+		v = ti_clk_ll_ops->clk_readl(&dd->control_reg);
 
 		if (dd->m4xen_mask) {
 			if (dd->last_rounded_m4xen)
@@ -390,7 +390,7 @@ static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 freqsel)
 				v &= ~dd->lpmode_mask;
 		}
 
-		ti_clk_ll_ops->clk_writel(v, dd->control_reg);
+		ti_clk_ll_ops->clk_writel(v, &dd->control_reg);
 	}
 
 	/* We let the clock framework set the other output dividers later */
@@ -652,10 +652,10 @@ static u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk)
 
 	dd = clk->dpll_data;
 
-	if (!dd->autoidle_reg)
+	if (!dd->autoidle_mask)
 		return -EINVAL;
 
-	v = ti_clk_ll_ops->clk_readl(dd->autoidle_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->autoidle_reg);
 	v &= dd->autoidle_mask;
 	v >>= __ffs(dd->autoidle_mask);
 
@@ -681,7 +681,7 @@ static void omap3_dpll_allow_idle(struct clk_hw_omap *clk)
 
 	dd = clk->dpll_data;
 
-	if (!dd->autoidle_reg)
+	if (!dd->autoidle_mask)
 		return;
 
 	/*
@@ -689,10 +689,10 @@ static void omap3_dpll_allow_idle(struct clk_hw_omap *clk)
 	 * by writing 0x5 instead of 0x1.  Add some mechanism to
 	 * optionally enter this mode.
 	 */
-	v = ti_clk_ll_ops->clk_readl(dd->autoidle_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->autoidle_reg);
 	v &= ~dd->autoidle_mask;
 	v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask);
-	ti_clk_ll_ops->clk_writel(v, dd->autoidle_reg);
+	ti_clk_ll_ops->clk_writel(v, &dd->autoidle_reg);
 }
 
 /**
@@ -711,13 +711,13 @@ static void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
 
 	dd = clk->dpll_data;
 
-	if (!dd->autoidle_reg)
+	if (!dd->autoidle_mask)
 		return;
 
-	v = ti_clk_ll_ops->clk_readl(dd->autoidle_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->autoidle_reg);
 	v &= ~dd->autoidle_mask;
 	v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
-	ti_clk_ll_ops->clk_writel(v, dd->autoidle_reg);
+	ti_clk_ll_ops->clk_writel(v, &dd->autoidle_reg);
 }
 
 /* Clock control for DPLL outputs */
@@ -773,7 +773,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
 
 	WARN_ON(!dd->enable_mask);
 
-	v = ti_clk_ll_ops->clk_readl(dd->control_reg) & dd->enable_mask;
+	v = ti_clk_ll_ops->clk_readl(&dd->control_reg) & dd->enable_mask;
 	v >>= __ffs(dd->enable_mask);
 	if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE))
 		rate = parent_rate;
drivers/clk/ti/dpll44xx.c +7 -7
index 82c05b5..d7a3f7e 100644
@@ -42,17 +42,17 @@ static void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
 	u32 v;
 	u32 mask;
 
-	if (!clk || !clk->clksel_reg)
+	if (!clk)
 		return;
 
 	mask = clk->flags & CLOCK_CLKOUTX2 ?
 			OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
 			OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
 
-	v = ti_clk_ll_ops->clk_readl(clk->clksel_reg);
+	v = ti_clk_ll_ops->clk_readl(&clk->clksel_reg);
 	/* Clear the bit to allow gatectrl */
 	v &= ~mask;
-	ti_clk_ll_ops->clk_writel(v, clk->clksel_reg);
+	ti_clk_ll_ops->clk_writel(v, &clk->clksel_reg);
 }
 
 static void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
@@ -60,17 +60,17 @@ static void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
 	u32 v;
 	u32 mask;
 
-	if (!clk || !clk->clksel_reg)
+	if (!clk)
 		return;
 
 	mask = clk->flags & CLOCK_CLKOUTX2 ?
 			OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
 			OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
 
-	v = ti_clk_ll_ops->clk_readl(clk->clksel_reg);
+	v = ti_clk_ll_ops->clk_readl(&clk->clksel_reg);
 	/* Set the bit to deny gatectrl */
 	v |= mask;
-	ti_clk_ll_ops->clk_writel(v, clk->clksel_reg);
+	ti_clk_ll_ops->clk_writel(v, &clk->clksel_reg);
 }
 
 const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = {
@@ -128,7 +128,7 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
 	rate = omap2_get_dpll_rate(clk);
 
 	/* regm4xen adds a multiplier of 4 to DPLL calculations */
-	v = ti_clk_ll_ops->clk_readl(dd->control_reg);
+	v = ti_clk_ll_ops->clk_readl(&dd->control_reg);
 	if (v & OMAP4430_DPLL_REGM4XEN_MASK)
 		rate *= OMAP4430_REGM4XEN_MULT;
 
drivers/clk/ti/gate.c +14 -18
index 77f0920..7151ec3 100644
@@ -76,15 +76,15 @@ static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw)
 
 	/* Restore the dividers */
 	if (!ret) {
-		orig_v = ti_clk_ll_ops->clk_readl(parent->reg);
+		orig_v = ti_clk_ll_ops->clk_readl(&parent->reg);
 		dummy_v = orig_v;
 
 		/* Write any other value different from the Read value */
 		dummy_v ^= (1 << parent->shift);
-		ti_clk_ll_ops->clk_writel(dummy_v, parent->reg);
+		ti_clk_ll_ops->clk_writel(dummy_v, &parent->reg);
 
 		/* Write the original divider */
-		ti_clk_ll_ops->clk_writel(orig_v, parent->reg);
+		ti_clk_ll_ops->clk_writel(orig_v, &parent->reg);
 	}
 
 	return ret;
@@ -92,7 +92,7 @@ static int omap36xx_gate_clk_enable_with_hsdiv_restore(struct clk_hw *hw)
 
 static struct clk *_register_gate(struct device *dev, const char *name,
 				  const char *parent_name, unsigned long flags,
-				  void __iomem *reg, u8 bit_idx,
+				  struct clk_omap_reg *reg, u8 bit_idx,
 				  u8 clk_gate_flags, const struct clk_ops *ops,
 				  const struct clk_hw_omap_ops *hw_ops)
 {
@@ -109,7 +109,7 @@ static struct clk *_register_gate(struct device *dev, const char *name,
 	init.name = name;
 	init.ops = ops;
 
-	clk_hw->enable_reg = reg;
+	memcpy(&clk_hw->enable_reg, reg, sizeof(*reg));
 	clk_hw->enable_bit = bit_idx;
 	clk_hw->ops = hw_ops;
 
@@ -133,8 +133,7 @@ struct clk *ti_clk_register_gate(struct ti_clk *setup)
 {
 	const struct clk_ops *ops = &omap_gate_clk_ops;
 	const struct clk_hw_omap_ops *hw_ops = NULL;
-	u32 reg;
-	struct clk_omap_reg *reg_setup;
+	struct clk_omap_reg reg;
 	u32 flags = 0;
 	u8 clk_gate_flags = 0;
 	struct ti_clk_gate *gate;
@@ -144,8 +143,6 @@ struct clk *ti_clk_register_gate(struct ti_clk *setup)
 	if (gate->flags & CLKF_INTERFACE)
 		return ti_clk_register_interface(setup);
 
-	reg_setup = (struct clk_omap_reg *)&reg;
-
 	if (gate->flags & CLKF_SET_RATE_PARENT)
 		flags |= CLK_SET_RATE_PARENT;
 
@@ -169,11 +166,12 @@ struct clk *ti_clk_register_gate(struct ti_clk *setup)
 	if (gate->flags & CLKF_AM35XX)
 		hw_ops = &clkhwops_am35xx_ipss_module_wait;
 
-	reg_setup->index = gate->module;
-	reg_setup->offset = gate->reg;
+	reg.index = gate->module;
+	reg.offset = gate->reg;
+	reg.ptr = NULL;
 
 	return _register_gate(NULL, setup->name, gate->parent, flags,
-			      (void __iomem *)reg, gate->bit_shift,
+			      &reg, gate->bit_shift,
 			      clk_gate_flags, ops, hw_ops);
 }
 
@@ -214,15 +212,14 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
 {
 	struct clk *clk;
 	const char *parent_name;
-	void __iomem *reg = NULL;
+	struct clk_omap_reg reg;
 	u8 enable_bit = 0;
 	u32 val;
 	u32 flags = 0;
 	u8 clk_gate_flags = 0;
 
 	if (ops != &omap_gate_clkdm_clk_ops) {
-		reg = ti_clk_get_reg_addr(node, 0);
-		if (IS_ERR(reg))
+		if (ti_clk_get_reg_addr(node, 0, &reg))
 			return;
 
 		if (!of_property_read_u32(node, "ti,bit-shift", &val))
@@ -242,7 +239,7 @@ 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,
+	clk = _register_gate(NULL, node->name, parent_name, flags, &reg,
 			     enable_bit, clk_gate_flags, ops, hw_ops);
 
 	if (!IS_ERR(clk))
@@ -260,8 +257,7 @@ static void __init _of_ti_gate_clk_setup(struct device_node *node,
 	if (!gate)
 		return;
 
-	gate->enable_reg = ti_clk_get_reg_addr(node, 0);
-	if (IS_ERR(gate->enable_reg))
+	if (ti_clk_get_reg_addr(node, 0, &gate->enable_reg))
 		goto cleanup;
 
 	of_property_read_u32(node, "ti,bit-shift", &val);
drivers/clk/ti/interface.c +10 -12
index 42d9fd4..62cf50c 100644
@@ -34,7 +34,7 @@
 
 static struct clk *_register_interface(struct device *dev, const char *name,
 				       const char *parent_name,
-				       void __iomem *reg, u8 bit_idx,
+				       struct clk_omap_reg *reg, u8 bit_idx,
 				       const struct clk_hw_omap_ops *ops)
 {
 	struct clk_init_data init = { NULL };
@@ -47,7 +47,7 @@ static struct clk *_register_interface(struct device *dev, const char *name,
 
 	clk_hw->hw.init = &init;
 	clk_hw->ops = ops;
-	clk_hw->enable_reg = reg;
+	memcpy(&clk_hw->enable_reg, reg, sizeof(*reg));
 	clk_hw->enable_bit = bit_idx;
 
 	init.name = name;
@@ -71,14 +71,13 @@ static struct clk *_register_interface(struct device *dev, const char *name,
 struct clk *ti_clk_register_interface(struct ti_clk *setup)
 {
 	const struct clk_hw_omap_ops *ops = &clkhwops_iclk_wait;
-	u32 reg;
-	struct clk_omap_reg *reg_setup;
+	struct clk_omap_reg reg;
 	struct ti_clk_gate *gate;
 
 	gate = setup->data;
-	reg_setup = (struct clk_omap_reg *)&reg;
-	reg_setup->index = gate->module;
-	reg_setup->offset = gate->reg;
+	reg.index = gate->module;
+	reg.offset = gate->reg;
+	reg.ptr = NULL;
 
 	if (gate->flags & CLKF_NO_WAIT)
 		ops = &clkhwops_iclk;
@@ -96,7 +95,7 @@ struct clk *ti_clk_register_interface(struct ti_clk *setup)
 		ops = &clkhwops_am35xx_ipss_wait;
 
 	return _register_interface(NULL, setup->name, gate->parent,
-				   (void __iomem *)reg, gate->bit_shift, ops);
+				   &reg, gate->bit_shift, ops);
 }
 #endif
 
@@ -105,12 +104,11 @@ static void __init _of_ti_interface_clk_setup(struct device_node *node,
 {
 	struct clk *clk;
 	const char *parent_name;
-	void __iomem *reg;
+	struct clk_omap_reg reg;
 	u8 enable_bit = 0;
 	u32 val;
 
-	reg = ti_clk_get_reg_addr(node, 0);
-	if (IS_ERR(reg))
+	if (ti_clk_get_reg_addr(node, 0, &reg))
 		return;
 
 	if (!of_property_read_u32(node, "ti,bit-shift", &val))
@@ -122,7 +120,7 @@ static void __init _of_ti_interface_clk_setup(struct device_node *node,
 		return;
 	}
 
-	clk = _register_interface(NULL, node->name, parent_name, reg,
+	clk = _register_interface(NULL, node->name, parent_name, &reg,
 				  enable_bit, ops);
 
 	if (!IS_ERR(clk))
drivers/clk/ti/mux.c +16 -25

126 lines not on this page · raw message

include/linux/clk/ti.h +24 -22

102 lines not on this page · raw message

Signature · 1 line
1.9.1
#16 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 9 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
[   14.674011] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa
0ad014
[   14.682708] pgd = cc2ac000
[   14.685607] [fa0ad014] *pgd=48011452(bad)
[   14.689941] Internal error: : 1028 [#1] SMP ARM
[   14.694732] Modules linked in: arc4 wl12xx wlcore mac80211 cfg80211 evdev joy
dev snd_soc_omap_twl4030 omapfb cfbfillrect cfbimgblt leds_gpio cpufreq_dt cfbco
pyarea led_class thermal_sys panel_dpi pwm_omap_dmtimer gpio_keys hwmon pwm_bl o
map3_isp videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_core v4l
2_common snd_soc_omap_mcbsp snd_soc_omap omap_wdt videodev media omap_hdq wlcore
_sdio wire cn phy_twl4030_usb omap2430 musb_hdrc udc_core twl4030_wdt rtc_twl sn
d_soc_twl4030 ehci_omap snd_soc_core snd_pcm_dmaengine snd_pcm ehci_hcd snd_time
r twl4030_pwrbutton ohci_omap3 twl4030_charger pwm_twl_led snd twl4030_keypad so
undcore pwm_twl industrialio matrix_keymap ohci_hcd usbcore usb_common at24 tsc2
004 omap_ssi tsc200x_core nvmem_core hsi omapdss
[   14.766357] CPU: 0 PID: 174 Comm: wpa_supplicant Not tainted 4.11.0-rc1-00015
-g6c0afb5 #1
[   14.774993] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[   14.781646] task: cc8a8000 task.stack: cc8bc000
[   14.786468] PC is at _wait_softreset_complete+0x70/0x114
[   14.792083] LR is at _enable_sysc+0x30/0x238
[   14.796630] pc : [<c011fe00>]    lr : [<c0120ce0>]    psr: 40010093
[   14.796630] sp : cc8bdbd0  ip : c01288fc  fp : 00000000
[   14.808715] r10: cc8bc000  r9 : c0b0225c  r8 : 00002710
[   14.814239] r7 : 000346dc  r6 : c0d20644  r5 : c0d202ac  r4 : 00000000
[   14.821136] r3 : fa0ad014  r2 : fa0ad000  r1 : 00000000  r0 : c0d202ac
[   14.828033] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment non
e
[   14.835662] Control: 10c5387d  Table: 8c2ac019  DAC: 00000051
[   14.841735] Process wpa_supplicant (pid: 174, stack limit = 0xcc8bc218)

[snip what appears to be just memory dump or a bunch of numbers]

[   15.147277] [<c011fe00>] (_wait_softreset_complete) from [<c0120ce0>] (_enabl
e_sysc+0x30/0x238)
[   15.156463] [<c0120ce0>] (_enable_sysc) from [<c012101c>] (_enable+0x134/0x25
8)
[   15.164215] [<c012101c>] (_enable) from [<c012172c>] (omap_hwmod_enable+0x28/
0x48)
[   15.172210] [<c012172c>] (omap_hwmod_enable) from [<c0122700>] (omap_device_e
nable+0x3c/0x90)
[   15.181213] [<c0122700>] (omap_device_enable) from [<c0122764>] (_od_runtime_
resume+0x10/0x38)
[   15.190338] [<c0122764>] (_od_runtime_resume) from [<c057fd24>] (__rpm_callba
ck+0xc0/0x214)
[   15.199157] [<c057fd24>] (__rpm_callback) from [<c057fec8>] (rpm_callback+0x5
0/0x80)
[   15.207366] [<c057fec8>] (rpm_callback) from [<c057f980>] (rpm_resume+0x4b8/0
x738)
[   15.215362] [<c057f980>] (rpm_resume) from [<c057fc4c>] (__pm_runtime_resume+
0x4c/0x64)
[   15.223846] [<c057fc4c>] (__pm_runtime_resume) from [<c065f538>] (__mmc_claim
_host+0x174/0x1b8)
[   15.233062] [<c065f538>] (__mmc_claim_host) from [<bf2ce1e8>] (wl12xx_sdio_ra
w_write+0x34/0x130 [wlcore_sdio])
[   15.243927] [<bf2ce1e8>] (wl12xx_sdio_raw_write [wlcore_sdio]) from [<bf604db
0>] (wlcore_set_partition+0xc4/0x4b0 [wlcore])
[   15.256042] [<bf604db0>] (wlcore_set_partition [wlcore]) from [<bf5fb840>] (w
l12xx_set_power_on+0x80/0x144 [wlcore])
[   15.267517] [<bf5fb840>] (wl12xx_set_power_on [wlcore]) from [<bf5fed6c>] (wl
1271_op_add_interface+0x6ac/0x9c0 [wlcore])
[   15.280303] [<bf5fed6c>] (wl1271_op_add_interface [wlcore]) from [<bf518cd0>]
 (drv_add_interface+0x80/0x31c [mac80211])
[   15.293121] [<bf518cd0>] (drv_add_interface [mac80211]) from [<bf537690>] (ie
ee80211_do_open+0x474/0x8d4 [mac80211])
[   15.304931] [<bf537690>] (ieee80211_do_open [mac80211]) from [<c06b8124>] (__
dev_open+0xa8/0x110)
[   15.314300] [<c06b8124>] (__dev_open) from [<c06b83a8>] (__dev_change_flags+0
x88/0x14c)
[   15.322784] [<c06b83a8>] (__dev_change_flags) from [<c06b8484>] (dev_change_f
lags+0x18/0x48)
[   15.331695] [<c06b8484>] (dev_change_flags) from [<c07334f4>] (devinet_ioctl+
0x720/0x824)
[   15.340362] [<c07334f4>] (devinet_ioctl) from [<c0692d24>] (sock_ioctl+0x160/
0x318)
[   15.348449] [<c0692d24>] (sock_ioctl) from [<c02c7d8c>] (do_vfs_ioctl+0x90/0x
a10)
[   15.356384] [<c02c7d8c>] (do_vfs_ioctl) from [<c02c8778>] (SyS_ioctl+0x6c/0x7
c)
[   15.364105] [<c02c8778>] (SyS_ioctl) from [<c0107840>] (ret_fast_syscall+0x0/
0x1c)
[   15.372131] Code: e3120c01 e595205c e6f23073 1affffef (e5933000)
[   15.378601] ---[ end trace 6966c05397661217 ]---
[   15.383544] In-band Error seen by MPU  at address 0

[snip]

There is much more data to dump after this, but I don't want to dump a bunch of noise if it isn't helpful.

Quoted 29 lines
---
 arch/arm/mach-omap2/clkt2xxx_dpllcore.c |  3 +-
 arch/arm/mach-omap2/clock.c             |  2 +-
 arch/arm/mach-omap2/clock.h             |  2 ++
 arch/arm/mach-omap2/cm.h                |  5 +--
 arch/arm/mach-omap2/cm2xxx.c            |  9 ++---
 arch/arm/mach-omap2/cm3xxx.c            | 10 ++----
 arch/arm/mach-omap2/cm_common.c         |  2 +-
 drivers/clk/ti/apll.c                   | 47 ++++++++++++-------------
 drivers/clk/ti/autoidle.c               | 18 +++++-----
 drivers/clk/ti/clk-3xxx.c               | 55 +++++++++++++++--------------
 drivers/clk/ti/clk.c                    | 47 ++++++++++++-------------
 drivers/clk/ti/clkt_dflt.c              | 61 ++++++++++++---------------------
 drivers/clk/ti/clkt_dpll.c              |  6 ++--
 drivers/clk/ti/clkt_iclk.c              | 29 ++++++++--------
 drivers/clk/ti/clock.h                  | 11 +++---
 drivers/clk/ti/clockdomain.c            |  8 -----
 drivers/clk/ti/divider.c                | 24 +++++++------
 drivers/clk/ti/dpll.c                   | 48 ++++++++++----------------
 drivers/clk/ti/dpll3xxx.c               | 38 ++++++++++----------
 drivers/clk/ti/dpll44xx.c               | 14 ++++----
 drivers/clk/ti/gate.c                   | 32 ++++++++---------
 drivers/clk/ti/interface.c              | 22 ++++++------
 drivers/clk/ti/mux.c                    | 41 +++++++++-------------
 include/linux/clk/ti.h                  | 46 +++++++++++++------------
 24 files changed, 264 insertions(+), 316 deletions(-)

[ snip]

Quoted 11 lines

+ s16 *prcm_inst, u8 *idlest_reg_id);
};

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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 7 lines · Adam Ford
Quoted 6 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 9 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

I don't have access to the specific hw, but can you try to dig out which hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

-Tero

Quoted 128 lines


# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
[   14.674011] Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa
0ad014
[   14.682708] pgd = cc2ac000
[   14.685607] [fa0ad014] *pgd=48011452(bad)
[   14.689941] Internal error: : 1028 [#1] SMP ARM
[   14.694732] Modules linked in: arc4 wl12xx wlcore mac80211 cfg80211 evdev joy
dev snd_soc_omap_twl4030 omapfb cfbfillrect cfbimgblt leds_gpio cpufreq_dt cfbco
pyarea led_class thermal_sys panel_dpi pwm_omap_dmtimer gpio_keys hwmon pwm_bl o
map3_isp videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_core v4l
2_common snd_soc_omap_mcbsp snd_soc_omap omap_wdt videodev media omap_hdq wlcore
_sdio wire cn phy_twl4030_usb omap2430 musb_hdrc udc_core twl4030_wdt rtc_twl sn
d_soc_twl4030 ehci_omap snd_soc_core snd_pcm_dmaengine snd_pcm ehci_hcd snd_time
r twl4030_pwrbutton ohci_omap3 twl4030_charger pwm_twl_led snd twl4030_keypad so
undcore pwm_twl industrialio matrix_keymap ohci_hcd usbcore usb_common at24 tsc2
004 omap_ssi tsc200x_core nvmem_core hsi omapdss
[   14.766357] CPU: 0 PID: 174 Comm: wpa_supplicant Not tainted 4.11.0-rc1-00015
-g6c0afb5 #1
[   14.774993] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[   14.781646] task: cc8a8000 task.stack: cc8bc000
[   14.786468] PC is at _wait_softreset_complete+0x70/0x114
[   14.792083] LR is at _enable_sysc+0x30/0x238
[   14.796630] pc : [<c011fe00>]    lr : [<c0120ce0>]    psr: 40010093
[   14.796630] sp : cc8bdbd0  ip : c01288fc  fp : 00000000
[   14.808715] r10: cc8bc000  r9 : c0b0225c  r8 : 00002710
[   14.814239] r7 : 000346dc  r6 : c0d20644  r5 : c0d202ac  r4 : 00000000
[   14.821136] r3 : fa0ad014  r2 : fa0ad000  r1 : 00000000  r0 : c0d202ac
[   14.828033] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment non
e
[   14.835662] Control: 10c5387d  Table: 8c2ac019  DAC: 00000051
[   14.841735] Process wpa_supplicant (pid: 174, stack limit = 0xcc8bc218)

[snip what appears to be just memory dump or a bunch of numbers]

[   15.147277] [<c011fe00>] (_wait_softreset_complete) from [<c0120ce0>] (_enabl
e_sysc+0x30/0x238)
[   15.156463] [<c0120ce0>] (_enable_sysc) from [<c012101c>] (_enable+0x134/0x25
8)
[   15.164215] [<c012101c>] (_enable) from [<c012172c>] (omap_hwmod_enable+0x28/
0x48)
[   15.172210] [<c012172c>] (omap_hwmod_enable) from [<c0122700>] (omap_device_e
nable+0x3c/0x90)
[   15.181213] [<c0122700>] (omap_device_enable) from [<c0122764>] (_od_runtime_
resume+0x10/0x38)
[   15.190338] [<c0122764>] (_od_runtime_resume) from [<c057fd24>] (__rpm_callba
ck+0xc0/0x214)
[   15.199157] [<c057fd24>] (__rpm_callback) from [<c057fec8>] (rpm_callback+0x5
0/0x80)
[   15.207366] [<c057fec8>] (rpm_callback) from [<c057f980>] (rpm_resume+0x4b8/0
x738)
[   15.215362] [<c057f980>] (rpm_resume) from [<c057fc4c>] (__pm_runtime_resume+
0x4c/0x64)
[   15.223846] [<c057fc4c>] (__pm_runtime_resume) from [<c065f538>] (__mmc_claim
_host+0x174/0x1b8)
[   15.233062] [<c065f538>] (__mmc_claim_host) from [<bf2ce1e8>] (wl12xx_sdio_ra
w_write+0x34/0x130 [wlcore_sdio])
[   15.243927] [<bf2ce1e8>] (wl12xx_sdio_raw_write [wlcore_sdio]) from [<bf604db
0>] (wlcore_set_partition+0xc4/0x4b0 [wlcore])
[   15.256042] [<bf604db0>] (wlcore_set_partition [wlcore]) from [<bf5fb840>] (w
l12xx_set_power_on+0x80/0x144 [wlcore])
[   15.267517] [<bf5fb840>] (wl12xx_set_power_on [wlcore]) from [<bf5fed6c>] (wl
1271_op_add_interface+0x6ac/0x9c0 [wlcore])
[   15.280303] [<bf5fed6c>] (wl1271_op_add_interface [wlcore]) from [<bf518cd0>]
  (drv_add_interface+0x80/0x31c [mac80211])
[   15.293121] [<bf518cd0>] (drv_add_interface [mac80211]) from [<bf537690>] (ie
ee80211_do_open+0x474/0x8d4 [mac80211])
[   15.304931] [<bf537690>] (ieee80211_do_open [mac80211]) from [<c06b8124>] (__
dev_open+0xa8/0x110)
[   15.314300] [<c06b8124>] (__dev_open) from [<c06b83a8>] (__dev_change_flags+0
x88/0x14c)
[   15.322784] [<c06b83a8>] (__dev_change_flags) from [<c06b8484>] (dev_change_f
lags+0x18/0x48)
[   15.331695] [<c06b8484>] (dev_change_flags) from [<c07334f4>] (devinet_ioctl+
0x720/0x824)
[   15.340362] [<c07334f4>] (devinet_ioctl) from [<c0692d24>] (sock_ioctl+0x160/
0x318)
[   15.348449] [<c0692d24>] (sock_ioctl) from [<c02c7d8c>] (do_vfs_ioctl+0x90/0x
a10)
[   15.356384] [<c02c7d8c>] (do_vfs_ioctl) from [<c02c8778>] (SyS_ioctl+0x6c/0x7
c)
[   15.364105] [<c02c8778>] (SyS_ioctl) from [<c0107840>] (ret_fast_syscall+0x0/
0x1c)
[   15.372131] Code: e3120c01 e595205c e6f23073 1affffef (e5933000)
[   15.378601] ---[ end trace 6966c05397661217 ]---
[   15.383544] In-band Error seen by MPU  at address 0

[snip]

There is much more data to dump after this, but I don't want to dump a bunch of noise if it isn't helpful.

Quoted 20 lines
---
  arch/arm/mach-omap2/clkt2xxx_dpllcore.c |  3 +-
  arch/arm/mach-omap2/clock.c             |  2 +-
  arch/arm/mach-omap2/clock.h             |  2 ++
  arch/arm/mach-omap2/cm.h                |  5 +--
  arch/arm/mach-omap2/cm2xxx.c            |  9 ++---
  arch/arm/mach-omap2/cm3xxx.c            | 10 ++----
  arch/arm/mach-omap2/cm_common.c         |  2 +-
  drivers/clk/ti/apll.c                   | 47 ++++++++++++-------------
  drivers/clk/ti/autoidle.c               | 18 +++++-----
  drivers/clk/ti/clk-3xxx.c               | 55 +++++++++++++++--------------
  drivers/clk/ti/clk.c                    | 47 ++++++++++++-------------
  drivers/clk/ti/clkt_dflt.c              | 61 ++++++++++++---------------------
  drivers/clk/ti/clkt_dpll.c              |  6 ++--
  drivers/clk/ti/clkt_iclk.c              | 29 ++++++++--------
  drivers/clk/ti/clock.h                  | 11 +++---
  drivers/clk/ti/clockdomain.c            |  8 -----
  drivers/clk/ti/divider.c                | 24 +++++++------
Quoted 9 lines
  drivers/clk/ti/dpll.c                   | 48 ++++++++++----------------
  drivers/clk/ti/dpll3xxx.c               | 38 ++++++++++----------
  drivers/clk/ti/dpll44xx.c               | 14 ++++----
  drivers/clk/ti/gate.c                   | 32 ++++++++---------
  drivers/clk/ti/interface.c              | 22 ++++++------
  drivers/clk/ti/mux.c                    | 41 +++++++++-------------
  include/linux/clk/ti.h                  | 46 +++++++++++++------------
  24 files changed, 264 insertions(+), 316 deletions(-)
Quoted 14 lines

[ snip]

Quoted 11 lines

+ s16 *prcm_inst, u8 *idlest_reg_id);
};

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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

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

#18 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 27 lines · Tero Kristo
Quoted 9 lines · Adam Ford
Quoted 7 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 7 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

Quoted 8 lines
Quoted 2 lines

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

I don't have access to the specific hw, but can you try to dig out which hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct omap_hwmod *oh)
        int c = 0;
 
        sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
        if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
                                   & SYSS_RESETDONE_MASK),

This leads me to believe that the omap_test_timeout functions might not be working quite right.

Here is the working log with the above patch:

# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B
[   17.992858] _wait_softreset_complete: mmc1
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)
[   18.878326] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
# [   19.526275] _wait_softreset_complete: mmc3
[   19.787322] _wait_softreset_complete: mmc3
[   20.544830] _wait_softreset_complete: mmc3
[   21.600433] _wait_softreset_complete: mmc1
[   21.619293] _wait_softreset_complete: i2c1
[   21.893341] _wait_softreset_complete: mmc3
[   22.362091] wlan0: authenticate with 70:3a:cb:5e:14:62
[   22.437713] wlan0: send auth to 70:3a:cb:5e:14:62 (try 1/3)
[   22.455139] wlan0: authenticated
[   22.471710] wlan0: associate with 70:3a:cb:5e:14:62 (try 1/3)
[   22.486206] wlan0: RX AssocResp from 70:3a:cb:5e:14:62 (capab=0x11 status=0 a
id=3)
[   22.517303] wlan0: associated
[   22.521728] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

I doubled checked again without the patch and it crashes like shown below, so the debug is definately make something better.

I haven't checked the 4.15-RC candidate yet, so I'll see if that's changed, and I'll let you know what I find.

Quoted 2 lines

-Tero

adam

Quoted 187 lines
Quoted 167 lines



# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
[   14.674011] Unhandled fault: external abort on non-linefetch (0x1028)
at 0xfa
0ad014
[   14.682708] pgd = cc2ac000
[   14.685607] [fa0ad014] *pgd=48011452(bad)
[   14.689941] Internal error: : 1028 [#1] SMP ARM
[   14.694732] Modules linked in: arc4 wl12xx wlcore mac80211 cfg80211
evdev joy
dev snd_soc_omap_twl4030 omapfb cfbfillrect cfbimgblt leds_gpio cpufreq_dt
cfbco
pyarea led_class thermal_sys panel_dpi pwm_omap_dmtimer gpio_keys hwmon
pwm_bl o
map3_isp videobuf2_dma_contig videobuf2_memops videobuf2_v4l2
videobuf2_core v4l
2_common snd_soc_omap_mcbsp snd_soc_omap omap_wdt videodev media omap_hdq
wlcore
_sdio wire cn phy_twl4030_usb omap2430 musb_hdrc udc_core twl4030_wdt
rtc_twl sn
d_soc_twl4030 ehci_omap snd_soc_core snd_pcm_dmaengine snd_pcm ehci_hcd
snd_time
r twl4030_pwrbutton ohci_omap3 twl4030_charger pwm_twl_led snd
twl4030_keypad so
undcore pwm_twl industrialio matrix_keymap ohci_hcd usbcore usb_common
at24 tsc2
004 omap_ssi tsc200x_core nvmem_core hsi omapdss
[   14.766357] CPU: 0 PID: 174 Comm: wpa_supplicant Not tainted
4.11.0-rc1-00015
-g6c0afb5 #1
[   14.774993] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[   14.781646] task: cc8a8000 task.stack: cc8bc000
[   14.786468] PC is at _wait_softreset_complete+0x70/0x114
[   14.792083] LR is at _enable_sysc+0x30/0x238
[   14.796630] pc : [<c011fe00>]    lr : [<c0120ce0>]    psr: 40010093
[   14.796630] sp : cc8bdbd0  ip : c01288fc  fp : 00000000
[   14.808715] r10: cc8bc000  r9 : c0b0225c  r8 : 00002710
[   14.814239] r7 : 000346dc  r6 : c0d20644  r5 : c0d202ac  r4 : 00000000
[   14.821136] r3 : fa0ad014  r2 : fa0ad000  r1 : 00000000  r0 : c0d202ac
[   14.828033] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment non
e
[   14.835662] Control: 10c5387d  Table: 8c2ac019  DAC: 00000051
[   14.841735] Process wpa_supplicant (pid: 174, stack limit = 0xcc8bc218)

[snip what appears to be just memory dump or a bunch of numbers]

[   15.147277] [<c011fe00>] (_wait_softreset_complete) from [<c0120ce0>]
(_enabl
e_sysc+0x30/0x238)
[   15.156463] [<c0120ce0>] (_enable_sysc) from [<c012101c>]
(_enable+0x134/0x25
8)
[   15.164215] [<c012101c>] (_enable) from [<c012172c>]
(omap_hwmod_enable+0x28/
0x48)
[   15.172210] [<c012172c>] (omap_hwmod_enable) from [<c0122700>]
(omap_device_e
nable+0x3c/0x90)
[   15.181213] [<c0122700>] (omap_device_enable) from [<c0122764>]
(_od_runtime_
resume+0x10/0x38)
[   15.190338] [<c0122764>] (_od_runtime_resume) from [<c057fd24>]
(__rpm_callba
ck+0xc0/0x214)
[   15.199157] [<c057fd24>] (__rpm_callback) from [<c057fec8>]
(rpm_callback+0x5
0/0x80)
[   15.207366] [<c057fec8>] (rpm_callback) from [<c057f980>]
(rpm_resume+0x4b8/0
x738)
[   15.215362] [<c057f980>] (rpm_resume) from [<c057fc4c>]
(__pm_runtime_resume+
0x4c/0x64)
[   15.223846] [<c057fc4c>] (__pm_runtime_resume) from [<c065f538>]
(__mmc_claim
_host+0x174/0x1b8)
[   15.233062] [<c065f538>] (__mmc_claim_host) from [<bf2ce1e8>]
(wl12xx_sdio_ra
w_write+0x34/0x130 [wlcore_sdio])
[   15.243927] [<bf2ce1e8>] (wl12xx_sdio_raw_write [wlcore_sdio]) from
[<bf604db
0>] (wlcore_set_partition+0xc4/0x4b0 [wlcore])
[   15.256042] [<bf604db0>] (wlcore_set_partition [wlcore]) from
[<bf5fb840>] (w
l12xx_set_power_on+0x80/0x144 [wlcore])
[   15.267517] [<bf5fb840>] (wl12xx_set_power_on [wlcore]) from
[<bf5fed6c>] (wl
1271_op_add_interface+0x6ac/0x9c0 [wlcore])
[   15.280303] [<bf5fed6c>] (wl1271_op_add_interface [wlcore]) from
[<bf518cd0>]
  (drv_add_interface+0x80/0x31c [mac80211])
[   15.293121] [<bf518cd0>] (drv_add_interface [mac80211]) from
[<bf537690>] (ie
ee80211_do_open+0x474/0x8d4 [mac80211])
[   15.304931] [<bf537690>] (ieee80211_do_open [mac80211]) from
[<c06b8124>] (__
dev_open+0xa8/0x110)
[   15.314300] [<c06b8124>] (__dev_open) from [<c06b83a8>]
(__dev_change_flags+0
x88/0x14c)
[   15.322784] [<c06b83a8>] (__dev_change_flags) from [<c06b8484>]
(dev_change_f
lags+0x18/0x48)
[   15.331695] [<c06b8484>] (dev_change_flags) from [<c07334f4>]
(devinet_ioctl+
0x720/0x824)
[   15.340362] [<c07334f4>] (devinet_ioctl) from [<c0692d24>]
(sock_ioctl+0x160/
0x318)
[   15.348449] [<c0692d24>] (sock_ioctl) from [<c02c7d8c>]
(do_vfs_ioctl+0x90/0x
a10)
[   15.356384] [<c02c7d8c>] (do_vfs_ioctl) from [<c02c8778>]
(SyS_ioctl+0x6c/0x7
c)
[   15.364105] [<c02c8778>] (SyS_ioctl) from [<c0107840>]
(ret_fast_syscall+0x0/
0x1c)
[   15.372131] Code: e3120c01 e595205c e6f23073 1affffef (e5933000)
[   15.378601] ---[ end trace 6966c05397661217 ]---
[   15.383544] In-band Error seen by MPU  at address 0

[snip]

There is much more data to dump after this, but I don't want to dump a bunch of noise if it isn't helpful.

Quoted 22 lines
---
  arch/arm/mach-omap2/clkt2xxx_dpllcore.c |  3 +-
  arch/arm/mach-omap2/clock.c             |  2 +-
  arch/arm/mach-omap2/clock.h             |  2 ++
  arch/arm/mach-omap2/cm.h                |  5 +--
  arch/arm/mach-omap2/cm2xxx.c            |  9 ++---
  arch/arm/mach-omap2/cm3xxx.c            | 10 ++----
  arch/arm/mach-omap2/cm_common.c         |  2 +-
  drivers/clk/ti/apll.c                   | 47 ++++++++++++-------------
  drivers/clk/ti/autoidle.c               | 18 +++++-----
  drivers/clk/ti/clk-3xxx.c               | 55
+++++++++++++++--------------
  drivers/clk/ti/clk.c                    | 47 ++++++++++++-------------
  drivers/clk/ti/clkt_dflt.c              | 61
++++++++++++---------------------
  drivers/clk/ti/clkt_dpll.c              |  6 ++--
  drivers/clk/ti/clkt_iclk.c              | 29 ++++++++--------
  drivers/clk/ti/clock.h                  | 11 +++---
  drivers/clk/ti/clockdomain.c            |  8 -----
  drivers/clk/ti/divider.c                | 24 +++++++------
Quoted 9 lines
  drivers/clk/ti/dpll.c                   | 48 ++++++++++----------------
  drivers/clk/ti/dpll3xxx.c               | 38 ++++++++++----------
  drivers/clk/ti/dpll44xx.c               | 14 ++++----
  drivers/clk/ti/gate.c                   | 32 ++++++++---------
  drivers/clk/ti/interface.c              | 22 ++++++------
  drivers/clk/ti/mux.c                    | 41 +++++++++-------------
  include/linux/clk/ti.h                  | 46 +++++++++++++------------
  24 files changed, 264 insertions(+), 316 deletions(-)
Quoted 15 lines

[ snip]

Quoted 12 lines

+ s16 *prcm_inst, u8
*idlest_reg_id);
};

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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

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

#19 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 83 lines · Adam Ford
Quoted 27 lines · Tero Kristo
Quoted 9 lines · Adam Ford
Quoted 7 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 7 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

Quoted 8 lines
Quoted 2 lines

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

I don't have access to the specific hw, but can you try to dig out which hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct omap_hwmod *oh)
        int c = 0;
 
        sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
        if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
                                   & SYSS_RESETDONE_MASK),

This leads me to believe that the omap_test_timeout functions might not be working quite right.

Here is the working log with the above patch:

# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B
[   17.992858] _wait_softreset_complete: mmc1
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)
[   18.878326] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
# [   19.526275] _wait_softreset_complete: mmc3
[   19.787322] _wait_softreset_complete: mmc3
[   20.544830] _wait_softreset_complete: mmc3
[   21.600433] _wait_softreset_complete: mmc1
[   21.619293] _wait_softreset_complete: i2c1
[   21.893341] _wait_softreset_complete: mmc3
[   22.362091] wlan0: authenticate with 70:3a:cb:5e:14:62
[   22.437713] wlan0: send auth to 70:3a:cb:5e:14:62 (try 1/3)
[   22.455139] wlan0: authenticated
[   22.471710] wlan0: associate with 70:3a:cb:5e:14:62 (try 1/3)
[   22.486206] wlan0: RX AssocResp from 70:3a:cb:5e:14:62 (capab=0x11 status=0 a
id=3)
[   22.517303] wlan0: associated
[   22.521728] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Quoted 6 lines

I doubled checked again without the patch and it crashes like shown below, so the debug is definately make something better.

I haven't checked the 4.15-RC candidate yet, so I'll see if that's changed, and I'll let you know what I find.

4.15.0-rc8 appears to be fixed, but 4.14 is still broken without
debuging. If you have any ideas on what might be able to backport to 4.14.y, I am willing to try it.

adam

Quoted 191 lines
Quoted 2 lines

-Tero

adam

Quoted 187 lines
Quoted 167 lines



# wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf -B
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
[   14.674011] Unhandled fault: external abort on non-linefetch (0x1028)
at 0xfa
0ad014
[   14.682708] pgd = cc2ac000
[   14.685607] [fa0ad014] *pgd=48011452(bad)
[   14.689941] Internal error: : 1028 [#1] SMP ARM
[   14.694732] Modules linked in: arc4 wl12xx wlcore mac80211 cfg80211
evdev joy
dev snd_soc_omap_twl4030 omapfb cfbfillrect cfbimgblt leds_gpio cpufreq_dt
cfbco
pyarea led_class thermal_sys panel_dpi pwm_omap_dmtimer gpio_keys hwmon
pwm_bl o
map3_isp videobuf2_dma_contig videobuf2_memops videobuf2_v4l2
videobuf2_core v4l
2_common snd_soc_omap_mcbsp snd_soc_omap omap_wdt videodev media omap_hdq
wlcore
_sdio wire cn phy_twl4030_usb omap2430 musb_hdrc udc_core twl4030_wdt
rtc_twl sn
d_soc_twl4030 ehci_omap snd_soc_core snd_pcm_dmaengine snd_pcm ehci_hcd
snd_time
r twl4030_pwrbutton ohci_omap3 twl4030_charger pwm_twl_led snd
twl4030_keypad so
undcore pwm_twl industrialio matrix_keymap ohci_hcd usbcore usb_common
at24 tsc2
004 omap_ssi tsc200x_core nvmem_core hsi omapdss
[   14.766357] CPU: 0 PID: 174 Comm: wpa_supplicant Not tainted
4.11.0-rc1-00015
-g6c0afb5 #1
[   14.774993] Hardware name: Generic OMAP36xx (Flattened Device Tree)
[   14.781646] task: cc8a8000 task.stack: cc8bc000
[   14.786468] PC is at _wait_softreset_complete+0x70/0x114
[   14.792083] LR is at _enable_sysc+0x30/0x238
[   14.796630] pc : [<c011fe00>]    lr : [<c0120ce0>]    psr: 40010093
[   14.796630] sp : cc8bdbd0  ip : c01288fc  fp : 00000000
[   14.808715] r10: cc8bc000  r9 : c0b0225c  r8 : 00002710
[   14.814239] r7 : 000346dc  r6 : c0d20644  r5 : c0d202ac  r4 : 00000000
[   14.821136] r3 : fa0ad014  r2 : fa0ad000  r1 : 00000000  r0 : c0d202ac
[   14.828033] Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM
Segment non
e
[   14.835662] Control: 10c5387d  Table: 8c2ac019  DAC: 00000051
[   14.841735] Process wpa_supplicant (pid: 174, stack limit = 0xcc8bc218)

[snip what appears to be just memory dump or a bunch of numbers]

[   15.147277] [<c011fe00>] (_wait_softreset_complete) from [<c0120ce0>]
(_enabl
e_sysc+0x30/0x238)
[   15.156463] [<c0120ce0>] (_enable_sysc) from [<c012101c>]
(_enable+0x134/0x25
8)
[   15.164215] [<c012101c>] (_enable) from [<c012172c>]
(omap_hwmod_enable+0x28/
0x48)
[   15.172210] [<c012172c>] (omap_hwmod_enable) from [<c0122700>]
(omap_device_e
nable+0x3c/0x90)
[   15.181213] [<c0122700>] (omap_device_enable) from [<c0122764>]
(_od_runtime_
resume+0x10/0x38)
[   15.190338] [<c0122764>] (_od_runtime_resume) from [<c057fd24>]
(__rpm_callba
ck+0xc0/0x214)
[   15.199157] [<c057fd24>] (__rpm_callback) from [<c057fec8>]
(rpm_callback+0x5
0/0x80)
[   15.207366] [<c057fec8>] (rpm_callback) from [<c057f980>]
(rpm_resume+0x4b8/0
x738)
[   15.215362] [<c057f980>] (rpm_resume) from [<c057fc4c>]
(__pm_runtime_resume+
0x4c/0x64)
[   15.223846] [<c057fc4c>] (__pm_runtime_resume) from [<c065f538>]
(__mmc_claim
_host+0x174/0x1b8)
[   15.233062] [<c065f538>] (__mmc_claim_host) from [<bf2ce1e8>]
(wl12xx_sdio_ra
w_write+0x34/0x130 [wlcore_sdio])
[   15.243927] [<bf2ce1e8>] (wl12xx_sdio_raw_write [wlcore_sdio]) from
[<bf604db
0>] (wlcore_set_partition+0xc4/0x4b0 [wlcore])
[   15.256042] [<bf604db0>] (wlcore_set_partition [wlcore]) from
[<bf5fb840>] (w
l12xx_set_power_on+0x80/0x144 [wlcore])
[   15.267517] [<bf5fb840>] (wl12xx_set_power_on [wlcore]) from
[<bf5fed6c>] (wl
1271_op_add_interface+0x6ac/0x9c0 [wlcore])
[   15.280303] [<bf5fed6c>] (wl1271_op_add_interface [wlcore]) from
[<bf518cd0>]
  (drv_add_interface+0x80/0x31c [mac80211])
[   15.293121] [<bf518cd0>] (drv_add_interface [mac80211]) from
[<bf537690>] (ie
ee80211_do_open+0x474/0x8d4 [mac80211])
[   15.304931] [<bf537690>] (ieee80211_do_open [mac80211]) from
[<c06b8124>] (__
dev_open+0xa8/0x110)
[   15.314300] [<c06b8124>] (__dev_open) from [<c06b83a8>]
(__dev_change_flags+0
x88/0x14c)
[   15.322784] [<c06b83a8>] (__dev_change_flags) from [<c06b8484>]
(dev_change_f
lags+0x18/0x48)
[   15.331695] [<c06b8484>] (dev_change_flags) from [<c07334f4>]
(devinet_ioctl+
0x720/0x824)
[   15.340362] [<c07334f4>] (devinet_ioctl) from [<c0692d24>]
(sock_ioctl+0x160/
0x318)
[   15.348449] [<c0692d24>] (sock_ioctl) from [<c02c7d8c>]
(do_vfs_ioctl+0x90/0x
a10)
[   15.356384] [<c02c7d8c>] (do_vfs_ioctl) from [<c02c8778>]
(SyS_ioctl+0x6c/0x7
c)
[   15.364105] [<c02c8778>] (SyS_ioctl) from [<c0107840>]
(ret_fast_syscall+0x0/
0x1c)
[   15.372131] Code: e3120c01 e595205c e6f23073 1affffef (e5933000)
[   15.378601] ---[ end trace 6966c05397661217 ]---
[   15.383544] In-band Error seen by MPU  at address 0

[snip]

There is much more data to dump after this, but I don't want to dump a bunch of noise if it isn't helpful.

Quoted 22 lines
---
  arch/arm/mach-omap2/clkt2xxx_dpllcore.c |  3 +-
  arch/arm/mach-omap2/clock.c             |  2 +-
  arch/arm/mach-omap2/clock.h             |  2 ++
  arch/arm/mach-omap2/cm.h                |  5 +--
  arch/arm/mach-omap2/cm2xxx.c            |  9 ++---
  arch/arm/mach-omap2/cm3xxx.c            | 10 ++----
  arch/arm/mach-omap2/cm_common.c         |  2 +-
  drivers/clk/ti/apll.c                   | 47 ++++++++++++-------------
  drivers/clk/ti/autoidle.c               | 18 +++++-----
  drivers/clk/ti/clk-3xxx.c               | 55
+++++++++++++++--------------
  drivers/clk/ti/clk.c                    | 47 ++++++++++++-------------
  drivers/clk/ti/clkt_dflt.c              | 61
++++++++++++---------------------
  drivers/clk/ti/clkt_dpll.c              |  6 ++--
  drivers/clk/ti/clkt_iclk.c              | 29 ++++++++--------
  drivers/clk/ti/clock.h                  | 11 +++---
  drivers/clk/ti/clockdomain.c            |  8 -----
  drivers/clk/ti/divider.c                | 24 +++++++------
Quoted 9 lines
  drivers/clk/ti/dpll.c                   | 48 ++++++++++----------------
  drivers/clk/ti/dpll3xxx.c               | 38 ++++++++++----------
  drivers/clk/ti/dpll44xx.c               | 14 ++++----
  drivers/clk/ti/gate.c                   | 32 ++++++++---------
  drivers/clk/ti/interface.c              | 22 ++++++------
  drivers/clk/ti/mux.c                    | 41 +++++++++-------------
  include/linux/clk/ti.h                  | 46 +++++++++++++------------
  24 files changed, 264 insertions(+), 316 deletions(-)
Quoted 15 lines

[ snip]

Quoted 12 lines

+ s16 *prcm_inst, u8
*idlest_reg_id);
};

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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

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

maintainer
#20 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

In reply to Adam Ford
Quoted 54 lines · Adam Ford
Quoted 27 lines · Tero Kristo
Quoted 9 lines · Adam Ford
Quoted 7 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 7 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

Quoted 8 lines
Quoted 2 lines

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

I don't have access to the specific hw, but can you try to dig out which hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct omap_hwmod *oh)
        int c = 0;
 
        sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
        if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
                                   & SYSS_RESETDONE_MASK),
Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Regards,

Tony

#21 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 62 lines · Tony Lindgren
Quoted 54 lines · Adam Ford
Quoted 27 lines · Tero Kristo
Quoted 9 lines · Adam Ford
Quoted 7 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 7 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

Quoted 8 lines
Quoted 2 lines

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

I don't have access to the specific hw, but can you try to dig out which hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct omap_hwmod *oh)
        int c = 0;
 
        sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
        if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
                                   & SYSS_RESETDONE_MASK),
Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

adam

Quoted 4 lines

Regards,

Tony

#22 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 67 lines · Adam Ford
Quoted 62 lines · Tony Lindgren
Quoted 54 lines · Adam Ford
Quoted 27 lines · Tero Kristo
Quoted 9 lines · Adam Ford
Quoted 7 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into a void pointer to store all register addresses. This can be considered as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 7 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

Quoted 8 lines
Quoted 2 lines

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

I don't have access to the specific hw, but can you try to dig out which hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct omap_hwmod *oh)
         int c = 0;
 
         sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
         if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                 omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
                                    & SYSS_RESETDONE_MASK),
Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Quoted 6 lines

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

Looking at the log you provided, it looks like only mmc1, mmc3 and i2c1 are reset during the wlan probe. Based on the prints coming out in the failing case, it looks like the culprit might be mmc3 for some reason.

[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)

^ the firmware notification above does not come out in the crash.

-Tero

Quoted 4 lines

adam

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

Regards,

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

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

#23 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 96 lines · Tero Kristo
Quoted 83 lines · Adam Ford
Quoted 76 lines · Tony Lindgren
Quoted 66 lines · Adam Ford
Quoted 39 lines · Tero Kristo
Quoted 14 lines · Adam Ford
Quoted 11 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into
a void pointer to store all register addresses. This can be considered
as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct
in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 9 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

Quoted 5 lines

I don't have access to the specific hw, but can you try to dig out which
hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct
 omap_hwmod *oh)
         int c = 0;
 
         sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
         if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                 omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)

& SYSS_RESETDONE_MASK),

Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Quoted 6 lines

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

Looking at the log you provided, it looks like only mmc1, mmc3 and i2c1 are reset during the wlan probe. Based on the prints coming out in the failing case, it looks like the culprit might be mmc3 for some reason.

Quoted 7 lines
[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)

^ the firmware notification above does not come out in the crash.

I agree with your assessment. Any ideas why moving the debug statement before the if statement would make it start working? I added some artificial udelay at around 100, but I still got the crash. It seems like there is some timing issue, but at the same time just adding a delay isn't enough.

Quoted 2 lines

-Tero

adam

Quoted 17 lines
Quoted 4 lines

adam

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

Regards,

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

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

#24 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 102 lines · Adam Ford
Quoted 101 lines · Tero Kristo
Quoted 83 lines · Adam Ford
Quoted 76 lines · Tony Lindgren
Quoted 66 lines · Adam Ford
Quoted 39 lines · Tero Kristo
Quoted 14 lines · Adam Ford
Quoted 11 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into
a void pointer to store all register addresses. This can be considered
as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct
in place for this, which contains all the previously used data.

Quoted 6 lines
Quoted 3 lines

This patch is rather large as it is touching multiple files, but this can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 9 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

I am hoping it might be a simple fix for something that just needs to get added or tweaked in the device tree.

Quoted 5 lines

I don't have access to the specific hw, but can you try to dig out which
hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct
 omap_hwmod *oh)
          int c = 0;
 
          sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
          if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                  omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)

& SYSS_RESETDONE_MASK),

Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Quoted 6 lines

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

Looking at the log you provided, it looks like only mmc1, mmc3 and i2c1 are reset during the wlan probe. Based on the prints coming out in the failing case, it looks like the culprit might be mmc3 for some reason.

[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)
Quoted 8 lines
Quoted 2 lines

^ the firmware notification above does not come out in the crash.

I agree with your assessment. Any ideas why moving the debug statement before the if statement would make it start working? I added some artificial udelay at around 100, but I still got the crash. It seems like there is some timing issue, but at the same time just adding a delay isn't enough.

The pr_warn does more than just delay, it accesses the io-space potentially causing a flush on certain IO ranges. There might be some OCP readback missing for example, in which case a simple udelay may not help.

-Tero

Quoted 21 lines
Quoted 3 lines

-Tero

adam

Quoted 15 lines
Quoted 4 lines

adam

Quoted 1 line
Quoted 9 lines
Quoted 3 lines

Regards,

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

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

#25 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 132 lines · Tero Kristo
Quoted 121 lines · Adam Ford
Quoted 119 lines · Tero Kristo
Quoted 97 lines · Adam Ford
Quoted 88 lines · Tony Lindgren
Quoted 76 lines · Adam Ford
Quoted 47 lines · Tero Kristo
Quoted 17 lines · Adam Ford
Quoted 12 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into
a void pointer to store all register addresses. This can be considered
as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct
in place for this, which contains all the previously used data.

Quoted 7 lines
Quoted 4 lines

This patch is rather large as it is touching multiple files, but this
can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 10 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

I am hoping it might be a simple fix for something that just needs to
get added or tweaked in the device tree.

Quoted 5 lines

I don't have access to the specific hw, but can you try to dig out which
hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct
 omap_hwmod *oh)
          int c = 0;
 
          sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
          if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                  omap_test_timeout((omap_hwmod_read(oh,

sysc->syss_offs)
& SYSS_RESETDONE_MASK),

Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Quoted 6 lines

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

Looking at the log you provided, it looks like only mmc1, mmc3 and i2c1 are
reset during the wlan probe. Based on the prints coming out in the failing
case, it looks like the culprit might be mmc3 for some reason.

[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)
Quoted 8 lines
Quoted 2 lines

^ the firmware notification above does not come out in the crash.

I agree with your assessment. Any ideas why moving the debug statement before the if statement would make it start working? I added some artificial udelay at around 100, but I still got the crash. It seems like there is some timing issue, but at the same time just adding a delay isn't enough.

Quoted 4 lines

The pr_warn does more than just delay, it accesses the io-space potentially causing a flush on certain IO ranges. There might be some OCP readback missing for example, in which case a simple udelay may not help.

I am not very familiar with the OCP and/or how the flushing would impact this. Do you have any suggestions on how I can troubleshoot?

adam

Quoted 30 lines

-Tero

Quoted 22 lines
Quoted 3 lines

-Tero

adam

Quoted 16 lines
Quoted 6 lines

adam

Quoted 3 lines

Regards,

Quoted 8 lines
Quoted 1 line

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

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

#26 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 133 lines · Adam Ford
Quoted 132 lines · Tero Kristo
Quoted 129 lines · Adam Ford
Quoted 114 lines · Tero Kristo
Quoted 97 lines · Adam Ford
Quoted 88 lines · Tony Lindgren
Quoted 76 lines · Adam Ford
Quoted 47 lines · Tero Kristo
Quoted 17 lines · Adam Ford
Quoted 12 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast into
a void pointer to store all register addresses. This can be considered
as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct
in place for this, which contains all the previously used data.

Quoted 7 lines
Quoted 4 lines

This patch is rather large as it is touching multiple files, but this
can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 10 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash. I checked kernel revisions starting at 4.14 and working back to when it worked, then used git bisect from there.

I am hoping it might be a simple fix for something that just needs to
get added or tweaked in the device tree.

Quoted 5 lines

I don't have access to the specific hw, but can you try to dig out which
hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct
 omap_hwmod *oh)
           int c = 0;
 
           sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
           if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                   omap_test_timeout((omap_hwmod_read(oh,

sysc->syss_offs)
& SYSS_RESETDONE_MASK),

Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Quoted 6 lines

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

Looking at the log you provided, it looks like only mmc1, mmc3 and i2c1 are
reset during the wlan probe. Based on the prints coming out in the failing
case, it looks like the culprit might be mmc3 for some reason.

Quoted 7 lines
[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)

^ the firmware notification above does not come out in the crash.

I agree with your assessment. Any ideas why moving the debug statement before the if statement would make it start working? I added some artificial udelay at around 100, but I still got the crash. It seems like there is some timing issue, but at the same time just adding a delay isn't enough.

Quoted 7 lines
Quoted 4 lines

The pr_warn does more than just delay, it accesses the io-space potentially causing a flush on certain IO ranges. There might be some OCP readback missing for example, in which case a simple udelay may not help.

I am not very familiar with the OCP and/or how the flushing would impact this. Do you have any suggestions on how I can troubleshoot?

Typically an OCP barrier is inserted in the code as an immediate readback of the register in question, this effectively forces the register write all the way to the IP.

But, you said that the issue gets fixed with 4.15-rc? You could just simply bisect the issue and see which exact patch fixes it.

-Tero

Quoted 31 lines

adam

Quoted 28 lines

-Tero

Quoted 22 lines
Quoted 3 lines

-Tero

adam

Quoted 16 lines
Quoted 6 lines

adam

Quoted 3 lines

Regards,

Quoted 8 lines
Quoted 1 line

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

--

--

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

#27 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 166 lines · Tero Kristo
Quoted 155 lines · Adam Ford
Quoted 153 lines · Tero Kristo
Quoted 148 lines · Adam Ford
Quoted 132 lines · Tero Kristo
Quoted 113 lines · Adam Ford
Quoted 101 lines · Tony Lindgren
Quoted 87 lines · Adam Ford
Quoted 56 lines · Tero Kristo
Quoted 20 lines · Adam Ford
Quoted 14 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast
into
a void pointer to store all register addresses. This can be considered
as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct
in place for this, which contains all the previously used data.

Quoted 8 lines
Quoted 4 lines

This patch is rather large as it is touching multiple files, but this
can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is
causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 9 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash.
I checked kernel revisions starting at 4.14 and working back to when
it worked, then used git bisect from there.

Quoted 3 lines

I am hoping it might be a simple fix for something that just needs to
get added or tweaked in the device tree.

Quoted 5 lines

I don't have access to the specific hw, but can you try to dig out which
hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct
 omap_hwmod *oh)
           int c = 0;
 
           sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
           if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                   omap_test_timeout((omap_hwmod_read(oh,

sysc->syss_offs)
& SYSS_RESETDONE_MASK),

Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Quoted 6 lines

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

Looking at the log you provided, it looks like only mmc1, mmc3 and i2c1 are
reset during the wlan probe. Based on the prints coming out in the failing
case, it looks like the culprit might be mmc3 for some reason.

Quoted 7 lines
[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)

^ the firmware notification above does not come out in the crash.

I agree with your assessment. Any ideas why moving the debug statement before the if statement would make it start working? I added some artificial udelay at around 100, but I still got the crash. It seems like there is some timing issue, but at the same time just adding a delay isn't enough.

Quoted 8 lines
Quoted 5 lines

The pr_warn does more than just delay, it accesses the io-space potentially
causing a flush on certain IO ranges. There might be some OCP readback missing for example, in which case a simple udelay may not help.

I am not very familiar with the OCP and/or how the flushing would impact this. Do you have any suggestions on how I can troubleshoot?

Quoted 7 lines

Typically an OCP barrier is inserted in the code as an immediate readback of the register in question, this effectively forces the register write all the way to the IP.

But, you said that the issue gets fixed with 4.15-rc? You could just simply bisect the issue and see which exact patch fixes it.

Good idea. It looks like 3c4d296e58a2 ("ARM: OMAP3: hwmod_data: add missing module_offs for MMC3") fixed the problem. I've tested that on Linux 4.14.14 and it fixes my issues. I'll e-mail stable and ask him to backport this patch and I'll CC you on it.

adam

Quoted 42 lines

-Tero

Quoted 34 lines

adam

Quoted 31 lines

-Tero

Quoted 24 lines
Quoted 3 lines

-Tero

adam

Quoted 18 lines
Quoted 10 lines

adam

Quoted 4 lines

Regards,

Tony

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

--

--

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

#28 lore raw

PATCH v2 15/15 clk: ti: convert to use proper register definition for all accesses

Quoted 171 lines · Adam Ford
Quoted 170 lines · Tero Kristo
Quoted 155 lines · Adam Ford
Quoted 153 lines · Tero Kristo
Quoted 148 lines · Adam Ford
Quoted 132 lines · Tero Kristo
Quoted 113 lines · Adam Ford
Quoted 101 lines · Tony Lindgren
Quoted 87 lines · Adam Ford
Quoted 56 lines · Tero Kristo
Quoted 20 lines · Adam Ford
Quoted 14 lines · Tero Kristo

Currently, TI clock driver uses an encapsulated struct that is cast
into
a void pointer to store all register addresses. This can be considered
as rather nasty hackery, and prevents from expanding the register address field also. Instead, replace all the code to use proper struct
in place for this, which contains all the previously used data.

Quoted 8 lines
Quoted 4 lines

This patch is rather large as it is touching multiple files, but this
can't be split up as we need to avoid any boot breakage.

I know it's late coming, but according to git bisect, this patch is
causing some problems with Logic PD Torpedo 37xx Dev kit.

Oh reporting bugs is never too late, thanks for posting this out.

Quoted 9 lines

It it is a DM3730 that has a WL1283 chipset attached to the SDIO interface on MMC3. The driver seems to load properly, but when loading wpa_supplicant to activate the WL1283, we get a giant crash.
I checked kernel revisions starting at 4.14 and working back to when
it worked, then used git bisect from there.

Quoted 3 lines

I am hoping it might be a simple fix for something that just needs to
get added or tweaked in the device tree.

Quoted 5 lines

I don't have access to the specific hw, but can you try to dig out which
hwmod is causing the crash? Just print out the oh->name from the _wait_softreset_complete. That would help root causing the issue.

With one small patch, I was able to make it work again.

arch/arm/mach-omap2/omap_hwmod.c +1 -1
index 2dbd632..ed1f625 100644
@@ -477,7 +477,7 @@ static int _wait_softreset_complete(struct
 omap_hwmod *oh)
            int c = 0;
 
            sysc = oh->class->sysc;
-
+pr_warn("_wait_softreset_complete: %s\n", oh->name);
            if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
                    omap_test_timeout((omap_hwmod_read(oh,

sysc->syss_offs)
& SYSS_RESETDONE_MASK),

Quoted 2 lines

This leads me to believe that the omap_test_timeout functions might not be working quite right.

There may be a srst_udelay needed for some module, see commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x") for example.

Quoted 3 lines

You might be able to find which module it is by commenting out postcore_initcall_sync(omap3_l3_init) in drivers/bus/omap_l3_smx.c temporarily as the system will most likely hang right there.

Quoted 6 lines

I commented out that line as you suggested, but the system boots as normal and I get the crash (as normal)

I am looking through the DM3730 and OMAP3630 TRM now. Any thought on a keyword search I should use to see which hwmods might require srst_udelay?

Looking at the log you provided, it looks like only mmc1, mmc3 and i2c1 are
reset during the wlan probe. Based on the prints coming out in the failing
case, it looks like the culprit might be mmc3 for some reason.

Quoted 7 lines
[   18.239746] _wait_softreset_complete: mmc3
[   18.638580] _wait_softreset_complete: mmc3
[   18.657562] _wait_softreset_complete: mmc1
[   18.833374] wlcore: firmware booted (Rev 7.3.10.0.141)

^ the firmware notification above does not come out in the crash.

I agree with your assessment. Any ideas why moving the debug statement before the if statement would make it start working? I added some artificial udelay at around 100, but I still got the crash. It seems like there is some timing issue, but at the same time just adding a delay isn't enough.

Quoted 8 lines
Quoted 5 lines

The pr_warn does more than just delay, it accesses the io-space potentially
causing a flush on certain IO ranges. There might be some OCP readback missing for example, in which case a simple udelay may not help.

I am not very familiar with the OCP and/or how the flushing would impact this. Do you have any suggestions on how I can troubleshoot?

Typically an OCP barrier is inserted in the code as an immediate readback of the register in question, this effectively forces the register write all the way to the IP.

Quoted 8 lines
Quoted 3 lines

But, you said that the issue gets fixed with 4.15-rc? You could just simply bisect the issue and see which exact patch fixes it.

Good idea. It looks like 3c4d296e58a2 ("ARM: OMAP3: hwmod_data: add missing module_offs for MMC3") fixed the problem. I've tested that on Linux 4.14.14 and it fixes my issues. I'll e-mail stable and ask him to backport this patch and I'll CC you on it.

Oh yea, missing that patch would definitely cause some problems... Good find, and sorry I didn't remember about that myself. >.<

-Tero

Quoted 44 lines

adam

Quoted 40 lines

-Tero

Quoted 34 lines

adam

Quoted 31 lines

-Tero

Quoted 24 lines
Quoted 3 lines

-Tero

adam

Quoted 18 lines
Quoted 10 lines

adam

Quoted 4 lines

Regards,

Tony

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

--

--

--

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