Skip to contentSkip to conversation

clk: Add clk_resolve_parent_clk() and fix up iMX clock drivers

PATCH In review Marek Vasut 9 participants 55 messages Mar 23, 2025 – Feb 5

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

v2 cover clk: Add clk_resolve_parent_clk() and fix up iMX clock drivers

Add clk_resolve_parent_clk() to resolve parent clock udevice name based on clock-names DT property. This is used in SoC clock drivers to look up the clock name in clock tables, which matches a clock name in DT clock-names property, and convert it into udevice name which is used by U-Boot clock framework to look up parent clock in e.g. clk_register() using uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);

Pass struct udevice pointer through the various iMX clock drivers.

Marek Vasut (24):
clk: Add clk_resolve_parent_clk()
clk: clk-mux: Fold clk_register_mux()
clk: clk-mux: Use struct udevice instead of struct device
clk: clk-mux: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_mux*()
clk: imx: Pass struct udevice to clk_register_mux()
clk: clk-gate: Use struct udevice instead of struct device
clk: clk-gate: Resolve parent clock by name
clk: imx: gate2: Use struct udevice instead of struct device
clk: imx: gate2: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_gate*()
clk: imx: Pass struct udevice to clk_register_gate*()
clk: clk-composite: Use struct udevice instead of struct device
clk: clk-composite: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_composite*()
clk: imx: Convert clock-osc-* back to osc_*
clk: imx: Pass struct udevice into imx_clk_pllv3*()
clk: imx: pllv3: Resolve parent clock by name
clk: clk-divider: Use struct udevice instead of struct device
clk: imx: Pass struct udevice into imx_clk_divider*()
clk: clk-divider: Resolve parent clock by name
clk: clk-fixed-factor: Use struct udevice instead of struct device
clk: clk-fixed-factor: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_fixed_factor*()

 drivers/clk/clk-composite.c        |   4 +-
 drivers/clk/clk-divider.c          |   7 +-
 drivers/clk/clk-fixed-factor.c     |   6 +-
 drivers/clk/clk-gate.c             |   5 +-
 drivers/clk/clk-mux.c              |  47 +---
 drivers/clk/clk-uclass.c           |  18 ++
 drivers/clk/imx/clk-composite-8m.c |   4 +-
 drivers/clk/imx/clk-gate2.c        |   5 +-
 drivers/clk/imx/clk-imx6q.c        |  80 +++----
 drivers/clk/imx/clk-imx8mm.c       | 254 +++++++++++----------
 drivers/clk/imx/clk-imx8mn.c       | 246 ++++++++++----------
 drivers/clk/imx/clk-imx8mp.c       | 348 ++++++++++++++---------------
 drivers/clk/imx/clk-imx8mq.c       | 226 +++++++++----------
 drivers/clk/imx/clk-imx93.c        |   8 +-
 drivers/clk/imx/clk-imxrt1020.c    |  42 ++--
 drivers/clk/imx/clk-imxrt1050.c    |  78 +++----
 drivers/clk/imx/clk-imxrt1170.c    |  30 +--
 drivers/clk/imx/clk-pllv3.c        |   9 +-
 drivers/clk/imx/clk.h              | 116 +++++-----
 include/clk.h                      |   9 +
 include/linux/clk-provider.h       |  10 +-
 21 files changed, 783 insertions(+), 769 deletions(-)

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

Signature · 1 line
2.47.2
#1 lore raw

PATCH v2 1/24 clk: Add clk_resolve_parent_clk()

Add clk_resolve_parent_clk() to resolve parent clock udevice name based on clock-names DT property. This is used in SoC clock drivers to look up the clock name in clock tables, which matches a clock name in DT clock-names property, and convert it into udevice name which is used by U-Boot clock framework to look up parent clock in e.g. clk_register() using uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-uclass.c | 18 ++++++++++++++++++
 include/clk.h            |  9 +++++++++
 2 files changed, 27 insertions(+)
drivers/clk/clk-uclass.c +18 -0
index 353ae476068..90b70529a47 100644
@@ -420,6 +420,24 @@ int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk)
 	return clk_get_by_index_nodev(node, index, clk);
 }
 
+const char *
+clk_resolve_parent_clk(struct udevice *dev, const char *name)
+{
+	struct udevice *parent;
+	struct clk clk;
+	int ret;
+
+	ret = uclass_get_device_by_name(UCLASS_CLK, name, &parent);
+	if (!ret)
+		return name;
+
+	ret = clk_get_by_name(dev, name, &clk);
+	if (!clk.dev)
+		return name;
+
+	return clk.dev->name;
+}
+
 int clk_release_all(struct clk *clk, unsigned int count)
 {
 	unsigned int i;
include/clk.h +9 -0
index 045e923a529..a6ef4e02692 100644
@@ -350,6 +350,15 @@ static inline int clk_get_by_name_nodev_optional(ofnode node, const char *name,
 	return ret;
 }
 
+/**
+ * clk_resolve_parent_clk - Determine name of clock udevice based on clock-names
+ * @dev:	The client udevice.
+ * @name:	The name of the clock to look up.
+ *
+ * Return name of the clock udevice which represents clock with clock-names name.
+ */
+const char *clk_resolve_parent_clk(struct udevice *dev, const char *name);
+
 /**
  * enum clk_defaults_stage - What stage clk_set_defaults() is called at
  * @CLK_DEFAULTS_PRE: Called before probe. Setting of defaults for clocks owned
Signature · 1 line
2.47.2
#2 lore raw

PATCH v2 2/24 clk: clk-mux: Fold clk_register_mux()

In reply to Marek Vasut

Neither clk_register_mux_table() nor clk_hw_register_mux_table() are called outside of clk-mux.c , fold both into clk_register_mux(). No functional change.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-mux.c | 39 +++++----------------------------------
 1 file changed, 5 insertions(+), 34 deletions(-)
drivers/clk/clk-mux.c +5 -34
index 62477e15d27..9507a779525 100644
@@ -159,15 +159,15 @@ const struct clk_ops clk_mux_ops = {
 	.set_parent = clk_mux_set_parent,
 };
 
-struct clk *clk_hw_register_mux_table(struct device *dev, const char *name,
+struct clk *clk_register_mux(struct device *dev, const char *name,
 		const char * const *parent_names, u8 num_parents,
 		unsigned long flags,
-		void __iomem *reg, u8 shift, u32 mask,
-		u8 clk_mux_flags, u32 *table)
+		void __iomem *reg, u8 shift, u8 width,
+		u8 clk_mux_flags)
 {
+	u32 mask = BIT(width) - 1;
 	struct clk_mux *mux;
 	struct clk *clk;
-	u8 width = 0;
 	int ret;
 
 	if (clk_mux_flags & CLK_MUX_HIWORD_MASK) {
@@ -192,7 +192,7 @@ struct clk *clk_hw_register_mux_table(struct device *dev, const char *name,
 	mux->shift = shift;
 	mux->mask = mask;
 	mux->flags = clk_mux_flags;
-	mux->table = table;
+	mux->table = NULL;
 #if IS_ENABLED(CONFIG_SANDBOX_CLK_CCF)
 	mux->io_mux_val = *(u32 *)reg;
 #endif
@@ -216,35 +216,6 @@ struct clk *clk_hw_register_mux_table(struct device *dev, const char *name,
 	return clk;
 }
 
-struct clk *clk_register_mux_table(struct device *dev, const char *name,
-		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 *clk;
-
-	clk = clk_hw_register_mux_table(dev, name, parent_names, num_parents,
-				       flags, reg, shift, mask, clk_mux_flags,
-				       table);
-	if (IS_ERR(clk))
-		return ERR_CAST(clk);
-	return clk;
-}
-
-struct clk *clk_register_mux(struct device *dev, const char *name,
-		const char * const *parent_names, u8 num_parents,
-		unsigned long flags,
-		void __iomem *reg, u8 shift, u8 width,
-		u8 clk_mux_flags)
-{
-	u32 mask = BIT(width) - 1;
-
-	return clk_register_mux_table(dev, name, parent_names, num_parents,
-				      flags, reg, shift, mask, clk_mux_flags,
-				      NULL);
-}
-
 U_BOOT_DRIVER(ccf_clk_mux) = {
 	.name	= UBOOT_DM_CLK_CCF_MUX,
 	.id	= UCLASS_CLK,
Signature · 1 line
2.47.2
#3 lore raw

PATCH v2 3/24 clk: clk-mux: Use struct udevice instead of struct device

In reply to Marek Vasut

Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-mux registration.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-mux.c        | 2 +-
 include/linux/clk-provider.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-mux.c +1 -1
index 9507a779525..e2331a07840 100644
@@ -159,7 +159,7 @@ const struct clk_ops clk_mux_ops = {
 	.set_parent = clk_mux_set_parent,
 };
 
-struct clk *clk_register_mux(struct device *dev, const char *name,
+struct clk *clk_register_mux(struct udevice *dev, const char *name,
 		const char * const *parent_names, u8 num_parents,
 		unsigned long flags,
 		void __iomem *reg, u8 shift, u8 width,
include/linux/clk-provider.h +1 -1
index 59f9c241b84..f27878ae6fa 100644
@@ -242,7 +242,7 @@ struct clk *clk_register_divider(struct device *dev, const char *name,
 		void __iomem *reg, u8 shift, u8 width,
 		u8 clk_divider_flags);
 
-struct clk *clk_register_mux(struct device *dev, const char *name,
+struct clk *clk_register_mux(struct udevice *dev, const char *name,
 		const char * const *parent_names, u8 num_parents,
 		unsigned long flags,
 		void __iomem *reg, u8 shift, u8 width,
Signature · 1 line
2.47.2
#4 lore raw

PATCH v2 4/24 clk: clk-mux: Resolve parent clock by name

In reply to Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-mux.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/clk/clk-mux.c +7 -1
index e2331a07840..d7411f8f282 100644
@@ -113,6 +113,11 @@ int clk_mux_fetch_parent_index(struct clk *clk, struct clk *parent)
 	for (i = 0; i < mux->num_parents; i++) {
 		if (!strcmp(parent->dev->name, mux->parent_names[i]))
 			return i;
+		if (!strcmp(parent->dev->name,
+			    clk_resolve_parent_clk(clk->dev,
+						   mux->parent_names[i])))
+			return i;
+
 	}
 
 	return -EINVAL;
@@ -207,7 +212,8 @@ struct clk *clk_register_mux(struct udevice *dev, const char *name,
 	 * for the corresponding clock (to do that define .set_parent() method).
 	 */
 	ret = clk_register(clk, UBOOT_DM_CLK_CCF_MUX, name,
-			   parent_names[clk_mux_get_parent(clk)]);
+			   clk_resolve_parent_clk(dev,
+				parent_names[clk_mux_get_parent(clk)]));
 	if (ret) {
 		kfree(mux);
 		return ERR_PTR(ret);
Signature · 1 line
2.47.2
#5 lore raw

PATCH v2 5/24 clk: imx: Pass struct udevice into imx_clk_mux*()

In reply to Marek Vasut

Pass struct udevice * into imx_clk_mux*() functions, so the clock core would have access to parent struct udevice *.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-imx6q.c     | 16 +++++++-------
 drivers/clk/imx/clk-imx8mm.c    | 24 ++++++++++-----------
 drivers/clk/imx/clk-imx8mn.c    | 24 ++++++++++-----------
 drivers/clk/imx/clk-imx8mp.c    | 26 +++++++++++-----------
 drivers/clk/imx/clk-imx8mq.c    | 38 ++++++++++++++++-----------------
 drivers/clk/imx/clk-imx93.c     |  2 +-
 drivers/clk/imx/clk-imxrt1020.c | 18 ++++++++--------
 drivers/clk/imx/clk-imxrt1050.c | 32 +++++++++++++--------------
 drivers/clk/imx/clk-imxrt1170.c |  8 +++----
 drivers/clk/imx/clk.h           | 12 +++++------
 10 files changed, 100 insertions(+), 100 deletions(-)
drivers/clk/imx/clk-imx6q.c +8 -8
index 61ca2982add..92b79a3a02c 100644
@@ -68,24 +68,24 @@ static int imx6q_clk_probe(struct udevice *dev)
 		return -EINVAL;
 
 	clk_dm(IMX6QDL_CLK_USDHC1_SEL,
-	       imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1,
+	       imx_clk_mux(dev, "usdhc1_sel", base + 0x1c, 16, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 	clk_dm(IMX6QDL_CLK_USDHC2_SEL,
-	       imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1,
+	       imx_clk_mux(dev, "usdhc2_sel", base + 0x1c, 17, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 	clk_dm(IMX6QDL_CLK_USDHC3_SEL,
-	       imx_clk_mux("usdhc3_sel", base + 0x1c, 18, 1,
+	       imx_clk_mux(dev, "usdhc3_sel", base + 0x1c, 18, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 	clk_dm(IMX6QDL_CLK_USDHC4_SEL,
-	       imx_clk_mux("usdhc4_sel", base + 0x1c, 19, 1,
+	       imx_clk_mux(dev, "usdhc4_sel", base + 0x1c, 19, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 
 	if (of_machine_is_compatible("fsl,imx6qp")) {
 		clk_dm(IMX6QDL_CLK_UART_SEL,
-		       imx_clk_mux("uart_sel", base + 0x24, 6, 1, uart_sels,
+		       imx_clk_mux(dev, "uart_sel", base + 0x24, 6, 1, uart_sels,
 				   ARRAY_SIZE(uart_sels)));
 		clk_dm(IMX6QDL_CLK_ECSPI_SEL,
-		       imx_clk_mux("ecspi_sel",	base + 0x38, 18, 1, ecspi_sels,
+		       imx_clk_mux(dev, "ecspi_sel", base + 0x38, 18, 1, ecspi_sels,
 				   ARRAY_SIZE(ecspi_sels)));
 	}
 
@@ -136,10 +136,10 @@ static int imx6q_clk_probe(struct udevice *dev)
 	       imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8));
 
 	clk_dm(IMX6QDL_CLK_PERIPH_PRE,
-	       imx_clk_mux("periph_pre", base + 0x18, 18, 2, periph_pre_sels,
+	       imx_clk_mux(dev, "periph_pre", base + 0x18, 18, 2, periph_pre_sels,
 			   ARRAY_SIZE(periph_pre_sels)));
 	clk_dm(IMX6QDL_CLK_PERIPH,
-	       imx_clk_busy_mux("periph",  base + 0x14, 25, 1, base + 0x48,
+	       imx_clk_busy_mux(dev, "periph",  base + 0x14, 25, 1, base + 0x48,
 				5, periph_sels,  ARRAY_SIZE(periph_sels)));
 	clk_dm(IMX6QDL_CLK_AHB,
 	       imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3,
drivers/clk/imx/clk-imx8mm.c +12 -12
index 378c07caba3..54eaff273d0 100644
@@ -172,19 +172,19 @@ static int imx8mm_clk_probe(struct udevice *dev)
 	base = (void *)ANATOP_BASE_ADDR;
 
 	clk_dm(IMX8MM_DRAM_PLL_REF_SEL,
-	       imx_clk_mux("dram_pll_ref_sel", base + 0x50, 0, 2,
+	       imx_clk_mux(dev, "dram_pll_ref_sel", base + 0x50, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MM_ARM_PLL_REF_SEL,
-	       imx_clk_mux("arm_pll_ref_sel", base + 0x84, 0, 2,
+	       imx_clk_mux(dev, "arm_pll_ref_sel", base + 0x84, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MM_SYS_PLL1_REF_SEL,
-	       imx_clk_mux("sys_pll1_ref_sel", base + 0x94, 0, 2,
+	       imx_clk_mux(dev, "sys_pll1_ref_sel", base + 0x94, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MM_SYS_PLL2_REF_SEL,
-	       imx_clk_mux("sys_pll2_ref_sel", base + 0x104, 0, 2,
+	       imx_clk_mux(dev, "sys_pll2_ref_sel", base + 0x104, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MM_SYS_PLL3_REF_SEL,
-	       imx_clk_mux("sys_pll3_ref_sel", base + 0x114, 0, 2,
+	       imx_clk_mux(dev, "sys_pll3_ref_sel", base + 0x114, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 
 	clk_dm(IMX8MM_DRAM_PLL,
@@ -205,27 +205,27 @@ static int imx8mm_clk_probe(struct udevice *dev)
 
 	/* PLL bypass out */
 	clk_dm(IMX8MM_DRAM_PLL_BYPASS,
-	       imx_clk_mux_flags("dram_pll_bypass", base + 0x50, 4, 1,
+	       imx_clk_mux_flags(dev, "dram_pll_bypass", base + 0x50, 4, 1,
 				 dram_pll_bypass_sels,
 				 ARRAY_SIZE(dram_pll_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MM_ARM_PLL_BYPASS,
-	       imx_clk_mux_flags("arm_pll_bypass", base + 0x84, 4, 1,
+	       imx_clk_mux_flags(dev, "arm_pll_bypass", base + 0x84, 4, 1,
 				 arm_pll_bypass_sels,
 				 ARRAY_SIZE(arm_pll_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MM_SYS_PLL1_BYPASS,
-	       imx_clk_mux_flags("sys_pll1_bypass", base + 0x94, 4, 1,
+	       imx_clk_mux_flags(dev, "sys_pll1_bypass", base + 0x94, 4, 1,
 				 sys_pll1_bypass_sels,
 				 ARRAY_SIZE(sys_pll1_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MM_SYS_PLL2_BYPASS,
-	       imx_clk_mux_flags("sys_pll2_bypass", base + 0x104, 4, 1,
+	       imx_clk_mux_flags(dev, "sys_pll2_bypass", base + 0x104, 4, 1,
 				 sys_pll2_bypass_sels,
 				 ARRAY_SIZE(sys_pll2_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MM_SYS_PLL3_BYPASS,
-	       imx_clk_mux_flags("sys_pll3_bypass", base + 0x114, 4, 1,
+	       imx_clk_mux_flags(dev, "sys_pll3_bypass", base + 0x114, 4, 1,
 				 sys_pll3_bypass_sels,
 				 ARRAY_SIZE(sys_pll3_bypass_sels),
 				 CLK_SET_RATE_PARENT));
@@ -291,7 +291,7 @@ static int imx8mm_clk_probe(struct udevice *dev)
 		return -EINVAL;
 
 	clk_dm(IMX8MM_CLK_A53_SRC,
-	       imx_clk_mux2("arm_a53_src", base + 0x8000, 24, 3,
+	       imx_clk_mux2(dev, "arm_a53_src", base + 0x8000, 24, 3,
 			    imx8mm_a53_sels, ARRAY_SIZE(imx8mm_a53_sels)));
 	clk_dm(IMX8MM_CLK_A53_CG,
 	       imx_clk_gate3("arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
@@ -454,7 +454,7 @@ static int imx8mm_clk_probe(struct udevice *dev)
 #endif
 
 	clk_dm(IMX8MM_CLK_ARM,
-	       imx_clk_mux2_flags("arm_core", base + 0x9880, 24, 1,
+	       imx_clk_mux2_flags(dev, "arm_core", base + 0x9880, 24, 1,
 				  imx8mm_arm_core_sels,
 				  ARRAY_SIZE(imx8mm_arm_core_sels),
 				  CLK_IS_CRITICAL));
drivers/clk/imx/clk-imx8mn.c +12 -12
index 54ae887817a..dbc94ff9450 100644
@@ -164,19 +164,19 @@ static int imx8mn_clk_probe(struct udevice *dev)
 	base = (void *)ANATOP_BASE_ADDR;
 
 	clk_dm(IMX8MN_DRAM_PLL_REF_SEL,
-	       imx_clk_mux("dram_pll_ref_sel", base + 0x50, 0, 2,
+	       imx_clk_mux(dev, "dram_pll_ref_sel", base + 0x50, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MN_ARM_PLL_REF_SEL,
-	       imx_clk_mux("arm_pll_ref_sel", base + 0x84, 0, 2,
+	       imx_clk_mux(dev, "arm_pll_ref_sel", base + 0x84, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MN_SYS_PLL1_REF_SEL,
-	       imx_clk_mux("sys_pll1_ref_sel", base + 0x94, 0, 2,
+	       imx_clk_mux(dev, "sys_pll1_ref_sel", base + 0x94, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MN_SYS_PLL2_REF_SEL,
-	       imx_clk_mux("sys_pll2_ref_sel", base + 0x104, 0, 2,
+	       imx_clk_mux(dev, "sys_pll2_ref_sel", base + 0x104, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MN_SYS_PLL3_REF_SEL,
-	       imx_clk_mux("sys_pll3_ref_sel", base + 0x114, 0, 2,
+	       imx_clk_mux(dev, "sys_pll3_ref_sel", base + 0x114, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 
 	clk_dm(IMX8MN_DRAM_PLL,
@@ -197,27 +197,27 @@ static int imx8mn_clk_probe(struct udevice *dev)
 
 	/* PLL bypass out */
 	clk_dm(IMX8MN_DRAM_PLL_BYPASS,
-	       imx_clk_mux_flags("dram_pll_bypass", base + 0x50, 4, 1,
+	       imx_clk_mux_flags(dev, "dram_pll_bypass", base + 0x50, 4, 1,
 				 dram_pll_bypass_sels,
 				 ARRAY_SIZE(dram_pll_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MN_ARM_PLL_BYPASS,
-	       imx_clk_mux_flags("arm_pll_bypass", base + 0x84, 4, 1,
+	       imx_clk_mux_flags(dev, "arm_pll_bypass", base + 0x84, 4, 1,
 				 arm_pll_bypass_sels,
 				 ARRAY_SIZE(arm_pll_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MN_SYS_PLL1_BYPASS,
-	       imx_clk_mux_flags("sys_pll1_bypass", base + 0x94, 4, 1,
+	       imx_clk_mux_flags(dev, "sys_pll1_bypass", base + 0x94, 4, 1,
 				 sys_pll1_bypass_sels,
 				 ARRAY_SIZE(sys_pll1_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MN_SYS_PLL2_BYPASS,
-	       imx_clk_mux_flags("sys_pll2_bypass", base + 0x104, 4, 1,
+	       imx_clk_mux_flags(dev, "sys_pll2_bypass", base + 0x104, 4, 1,
 				 sys_pll2_bypass_sels,
 				 ARRAY_SIZE(sys_pll2_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MN_SYS_PLL3_BYPASS,
-	       imx_clk_mux_flags("sys_pll3_bypass", base + 0x114, 4, 1,
+	       imx_clk_mux_flags(dev, "sys_pll3_bypass", base + 0x114, 4, 1,
 				 sys_pll3_bypass_sels,
 				 ARRAY_SIZE(sys_pll3_bypass_sels),
 				 CLK_SET_RATE_PARENT));
@@ -288,7 +288,7 @@ static int imx8mn_clk_probe(struct udevice *dev)
 		return -EINVAL;
 
 	clk_dm(IMX8MN_CLK_A53_SRC,
-	       imx_clk_mux2("arm_a53_src", base + 0x8000, 24, 3,
+	       imx_clk_mux2(dev, "arm_a53_src", base + 0x8000, 24, 3,
 			    imx8mn_a53_sels, ARRAY_SIZE(imx8mn_a53_sels)));
 	clk_dm(IMX8MN_CLK_A53_CG,
 	       imx_clk_gate3("arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
@@ -438,7 +438,7 @@ static int imx8mn_clk_probe(struct udevice *dev)
 #endif
 
 	clk_dm(IMX8MN_CLK_ARM,
-	       imx_clk_mux2_flags("arm_core", base + 0x9880, 24, 1,
+	       imx_clk_mux2_flags(dev, "arm_core", base + 0x9880, 24, 1,
 				  imx8mn_arm_core_sels,
 				  ARRAY_SIZE(imx8mn_arm_core_sels),
 				  CLK_IS_CRITICAL));
drivers/clk/imx/clk-imx8mp.c +13 -13
index 1d04090ca00..4b916bef7a1 100644
@@ -199,11 +199,11 @@ static int imx8mp_clk_probe(struct udevice *dev)
 
 	clk_dm(IMX8MP_CLK_DUMMY, clk_register_fixed_rate(NULL, "dummy", 0));
 
-	clk_dm(IMX8MP_DRAM_PLL_REF_SEL, imx_clk_mux("dram_pll_ref_sel", base + 0x50, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
-	clk_dm(IMX8MP_ARM_PLL_REF_SEL, imx_clk_mux("arm_pll_ref_sel", base + 0x84, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
-	clk_dm(IMX8MP_SYS_PLL1_REF_SEL, imx_clk_mux("sys_pll1_ref_sel", base + 0x94, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
-	clk_dm(IMX8MP_SYS_PLL2_REF_SEL, imx_clk_mux("sys_pll2_ref_sel", base + 0x104, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
-	clk_dm(IMX8MP_SYS_PLL3_REF_SEL, imx_clk_mux("sys_pll3_ref_sel", base + 0x114, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
+	clk_dm(IMX8MP_DRAM_PLL_REF_SEL, imx_clk_mux(dev, "dram_pll_ref_sel", base + 0x50, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
+	clk_dm(IMX8MP_ARM_PLL_REF_SEL, imx_clk_mux(dev, "arm_pll_ref_sel", base + 0x84, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
+	clk_dm(IMX8MP_SYS_PLL1_REF_SEL, imx_clk_mux(dev, "sys_pll1_ref_sel", base + 0x94, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
+	clk_dm(IMX8MP_SYS_PLL2_REF_SEL, imx_clk_mux(dev, "sys_pll2_ref_sel", base + 0x104, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
+	clk_dm(IMX8MP_SYS_PLL3_REF_SEL, imx_clk_mux(dev, "sys_pll3_ref_sel", base + 0x114, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 
 	clk_dm(IMX8MP_DRAM_PLL, imx_clk_pll14xx("dram_pll", "dram_pll_ref_sel", base + 0x50,
 						&imx_1443x_dram_pll));
@@ -216,11 +216,11 @@ static int imx8mp_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MP_SYS_PLL3, imx_clk_pll14xx("sys_pll3", "sys_pll3_ref_sel", base + 0x114,
 						&imx_1416x_pll));
 
-	clk_dm(IMX8MP_DRAM_PLL_BYPASS, imx_clk_mux_flags("dram_pll_bypass", base + 0x50, 4, 1, dram_pll_bypass_sels, ARRAY_SIZE(dram_pll_bypass_sels), CLK_SET_RATE_PARENT));
-	clk_dm(IMX8MP_ARM_PLL_BYPASS, imx_clk_mux_flags("arm_pll_bypass", base + 0x84, 4, 1, arm_pll_bypass_sels, ARRAY_SIZE(arm_pll_bypass_sels), CLK_SET_RATE_PARENT));
-	clk_dm(IMX8MP_SYS_PLL1_BYPASS, imx_clk_mux_flags("sys_pll1_bypass", base + 0x94, 4, 1, sys_pll1_bypass_sels, ARRAY_SIZE(sys_pll1_bypass_sels), CLK_SET_RATE_PARENT));
-	clk_dm(IMX8MP_SYS_PLL2_BYPASS, imx_clk_mux_flags("sys_pll2_bypass", base + 0x104, 4, 1, sys_pll2_bypass_sels, ARRAY_SIZE(sys_pll2_bypass_sels), CLK_SET_RATE_PARENT));
-	clk_dm(IMX8MP_SYS_PLL3_BYPASS, imx_clk_mux_flags("sys_pll3_bypass", base + 0x114, 4, 1, sys_pll3_bypass_sels, ARRAY_SIZE(sys_pll3_bypass_sels), CLK_SET_RATE_PARENT));
+	clk_dm(IMX8MP_DRAM_PLL_BYPASS, imx_clk_mux_flags(dev, "dram_pll_bypass", base + 0x50, 4, 1, dram_pll_bypass_sels, ARRAY_SIZE(dram_pll_bypass_sels), CLK_SET_RATE_PARENT));
+	clk_dm(IMX8MP_ARM_PLL_BYPASS, imx_clk_mux_flags(dev, "arm_pll_bypass", base + 0x84, 4, 1, arm_pll_bypass_sels, ARRAY_SIZE(arm_pll_bypass_sels), CLK_SET_RATE_PARENT));
+	clk_dm(IMX8MP_SYS_PLL1_BYPASS, imx_clk_mux_flags(dev, "sys_pll1_bypass", base + 0x94, 4, 1, sys_pll1_bypass_sels, ARRAY_SIZE(sys_pll1_bypass_sels), CLK_SET_RATE_PARENT));
+	clk_dm(IMX8MP_SYS_PLL2_BYPASS, imx_clk_mux_flags(dev, "sys_pll2_bypass", base + 0x104, 4, 1, sys_pll2_bypass_sels, ARRAY_SIZE(sys_pll2_bypass_sels), CLK_SET_RATE_PARENT));
+	clk_dm(IMX8MP_SYS_PLL3_BYPASS, imx_clk_mux_flags(dev, "sys_pll3_bypass", base + 0x114, 4, 1, sys_pll3_bypass_sels, ARRAY_SIZE(sys_pll3_bypass_sels), CLK_SET_RATE_PARENT));
 
 	clk_dm(IMX8MP_DRAM_PLL_OUT, imx_clk_gate("dram_pll_out", "dram_pll_bypass", base + 0x50, 13));
 	clk_dm(IMX8MP_ARM_PLL_OUT, imx_clk_gate("arm_pll_out", "arm_pll_bypass", base + 0x84, 11));
@@ -262,7 +262,7 @@ static int imx8mp_clk_probe(struct udevice *dev)
 	if (!base)
 		return -EINVAL;
 
-	clk_dm(IMX8MP_CLK_A53_SRC, imx_clk_mux2("arm_a53_src", base + 0x8000, 24, 3, imx8mp_a53_sels, ARRAY_SIZE(imx8mp_a53_sels)));
+	clk_dm(IMX8MP_CLK_A53_SRC, imx_clk_mux2(dev, "arm_a53_src", base + 0x8000, 24, 3, imx8mp_a53_sels, ARRAY_SIZE(imx8mp_a53_sels)));
 	clk_dm(IMX8MP_CLK_A53_CG, imx_clk_gate3("arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
 	clk_dm(IMX8MP_CLK_A53_DIV, imx_clk_divider2("arm_a53_div", "arm_a53_cg", base + 0x8000, 0, 3));
 
@@ -314,7 +314,7 @@ static int imx8mp_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MP_CLK_USDHC3, imx8m_clk_composite("usdhc3", imx8mp_usdhc3_sels, base + 0xbc80));
 
 	clk_dm(IMX8MP_CLK_DRAM_ALT_ROOT, imx_clk_fixed_factor("dram_alt_root", "dram_alt", 1, 4));
-	clk_dm(IMX8MP_CLK_DRAM_CORE, imx_clk_mux2_flags("dram_core_clk", base + 0x9800, 24, 1, imx8mp_dram_core_sels, ARRAY_SIZE(imx8mp_dram_core_sels), CLK_IS_CRITICAL));
+	clk_dm(IMX8MP_CLK_DRAM_CORE, imx_clk_mux2_flags(dev, "dram_core_clk", base + 0x9800, 24, 1, imx8mp_dram_core_sels, ARRAY_SIZE(imx8mp_dram_core_sels), CLK_IS_CRITICAL));
 
 	clk_dm(IMX8MP_CLK_DRAM1_ROOT, imx_clk_gate4_flags("dram1_root_clk", "dram_core_clk", base + 0x4050, 0, CLK_IS_CRITICAL));
 	clk_dm(IMX8MP_CLK_ECSPI1_ROOT, imx_clk_gate4("ecspi1_root_clk", "ecspi1", base + 0x4070, 0));
@@ -359,7 +359,7 @@ static int imx8mp_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MP_CLK_USDHC3_ROOT, imx_clk_gate4("usdhc3_root_clk", "usdhc3", base + 0x45e0, 0));
 
 	clk_dm(IMX8MP_CLK_ARM,
-	       imx_clk_mux2_flags("arm_core", base + 0x9880, 24, 1,
+	       imx_clk_mux2_flags(dev, "arm_core", base + 0x9880, 24, 1,
 				  imx8mp_arm_core_sels,
 				  ARRAY_SIZE(imx8mp_arm_core_sels),
 				  CLK_IS_CRITICAL));
drivers/clk/imx/clk-imx8mq.c +19 -19
index ed4acd79ef7..dc9b7d56815 100644
@@ -152,31 +152,31 @@ static int imx8mq_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MQ_CLK_27M, clk_register_fixed_rate(NULL, "clock-osc-27m", 27000000));
 
 	clk_dm(IMX8MQ_DRAM_PLL1_REF_SEL,
-	       imx_clk_mux("dram_pll_ref_sel", base + 0x60, 0, 2,
+	       imx_clk_mux(dev, "dram_pll_ref_sel", base + 0x60, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_ARM_PLL_REF_SEL,
-	       imx_clk_mux("arm_pll_ref_sel", base + 0x28, 0, 2,
+	       imx_clk_mux(dev, "arm_pll_ref_sel", base + 0x28, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_GPU_PLL_REF_SEL,
-	       imx_clk_mux("gpu_pll_ref_sel", base + 0x18, 0, 2,
+	       imx_clk_mux(dev, "gpu_pll_ref_sel", base + 0x18, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_VPU_PLL_REF_SEL,
-	       imx_clk_mux("vpu_pll_ref_sel", base + 0x20, 0, 2,
+	       imx_clk_mux(dev, "vpu_pll_ref_sel", base + 0x20, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_SYS3_PLL1_REF_SEL,
-	       imx_clk_mux("sys3_pll_ref_sel", base + 0x48, 0, 2,
+	       imx_clk_mux(dev, "sys3_pll_ref_sel", base + 0x48, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_AUDIO_PLL1_REF_SEL,
-	       imx_clk_mux("audio_pll1_ref_sel", base + 0x0, 0, 2,
+	       imx_clk_mux(dev, "audio_pll1_ref_sel", base + 0x0, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_AUDIO_PLL2_REF_SEL,
-	       imx_clk_mux("audio_pll2_ref_sel", base + 0x8, 0, 2,
+	       imx_clk_mux(dev, "audio_pll2_ref_sel", base + 0x8, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_VIDEO_PLL1_REF_SEL,
-	       imx_clk_mux("video_pll1_ref_sel", base + 0x10, 0, 2,
+	       imx_clk_mux(dev, "video_pll1_ref_sel", base + 0x10, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMX8MQ_VIDEO2_PLL1_REF_SEL,
-	       imx_clk_mux("video_pll2_ref_sel", base + 0x54, 0, 2,
+	       imx_clk_mux(dev, "video_pll2_ref_sel", base + 0x54, 0, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 
 	clk_dm(IMX8MQ_ARM_PLL,
@@ -207,32 +207,32 @@ static int imx8mq_clk_probe(struct udevice *dev)
 
 	/* PLL bypass out */
 	clk_dm(IMX8MQ_ARM_PLL_BYPASS,
-	       imx_clk_mux_flags("arm_pll_bypass", base + 0x28, 4, 1,
+	       imx_clk_mux_flags(dev, "arm_pll_bypass", base + 0x28, 4, 1,
 				 arm_pll_bypass_sels,
 				 ARRAY_SIZE(arm_pll_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MQ_GPU_PLL_BYPASS,
-	       imx_clk_mux_flags("gpu_pll_bypass", base + 0x18, 4, 1,
+	       imx_clk_mux_flags(dev, "gpu_pll_bypass", base + 0x18, 4, 1,
 				 gpu_pll_bypass_sels,
 				 ARRAY_SIZE(gpu_pll_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MQ_VPU_PLL_BYPASS,
-	       imx_clk_mux_flags("vpu_pll_bypass", base + 0x20, 4, 1,
+	       imx_clk_mux_flags(dev, "vpu_pll_bypass", base + 0x20, 4, 1,
 				 vpu_pll_bypass_sels,
 				 ARRAY_SIZE(vpu_pll_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MQ_AUDIO_PLL1_BYPASS,
-	       imx_clk_mux_flags("audio_pll1_bypass", base + 0x0, 4, 1,
+	       imx_clk_mux_flags(dev, "audio_pll1_bypass", base + 0x0, 4, 1,
 				 audio_pll1_bypass_sels,
 				 ARRAY_SIZE(audio_pll1_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MQ_AUDIO_PLL2_BYPASS,
-	       imx_clk_mux_flags("audio_pll2_bypass", base + 0x8, 4, 1,
+	       imx_clk_mux_flags(dev, "audio_pll2_bypass", base + 0x8, 4, 1,
 				 audio_pll2_bypass_sels,
 				 ARRAY_SIZE(audio_pll2_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMX8MQ_VIDEO_PLL1_BYPASS,
-	       imx_clk_mux_flags("video_pll1_bypass", base + 0x10, 4, 1,
+	       imx_clk_mux_flags(dev, "video_pll1_bypass", base + 0x10, 4, 1,
 				 video_pll1_bypass_sels,
 				 ARRAY_SIZE(video_pll1_bypass_sels),
 				 CLK_SET_RATE_PARENT));
@@ -335,7 +335,7 @@ static int imx8mq_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MQ_CLK_MON_VIDEO_PLL2_DIV,
 	       imx_clk_divider("video_pll2_out_monitor", "video_pll2_out", base + 0x7c, 16, 3));
 	clk_dm(IMX8MQ_CLK_MON_SEL,
-	       imx_clk_mux_flags("pllout_monitor_sel", base + 0x74, 0, 4,
+	       imx_clk_mux_flags(dev, "pllout_monitor_sel", base + 0x74, 0, 4,
 				 pllout_monitor_sels,
 				 ARRAY_SIZE(pllout_monitor_sels),
 				 CLK_SET_RATE_PARENT));
@@ -349,7 +349,7 @@ static int imx8mq_clk_probe(struct udevice *dev)
 	}
 
 	clk_dm(IMX8MQ_CLK_A53_SRC,
-	       imx_clk_mux2("arm_a53_src", base + 0x8000, 24, 3,
+	       imx_clk_mux2(dev, "arm_a53_src", base + 0x8000, 24, 3,
 			    imx8mq_a53_sels, ARRAY_SIZE(imx8mq_a53_sels)));
 	clk_dm(IMX8MQ_CLK_A53_CG,
 	       imx_clk_gate3("arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
@@ -357,7 +357,7 @@ static int imx8mq_clk_probe(struct udevice *dev)
 	       imx_clk_divider2("arm_a53_div", "arm_a53_cg",
 				base + 0x8000, 0, 3));
 	clk_dm(IMX8MQ_CLK_A53_CORE,
-	       imx_clk_mux2("arm_a53_src", base + 0x9880, 24, 1,
+	       imx_clk_mux2(dev, "arm_a53_src", base + 0x9880, 24, 1,
 			    imx8mq_a53_core_sels, ARRAY_SIZE(imx8mq_a53_core_sels)));
 
 	clk_dm(IMX8MQ_CLK_AHB,
@@ -378,7 +378,7 @@ static int imx8mq_clk_probe(struct udevice *dev)
 
 	/* DRAM */
 	clk_dm(IMX8MQ_CLK_DRAM_CORE,
-	       imx_clk_mux2("dram_core_clk", base + 0x9800, 24, 1,
+	       imx_clk_mux2(dev, "dram_core_clk", base + 0x9800, 24, 1,
 			    imx8mq_dram_core_sels, ARRAY_SIZE(imx8mq_dram_core_sels)));
 	clk_dm(IMX8MQ_CLK_DRAM_ALT,
 	       imx8m_clk_composite("dram_alt", imx8mq_dram_alt_sels, base + 0xa000));
drivers/clk/imx/clk-imx93.c +1 -1
index b31e57a4a01..0caec91fd9a 100644
@@ -338,7 +338,7 @@ static int imx93_clk_probe(struct udevice *dev)
 	}
 
 	clk_dm(IMX93_CLK_A55_SEL,
-	       imx_clk_mux2("a55_sel", base + 0x4820, 0, 1,
+	       imx_clk_mux2(dev, "a55_sel", base + 0x4820, 0, 1,
 			    a55_core_sels, ARRAY_SIZE(a55_core_sels)));
 
 	return 0;
drivers/clk/imx/clk-imxrt1020.c +9 -9
index 752434cb0ad..16fc3bcdb3e 100644
@@ -46,12 +46,12 @@ static int imxrt1020_clk_probe(struct udevice *dev)
 
 	/* PLL bypass out */
 	clk_dm(IMXRT1020_CLK_PLL2_BYPASS,
-	       imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1,
+	       imx_clk_mux_flags(dev, "pll2_bypass", base + 0x30, 16, 1,
 				 pll2_bypass_sels,
 				 ARRAY_SIZE(pll2_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMXRT1020_CLK_PLL3_BYPASS,
-	       imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1,
+	       imx_clk_mux_flags(dev, "pll3_bypass", base + 0x10, 16, 1,
 				 pll3_bypass_sels,
 				 ARRAY_SIZE(pll3_bypass_sels),
 				 CLK_SET_RATE_PARENT));
@@ -78,25 +78,25 @@ static int imxrt1020_clk_probe(struct udevice *dev)
 		return -EINVAL;
 
 	clk_dm(IMXRT1020_CLK_PRE_PERIPH_SEL,
-	       imx_clk_mux("pre_periph_sel", base + 0x18, 18, 2,
+	       imx_clk_mux(dev, "pre_periph_sel", base + 0x18, 18, 2,
 			   pre_periph_sels, ARRAY_SIZE(pre_periph_sels)));
 	clk_dm(IMXRT1020_CLK_PERIPH_SEL,
-	       imx_clk_mux("periph_sel", base + 0x14, 25, 1,
+	       imx_clk_mux(dev, "periph_sel", base + 0x14, 25, 1,
 			   periph_sels, ARRAY_SIZE(periph_sels)));
 	clk_dm(IMXRT1020_CLK_USDHC1_SEL,
-	       imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1,
+	       imx_clk_mux(dev, "usdhc1_sel", base + 0x1c, 16, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 	clk_dm(IMXRT1020_CLK_USDHC2_SEL,
-	       imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1,
+	       imx_clk_mux(dev, "usdhc2_sel", base + 0x1c, 17, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 	clk_dm(IMXRT1020_CLK_LPUART_SEL,
-	       imx_clk_mux("lpuart_sel", base + 0x24, 6, 1,
+	       imx_clk_mux(dev, "lpuart_sel", base + 0x24, 6, 1,
 			   lpuart_sels, ARRAY_SIZE(lpuart_sels)));
 	clk_dm(IMXRT1020_CLK_SEMC_ALT_SEL,
-	       imx_clk_mux("semc_alt_sel", base + 0x14, 7, 1,
+	       imx_clk_mux(dev, "semc_alt_sel", base + 0x14, 7, 1,
 			   semc_alt_sels, ARRAY_SIZE(semc_alt_sels)));
 	clk_dm(IMXRT1020_CLK_SEMC_SEL,
-	       imx_clk_mux("semc_sel", base + 0x14, 6, 1,
+	       imx_clk_mux(dev, "semc_sel", base + 0x14, 6, 1,
 			   semc_sels, ARRAY_SIZE(semc_sels)));
 
 	clk_dm(IMXRT1020_CLK_AHB_PODF,
drivers/clk/imx/clk-imxrt1050.c +16 -16
index 2c029ec5a6e..5f37915f593 100644
@@ -36,16 +36,16 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 	base = (void *)ofnode_get_addr(ofnode_by_compatible(ofnode_null(), "fsl,imxrt-anatop"));
 
 	clk_dm(IMXRT1050_CLK_PLL1_REF_SEL,
-	       imx_clk_mux("pll1_arm_ref_sel", base + 0x0, 14, 2,
+	       imx_clk_mux(dev, "pll1_arm_ref_sel", base + 0x0, 14, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMXRT1050_CLK_PLL2_REF_SEL,
-	       imx_clk_mux("pll2_sys_ref_sel", base + 0x30, 14, 2,
+	       imx_clk_mux(dev, "pll2_sys_ref_sel", base + 0x30, 14, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMXRT1050_CLK_PLL3_REF_SEL,
-	       imx_clk_mux("pll3_usb_otg_ref_sel", base + 0x10, 14, 2,
+	       imx_clk_mux(dev, "pll3_usb_otg_ref_sel", base + 0x10, 14, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 	clk_dm(IMXRT1050_CLK_PLL5_REF_SEL,
-	       imx_clk_mux("pll5_video_ref_sel", base + 0xa0, 14, 2,
+	       imx_clk_mux(dev, "pll5_video_ref_sel", base + 0xa0, 14, 2,
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 
 	clk_dm(IMXRT1050_CLK_PLL1_ARM,
@@ -64,22 +64,22 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 
 	/* PLL bypass out */
 	clk_dm(IMXRT1050_CLK_PLL1_BYPASS,
-	       imx_clk_mux_flags("pll1_bypass", base + 0x0, 16, 1,
+	       imx_clk_mux_flags(dev, "pll1_bypass", base + 0x0, 16, 1,
 				 pll1_bypass_sels,
 				 ARRAY_SIZE(pll1_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMXRT1050_CLK_PLL2_BYPASS,
-	       imx_clk_mux_flags("pll2_bypass", base + 0x30, 16, 1,
+	       imx_clk_mux_flags(dev, "pll2_bypass", base + 0x30, 16, 1,
 				 pll2_bypass_sels,
 				 ARRAY_SIZE(pll2_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMXRT1050_CLK_PLL3_BYPASS,
-	       imx_clk_mux_flags("pll3_bypass", base + 0x10, 16, 1,
+	       imx_clk_mux_flags(dev, "pll3_bypass", base + 0x10, 16, 1,
 				 pll3_bypass_sels,
 				 ARRAY_SIZE(pll3_bypass_sels),
 				 CLK_SET_RATE_PARENT));
 	clk_dm(IMXRT1050_CLK_PLL5_BYPASS,
-	       imx_clk_mux_flags("pll5_bypass", base + 0xa0, 16, 1,
+	       imx_clk_mux_flags(dev, "pll5_bypass", base + 0xa0, 16, 1,
 				 pll5_bypass_sels,
 				 ARRAY_SIZE(pll5_bypass_sels),
 				 CLK_SET_RATE_PARENT));
@@ -117,28 +117,28 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 			       base + 0x10, 0, 3));
 
 	clk_dm(IMXRT1050_CLK_PRE_PERIPH_SEL,
-	       imx_clk_mux("pre_periph_sel", base + 0x18, 18, 2,
+	       imx_clk_mux(dev, "pre_periph_sel", base + 0x18, 18, 2,
 			   pre_periph_sels, ARRAY_SIZE(pre_periph_sels)));
 	clk_dm(IMXRT1050_CLK_PERIPH_SEL,
-	       imx_clk_mux("periph_sel", base + 0x14, 25, 1,
+	       imx_clk_mux(dev, "periph_sel", base + 0x14, 25, 1,
 			   periph_sels, ARRAY_SIZE(periph_sels)));
 	clk_dm(IMXRT1050_CLK_USDHC1_SEL,
-	       imx_clk_mux("usdhc1_sel", base + 0x1c, 16, 1,
+	       imx_clk_mux(dev, "usdhc1_sel", base + 0x1c, 16, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 	clk_dm(IMXRT1050_CLK_USDHC2_SEL,
-	       imx_clk_mux("usdhc2_sel", base + 0x1c, 17, 1,
+	       imx_clk_mux(dev, "usdhc2_sel", base + 0x1c, 17, 1,
 			   usdhc_sels, ARRAY_SIZE(usdhc_sels)));
 	clk_dm(IMXRT1050_CLK_LPUART_SEL,
-	       imx_clk_mux("lpuart_sel", base + 0x24, 6, 1,
+	       imx_clk_mux(dev, "lpuart_sel", base + 0x24, 6, 1,
 			   lpuart_sels, ARRAY_SIZE(lpuart_sels)));
 	clk_dm(IMXRT1050_CLK_SEMC_ALT_SEL,
-	       imx_clk_mux("semc_alt_sel", base + 0x14, 7, 1,
+	       imx_clk_mux(dev, "semc_alt_sel", base + 0x14, 7, 1,
 			   semc_alt_sels, ARRAY_SIZE(semc_alt_sels)));
 	clk_dm(IMXRT1050_CLK_SEMC_SEL,
-	       imx_clk_mux("semc_sel", base + 0x14, 6, 1,
+	       imx_clk_mux(dev, "semc_sel", base + 0x14, 6, 1,
 			   semc_sels, ARRAY_SIZE(semc_sels)));
 	clk_dm(IMXRT1050_CLK_LCDIF_SEL,
-	       imx_clk_mux("lcdif_sel", base + 0x38, 15, 3,
+	       imx_clk_mux(dev, "lcdif_sel", base + 0x38, 15, 3,
 			   lcdif_sels, ARRAY_SIZE(lcdif_sels)));
 
 	clk_dm(IMXRT1050_CLK_AHB_PODF,
drivers/clk/imx/clk-imxrt1170.c +4 -4
index 88a294f4165..7e06504584f 100644
@@ -157,28 +157,28 @@ static int imxrt1170_clk_probe(struct udevice *dev)
 		return -EINVAL;
 
 	clk_dm(IMXRT1170_CLK_LPUART1_SEL,
-	       imx_clk_mux("lpuart1_sel", base + (25 * 0x80), 8, 3,
+	       imx_clk_mux(dev, "lpuart1_sel", base + (25 * 0x80), 8, 3,
 			   lpuart1_sels, ARRAY_SIZE(lpuart1_sels)));
 	clk_dm(IMXRT1170_CLK_LPUART1,
 	       imx_clk_divider("lpuart1", "lpuart1_sel",
 			       base + (25 * 0x80), 0, 8));
 
 	clk_dm(IMXRT1170_CLK_USDHC1_SEL,
-	       imx_clk_mux("usdhc1_sel", base + (58 * 0x80), 8, 3,
+	       imx_clk_mux(dev, "usdhc1_sel", base + (58 * 0x80), 8, 3,
 			   usdhc1_sels, ARRAY_SIZE(usdhc1_sels)));
 	clk_dm(IMXRT1170_CLK_USDHC1,
 	       imx_clk_divider("usdhc1", "usdhc1_sel",
 			       base + (58 * 0x80), 0, 8));
 
 	clk_dm(IMXRT1170_CLK_GPT1_SEL,
-	       imx_clk_mux("gpt1_sel", base + (14 * 0x80), 8, 3,
+	       imx_clk_mux(dev, "gpt1_sel", base + (14 * 0x80), 8, 3,
 			   gpt1_sels, ARRAY_SIZE(gpt1_sels)));
 	clk_dm(IMXRT1170_CLK_GPT1,
 	       imx_clk_divider("gpt1", "gpt1_sel",
 			       base + (14 * 0x80), 0, 8));
 
 	clk_dm(IMXRT1170_CLK_SEMC_SEL,
-	       imx_clk_mux("semc_sel", base + (4 * 0x80), 8, 3,
+	       imx_clk_mux(dev, "semc_sel", base + (4 * 0x80), 8, 3,
 			   semc_sels, ARRAY_SIZE(semc_sels)));
 	clk_dm(IMXRT1170_CLK_SEMC,
 	       imx_clk_divider("semc", "semc_sel",
drivers/clk/imx/clk.h +6 -6
index 27a53ae5583..f18249ee8a8 100644
@@ -167,7 +167,7 @@ struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg,
 			      u8 shift, u8 width, const char * const *parents,
 			      int num_parents, void (*fixup)(u32 *val));
 
-static inline struct clk *imx_clk_mux_flags(const char *name,
+static inline struct clk *imx_clk_mux_flags(struct udevice *dev, const char *name,
 			void __iomem *reg, u8 shift, u8 width,
 			const char * const *parents, int num_parents,
 			unsigned long flags)
@@ -177,7 +177,7 @@ static inline struct clk *imx_clk_mux_flags(const char *name,
 				width, 0);
 }
 
-static inline struct clk *imx_clk_mux2_flags(const char *name,
+static inline struct clk *imx_clk_mux2_flags(struct udevice *dev, const char *name,
 		void __iomem *reg, u8 shift, u8 width,
 		const char * const *parents,
 		int num_parents, unsigned long flags)
@@ -187,8 +187,8 @@ static inline struct clk *imx_clk_mux2_flags(const char *name,
 			reg, shift, width, 0);
 }
 
-static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
-			u8 shift, u8 width, const char * const *parents,
+static inline struct clk *imx_clk_mux(struct udevice *dev, const char *name,
+			void __iomem *reg, u8 shift, u8 width, const char * const *parents,
 			int num_parents)
 {
 	return clk_register_mux(NULL, name, parents, num_parents,
@@ -197,7 +197,7 @@ static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
 }
 
 static inline struct clk *
-imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, u8 width,
+imx_clk_busy_mux(struct udevice *dev, const char *name, void __iomem *reg, u8 shift, u8 width,
 		 void __iomem *busy_reg, u8 busy_shift,
 		 const char * const *parents, int num_parents)
 {
@@ -206,7 +206,7 @@ imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift, u8 width,
 			width, 0);
 }
 
-static inline struct clk *imx_clk_mux2(const char *name, void __iomem *reg,
+static inline struct clk *imx_clk_mux2(struct udevice *dev, const char *name, void __iomem *reg,
 			u8 shift, u8 width, const char * const *parents,
 			int num_parents)
 {
Signature · 1 line
2.47.2
#6 lore raw

PATCH v2 6/24 clk: imx: Pass struct udevice to clk_register_mux()

In reply to Marek Vasut

Pass U-Boot specific struct udevice pointer to clock parent device to clk_register_mux(), so clk_register_mux() can access the parent udevice.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/imx/clk.h +5 -5
index f18249ee8a8..6f0ae86f612 100644
@@ -172,7 +172,7 @@ static inline struct clk *imx_clk_mux_flags(struct udevice *dev, const char *nam
 			const char * const *parents, int num_parents,
 			unsigned long flags)
 {
-	return clk_register_mux(NULL, name, parents, num_parents,
+	return clk_register_mux(dev, name, parents, num_parents,
 				flags | CLK_SET_RATE_NO_REPARENT, reg, shift,
 				width, 0);
 }
@@ -182,7 +182,7 @@ static inline struct clk *imx_clk_mux2_flags(struct udevice *dev, const char *na
 		const char * const *parents,
 		int num_parents, unsigned long flags)
 {
-	return clk_register_mux(NULL, name, parents, num_parents,
+	return clk_register_mux(dev, name, parents, num_parents,
 			flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE,
 			reg, shift, width, 0);
 }
@@ -191,7 +191,7 @@ static inline struct clk *imx_clk_mux(struct udevice *dev, const char *name,
 			void __iomem *reg, u8 shift, u8 width, const char * const *parents,
 			int num_parents)
 {
-	return clk_register_mux(NULL, name, parents, num_parents,
+	return clk_register_mux(dev, name, parents, num_parents,
 			CLK_SET_RATE_NO_REPARENT, reg, shift,
 			width, 0);
 }
@@ -201,7 +201,7 @@ imx_clk_busy_mux(struct udevice *dev, const char *name, void __iomem *reg, u8 sh
 		 void __iomem *busy_reg, u8 busy_shift,
 		 const char * const *parents, int num_parents)
 {
-	return clk_register_mux(NULL, name, parents, num_parents,
+	return clk_register_mux(dev, name, parents, num_parents,
 			CLK_SET_RATE_NO_REPARENT, reg, shift,
 			width, 0);
 }
@@ -210,7 +210,7 @@ static inline struct clk *imx_clk_mux2(struct udevice *dev, const char *name, vo
 			u8 shift, u8 width, const char * const *parents,
 			int num_parents)
 {
-	return clk_register_mux(NULL, name, parents, num_parents,
+	return clk_register_mux(dev, name, parents, num_parents,
 			CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE,
 			reg, shift, width, 0);
 }
Signature · 1 line
2.47.2
#7 lore raw

PATCH v2 7/24 clk: clk-gate: Use struct udevice instead of struct device

In reply to Marek Vasut

Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-gate registration.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-gate.c       | 2 +-
 include/linux/clk-provider.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-gate.c +1 -1
index bf1c6a93b46..cef98720b69 100644
@@ -117,7 +117,7 @@ const struct clk_ops clk_gate_ops = {
 	.get_rate = clk_generic_get_rate,
 };
 
-struct clk *clk_register_gate(struct device *dev, const char *name,
+struct clk *clk_register_gate(struct udevice *dev, const char *name,
 			      const char *parent_name, unsigned long flags,
 			      void __iomem *reg, u8 bit_idx,
 			      u8 clk_gate_flags, spinlock_t *lock)
include/linux/clk-provider.h +1 -1
index f27878ae6fa..e282be12897 100644
@@ -105,7 +105,7 @@ struct clk_gate {
 #define CLK_GATE_HIWORD_MASK		BIT(1)
 
 extern const struct clk_ops clk_gate_ops;
-struct clk *clk_register_gate(struct device *dev, const char *name,
+struct clk *clk_register_gate(struct udevice *dev, const char *name,
 			      const char *parent_name, unsigned long flags,
 			      void __iomem *reg, u8 bit_idx,
 			      u8 clk_gate_flags, spinlock_t *lock);
Signature · 1 line
2.47.2
#8 lore raw

PATCH v2 8/24 clk: clk-gate: Resolve parent clock by name

In reply to Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-gate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/clk-gate.c +2 -1
index cef98720b69..256ff108991 100644
@@ -149,7 +149,8 @@ struct clk *clk_register_gate(struct udevice *dev, const char *name,
 	clk = &gate->clk;
 	clk->flags = flags;
 
-	ret = clk_register(clk, UBOOT_DM_CLK_GATE, name, parent_name);
+	ret = clk_register(clk, UBOOT_DM_CLK_GATE, name,
+		clk_resolve_parent_clk(dev, parent_name));
 	if (ret) {
 		kfree(gate);
 		return ERR_PTR(ret);
Signature · 1 line
2.47.2
#9 lore raw

PATCH v2 9/24 clk: imx: gate2: Use struct udevice instead of struct device

In reply to Marek Vasut

Use U-Boot specific struct udevice instead of Linux compatibility struct device in gate2 clock registration.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-gate2.c | 2 +-
 drivers/clk/imx/clk.h       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-gate2.c +1 -1
index 65fa6b5b139..400121a8ae1 100644
@@ -90,7 +90,7 @@ static const struct clk_ops clk_gate2_ops = {
 	.get_rate = clk_generic_get_rate,
 };
 
-struct clk *clk_register_gate2(struct device *dev, const char *name,
+struct clk *clk_register_gate2(struct udevice *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		void __iomem *reg, u8 bit_idx, u8 cgr_val,
 		u8 clk_gate2_flags, unsigned int *share_count)
drivers/clk/imx/clk.h +1 -1
index 6f0ae86f612..6f964f2679f 100644
@@ -78,7 +78,7 @@ struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
 			    void __iomem *base,
 			    const struct imx_pll14xx_clk *pll_clk);
 
-struct clk *clk_register_gate2(struct device *dev, const char *name,
+struct clk *clk_register_gate2(struct udevice *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		void __iomem *reg, u8 bit_idx, u8 cgr_val,
 		u8 clk_gate_flags, unsigned int *share_count);
Signature · 1 line
2.47.2
#10 lore raw

PATCH v2 10/24 clk: imx: gate2: Resolve parent clock by name

In reply to Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-gate2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-gate2.c +2 -1
index 400121a8ae1..fa07b13249b 100644
@@ -111,7 +111,8 @@ struct clk *clk_register_gate2(struct udevice *dev, const char *name,
 
 	clk = &gate->clk;
 
-	ret = clk_register(clk, UBOOT_DM_CLK_IMX_GATE2, name, parent_name);
+	ret = clk_register(clk, UBOOT_DM_CLK_IMX_GATE2, name,
+		clk_resolve_parent_clk(dev, parent_name));
 	if (ret) {
 		kfree(gate);
 		return ERR_PTR(ret);
Signature · 1 line
2.47.2
#11 lore raw

PATCH v2 11/24 clk: imx: Pass struct udevice into imx_clk_gate*()

In reply to Marek Vasut

Pass struct udevice * into imx_clk_gate*() functions, so the clock core would have access to parent struct udevice *.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-imx6q.c     | 32 +++++------
 drivers/clk/imx/clk-imx8mm.c    | 56 ++++++++++----------
 drivers/clk/imx/clk-imx8mn.c    | 66 +++++++++++------------
 drivers/clk/imx/clk-imx8mp.c    | 94 ++++++++++++++++-----------------
 drivers/clk/imx/clk-imx8mq.c    | 72 ++++++++++++-------------
 drivers/clk/imx/clk-imxrt1020.c |  8 +--
 drivers/clk/imx/clk-imxrt1050.c | 14 ++---
 drivers/clk/imx/clk.h           | 28 +++++-----
 8 files changed, 187 insertions(+), 183 deletions(-)
drivers/clk/imx/clk-imx6q.c +16 -16
index 92b79a3a02c..d9eb43d82be 100644
@@ -60,7 +60,7 @@ static int imx6q_clk_probe(struct udevice *dev)
 	clk_dm(IMX6QDL_CLK_PLL6,
 	       imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3));
 	clk_dm(IMX6QDL_CLK_PLL6_ENET,
-	       imx_clk_gate("pll6_enet", "pll6", base + 0xe0, 13));
+	       imx_clk_gate(dev, "pll6_enet", "pll6", base + 0xe0, 13));
 
 	/* CCM clocks */
 	base = dev_read_addr_ptr(dev);
@@ -115,25 +115,25 @@ static int imx6q_clk_probe(struct udevice *dev)
 	}
 
 	clk_dm(IMX6QDL_CLK_ECSPI1,
-	       imx_clk_gate2("ecspi1", "ecspi_root", base + 0x6c, 0));
+	       imx_clk_gate2(dev, "ecspi1", "ecspi_root", base + 0x6c, 0));
 	clk_dm(IMX6QDL_CLK_ECSPI2,
-	       imx_clk_gate2("ecspi2", "ecspi_root", base + 0x6c, 2));
+	       imx_clk_gate2(dev, "ecspi2", "ecspi_root", base + 0x6c, 2));
 	clk_dm(IMX6QDL_CLK_ECSPI3,
-	       imx_clk_gate2("ecspi3", "ecspi_root", base + 0x6c, 4));
+	       imx_clk_gate2(dev, "ecspi3", "ecspi_root", base + 0x6c, 4));
 	clk_dm(IMX6QDL_CLK_ECSPI4,
-	       imx_clk_gate2("ecspi4", "ecspi_root", base + 0x6c, 6));
+	       imx_clk_gate2(dev, "ecspi4", "ecspi_root", base + 0x6c, 6));
 	clk_dm(IMX6QDL_CLK_UART_IPG,
-	       imx_clk_gate2("uart_ipg", "ipg", base + 0x7c, 24));
+	       imx_clk_gate2(dev, "uart_ipg", "ipg", base + 0x7c, 24));
 	clk_dm(IMX6QDL_CLK_UART_SERIAL,
-	       imx_clk_gate2("uart_serial", "uart_serial_podf",  base + 0x7c, 26));
+	       imx_clk_gate2(dev, "uart_serial", "uart_serial_podf",  base + 0x7c, 26));
 	clk_dm(IMX6QDL_CLK_USDHC1,
-	       imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2));
+	       imx_clk_gate2(dev, "usdhc1", "usdhc1_podf", base + 0x80, 2));
 	clk_dm(IMX6QDL_CLK_USDHC2,
-	       imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4));
+	       imx_clk_gate2(dev, "usdhc2", "usdhc2_podf", base + 0x80, 4));
 	clk_dm(IMX6QDL_CLK_USDHC3,
-	       imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6));
+	       imx_clk_gate2(dev, "usdhc3", "usdhc3_podf", base + 0x80, 6));
 	clk_dm(IMX6QDL_CLK_USDHC4,
-	       imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8));
+	       imx_clk_gate2(dev, "usdhc4", "usdhc4_podf", base + 0x80, 8));
 
 	clk_dm(IMX6QDL_CLK_PERIPH_PRE,
 	       imx_clk_mux(dev, "periph_pre", base + 0x18, 18, 2, periph_pre_sels,
@@ -149,15 +149,15 @@ static int imx6q_clk_probe(struct udevice *dev)
 	clk_dm(IMX6QDL_CLK_IPG_PER,
 	       imx_clk_divider("ipg_per", "ipg", base + 0x1c, 0, 6));
 	clk_dm(IMX6QDL_CLK_I2C1,
-	       imx_clk_gate2("i2c1", "ipg_per", base + 0x70, 6));
+	       imx_clk_gate2(dev, "i2c1", "ipg_per", base + 0x70, 6));
 	clk_dm(IMX6QDL_CLK_I2C2,
-	       imx_clk_gate2("i2c2", "ipg_per", base + 0x70, 8));
+	       imx_clk_gate2(dev, "i2c2", "ipg_per", base + 0x70, 8));
 	clk_dm(IMX6QDL_CLK_I2C3,
-	       imx_clk_gate2("i2c3", "ipg_per", base + 0x70, 10));
+	       imx_clk_gate2(dev, "i2c3", "ipg_per", base + 0x70, 10));
 	clk_dm(IMX6QDL_CLK_PWM1,
-	       imx_clk_gate2("pwm1", "ipg_per", base + 0x78, 16));
+	       imx_clk_gate2(dev, "pwm1", "ipg_per", base + 0x78, 16));
 
-	clk_dm(IMX6QDL_CLK_ENET, imx_clk_gate2("enet", "ipg", base + 0x6c, 10));
+	clk_dm(IMX6QDL_CLK_ENET, imx_clk_gate2(dev, "enet", "ipg", base + 0x6c, 10));
 	clk_dm(IMX6QDL_CLK_ENET_REF,
 	       imx_clk_fixed_factor("enet_ref", "pll6_enet", 1, 1));
 
drivers/clk/imx/clk-imx8mm.c +28 -28

126 lines not on this page · raw message

drivers/clk/imx/clk-imx8mn.c +33 -33

135 lines not on this page · raw message

drivers/clk/imx/clk-imx8mp.c +47 -47

112 lines not on this page · raw message

drivers/clk/imx/clk-imx8mq.c +36 -36

144 lines not on this page · raw message

drivers/clk/imx/clk-imxrt1020.c +4 -4
index 16fc3bcdb3e..40cba218c29 100644
@@ -116,13 +116,13 @@ static int imxrt1020_clk_probe(struct udevice *dev)
 			       base + 0x14, 16, 3));
 
 	clk_dm(IMXRT1020_CLK_USDHC1,
-	       imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2));
+	       imx_clk_gate2(dev, "usdhc1", "usdhc1_podf", base + 0x80, 2));
 	clk_dm(IMXRT1020_CLK_USDHC2,
-	       imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4));
+	       imx_clk_gate2(dev, "usdhc2", "usdhc2_podf", base + 0x80, 4));
 	clk_dm(IMXRT1020_CLK_LPUART1,
-	       imx_clk_gate2("lpuart1", "lpuart_podf", base + 0x7c, 24));
+	       imx_clk_gate2(dev, "lpuart1", "lpuart_podf", base + 0x7c, 24));
 	clk_dm(IMXRT1020_CLK_SEMC,
-	       imx_clk_gate2("semc", "semc_podf", base + 0x74, 4));
+	       imx_clk_gate2(dev, "semc", "semc_podf", base + 0x74, 4));
 
 #ifdef CONFIG_XPL_BUILD
 	struct clk *clk, *clk1;
drivers/clk/imx/clk-imxrt1050.c +7 -7
index 5f37915f593..71d5fa8a90e 100644
@@ -167,19 +167,19 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 			       base + 0x18, 23, 3));
 
 	clk_dm(IMXRT1050_CLK_USDHC1,
-	       imx_clk_gate2("usdhc1", "usdhc1_podf", base + 0x80, 2));
+	       imx_clk_gate2(dev, "usdhc1", "usdhc1_podf", base + 0x80, 2));
 	clk_dm(IMXRT1050_CLK_USDHC2,
-	       imx_clk_gate2("usdhc2", "usdhc2_podf", base + 0x80, 4));
+	       imx_clk_gate2(dev, "usdhc2", "usdhc2_podf", base + 0x80, 4));
 	clk_dm(IMXRT1050_CLK_LPUART1,
-	       imx_clk_gate2("lpuart1", "lpuart_podf", base + 0x7c, 24));
+	       imx_clk_gate2(dev, "lpuart1", "lpuart_podf", base + 0x7c, 24));
 	clk_dm(IMXRT1050_CLK_SEMC,
-	       imx_clk_gate2("semc", "semc_podf", base + 0x74, 4));
+	       imx_clk_gate2(dev, "semc", "semc_podf", base + 0x74, 4));
 	clk_dm(IMXRT1050_CLK_LCDIF_APB,
-	       imx_clk_gate2("lcdif", "lcdif_podf", base + 0x70, 28));
+	       imx_clk_gate2(dev, "lcdif", "lcdif_podf", base + 0x70, 28));
 	clk_dm(IMXRT1050_CLK_LCDIF_PIX,
-	       imx_clk_gate2("lcdif_pix", "lcdif", base + 0x74, 10));
+	       imx_clk_gate2(dev, "lcdif_pix", "lcdif", base + 0x74, 10));
 	clk_dm(IMXRT1050_CLK_USBOH3,
-	       imx_clk_gate2("usboh3", "pll3_usb_otg", base + 0x80, 0));
+	       imx_clk_gate2(dev, "usboh3", "pll3_usb_otg", base + 0x80, 0));
 
 	struct clk *clk, *clk1;
 
drivers/clk/imx/clk.h +16 -12
index 6f964f2679f..d2122977e47 100644
@@ -87,14 +87,15 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
 			  const char *parent_name, void __iomem *base,
 			  u32 div_mask);
 
-static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
-					void __iomem *reg, u8 shift)
+static inline struct clk *imx_clk_gate2(struct udevice *dev, const char *name,
+					const char *parent, void __iomem *reg,
+					u8 shift)
 {
 	return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
 			shift, 0x3, 0, NULL);
 }
 
-static inline struct clk *imx_clk_gate2_shared(const char *name,
+static inline struct clk *imx_clk_gate2_shared(struct udevice *dev, const char *name,
 					       const char *parent,
 					       void __iomem *reg, u8 shift,
 					       unsigned int *share_count)
@@ -103,7 +104,7 @@ static inline struct clk *imx_clk_gate2_shared(const char *name,
 				  shift, 0x3, 0, share_count);
 }
 
-static inline struct clk *imx_clk_gate2_shared2(const char *name,
+static inline struct clk *imx_clk_gate2_shared2(struct udevice *dev, const char *name,
 						const char *parent,
 						void __iomem *reg, u8 shift,
 						unsigned int *share_count)
@@ -113,7 +114,7 @@ static inline struct clk *imx_clk_gate2_shared2(const char *name,
 				  share_count);
 }
 
-static inline struct clk *imx_clk_gate4(const char *name, const char *parent,
+static inline struct clk *imx_clk_gate4(struct udevice *dev, const char *name, const char *parent,
 		void __iomem *reg, u8 shift)
 {
 	return clk_register_gate2(NULL, name, parent,
@@ -121,7 +122,7 @@ static inline struct clk *imx_clk_gate4(const char *name, const char *parent,
 			reg, shift, 0x3, 0, NULL);
 }
 
-static inline struct clk *imx_clk_gate4_flags(const char *name,
+static inline struct clk *imx_clk_gate4_flags(struct udevice *dev, const char *name,
 		const char *parent, void __iomem *reg, u8 shift,
 		unsigned long flags)
 {
@@ -215,22 +216,25 @@ static inline struct clk *imx_clk_mux2(struct udevice *dev, const char *name, vo
 			reg, shift, width, 0);
 }
 
-static inline struct clk *imx_clk_gate(const char *name, const char *parent,
-		void __iomem *reg, u8 shift)
+static inline struct clk *imx_clk_gate(struct udevice *dev, const char *name,
+				       const char *parent, void __iomem *reg,
+				       u8 shift)
 {
 	return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
 			shift, 0, NULL);
 }
 
-static inline struct clk *imx_clk_gate_flags(const char *name, const char *parent,
-		void __iomem *reg, u8 shift, unsigned long flags)
+static inline struct clk *imx_clk_gate_flags(struct udevice *dev, const char *name,
+					     const char *parent, void __iomem *reg,
+					     u8 shift, unsigned long flags)
 {
 	return clk_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
 			shift, 0, NULL);
 }
 
-static inline struct clk *imx_clk_gate3(const char *name, const char *parent,
-		void __iomem *reg, u8 shift)
+static inline struct clk *imx_clk_gate3(struct udevice *dev, const char *name,
+					const char *parent, void __iomem *reg,
+					u8 shift)
 {
 	return clk_register_gate(NULL, name, parent,
 			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
Signature · 1 line
2.47.2
#12 lore raw

PATCH v2 12/24 clk: imx: Pass struct udevice to clk_register_gate*()

In reply to Marek Vasut

Pass U-Boot specific struct udevice pointer to clock parent device to clk_register_gate*(), so clk_register_gate*() can access the parent udevice.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/clk/imx/clk.h +8 -8
index d2122977e47..22b5d823ff9 100644
@@ -91,7 +91,7 @@ static inline struct clk *imx_clk_gate2(struct udevice *dev, const char *name,
 					const char *parent, void __iomem *reg,
 					u8 shift)
 {
-	return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
+	return clk_register_gate2(dev, name, parent, CLK_SET_RATE_PARENT, reg,
 			shift, 0x3, 0, NULL);
 }
 
@@ -100,7 +100,7 @@ static inline struct clk *imx_clk_gate2_shared(struct udevice *dev, const char *
 					       void __iomem *reg, u8 shift,
 					       unsigned int *share_count)
 {
-	return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
+	return clk_register_gate2(dev, name, parent, CLK_SET_RATE_PARENT, reg,
 				  shift, 0x3, 0, share_count);
 }
 
@@ -109,7 +109,7 @@ static inline struct clk *imx_clk_gate2_shared2(struct udevice *dev, const char
 						void __iomem *reg, u8 shift,
 						unsigned int *share_count)
 {
-	return clk_register_gate2(NULL, name, parent, CLK_SET_RATE_PARENT |
+	return clk_register_gate2(dev, name, parent, CLK_SET_RATE_PARENT |
 				  CLK_OPS_PARENT_ENABLE, reg, shift, 0x3, 0,
 				  share_count);
 }
@@ -117,7 +117,7 @@ static inline struct clk *imx_clk_gate2_shared2(struct udevice *dev, const char
 static inline struct clk *imx_clk_gate4(struct udevice *dev, const char *name, const char *parent,
 		void __iomem *reg, u8 shift)
 {
-	return clk_register_gate2(NULL, name, parent,
+	return clk_register_gate2(dev, name, parent,
 			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
 			reg, shift, 0x3, 0, NULL);
 }
@@ -126,7 +126,7 @@ static inline struct clk *imx_clk_gate4_flags(struct udevice *dev, const char *n
 		const char *parent, void __iomem *reg, u8 shift,
 		unsigned long flags)
 {
-	return clk_register_gate2(NULL, name, parent,
+	return clk_register_gate2(dev, name, parent,
 			flags | CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
 			reg, shift, 0x3, 0, NULL);
 }
@@ -220,7 +220,7 @@ static inline struct clk *imx_clk_gate(struct udevice *dev, const char *name,
 				       const char *parent, void __iomem *reg,
 				       u8 shift)
 {
-	return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
+	return clk_register_gate(dev, name, parent, CLK_SET_RATE_PARENT, reg,
 			shift, 0, NULL);
 }
 
@@ -228,7 +228,7 @@ static inline struct clk *imx_clk_gate_flags(struct udevice *dev, const char *na
 					     const char *parent, void __iomem *reg,
 					     u8 shift, unsigned long flags)
 {
-	return clk_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
+	return clk_register_gate(dev, name, parent, flags | CLK_SET_RATE_PARENT, reg,
 			shift, 0, NULL);
 }
 
@@ -236,7 +236,7 @@ static inline struct clk *imx_clk_gate3(struct udevice *dev, const char *name,
 					const char *parent, void __iomem *reg,
 					u8 shift)
 {
-	return clk_register_gate(NULL, name, parent,
+	return clk_register_gate(dev, name, parent,
 			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
 			reg, shift, 0, NULL);
 }
Signature · 1 line
2.47.2
#13 lore raw

PATCH v2 13/24 clk: clk-composite: Use struct udevice instead of struct device

In reply to Marek Vasut

Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-composite registration.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-composite.c  | 2 +-
 include/linux/clk-provider.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-composite.c +1 -1
index 199ca6eaa37..1191bdf87df 100644
@@ -97,7 +97,7 @@ static int clk_composite_disable(struct clk *clk)
 		return 0;
 }
 
-struct clk *clk_register_composite(struct device *dev, const char *name,
+struct clk *clk_register_composite(struct udevice *dev, const char *name,
 				   const char * const *parent_names,
 				   int num_parents, struct clk *mux,
 				   const struct clk_ops *mux_ops,
include/linux/clk-provider.h +1 -1
index e282be12897..d44ead53079 100644
@@ -223,7 +223,7 @@ struct clk_composite {
 
 #define to_clk_composite(_clk) container_of(_clk, struct clk_composite, clk)
 
-struct clk *clk_register_composite(struct device *dev, const char *name,
+struct clk *clk_register_composite(struct udevice *dev, const char *name,
 		const char * const *parent_names, int num_parents,
 		struct clk *mux_clk, const struct clk_ops *mux_ops,
 		struct clk *rate_clk, const struct clk_ops *rate_ops,
Signature · 1 line
2.47.2
#14 lore raw

PATCH v2 14/24 clk: clk-composite: Resolve parent clock by name

In reply to Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-composite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-composite.c +1 -1
index 1191bdf87df..9e3b5191767 100644
@@ -149,7 +149,7 @@ struct clk *clk_register_composite(struct udevice *dev, const char *name,
 	clk = &composite->clk;
 	clk->flags = flags;
 	ret = clk_register(clk, UBOOT_DM_CLK_COMPOSITE, name,
-			   parent_names[clk_composite_get_parent(clk)]);
+		clk_resolve_parent_clk(dev, parent_names[clk_composite_get_parent(clk)]));
 	if (ret) {
 		clk = ERR_PTR(ret);
 		goto err;
Signature · 1 line
2.47.2
#15 lore raw

Re: [PATCH v2 14/24] clk: clk-composite: Resolve parent clock by name

Quoted 5 lines · Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

This patch breaks booting starfive_visionfive2_defconfig in the SPL stage.

To dig a bit deeper I enabled the debug UART for SPL with these setting on origin/master (5e74863ad6613df):

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_NS16550=y
CONFIG_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_SHIFT=2

clk_register: failed to get pll0_out device (parent of perh_root)
clk_register: failed to get pll0_out device (parent of qspi_ref_src)
clk_register: failed to get pll0_out device (parent of usb_125m)
clk_register: failed to get pll0_out device (parent of gmac_src)
clk_register: failed to get pll0_out device (parent of gmac1_gtxclk)
clk_register: failed to get pll0_out device (parent of gmac0_gtxclk)

Marek assumes that property bootph-pre-ram might be missing for some clocks in arch/riscv/dts/jh7110-u-boot.dtsi.

Best regards

Heinrich

Quoted 31 lines

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
  drivers/clk/clk-composite.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-composite.c +1 -1
index 1191bdf87df..9e3b5191767 100644
@@ -149,7 +149,7 @@ struct clk *clk_register_composite(struct udevice *dev, const char *name,
  	clk = &composite->clk;
  	clk->flags = flags;
  	ret = clk_register(clk, UBOOT_DM_CLK_COMPOSITE, name,
-			   parent_names[clk_composite_get_parent(clk)]);
+		clk_resolve_parent_clk(dev, parent_names[clk_composite_get_parent(clk)]));
  	if (ret) {
  		clk = ERR_PTR(ret);
  		goto err;
#16 lore raw

Re: [PATCH v2 14/24] clk: clk-composite: Resolve parent clock by name

Quoted 18 lines · Heinrich Schuchardt
Quoted 5 lines · Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

This patch breaks booting starfive_visionfive2_defconfig in the SPL stage.

To dig a bit deeper I enabled the debug UART for SPL with these setting on origin/master (5e74863ad6613df):

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_NS16550=y
CONFIG_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_SHIFT=2

Quoted 8 lines

clk_register: failed to get pll0_out device (parent of perh_root)
clk_register: failed to get pll0_out device (parent of qspi_ref_src)
clk_register: failed to get pll0_out device (parent of usb_125m)
clk_register: failed to get pll0_out device (parent of gmac_src)
clk_register: failed to get pll0_out device (parent of gmac1_gtxclk)
clk_register: failed to get pll0_out device (parent of gmac0_gtxclk)

Marek assumes that property bootph-pre-ram might be missing for some clocks in arch/riscv/dts/jh7110-u-boot.dtsi.

This change suggested by Marek resolves the issue:

arch/riscv/dts/jh7110-u-boot.dtsi +4 -0
index ce7d9e16961..4ed764393bb 100644
@@ -113,3 +113,7 @@
 &sys_syscon {
        bootph-pre-ram;
 };
+
+&pllclk {
+       bootph-pre-ram;
+};

Best regards

Heinrich

Quoted 35 lines
Quoted 34 lines

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches
---
  drivers/clk/clk-composite.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-composite.c +1 -1
index 1191bdf87df..9e3b5191767 100644
@@ -149,7 +149,7 @@ struct clk *clk_register_composite(struct udevice 
 *dev, const char *name,
       clk = &composite->clk;
       clk->flags = flags;
       ret = clk_register(clk, UBOOT_DM_CLK_COMPOSITE, name,
-               parent_names[clk_composite_get_parent(clk)]);
+        clk_resolve_parent_clk(dev, 
 parent_names[clk_composite_get_parent(clk)]));
       if (ret) {

          clk = ERR_PTR(ret);
          goto err;

#17 lore raw

Re: [PATCH v2 14/24] clk: clk-composite: Resolve parent clock by name

Hi Heinrich,

Quoted 39 lines · Heinrich Schuchardt
Quoted 26 lines · Heinrich Schuchardt
Quoted 5 lines · Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

This patch breaks booting starfive_visionfive2_defconfig in the SPL stage.

To dig a bit deeper I enabled the debug UART for SPL with these setting on origin/master (5e74863ad6613df):

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_NS16550=y
CONFIG_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_SHIFT=2

clk_register: failed to get pll0_out device (parent of perh_root)
clk_register: failed to get pll0_out device (parent of qspi_ref_src)
clk_register: failed to get pll0_out device (parent of usb_125m)
clk_register: failed to get pll0_out device (parent of gmac_src)
clk_register: failed to get pll0_out device (parent of gmac1_gtxclk)
clk_register: failed to get pll0_out device (parent of gmac0_gtxclk)

Quoted 2 lines

Marek assumes that property bootph-pre-ram might be missing for some clocks in arch/riscv/dts/jh7110-u-boot.dtsi.

This change suggested by Marek resolves the issue:

arch/riscv/dts/jh7110-u-boot.dtsi +0 -0
index ce7d9e16961..4ed764393bb 100644

arch/riscv/dts/jh7110-u-boot.dtsi line 119

Quoted 7 lines
arch/riscv/dts/jh7110-u-boot.dtsi +4 -0
@@ -113,3 +113,7 @@
  &sys_syscon {
         bootph-pre-ram;
  };
+
+&pllclk {
+       bootph-pre-ram;
+};

I just hit this as well, thanks for the post.

However, -master still does not boot for me on vf2:

U-Boot SPL 2026.04-rc1 (Jan 26 2026 - 19:52:48 -0700) DDR version: dc2e84f0.
Trying to boot from MMC2
spl: partition error
Error: -38
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Regards,
Simon

Quoted 37 lines
Quoted 36 lines
Quoted 35 lines

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
  drivers/clk/clk-composite.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-composite.c +1 -1
index 1191bdf87df..9e3b5191767 100644
@@ -149,7 +149,7 @@ struct clk *clk_register_composite(struct udevice
 *dev, const char *name,
      clk = &composite->clk;
      clk->flags = flags;
      ret = clk_register(clk, UBOOT_DM_CLK_COMPOSITE, name,
-               parent_names[clk_composite_get_parent(clk)]);
+        clk_resolve_parent_clk(dev,
 parent_names[clk_composite_get_parent(clk)]));
      if (ret) {
          clk = ERR_PTR(ret);
          goto err;
#18 lore raw

Re: [PATCH v2 14/24] clk: clk-composite: Resolve parent clock by name

Hi Simon,

Quoted 64 lines · Simon Glass

Hi Heinrich,

Quoted 39 lines · Heinrich Schuchardt
Quoted 26 lines · Heinrich Schuchardt
Quoted 5 lines · Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

This patch breaks booting starfive_visionfive2_defconfig in the SPL stage.

To dig a bit deeper I enabled the debug UART for SPL with these setting on origin/master (5e74863ad6613df):

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_NS16550=y
CONFIG_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_SHIFT=2

clk_register: failed to get pll0_out device (parent of perh_root)
clk_register: failed to get pll0_out device (parent of qspi_ref_src)
clk_register: failed to get pll0_out device (parent of usb_125m)
clk_register: failed to get pll0_out device (parent of gmac_src)
clk_register: failed to get pll0_out device (parent of gmac1_gtxclk)
clk_register: failed to get pll0_out device (parent of gmac0_gtxclk)

Quoted 2 lines

Marek assumes that property bootph-pre-ram might be missing for some clocks in arch/riscv/dts/jh7110-u-boot.dtsi.

This change suggested by Marek resolves the issue:

arch/riscv/dts/jh7110-u-boot.dtsi +0 -0
index ce7d9e16961..4ed764393bb 100644

arch/riscv/dts/jh7110-u-boot.dtsi line 119

Quoted 7 lines
arch/riscv/dts/jh7110-u-boot.dtsi +4 -0
@@ -113,3 +113,7 @@
  &sys_syscon {
         bootph-pre-ram;
  };
+
+&pllclk {
+       bootph-pre-ram;
+};

I just hit this as well, thanks for the post.

However, -master still does not boot for me on vf2:

U-Boot SPL 2026.04-rc1 (Jan 26 2026 - 19:52:48 -0700) DDR version: dc2e84f0.
Trying to boot from MMC2
spl: partition error
Error: -38
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Quoted 2 lines

Regards,
Simon

Is this to be expected? ref:
https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html#zero-stage-bootloader

The JH-7110 has enough SRAM to contain the unfiltered devicetree if you would like to experiment without filtering to reduce size for the SPL.

Meanwhile though the uses of "sd card image" for U-Boot SPL to access MMC are not anymore supported; transition to instead use the remaining supported methods SPI Flash or UART Serial.

-E

#19 lore raw

Re: [PATCH v2 14/24] clk: clk-composite: Resolve parent clock by name

Hi E,

Quoted 74 lines · E Shattow

Hi Simon,

Quoted 64 lines · Simon Glass

Hi Heinrich,

Quoted 39 lines · Heinrich Schuchardt
Quoted 26 lines · Heinrich Schuchardt
Quoted 5 lines · Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

This patch breaks booting starfive_visionfive2_defconfig in the SPL stage.

To dig a bit deeper I enabled the debug UART for SPL with these setting on origin/master (5e74863ad6613df):

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_NS16550=y
CONFIG_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_SHIFT=2

clk_register: failed to get pll0_out device (parent of perh_root)
clk_register: failed to get pll0_out device (parent of qspi_ref_src)
clk_register: failed to get pll0_out device (parent of usb_125m)
clk_register: failed to get pll0_out device (parent of gmac_src)
clk_register: failed to get pll0_out device (parent of gmac1_gtxclk)
clk_register: failed to get pll0_out device (parent of gmac0_gtxclk)

Quoted 2 lines

Marek assumes that property bootph-pre-ram might be missing for some clocks in arch/riscv/dts/jh7110-u-boot.dtsi.

This change suggested by Marek resolves the issue:

arch/riscv/dts/jh7110-u-boot.dtsi +0 -0
index ce7d9e16961..4ed764393bb 100644

arch/riscv/dts/jh7110-u-boot.dtsi line 119

Quoted 7 lines
arch/riscv/dts/jh7110-u-boot.dtsi +4 -0
@@ -113,3 +113,7 @@
  &sys_syscon {
         bootph-pre-ram;
  };
+
+&pllclk {
+       bootph-pre-ram;
+};

I just hit this as well, thanks for the post.

However, -master still does not boot for me on vf2:

U-Boot SPL 2026.04-rc1 (Jan 26 2026 - 19:52:48 -0700) DDR version: dc2e84f0.
Trying to boot from MMC2
spl: partition error
Error: -38
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Quoted 2 lines

Regards,
Simon

Is this to be expected? ref:
https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html#zero-stage-bootloader

Quoted 6 lines

The JH-7110 has enough SRAM to contain the unfiltered devicetree if you would like to experiment without filtering to reduce size for the SPL.

Meanwhile though the uses of "sd card image" for U-Boot SPL to access MMC are not anymore supported; transition to instead use the remaining supported methods SPI Flash or UART Serial.

I'm not sure that I can make that work in my lab. I have a SPI-flash emulator for some boards, but it requires a special probe.

What is wrong with putting U-Boot on the SD card?

Regards,
Simon

#20 lore raw

Re: [PATCH v2 14/24] clk: clk-composite: Resolve parent clock by name

Hi Simon,

Quoted 80 lines · Simon Glass

Hi E,

Quoted 77 lines · E Shattow

Hi Simon,

Quoted 64 lines · Simon Glass

Hi Heinrich,

Quoted 39 lines · Heinrich Schuchardt
Quoted 26 lines · Heinrich Schuchardt
Quoted 5 lines · Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

This patch breaks booting starfive_visionfive2_defconfig in the SPL stage.

To dig a bit deeper I enabled the debug UART for SPL with these setting on origin/master (5e74863ad6613df):

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_NS16550=y
CONFIG_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_SHIFT=2

clk_register: failed to get pll0_out device (parent of perh_root)
clk_register: failed to get pll0_out device (parent of qspi_ref_src)
clk_register: failed to get pll0_out device (parent of usb_125m)
clk_register: failed to get pll0_out device (parent of gmac_src)
clk_register: failed to get pll0_out device (parent of gmac1_gtxclk)
clk_register: failed to get pll0_out device (parent of gmac0_gtxclk)

Quoted 2 lines

Marek assumes that property bootph-pre-ram might be missing for some clocks in arch/riscv/dts/jh7110-u-boot.dtsi.

This change suggested by Marek resolves the issue:

arch/riscv/dts/jh7110-u-boot.dtsi +0 -0
index ce7d9e16961..4ed764393bb 100644

arch/riscv/dts/jh7110-u-boot.dtsi line 119

Quoted 7 lines
arch/riscv/dts/jh7110-u-boot.dtsi +4 -0
@@ -113,3 +113,7 @@
  &sys_syscon {
         bootph-pre-ram;
  };
+
+&pllclk {
+       bootph-pre-ram;
+};

I just hit this as well, thanks for the post.

However, -master still does not boot for me on vf2:

U-Boot SPL 2026.04-rc1 (Jan 26 2026 - 19:52:48 -0700) DDR version: dc2e84f0.
Trying to boot from MMC2
spl: partition error
Error: -38
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Quoted 2 lines

Regards,
Simon

Is this to be expected? ref:
https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html#zero-stage-bootloader

The JH-7110 has enough SRAM to contain the unfiltered devicetree if you would like to experiment without filtering to reduce size for the SPL.

Quoted 8 lines
Quoted 3 lines

Meanwhile though the uses of "sd card image" for U-Boot SPL to access MMC are not anymore supported; transition to instead use the remaining supported methods SPI Flash or UART Serial.

I'm not sure that I can make that work in my lab. I have a SPI-flash emulator for some boards, but it requires a special probe.

What is wrong with putting U-Boot on the SD card?

TL;DR recap the feature is retracted from newer official documentation, new board designs do not have this capability, and apparent lack of interest yet to press StarFive for GPL2.0+ compliance. The latter is necessary else you're depending on "mystery" feature that was dropped and is unsupported by the vendor for your testing fixture. I have ~100+ hours into the JH-7110 BootROM reverse-engineering effort that I'd like to hand off for peer review.

Quoted 3 lines

Regards,
Simon

Simon: You personally are one of the copyright holders I have identified whose code is being ripped off by StarFive. Concurrently the reverse-engineering of JH-7110 BootROM effort has a sizeable chunk ready for peer-review but that is another topic; there may or may not be enough usable there but I think it'd be worth your time to review to decide what you would like to do. Contact me off-list for discussion about the r/e effort specifically.

-E

#21 lore raw

Re: [PATCH v2 14/24] clk: clk-composite: Resolve parent clock by name

In reply to E Shattow
Quoted 73 lines · E Shattow

Hi Simon,

Quoted 64 lines · Simon Glass

Hi Heinrich,

Quoted 39 lines · Heinrich Schuchardt
Quoted 26 lines · Heinrich Schuchardt
Quoted 5 lines · Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

This patch breaks booting starfive_visionfive2_defconfig in the SPL stage.

To dig a bit deeper I enabled the debug UART for SPL with these setting on origin/master (5e74863ad6613df):

CONFIG_DEBUG_UART=y
CONFIG_DEBUG_UART_NS16550=y
CONFIG_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_SPL_DEBUG_UART_BASE=0x10000000
CONFIG_DEBUG_UART_SHIFT=2

clk_register: failed to get pll0_out device (parent of perh_root)
clk_register: failed to get pll0_out device (parent of qspi_ref_src)
clk_register: failed to get pll0_out device (parent of usb_125m)
clk_register: failed to get pll0_out device (parent of gmac_src)
clk_register: failed to get pll0_out device (parent of gmac1_gtxclk)
clk_register: failed to get pll0_out device (parent of gmac0_gtxclk)

Quoted 2 lines

Marek assumes that property bootph-pre-ram might be missing for some clocks in arch/riscv/dts/jh7110-u-boot.dtsi.

This change suggested by Marek resolves the issue:

arch/riscv/dts/jh7110-u-boot.dtsi +0 -0
index ce7d9e16961..4ed764393bb 100644

arch/riscv/dts/jh7110-u-boot.dtsi line 119

Quoted 7 lines
arch/riscv/dts/jh7110-u-boot.dtsi +4 -0
@@ -113,3 +113,7 @@
   &sys_syscon {
          bootph-pre-ram;
   };
+
+&pllclk {
+       bootph-pre-ram;
+};

I just hit this as well, thanks for the post.

However, -master still does not boot for me on vf2:

U-Boot SPL 2026.04-rc1 (Jan 26 2026 - 19:52:48 -0700) DDR version: dc2e84f0.
Trying to boot from MMC2
spl: partition error
Error: -38
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

Quoted 2 lines

Regards,
Simon

Is this to be expected? ref:
https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html#zero-stage-bootloader

Quoted 8 lines

The JH-7110 has enough SRAM to contain the unfiltered devicetree if you would like to experiment without filtering to reduce size for the SPL.

Meanwhile though the uses of "sd card image" for U-Boot SPL to access MMC are not anymore supported; transition to instead use the remaining supported methods SPI Flash or UART Serial.

-E

The JH7110 boot ROM did not change. Why would anybody remove the SD-card support from SPL while distros are still using it for preinstalled images?

Best regards

Heinrich

#22 lore raw

PATCH v2 15/24 clk: imx: Pass struct udevice into imx_clk_composite*()

In reply to Marek Vasut

Pass struct udevice * into imx_clk_composite*() functions, so the clock core would have access to parent struct udevice *.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-composite-8m.c |  4 +-
 drivers/clk/imx/clk-imx8mm.c       | 74 +++++++++++++-------------
 drivers/clk/imx/clk-imx8mn.c       | 60 ++++++++++-----------
 drivers/clk/imx/clk-imx8mp.c       | 84 +++++++++++++++---------------
 drivers/clk/imx/clk-imx8mq.c       | 52 +++++++++---------
 drivers/clk/imx/clk.h              | 14 ++---
 6 files changed, 143 insertions(+), 145 deletions(-)
drivers/clk/imx/clk-composite-8m.c +2 -2
index 64bffa3b181..14c5b92939c 100644
@@ -151,7 +151,7 @@ const struct clk_ops imx8m_clk_mux_ops = {
 	.set_parent = imx8m_clk_mux_set_parent,
 };
 
-struct clk *imx8m_clk_composite_flags(const char *name,
+struct clk *imx8m_clk_composite_flags(struct udevice *dev, const char *name,
 				      const char * const *parent_names,
 				      int num_parents, void __iomem *reg,
 				      unsigned long flags)
@@ -187,7 +187,7 @@ struct clk *imx8m_clk_composite_flags(const char *name,
 	gate->reg = reg;
 	gate->bit_idx = PCG_CGC_SHIFT;
 
-	clk = clk_register_composite(NULL, name,
+	clk = clk_register_composite(dev, name,
 				     parent_names, num_parents,
 				     &mux->clk, &imx8m_clk_mux_ops, &div->clk,
 				     &imx8m_clk_composite_divider_ops,
drivers/clk/imx/clk-imx8mm.c +36 -38

153 lines not on this page · raw message

drivers/clk/imx/clk-imx8mn.c +30 -30

123 lines not on this page · raw message

drivers/clk/imx/clk-imx8mp.c +42 -42

94 lines not on this page · raw message

drivers/clk/imx/clk-imx8mq.c +26 -26

106 lines not on this page · raw message

drivers/clk/imx/clk.h +7 -7
index 22b5d823ff9..1a814d9a386 100644
@@ -241,20 +241,20 @@ static inline struct clk *imx_clk_gate3(struct udevice *dev, const char *name,
 			reg, shift, 0, NULL);
 }
 
-struct clk *imx8m_clk_composite_flags(const char *name,
+struct clk *imx8m_clk_composite_flags(struct udevice *dev, const char *name,
 		const char * const *parent_names,
 		int num_parents, void __iomem *reg, unsigned long flags);
 
-#define __imx8m_clk_composite(name, parent_names, reg, flags) \
-	imx8m_clk_composite_flags(name, parent_names, \
+#define __imx8m_clk_composite(dev, name, parent_names, reg, flags) \
+	imx8m_clk_composite_flags(dev, name, parent_names, \
 		ARRAY_SIZE(parent_names), reg, \
 		flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
 
-#define imx8m_clk_composite(name, parent_names, reg) \
-	__imx8m_clk_composite(name, parent_names, reg, 0)
+#define imx8m_clk_composite(dev, name, parent_names, reg) \
+	__imx8m_clk_composite(dev, name, parent_names, reg, 0)
 
-#define imx8m_clk_composite_critical(name, parent_names, reg) \
-	__imx8m_clk_composite(name, parent_names, reg, CLK_IS_CRITICAL)
+#define imx8m_clk_composite_critical(dev, name, parent_names, reg) \
+	__imx8m_clk_composite(dev, name, parent_names, reg, CLK_IS_CRITICAL)
 
 struct clk *imx93_clk_composite_flags(const char *name,
 				      const char * const *parent_names,
Signature · 1 line
2.47.2
#23 lore raw

PATCH v2 16/24 clk: imx: Convert clock-osc-* back to osc_*

In reply to Marek Vasut

Convert clock-osc-24m back to osc_24m and clock-osc-32k back to osc_32k. These are the clock which match clock tables in Linux. This is now possible because the clock drivers now resolve clock names based on clock-names DT property in the CCM DT node.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-imx8mm.c | 60 ++++++++++++-------------
 drivers/clk/imx/clk-imx8mn.c | 56 +++++++++++------------
 drivers/clk/imx/clk-imx8mp.c | 86 ++++++++++++++++++------------------
 3 files changed, 101 insertions(+), 101 deletions(-)
drivers/clk/imx/clk-imx8mm.c +30 -30
index c9d6954ac75..07e0f6da33e 100644
@@ -14,7 +14,7 @@
 
 #include "clk.h"
 
-static const char * const pll_ref_sels[] = { "clock-osc-24m", "dummy", "dummy", "dummy", };
+static const char * const pll_ref_sels[] = { "osc_24m", "dummy", "dummy", "dummy", };
 static const char * const dram_pll_bypass_sels[] = {"dram_pll", "dram_pll_ref_sel", };
 static const char * const arm_pll_bypass_sels[] = {"arm_pll", "arm_pll_ref_sel", };
 static const char * const sys_pll1_bypass_sels[] = {"sys_pll1", "sys_pll1_ref_sel", };
@@ -23,61 +23,61 @@ static const char * const sys_pll3_bypass_sels[] = {"sys_pll3", "sys_pll3_ref_se
 
 static const char * const imx8mm_arm_core_sels[] = {"arm_a53_src", "arm_pll_out", };
 
-static const char * const imx8mm_a53_sels[] = {"clock-osc-24m", "arm_pll_out", "sys_pll2_500m",
+static const char * const imx8mm_a53_sels[] = {"osc_24m", "arm_pll_out", "sys_pll2_500m",
 					       "sys_pll2_1000m", "sys_pll1_800m", "sys_pll1_400m",
 					       "audio_pll1_out", "sys_pll3_out", };
 
-static const char * const imx8mm_ahb_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_800m",
+static const char * const imx8mm_ahb_sels[] = {"osc_24m", "sys_pll1_133m", "sys_pll1_800m",
 					       "sys_pll1_400m", "sys_pll2_125m", "sys_pll3_out",
 					       "audio_pll1_out", "video_pll1_out", };
 
 #ifndef CONFIG_XPL_BUILD
-static const char * const imx8mm_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m",
+static const char * const imx8mm_enet_axi_sels[] = {"osc_24m", "sys_pll1_266m", "sys_pll1_800m",
 						    "sys_pll2_250m", "sys_pll2_200m", "audio_pll1_out",
 						    "video_pll1_out", "sys_pll3_out", };
 
-static const char * const imx8mm_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m",
+static const char * const imx8mm_enet_ref_sels[] = {"osc_24m", "sys_pll2_125m", "sys_pll2_50m",
 						    "sys_pll2_100m", "sys_pll1_160m", "audio_pll1_out",
 						    "video_pll1_out", "clk_ext4", };
 
-static const char * const imx8mm_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out",
+static const char * const imx8mm_enet_timer_sels[] = {"osc_24m", "sys_pll2_100m", "audio_pll1_out",
 						      "clk_ext1", "clk_ext2", "clk_ext3",
 						      "clk_ext4", "video_pll1_out", };
 
-static const char * const imx8mm_enet_phy_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m",
+static const char * const imx8mm_enet_phy_sels[] = {"osc_24m", "sys_pll2_50m", "sys_pll2_125m",
 						    "sys_pll2_200m", "sys_pll2_500m", "video_pll1_out",
 						    "audio_pll2_out", };
 #endif
 
-static const char * const imx8mm_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m",
+static const char * const imx8mm_nand_usdhc_sels[] = {"osc_24m", "sys_pll1_266m", "sys_pll1_800m",
 						      "sys_pll2_200m", "sys_pll1_133m", "sys_pll3_out",
 						      "sys_pll2_250m", "audio_pll1_out", };
 
-static const char * const imx8mm_usb_bus_sels[] = {"clock-osc-24m", "sys_pll2_500m", "sys_pll1_800m",
+static const char * const imx8mm_usb_bus_sels[] = {"osc_24m", "sys_pll2_500m", "sys_pll1_800m",
 						   "sys_pll2_100m", "sys_pll2_200m", "clk_ext2",
 						   "clk_ext4", "audio_pll2_out", };
 
-static const char * const imx8mm_usdhc1_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m",
+static const char * const imx8mm_usdhc1_sels[] = {"osc_24m", "sys_pll1_400m", "sys_pll1_800m",
 						  "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m",
 						  "audio_pll2_out", "sys_pll1_100m", };
 
-static const char * const imx8mm_usdhc2_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m",
+static const char * const imx8mm_usdhc2_sels[] = {"osc_24m", "sys_pll1_400m", "sys_pll1_800m",
 						  "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m",
 						  "audio_pll2_out", "sys_pll1_100m", };
 
-static const char * const imx8mm_i2c1_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m",
+static const char * const imx8mm_i2c1_sels[] = {"osc_24m", "sys_pll1_160m", "sys_pll2_50m",
 						"sys_pll3_out", "audio_pll1_out", "video_pll1_out",
 						"audio_pll2_out", "sys_pll1_133m", };
 
-static const char * const imx8mm_i2c2_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m",
+static const char * const imx8mm_i2c2_sels[] = {"osc_24m", "sys_pll1_160m", "sys_pll2_50m",
 						"sys_pll3_out", "audio_pll1_out", "video_pll1_out",
 						"audio_pll2_out", "sys_pll1_133m", };
 
-static const char * const imx8mm_i2c3_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m",
+static const char * const imx8mm_i2c3_sels[] = {"osc_24m", "sys_pll1_160m", "sys_pll2_50m",
 						"sys_pll3_out", "audio_pll1_out", "video_pll1_out",
 						"audio_pll2_out", "sys_pll1_133m", };
 
-static const char * const imx8mm_i2c4_sels[] = {"clock-osc-24m", "sys_pll1_160m", "sys_pll2_50m",
+static const char * const imx8mm_i2c4_sels[] = {"osc_24m", "sys_pll1_160m", "sys_pll2_50m",
 						"sys_pll3_out", "audio_pll1_out", "video_pll1_out",
 						"audio_pll2_out", "sys_pll1_133m", };
 
@@ -98,69 +98,69 @@ static const char * const imx8mm_uart4_sels[] = {"clock-osc-24m", "sys_pll1_80m"
 					  "audio_pll2_out", };
 
 #if CONFIG_IS_ENABLED(PCIE_DW_IMX)
-static const char * const imx8mm_pcie1_ctrl_sels[] = {"clock-osc-24m", "sys_pll2_250m", "sys_pll2_200m",
+static const char * const imx8mm_pcie1_ctrl_sels[] = {"osc_24m", "sys_pll2_250m", "sys_pll2_200m",
 						      "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_500m",
 						      "sys_pll2_333m", "sys_pll3_out", };
 
-static const char * const imx8mm_pcie1_phy_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll2_500m",
+static const char * const imx8mm_pcie1_phy_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll2_500m",
 						     "clk_ext1", "clk_ext2", "clk_ext3",
 						     "clk_ext4", "sys_pll1_400m", };
 
-static const char * const imx8mm_pcie1_aux_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll2_50m",
+static const char * const imx8mm_pcie1_aux_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll2_50m",
 						     "sys_pll3_out", "sys_pll2_100m", "sys_pll1_80m",
 						     "sys_pll1_160m", "sys_pll1_200m", };
 #endif
 
 #ifndef CONFIG_XPL_BUILD
-static const char * const imx8mm_pwm1_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m",
+static const char * const imx8mm_pwm1_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll1_160m",
 						"sys_pll1_40m", "sys_pll3_out", "clk_ext1",
 						"sys_pll1_80m", "video_pll1_out", };
 
-static const char * const imx8mm_pwm2_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m",
+static const char * const imx8mm_pwm2_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll1_160m",
 						"sys_pll1_40m", "sys_pll3_out", "clk_ext1",
 						"sys_pll1_80m", "video_pll1_out", };
 
-static const char * const imx8mm_pwm3_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m",
+static const char * const imx8mm_pwm3_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll1_160m",
 						"sys_pll1_40m", "sys_pll3_out", "clk_ext2",
 						"sys_pll1_80m", "video_pll1_out", };
 
-static const char * const imx8mm_pwm4_sels[] = {"clock-osc-24m", "sys_pll2_100m", "sys_pll1_160m",
+static const char * const imx8mm_pwm4_sels[] = {"osc_24m", "sys_pll2_100m", "sys_pll1_160m",
 						"sys_pll1_40m", "sys_pll3_out", "clk_ext2",
 						"sys_pll1_80m", "video_pll1_out", };
 #endif
 
-static const char * const imx8mm_wdog_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_pll1_160m",
+static const char * const imx8mm_wdog_sels[] = {"osc_24m", "sys_pll1_133m", "sys_pll1_160m",
 						"vpu_pll_out", "sys_pll2_125m", "sys_pll3_out",
 						"sys_pll1_80m", "sys_pll2_166m", };
 
-static const char * const imx8mm_usdhc3_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll1_800m",
+static const char * const imx8mm_usdhc3_sels[] = {"osc_24m", "sys_pll1_400m", "sys_pll1_800m",
 						  "sys_pll2_500m", "sys_pll3_out", "sys_pll1_266m",
 						  "audio_pll2_clk", "sys_pll1_100m", };
 
 #if CONFIG_IS_ENABLED(NXP_FSPI)
-static const char * const imx8mm_qspi_sels[] = {"clock-osc-24m", "sys_pll1_400m", "sys_pll2_333m",
+static const char * const imx8mm_qspi_sels[] = {"osc_24m", "sys_pll1_400m", "sys_pll2_333m",
 						"sys_pll2_500m", "audio_pll2_out", "sys_pll1_266m",
 						"sys_pll3_out", "sys_pll1_100m", };
 #endif
 
-static const char * const imx8mm_usb_core_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m",
+static const char * const imx8mm_usb_core_sels[] = {"osc_24m", "sys_pll1_100m", "sys_pll1_40m",
 						    "sys_pll2_100m", "sys_pll2_200m", "clk_ext2",
 						    "clk_ext3", "audio_pll2_out", };
 
-static const char * const imx8mm_usb_phy_sels[] = {"clock-osc-24m", "sys_pll1_100m", "sys_pll1_40m",
+static const char * const imx8mm_usb_phy_sels[] = {"osc_24m", "sys_pll1_100m", "sys_pll1_40m",
 						   "sys_pll2_100m", "sys_pll2_200m", "clk_ext2",
 						   "clk_ext3", "audio_pll2_out", };
 
 #if CONFIG_IS_ENABLED(DM_SPI)
-static const char * const imx8mm_ecspi1_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m",
+static const char * const imx8mm_ecspi1_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m",
 						  "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out",
 						  "sys_pll2_250m", "audio_pll2_out", };
 
-static const char * const imx8mm_ecspi2_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m",
+static const char * const imx8mm_ecspi2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m",
 						  "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out",
 						  "sys_pll2_250m", "audio_pll2_out", };
 
-static const char * const imx8mm_ecspi3_sels[] = {"clock-osc-24m", "sys_pll2_200m", "sys_pll1_40m",
+static const char * const imx8mm_ecspi3_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_40m",
 						  "sys_pll1_160m", "sys_pll1_800m", "sys_pll3_out",
 						  "sys_pll2_250m", "audio_pll2_out", };
 #endif
drivers/clk/imx/clk-imx8mn.c +28 -28

154 lines not on this page · raw message

drivers/clk/imx/clk-imx8mp.c +43 -43

224 lines not on this page · raw message

Signature · 1 line
2.47.2
#24 lore raw

[REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Hello Marex, Fabio, all

Quoted 6 lines · Marek Vasut

Convert clock-osc-24m back to osc_24m and clock-osc-32k back to osc_32k. These are the clock which match clock tables in Linux. This is now possible because the clock drivers now resolve clock names based on clock-names DT property in the CCM DT node.

Current USB fastboot functionality from U-Boot proper in master is broken on Verdin iMX8M Plus since commit b4734c9c333b ("clk: imx: Convert clock-osc-* back to osc_*"). Other i.MX SoCs might be affected, I have not looked into every detail.

Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000
No USB device found
USB init failed: -19

Reverting this commit on top of master is not trivial (there are conflicts, and I have not looked into the details).

Full log for reference

U-Boot SPL 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200) Training FAILED
DDR configured as single rank
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout)
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: USB boot
Find img info 0x4802ec00, size 1116
Need continue download 1024

  NOTICE:  Do not release JR0 to NS as it can be used by HAB
  NOTICE:  BL31: v2.12.0(release):v2.12.0-946-g4d913df8f85e
  NOTICE:  BL31: Built : 13:19:07, Apr 15 2025

U-Boot 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200)

CPU: Freescale i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 56C
Reset cause: POR

  DRAM:  4 GiB
  Core:  309 devices, 31 uclasses, devicetree: separate
  WDT:   Started watchdog@30280000 with servicing every 1000ms (60s timeout)
  MMC:   FSL_SDHC: 1, FSL_SDHC: 2
  Loading Environment from nowhere... OK
  In:    serial@30880000
  Out:   serial@30880000
  Err:   serial@30880000

Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.0B Serial#: 06849144
Carrier: Toradex Dahlia V1.1A, Serial# 10763256
SEC0: RNG instantiated
Setting variant to wifi
Net: pca953x gpio-expander@21: Error reading output register
eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME] Hit any key to stop autoboot: 0
Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000
No USB device found
USB init failed: -19
Verdin iMX8MP #

Any suggestion?
Francesco

#25 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 56 lines · Francesco Dolcini

Hello Marex, Fabio, all

Quoted 6 lines · Marek Vasut

Convert clock-osc-24m back to osc_24m and clock-osc-32k back to osc_32k. These are the clock which match clock tables in Linux. This is now possible because the clock drivers now resolve clock names based on clock-names DT property in the CCM DT node.

Current USB fastboot functionality from U-Boot proper in master is broken on Verdin iMX8M Plus since commit b4734c9c333b ("clk: imx: Convert clock-osc-* back to osc_*"). Other i.MX SoCs might be affected, I have not looked into every detail.

Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000
No USB device found
USB init failed: -19

Reverting this commit on top of master is not trivial (there are conflicts, and I have not looked into the details).

Full log for reference

U-Boot SPL 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200) Training FAILED
DDR configured as single rank
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout)
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: USB boot
Find img info 0x4802ec00, size 1116
Need continue download 1024

  NOTICE:  Do not release JR0 to NS as it can be used by HAB
  NOTICE:  BL31: v2.12.0(release):v2.12.0-946-g4d913df8f85e
  NOTICE:  BL31: Built : 13:19:07, Apr 15 2025

U-Boot 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200)

CPU: Freescale i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 56C
Reset cause: POR

  DRAM:  4 GiB
  Core:  309 devices, 31 uclasses, devicetree: separate
  WDT:   Started watchdog@30280000 with servicing every 1000ms (60s timeout)
  MMC:   FSL_SDHC: 1, FSL_SDHC: 2
  Loading Environment from nowhere... OK
  In:    serial@30880000
  Out:   serial@30880000
  Err:   serial@30880000
Quoted 12 lines

Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.0B Serial#: 06849144
Carrier: Toradex Dahlia V1.1A, Serial# 10763256
SEC0: RNG instantiated
Setting variant to wifi
Net: pca953x gpio-expander@21: Error reading output register
eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME] Hit any key to stop autoboot: 0
Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000

When running my 8M Plus in Host mode, I got similar "Failed to get PHY0 for usb" failures, but I hadn't yet bisected it. The PHY itself doesn't appear to have a clock reference itself, but it does reference a power-domain which uses multiple clocks. I wonder if one of the
clocks in the hsio power domain isn't registering properly. I won't
be near my 8MP until much later tonight, but can you run 'dm tree' to see what clocks are enumerated and which might be missing?

adam

Quoted 7 lines

No USB device found
USB init failed: -19
Verdin iMX8MP #

Any suggestion?
Francesco

#26 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 70 lines · Adam Ford
Quoted 56 lines · Francesco Dolcini

Hello Marex, Fabio, all

Quoted 6 lines · Marek Vasut

Convert clock-osc-24m back to osc_24m and clock-osc-32k back to osc_32k. These are the clock which match clock tables in Linux. This is now possible because the clock drivers now resolve clock names based on clock-names DT property in the CCM DT node.

Current USB fastboot functionality from U-Boot proper in master is broken on Verdin iMX8M Plus since commit b4734c9c333b ("clk: imx: Convert clock-osc-* back to osc_*"). Other i.MX SoCs might be affected, I have not looked into every detail.

Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000
No USB device found
USB init failed: -19

Reverting this commit on top of master is not trivial (there are conflicts, and I have not looked into the details).

Full log for reference

U-Boot SPL 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200) Training FAILED
DDR configured as single rank
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout)
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: USB boot
Find img info 0x4802ec00, size 1116
Need continue download 1024

  NOTICE:  Do not release JR0 to NS as it can be used by HAB
  NOTICE:  BL31: v2.12.0(release):v2.12.0-946-g4d913df8f85e
  NOTICE:  BL31: Built : 13:19:07, Apr 15 2025

U-Boot 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200)

CPU: Freescale i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 56C
Reset cause: POR

  DRAM:  4 GiB
  Core:  309 devices, 31 uclasses, devicetree: separate
  WDT:   Started watchdog@30280000 with servicing every 1000ms (60s timeout)
  MMC:   FSL_SDHC: 1, FSL_SDHC: 2
  Loading Environment from nowhere... OK
  In:    serial@30880000
  Out:   serial@30880000
  Err:   serial@30880000
Quoted 12 lines

Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.0B Serial#: 06849144
Carrier: Toradex Dahlia V1.1A, Serial# 10763256
SEC0: RNG instantiated
Setting variant to wifi
Net: pca953x gpio-expander@21: Error reading output register
eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME] Hit any key to stop autoboot: 0
Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000

Quoted 7 lines

When running my 8M Plus in Host mode, I got similar "Failed to get PHY0 for usb" failures, but I hadn't yet bisected it. The PHY itself doesn't appear to have a clock reference itself, but it does reference a power-domain which uses multiple clocks. I wonder if one of the
clocks in the hsio power domain isn't registering properly. I won't
be near my 8MP until much later tonight, but can you run 'dm tree' to see what clocks are enumerated and which might be missing?

Here the logs,
https://gist.github.com/dolcini/035ede9e94026c8f7f34e64ee07e124b

commit bcb141d11428 ("clk: imx: Pass struct udevice into imx_clk_composite*()") is the last good, commit b4734c9c333b ("clk: imx:
Convert clock-osc-* back to osc_*") is the first bad.

Francesco

#27 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 79 lines · Francesco Dolcini
Quoted 70 lines · Adam Ford
Quoted 56 lines · Francesco Dolcini

Hello Marex, Fabio, all

Quoted 6 lines · Marek Vasut

Convert clock-osc-24m back to osc_24m and clock-osc-32k back to osc_32k. These are the clock which match clock tables in Linux. This is now possible because the clock drivers now resolve clock names based on clock-names DT property in the CCM DT node.

Current USB fastboot functionality from U-Boot proper in master is broken on Verdin iMX8M Plus since commit b4734c9c333b ("clk: imx: Convert clock-osc-* back to osc_*"). Other i.MX SoCs might be affected, I have not looked into every detail.

Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000
No USB device found
USB init failed: -19

Reverting this commit on top of master is not trivial (there are conflicts, and I have not looked into the details).

Full log for reference

U-Boot SPL 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200) Training FAILED
DDR configured as single rank
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout)
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: USB boot
Find img info 0x4802ec00, size 1116
Need continue download 1024

   NOTICE:  Do not release JR0 to NS as it can be used by HAB
   NOTICE:  BL31: v2.12.0(release):v2.12.0-946-g4d913df8f85e
   NOTICE:  BL31: Built : 13:19:07, Apr 15 2025

U-Boot 2025.04-rc4-00537-gb4734c9c333b (Apr 15 2025 - 16:14:09 +0200)

CPU: Freescale i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 56C
Reset cause: POR

   DRAM:  4 GiB
   Core:  309 devices, 31 uclasses, devicetree: separate
   WDT:   Started watchdog@30280000 with servicing every 1000ms (60s timeout)
   MMC:   FSL_SDHC: 1, FSL_SDHC: 2
   Loading Environment from nowhere... OK
   In:    serial@30880000
   Out:   serial@30880000
   Err:   serial@30880000
Quoted 12 lines

Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.0B Serial#: 06849144
Carrier: Toradex Dahlia V1.1A, Serial# 10763256
SEC0: RNG instantiated
Setting variant to wifi
Net: pca953x gpio-expander@21: Error reading output register
eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME] Hit any key to stop autoboot: 0
Could not fetch index
Failed to get PHY0 for usb@38100000
Could not fetch index
Failed to get PHY0 for usb@38100000

Quoted 7 lines

When running my 8M Plus in Host mode, I got similar "Failed to get PHY0 for usb" failures, but I hadn't yet bisected it. The PHY itself doesn't appear to have a clock reference itself, but it does reference a power-domain which uses multiple clocks. I wonder if one of the
clocks in the hsio power domain isn't registering properly. I won't
be near my 8MP until much later tonight, but can you run 'dm tree' to see what clocks are enumerated and which might be missing?

Quoted 6 lines

Here the logs,
https://gist.github.com/dolcini/035ede9e94026c8f7f34e64ee07e124b

commit bcb141d11428 ("clk: imx: Pass struct udevice into imx_clk_composite*()") is the last good, commit b4734c9c333b ("clk: imx:
Convert clock-osc-* back to osc_*") is the first bad.

Do you have af9cdd1ccd2d ("Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs"") in place ? If so, try and revert it, does it help ?

reviewer
#28 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 3 lines · Marek Vasut

Do you have af9cdd1ccd2d ("Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs"") in place ? If so, try and revert it, does it help ?

It seems I have not pushed the "Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs" fix. Sorry about that.

As Francesco is using imx8mp, then I guess we also need to do the same for imx8mp:

arch/arm/dts/imx8mn-u-boot.dtsi +0 -5
index 96a6df94c6cf..6cc910ee9835 100644
@@ -68,11 +68,6 @@
        bootph-all;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 #ifdef CONFIG_FSL_CAAM
 &sec_jr0 {
        bootph-pre-ram;
arch/arm/dts/imx8mp-u-boot.dtsi +0 -5
index 6de9ab5d37cf..35af412f01b0 100644
@@ -37,11 +37,6 @@
        /delete-property/ assigned-clock-rates;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 &osc_24m {
        bootph-pre-ram;
        bootph-all;

Does this fix the boot problem?

#29 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Marek Vasut

Do you have af9cdd1ccd2d ("Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs"") in place ? If so, try and revert it, does it help ?

It seems I have not pushed the "Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs" fix. Sorry about that.

On my Nano, if I revert arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs" it does not boot any more.

I haven't tried on my Mini and Plus yet, but if you want, I can.

adam

Quoted 38 lines

As Francesco is using imx8mp, then I guess we also need to do the same for imx8mp:

arch/arm/dts/imx8mn-u-boot.dtsi +0 -5
index 96a6df94c6cf..6cc910ee9835 100644
@@ -68,11 +68,6 @@
        bootph-all;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 #ifdef CONFIG_FSL_CAAM
 &sec_jr0 {
        bootph-pre-ram;
arch/arm/dts/imx8mp-u-boot.dtsi +0 -5
index 6de9ab5d37cf..35af412f01b0 100644
@@ -37,11 +37,6 @@
        /delete-property/ assigned-clock-rates;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 &osc_24m {
        bootph-pre-ram;
        bootph-all;

Does this fix the boot problem?

#30 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

In reply to Fabio Estevam
Quoted 28 lines · Fabio Estevam
Quoted 3 lines · Marek Vasut

Do you have af9cdd1ccd2d ("Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs"") in place ? If so, try and revert it, does it help ?

It seems I have not pushed the "Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs" fix. Sorry about that.

As Francesco is using imx8mp, then I guess we also need to do the same for imx8mp:

arch/arm/dts/imx8mp-u-boot.dtsi +0 -5
index 6de9ab5d37cf..35af412f01b0 100644
@@ -37,11 +37,6 @@
        /delete-property/ assigned-clock-rates;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 &osc_24m {
        bootph-pre-ram;
        bootph-all;
Quoted 1 line

Does this fix the boot problem?

My issue is not the boot. The issue is that USB is not working.

With this patch applied nothing changes, the issue is not solved.

Francesco

#31 lore raw

RE: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

From: Francesco Dolcini <[email protected]>
Sent: Wednesday, April 16, 2025 11:27 AM

Quoted 29 lines · Fabio Estevam
Quoted 28 lines · Marek Vasut
Quoted 3 lines

Do you have af9cdd1ccd2d ("Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs"") in place ? If so, try and revert it, does it help ?

It seems I have not pushed the "Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs" fix. Sorry about that.

As Francesco is using imx8mp, then I guess we also need to do the same for imx8mp:

arch/arm/dts/imx8mp-u-boot.dtsi +0 -5
index 6de9ab5d37cf..35af412f01b0 100644
@@ -37,11 +37,6 @@
        /delete-property/ assigned-clock-rates;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 &osc_24m {
        bootph-pre-ram;
        bootph-all;
Quoted 7 lines
Quoted 1 line

Does this fix the boot problem?

My issue is not the boot. The issue is that USB is not working.

With this patch applied nothing changes, the issue is not solved.

Francesco

Hello,

I don't know if it is related or not, I noticed that Adam Ford's patches commit 6d33ca36e3b ("clk: imx8mm: register UART clocks") and commit 8999b76f238 ("clk: imx8mn: register UART clocks")
use the former name "clock-osc-24m". But Marek's patch commit b4734c9c333 ("clk: imx: Convert clock-osc-* back to osc_*") converted clock-osc-* to osc_*. So I think the UART clocks should also use the current name osc_*.

Regards
Christoph

#32 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 42 lines · Christoph Niedermaier

From: Francesco Dolcini <[email protected]>
Sent: Wednesday, April 16, 2025 11:27 AM

Quoted 29 lines · Fabio Estevam
Quoted 28 lines · Marek Vasut
Quoted 3 lines

Do you have af9cdd1ccd2d ("Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs"") in place ? If so, try and revert it, does it help ?

It seems I have not pushed the "Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs" fix. Sorry about that.

As Francesco is using imx8mp, then I guess we also need to do the same for imx8mp:

arch/arm/dts/imx8mp-u-boot.dtsi +0 -5
index 6de9ab5d37cf..35af412f01b0 100644
@@ -37,11 +37,6 @@
        /delete-property/ assigned-clock-rates;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 &osc_24m {
        bootph-pre-ram;
        bootph-all;
Quoted 7 lines
Quoted 1 line

Does this fix the boot problem?

My issue is not the boot. The issue is that USB is not working.

With this patch applied nothing changes, the issue is not solved.

Francesco

Hello,

Quoted 7 lines

I don't know if it is related or not, I noticed that Adam Ford's patches commit 6d33ca36e3b ("clk: imx8mm: register UART clocks") and commit 8999b76f238 ("clk: imx8mn: register UART clocks")
use the former name "clock-osc-24m". But Marek's patch commit b4734c9c333 ("clk: imx: Convert clock-osc-* back to osc_*") converted clock-osc-* to osc_*. So I think the UART clocks should also use the current name osc_*.

I sent a fix for that, but back to the subject at hand.

I added some debug code to the clk driver to see which clock is failing:

u-boot=> usb start
starting USB...
Bus usb@38200000: clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll2_500m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
500000000 reg: 0000000030388380 clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll1_800m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
800000000 reg: 0000000030388380 clk_mux_fetch_parent_index usb_phy_ref clk_mux_fetch_parent_index (parent) clock-osc-24m Could not fetch index
Failed to get PHY0 for usb@38200000
Port not available.
u-boot=>

When I change the name back to "clock-osc-24m" in imx8mp_usb_phy_ref_sels, the functionality returns.

u-boot=> usb start
starting USB...
Bus usb@38200000: clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll2_500m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
500000000 reg: 0000000030388380
clk_mux_fetch_parent_index hsio_axi
clk_mux_fetch_parent_index (parent) sys_pll1_800m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
800000000 reg: 0000000030388380
clk_mux_fetch_parent_index usb_phy_ref clk_mux_fetch_parent_index (parent) clock-osc-24m
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@38200000 for devices... clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll1_800m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
800000000 reg: 0000000030388380
4 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
u-boot=>

DM tree

Show the parent of usb_phy_ref is "clock-osc-24m"

u-boot=> dm tree
Class Seq Probed Driver Name
-----------------------------------------------------------

 root          0  [ + ]   root_driver           root_driver
 clk           0  [ + ]   fixed_clock           |-- clock-osc-32k
 clk           1  [ + ]   fixed_clock           |-- clock-osc-24m
 clk          11  [ + ]   ccf_clk_mux           |   |-- dram_pll_ref_sel
 clk          16  [ + ]   imx_clk_pll1443x      |   |   `-- dram_pll
 clk          21  [ + ]   ccf_clk_mux           |   |       `-- dram_pll_bypass
 clk          26  [ + ]   clk_gate              |   |           `-- dram_pll_out
 clk          94  [ + ]   ccf_clk_mux           |   |

`-- dram_core_clk
clk 95 [ ] imx_clk_gate2 | |
`-- dram1_root_clk
<snip>

 clk         126  [   ]   imx_clk_gate2         |   |-- usb_suspend_clk
 clk          82  [ + ]   clk_composite         |   `-- usb_phy_ref
 clk         127  [   ]   imx_clk_gate2         |       `-- usb_phy_root_clk

The device tree node lists the 24m clock as:

osc_24m: clock-osc-24m

So it seems to me, we need to somehow address the translation from clock-osc-24m back to osc_24m.

adam

Quoted 3 lines

Regards
Christoph

#33 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 123 lines · Adam Ford
Quoted 42 lines · Christoph Niedermaier

From: Francesco Dolcini <[email protected]>
Sent: Wednesday, April 16, 2025 11:27 AM

Quoted 29 lines · Fabio Estevam
Quoted 28 lines · Marek Vasut
Quoted 3 lines

Do you have af9cdd1ccd2d ("Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs"") in place ? If so, try and revert it, does it help ?

It seems I have not pushed the "Revert "arm64: dts: imx8mn: Include 32kHz oscillator clock in SPL DTs" fix. Sorry about that.

As Francesco is using imx8mp, then I guess we also need to do the same for imx8mp:

arch/arm/dts/imx8mp-u-boot.dtsi +0 -5
index 6de9ab5d37cf..35af412f01b0 100644
@@ -37,11 +37,6 @@
        /delete-property/ assigned-clock-rates;
 };
 
-&osc_32k {
-       bootph-pre-ram;
-       bootph-all;
-};
-
 &osc_24m {
        bootph-pre-ram;
        bootph-all;
Quoted 7 lines
Quoted 1 line

Does this fix the boot problem?

My issue is not the boot. The issue is that USB is not working.

With this patch applied nothing changes, the issue is not solved.

Francesco

Hello,

Quoted 7 lines

I don't know if it is related or not, I noticed that Adam Ford's patches commit 6d33ca36e3b ("clk: imx8mm: register UART clocks") and commit 8999b76f238 ("clk: imx8mn: register UART clocks")
use the former name "clock-osc-24m". But Marek's patch commit b4734c9c333 ("clk: imx: Convert clock-osc-* back to osc_*") converted clock-osc-* to osc_*. So I think the UART clocks should also use the current name osc_*.

I sent a fix for that, but back to the subject at hand.

I added some debug code to the clk driver to see which clock is failing:

u-boot=> usb start
starting USB...
Bus usb@38200000: clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll2_500m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
500000000 reg: 0000000030388380 clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll1_800m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
800000000 reg: 0000000030388380 clk_mux_fetch_parent_index usb_phy_ref clk_mux_fetch_parent_index (parent) clock-osc-24m Could not fetch index
Failed to get PHY0 for usb@38200000
Port not available.
u-boot=>

When I change the name back to "clock-osc-24m" in imx8mp_usb_phy_ref_sels, the functionality returns.

u-boot=> usb start
starting USB...
Bus usb@38200000: clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll2_500m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
500000000 reg: 0000000030388380
clk_mux_fetch_parent_index hsio_axi
clk_mux_fetch_parent_index (parent) sys_pll1_800m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
800000000 reg: 0000000030388380
clk_mux_fetch_parent_index usb_phy_ref clk_mux_fetch_parent_index (parent) clock-osc-24m
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@38200000 for devices... clk_mux_fetch_parent_index hsio_axi clk_mux_fetch_parent_index (parent) sys_pll1_800m imx8m_clk_composite_divider_recalc_rate: name hsio_axi prate:
800000000 reg: 0000000030388380
4 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
u-boot=>

DM tree

Show the parent of usb_phy_ref is "clock-osc-24m"

u-boot=> dm tree
Class Seq Probed Driver Name
-----------------------------------------------------------

 root          0  [ + ]   root_driver           root_driver
 clk           0  [ + ]   fixed_clock           |-- clock-osc-32k
 clk           1  [ + ]   fixed_clock           |-- clock-osc-24m
 clk          11  [ + ]   ccf_clk_mux           |   |-- dram_pll_ref_sel
 clk          16  [ + ]   imx_clk_pll1443x      |   |   `-- dram_pll
 clk          21  [ + ]   ccf_clk_mux           |   |       `-- dram_pll_bypass
 clk          26  [ + ]   clk_gate              |   |           `-- dram_pll_out
 clk          94  [ + ]   ccf_clk_mux           |   |

`-- dram_core_clk
clk 95 [ ] imx_clk_gate2 | |
`-- dram1_root_clk
<snip>

 clk         126  [   ]   imx_clk_gate2         |   |-- usb_suspend_clk
 clk          82  [ + ]   clk_composite         |   `-- usb_phy_ref
 clk         127  [   ]   imx_clk_gate2         |       `-- usb_phy_root_clk
Quoted 6 lines

The device tree node lists the 24m clock as:

osc_24m: clock-osc-24m

So it seems to me, we need to somehow address the translation from clock-osc-24m back to osc_24m.

From what I can tell, the name of the clock is osc_24m as defined by clock-output-names in the node, but we are not looking at that entry. There is a function, dev_read_string_index, which appears to let us look for the that string, and it returns so we can sort through the list. Adding some debug code, a few other functions look for the index, and they appear to be returning valid numbers, and the match for osc_24m returns an index of 0 which appear correct.

With the following patch, the 'usb start' command now works for me, so I would expect the usb peripheral mode would too.

adam

Can you try the following patch and see if it works?

drivers/clk/clk-mux.c +2 -1
index d7411f8f282..de669164939 100644
@@ -31,6 +31,7 @@
 #include <dm/device.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <dm/read.h>
 #include <dm/uclass.h>
 #include <linux/bitops.h>
 #include <linux/clk-provider.h>
@@ -104,7 +105,7 @@ u8 clk_mux_get_parent(struct clk *clk)
 int clk_mux_fetch_parent_index(struct clk *clk, struct clk *parent)
 {
        struct clk_mux *mux = to_clk_mux(clk);
-
+       const char *name;
        int i;
 
        if (!parent)
@@ -113,6 +114,9 @@ int clk_mux_fetch_parent_index(struct clk *clk,

struct clk *parent)

        for (i = 0; i < mux->num_parents; i++) {
                if (!strcmp(parent->dev->name, mux->parent_names[i]))
                        return i;
+               dev_read_string_index(parent->dev,
"clock-output-names", i, &name);
+               if (!strcmp(name, mux->parent_names[i]))
+                       return i;
                if (!strcmp(parent->dev->name,
                            clk_resolve_parent_clk(clk->dev,
                                                   mux->parent_names[i])))
Quoted 7 lines

adam

Quoted 3 lines

Regards
Christoph

#34 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

On 4/17/25 1:35 AM, Adam Ford wrote:

[...]

Review int clk_mux_fetch_parent_index(struct clk *clk, · line 119

Quoted 8 lines

if (!parent)

(quoted diff) +1 -0
@@ -113,6 +114,9 @@ int clk_mux_fetch_parent_index(struct clk *clk,
 struct clk *parent)
         for (i = 0; i < mux->num_parents; i++) {
                 if (!strcmp(parent->dev->name, mux->parent_names[i]))
                         return i;
+               dev_read_string_index(parent->dev,
 "clock-output-names", i, &name);

You are not supposed to use "clock-output-names" for clock look up.
You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

Quoted 5 lines
(quoted diff) +2 -0
+               if (!strcmp(name, mux->parent_names[i]))
+                       return i;
                 if (!strcmp(parent->dev->name,
                             clk_resolve_parent_clk(clk->dev,
                                                    mux->parent_names[i])))

clk_resolve_parent_clk() is meant to look up the clocks in local DT node "clock-names" property by name, and based on that, figure out which phandle to use in local DT node "clocks" property to access those clock:

For example, in dts/upstream/src/arm64/freescale/imx8mp.dtsi

745 clk: clock-controller@30380000 {

 746         compatible = "fsl,imx8mp-ccm";
 747         reg = <0x30380000 0x10000>;
 748         interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>,
 749                      <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
 750         #clock-cells = <1>;
 751         clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>, <&clk_ext2>,
                                   ^^^^^^^^
 752                  <&clk_ext3>, <&clk_ext4>;
 753         clock-names = "osc_32k", "osc_24m", "clk_ext1", "clk_ext2",
                                       ^^^^^^^
                This "osc_24m" is also the same osc_24m referenced in
                drivers/clk/imx/clk-imx8mp.c imx8mp_a53_sels[] and co.

Is then resolved to these clock:

188 osc_24m: clock-osc-24m {

 189                 compatible = "fixed-clock";
 190                 #clock-cells = <0>;
 191                 clock-frequency = <24000000>;
 192                 clock-output-names = "osc_24m";
                                           ^^^^^^^ Ignore this

193 };

reviewer
#35 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 3 lines · Marek Vasut

You are not supposed to use "clock-output-names" for clock look up. You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

What do you think about registering the osc clocks like this?

https://paste.debian.net/1369857/

reviewer
#36 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 3 lines · Fabio Estevam

What do you think about registering the osc clocks like this?

https://paste.debian.net/1369857/

With this patch, "ums 0 mmc 1" works on the imx8mp-evk.

#37 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

In reply to Fabio Estevam
Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Marek Vasut

You are not supposed to use "clock-output-names" for clock look up. You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

What do you think about registering the osc clocks like this?

https://paste.debian.net/1369857/

It would be good to include the patch inline in this email, not in a link to some paste site which will go away.

This also does not work in case 24 MHz or 32 kHz clock are provided by something else than an xtal , and it will also lead to instantiation of the same clock twice. The clock are already described in DT as fixed-clock , there is fixed clock driver which binds to those clock based on their DT description , the problem here seems to be related to the look up of those 24 MHz or 32 kHz clock, not their (re)registration.

#38 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 15 lines · Marek Vasut
Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Marek Vasut

You are not supposed to use "clock-output-names" for clock look up. You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

What do you think about registering the osc clocks like this?

https://paste.debian.net/1369857/

It would be good to include the patch inline in this email, not in a link to some paste site which will go away.

Quoted 6 lines

This also does not work in case 24 MHz or 32 kHz clock are provided by something else than an xtal , and it will also lead to instantiation of the same clock twice. The clock are already described in DT as fixed-clock , there is fixed clock driver which binds to those clock based on their DT description , the problem here seems to be related to the look up of those 24 MHz or 32 kHz clock, not their (re)registration.

Since that patch changed the lookup of the clock name broke USB on multiple boards, I would like to recommend we revert it until a proper solution is found.

adam

#39 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 24 lines · Adam Ford
Quoted 15 lines · Marek Vasut
Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Marek Vasut

You are not supposed to use "clock-output-names" for clock look up. You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

What do you think about registering the osc clocks like this?

https://paste.debian.net/1369857/

It would be good to include the patch inline in this email, not in a link to some paste site which will go away.

Quoted 6 lines

This also does not work in case 24 MHz or 32 kHz clock are provided by something else than an xtal , and it will also lead to instantiation of the same clock twice. The clock are already described in DT as fixed-clock , there is fixed clock driver which binds to those clock based on their DT description , the problem here seems to be related to the look up of those 24 MHz or 32 kHz clock, not their (re)registration.

Quoted 3 lines

Since that patch changed the lookup of the clock name broke USB on multiple boards, I would like to recommend we revert it until a proper solution is found.

This would also re-introduce the bogus clock-osc-24m look up, which requires workarounds in DT, so no. Let's actually fix this instead of reinstating broken workarounds.

Does clk_resolve_parent_clk() in clk_mux_fetch_parent_index() not resolve the mux index correctly or something ? Do you by any chance have some -u-boot.dtsi modification to the clock-controller@30380000 node which changes clocks/clock-names somehow ? Which mux does not get correctly resolved here ? Is there a simple reproducer ?

#40 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 33 lines · Marek Vasut
Quoted 24 lines · Adam Ford
Quoted 15 lines · Marek Vasut
Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Marek Vasut

You are not supposed to use "clock-output-names" for clock look up. You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

What do you think about registering the osc clocks like this?

https://paste.debian.net/1369857/

It would be good to include the patch inline in this email, not in a link to some paste site which will go away.

Quoted 6 lines

This also does not work in case 24 MHz or 32 kHz clock are provided by something else than an xtal , and it will also lead to instantiation of the same clock twice. The clock are already described in DT as fixed-clock , there is fixed clock driver which binds to those clock based on their DT description , the problem here seems to be related to the look up of those 24 MHz or 32 kHz clock, not their (re)registration.

Quoted 3 lines

Since that patch changed the lookup of the clock name broke USB on multiple boards, I would like to recommend we revert it until a proper solution is found.

This would also re-introduce the bogus clock-osc-24m look up, which requires workarounds in DT, so no. Let's actually fix this instead of reinstating broken workarounds.

Quoted 5 lines

Does clk_resolve_parent_clk() in clk_mux_fetch_parent_index() not resolve the mux index correctly or something ? Do you by any chance have some -u-boot.dtsi modification to the clock-controller@30380000 node which changes clocks/clock-names somehow ? Which mux does not get correctly resolved here ? Is there a simple reproducer ?

I am not modifying my clock-controller node, but I did spend a little time looking at how Linux reviews the parent clock names.

In Linux, of_clk_get_parent_name() will look for 'clock-output-names' and return that value if it's present. If we go with your proposal, I feel like we'd have to traverse to the top of the clock tree to get the CCM's clock associated with osc_24m, and then compare the clock it returns with the clock we want to see if they match.

If we follow the Linux method where we try to fetch the parent clock name and use the name associated with it, we could simplify this. Another possibiltiy, is to change the name of the clock at the of registration to match the name returned from clock-output-names.

adam

#41 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

Quoted 40 lines · Adam Ford
Quoted 33 lines · Marek Vasut
Quoted 24 lines · Adam Ford
Quoted 15 lines · Marek Vasut
Quoted 9 lines · Fabio Estevam
Quoted 3 lines · Marek Vasut

You are not supposed to use "clock-output-names" for clock look up. You are supposed to use "clocks"/"clock-names" DT properties and then resolve the remote clock from information in those.

What do you think about registering the osc clocks like this?

https://paste.debian.net/1369857/

It would be good to include the patch inline in this email, not in a link to some paste site which will go away.

Quoted 6 lines

This also does not work in case 24 MHz or 32 kHz clock are provided by something else than an xtal , and it will also lead to instantiation of the same clock twice. The clock are already described in DT as fixed-clock , there is fixed clock driver which binds to those clock based on their DT description , the problem here seems to be related to the look up of those 24 MHz or 32 kHz clock, not their (re)registration.

Quoted 3 lines

Since that patch changed the lookup of the clock name broke USB on multiple boards, I would like to recommend we revert it until a proper solution is found.

This would also re-introduce the bogus clock-osc-24m look up, which requires workarounds in DT, so no. Let's actually fix this instead of reinstating broken workarounds.

Quoted 5 lines

Does clk_resolve_parent_clk() in clk_mux_fetch_parent_index() not resolve the mux index correctly or something ? Do you by any chance have some -u-boot.dtsi modification to the clock-controller@30380000 node which changes clocks/clock-names somehow ? Which mux does not get correctly resolved here ? Is there a simple reproducer ?

Quoted 4 lines

I am not modifying my clock-controller node, but I did spend a little time looking at how Linux reviews the parent clock names.

In Linux, of_clk_get_parent_name() will look for 'clock-output-names'

This here is not about finding out the clock NAME, this is about resolving the parent clock driver instance .

Quoted 4 lines

and return that value if it's present. If we go with your proposal, I feel like we'd have to traverse to the top of the clock tree to get the CCM's clock associated with osc_24m, and then compare the clock it returns with the clock we want to see if they match.

Have a look at my reply to "[PATCH v2] clk: fixed-rate: Use "clock-output-names" to name fixed clocks" , maybe that clarifies how clock resolution is supposed to work. Clock "NAME" does never enter that resolution, except for mapping of local "clock-names" array offset to "clocks" array offset, the rest uses DT phandles to other clock nodes.

Quoted 2 lines

If we follow the Linux method where we try to fetch the parent clock name and use the name associated with it, we could simplify this.

Linux does NOT use clock names to resolve clock in DT, Linux does use "clocks" and "clock-names" properties and phandles.

Quoted 2 lines

Another possibiltiy, is to change the name of the clock at the of registration to match the name returned from clock-output-names.

Sorry, but no, this is plain wrong.

... and let me ask again, how do I reproduce this issue you have ?

reviewer
#42 lore raw

Re: [REGRESSION] Re: [PATCH v2 16/24] clk: imx: Convert clock-osc-* back to osc_*

In reply to Marek Vasut

Hi Marek,

Quoted 9 lines · Marek Vasut

It would be good to include the patch inline in this email, not in a link to some paste site which will go away.

This also does not work in case 24 MHz or 32 kHz clock are provided by something else than an xtal , and it will also lead to instantiation of the same clock twice. The clock are already described in DT as fixed-clock , there is fixed clock driver which binds to those clock based on their DT description , the problem here seems to be related to the look up of those 24 MHz or 32 kHz clock, not their (re)registration.

You are right.

I sent a patch that uses a different approach to fix this issue.

#43 lore raw

PATCH v2 17/24 clk: imx: Pass struct udevice into imx_clk_pllv3*()

In reply to Marek Vasut

Pass struct udevice * into imx_clk_pllv3*() functions, so the clock core would have access to parent struct udevice *.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-imx6q.c     | 6 +++---
 drivers/clk/imx/clk-imxrt1020.c | 4 ++--
 drivers/clk/imx/clk-imxrt1050.c | 8 ++++----
 drivers/clk/imx/clk-imxrt1170.c | 6 +++---
 drivers/clk/imx/clk-pllv3.c     | 6 +++---
 drivers/clk/imx/clk.h           | 6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)
drivers/clk/imx/clk-imx6q.c +3 -3
index d9eb43d82be..8327aea8950 100644
@@ -46,10 +46,10 @@ static int imx6q_clk_probe(struct udevice *dev)
 	base = (void *)ANATOP_BASE_ADDR;
 
 	clk_dm(IMX6QDL_CLK_PLL2,
-	       imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc",
+	       imx_clk_pllv3(dev, IMX_PLLV3_GENERIC, "pll2_bus", "osc",
 			     base + 0x30, 0x1));
 	clk_dm(IMX6QDL_CLK_PLL3_USB_OTG,
-	       imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc",
+	       imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3_usb_otg", "osc",
 			     base + 0x10, 0x3));
 	clk_dm(IMX6QDL_CLK_PLL3_60M,
 	       imx_clk_fixed_factor("pll3_60m",  "pll3_usb_otg",   1, 8));
@@ -58,7 +58,7 @@ static int imx6q_clk_probe(struct udevice *dev)
 	clk_dm(IMX6QDL_CLK_PLL2_PFD2_396M,
 	       imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2));
 	clk_dm(IMX6QDL_CLK_PLL6,
-	       imx_clk_pllv3(IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3));
+	       imx_clk_pllv3(dev, IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0, 0x3));
 	clk_dm(IMX6QDL_CLK_PLL6_ENET,
 	       imx_clk_gate(dev, "pll6_enet", "pll6", base + 0xe0, 13));
 
drivers/clk/imx/clk-imxrt1020.c +2 -2
index 40cba218c29..62c00ba3314 100644
@@ -38,10 +38,10 @@ static int imxrt1020_clk_probe(struct udevice *dev)
 	base = (void *)ofnode_get_addr(ofnode_by_compatible(ofnode_null(), "fsl,imxrt-anatop"));
 
 	clk_dm(IMXRT1020_CLK_PLL2_SYS,
-	       imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_sys", "osc",
+	       imx_clk_pllv3(dev, IMX_PLLV3_GENERIC, "pll2_sys", "osc",
 			     base + 0x30, 0x1));
 	clk_dm(IMXRT1020_CLK_PLL3_USB_OTG,
-	       imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg", "osc",
+	       imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3_usb_otg", "osc",
 			     base + 0x10, 0x1));
 
 	/* PLL bypass out */
drivers/clk/imx/clk-imxrt1050.c +4 -4
index 71d5fa8a90e..02f7b05da5f 100644
@@ -49,17 +49,17 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 			   pll_ref_sels, ARRAY_SIZE(pll_ref_sels)));
 
 	clk_dm(IMXRT1050_CLK_PLL1_ARM,
-	       imx_clk_pllv3(IMX_PLLV3_SYS, "pll1_arm", "pll1_arm_ref_sel",
+	       imx_clk_pllv3(dev, IMX_PLLV3_SYS, "pll1_arm", "pll1_arm_ref_sel",
 			     base + 0x0, 0x7f));
 	clk_dm(IMXRT1050_CLK_PLL2_SYS,
-	       imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_sys", "pll2_sys_ref_sel",
+	       imx_clk_pllv3(dev, IMX_PLLV3_GENERIC, "pll2_sys", "pll2_sys_ref_sel",
 			     base + 0x30, 0x1));
 	clk_dm(IMXRT1050_CLK_PLL3_USB_OTG,
-	       imx_clk_pllv3(IMX_PLLV3_USB, "pll3_usb_otg",
+	       imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3_usb_otg",
 			     "pll3_usb_otg_ref_sel",
 			     base + 0x10, 0x1));
 	clk_dm(IMXRT1050_CLK_PLL5_VIDEO,
-	       imx_clk_pllv3(IMX_PLLV3_AV, "pll5_video", "pll5_video_ref_sel",
+	       imx_clk_pllv3(dev, IMX_PLLV3_AV, "pll5_video", "pll5_video_ref_sel",
 			     base + 0xa0, 0x7f));
 
 	/* PLL bypass out */
drivers/clk/imx/clk-imxrt1170.c +3 -3
index 7e06504584f..caf34a55459 100644
@@ -121,13 +121,13 @@ static int imxrt1170_clk_probe(struct udevice *dev)
 	       imx_clk_fixed_factor("rcosc48M_div2",  "rcosc48M", 1, 2));
 
 	clk_dm(IMXRT1170_CLK_PLL_ARM,
-	       imx_clk_pllv3(IMX_PLLV3_SYS, "pll_arm", "osc",
+	       imx_clk_pllv3(dev, IMX_PLLV3_SYS, "pll_arm", "osc",
 			     base + 0x200, 0xff));
 	clk_dm(IMXRT1170_CLK_PLL3,
-	       imx_clk_pllv3(IMX_PLLV3_GENERICV2, "pll3_sys", "osc",
+	       imx_clk_pllv3(dev, IMX_PLLV3_GENERICV2, "pll3_sys", "osc",
 			     base + 0x210, 1));
 	clk_dm(IMXRT1170_CLK_PLL2,
-	       imx_clk_pllv3(IMX_PLLV3_GENERICV2, "pll2_sys", "osc",
+	       imx_clk_pllv3(dev, IMX_PLLV3_GENERICV2, "pll2_sys", "osc",
 			     base + 0x240, 1));
 
 	clk_dm(IMXRT1170_CLK_PLL3_PFD0,
drivers/clk/imx/clk-pllv3.c +3 -3
index c6692f2f9f5..bc9916385c8 100644
@@ -281,9 +281,9 @@ static const struct clk_ops clk_pllv3_enet_ops = {
 	.get_rate	= clk_pllv3_enet_get_rate,
 };
 
-struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
-			  const char *parent_name, void __iomem *base,
-			  u32 div_mask)
+struct clk *imx_clk_pllv3(struct udevice *dev, enum imx_pllv3_type type,
+			  const char *name, const char *parent_name,
+			  void __iomem *base, u32 div_mask)
 {
 	struct clk_pllv3 *pll;
 	struct clk *clk;
drivers/clk/imx/clk.h +3 -3
index 1a814d9a386..4caf3b053d4 100644
@@ -83,9 +83,9 @@ struct clk *clk_register_gate2(struct udevice *dev, const char *name,
 		void __iomem *reg, u8 bit_idx, u8 cgr_val,
 		u8 clk_gate_flags, unsigned int *share_count);
 
-struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,
-			  const char *parent_name, void __iomem *base,
-			  u32 div_mask);
+struct clk *imx_clk_pllv3(struct udevice *dev, enum imx_pllv3_type type,
+			  const char *name, const char *parent_name,
+			  void __iomem *base, u32 div_mask);
 
 static inline struct clk *imx_clk_gate2(struct udevice *dev, const char *name,
 					const char *parent, void __iomem *reg,
Signature · 1 line
2.47.2
#44 lore raw

PATCH v2 18/24 clk: imx: pllv3: Resolve parent clock by name

In reply to Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-pllv3.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-pllv3.c +2 -1
index bc9916385c8..85b6a9809e8 100644
@@ -339,7 +339,8 @@ struct clk *imx_clk_pllv3(struct udevice *dev, enum imx_pllv3_type type,
 	pll->div_mask = div_mask;
 	clk = &pll->clk;
 
-	ret = clk_register(clk, drv_name, name, parent_name);
+	ret = clk_register(clk, drv_name, name,
+			   clk_resolve_parent_clk(dev, parent_name));
 	if (ret) {
 		kfree(pll);
 		return ERR_PTR(ret);
Signature · 1 line
2.47.2
#45 lore raw

PATCH v2 19/24 clk: clk-divider: Use struct udevice instead of struct device

In reply to Marek Vasut

Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-divider clock registration.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-divider.c    | 4 ++--
 include/linux/clk-provider.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clk-divider.c +2 -2
index aa210e3d15f..3b4b3c4fa5f 100644
@@ -183,7 +183,7 @@ const struct clk_ops clk_divider_ops = {
 	.set_rate = clk_divider_set_rate,
 };
 
-static struct clk *_register_divider(struct device *dev, const char *name,
+static struct clk *_register_divider(struct udevice *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		void __iomem *reg, u8 shift, u8 width,
 		u8 clk_divider_flags, const struct clk_div_table *table)
@@ -227,7 +227,7 @@ static struct clk *_register_divider(struct device *dev, const char *name,
 	return clk;
 }
 
-struct clk *clk_register_divider(struct device *dev, const char *name,
+struct clk *clk_register_divider(struct udevice *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		void __iomem *reg, u8 shift, u8 width,
 		u8 clk_divider_flags)
include/linux/clk-provider.h +1 -1
index d44ead53079..198f3ff0e42 100644
@@ -237,7 +237,7 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		unsigned int mult, unsigned int div);
 
-struct clk *clk_register_divider(struct device *dev, const char *name,
+struct clk *clk_register_divider(struct udevice *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		void __iomem *reg, u8 shift, u8 width,
 		u8 clk_divider_flags);
Signature · 1 line
2.47.2
#46 lore raw

PATCH v2 20/24 clk: imx: Pass struct udevice into imx_clk_divider*()

In reply to Marek Vasut

Pass struct udevice * into imx_clk_divider*() functions, so the clock core would have access to parent struct udevice *.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-imx6q.c     | 22 +++++++++++-----------
 drivers/clk/imx/clk-imx8mm.c    |  4 ++--
 drivers/clk/imx/clk-imx8mn.c    |  4 ++--
 drivers/clk/imx/clk-imx8mp.c    |  4 ++--
 drivers/clk/imx/clk-imx8mq.c    | 26 +++++++++++++-------------
 drivers/clk/imx/clk-imxrt1020.c | 10 +++++-----
 drivers/clk/imx/clk-imxrt1050.c | 22 +++++++++++-----------
 drivers/clk/imx/clk-imxrt1170.c |  8 ++++----
 drivers/clk/imx/clk.h           | 21 ++++++++++++---------
 9 files changed, 62 insertions(+), 59 deletions(-)
drivers/clk/imx/clk-imx6q.c +11 -11
index 8327aea8950..5313db9e757 100644
@@ -90,28 +90,28 @@ static int imx6q_clk_probe(struct udevice *dev)
 	}
 
 	clk_dm(IMX6QDL_CLK_USDHC1_PODF,
-	       imx_clk_divider("usdhc1_podf", "usdhc1_sel",
+	       imx_clk_divider(dev, "usdhc1_podf", "usdhc1_sel",
 			       base + 0x24, 11, 3));
 	clk_dm(IMX6QDL_CLK_USDHC2_PODF,
-	       imx_clk_divider("usdhc2_podf", "usdhc2_sel",
+	       imx_clk_divider(dev, "usdhc2_podf", "usdhc2_sel",
 			       base + 0x24, 16, 3));
 	clk_dm(IMX6QDL_CLK_USDHC3_PODF,
-	       imx_clk_divider("usdhc3_podf", "usdhc3_sel",
+	       imx_clk_divider(dev, "usdhc3_podf", "usdhc3_sel",
 			       base + 0x24, 19, 3));
 	clk_dm(IMX6QDL_CLK_USDHC4_PODF,
-	       imx_clk_divider("usdhc4_podf", "usdhc4_sel",
+	       imx_clk_divider(dev, "usdhc4_podf", "usdhc4_sel",
 			       base + 0x24, 22, 3));
 
 	if (of_machine_is_compatible("fsl,imx6qp")) {
 		clk_dm(IMX6QDL_CLK_UART_SERIAL_PODF,
-		       imx_clk_divider("uart_serial_podf", "uart_sel", base + 0x24, 0, 6));
+		       imx_clk_divider(dev, "uart_serial_podf", "uart_sel", base + 0x24, 0, 6));
 		clk_dm(IMX6QDL_CLK_ECSPI_ROOT,
-		       imx_clk_divider("ecspi_root", "ecspi_sel", base + 0x38, 19, 6));
+		       imx_clk_divider(dev, "ecspi_root", "ecspi_sel", base + 0x38, 19, 6));
 	} else {
 		clk_dm(IMX6QDL_CLK_UART_SERIAL_PODF,
-		       imx_clk_divider("uart_serial_podf", "pll3_80m", base + 0x24, 0, 6));
+		       imx_clk_divider(dev, "uart_serial_podf", "pll3_80m", base + 0x24, 0, 6));
 		clk_dm(IMX6QDL_CLK_ECSPI_ROOT,
-		       imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6));
+		       imx_clk_divider(dev, "ecspi_root", "pll3_60m", base + 0x38, 19, 6));
 	}
 
 	clk_dm(IMX6QDL_CLK_ECSPI1,
@@ -142,12 +142,12 @@ static int imx6q_clk_probe(struct udevice *dev)
 	       imx_clk_busy_mux(dev, "periph",  base + 0x14, 25, 1, base + 0x48,
 				5, periph_sels,  ARRAY_SIZE(periph_sels)));
 	clk_dm(IMX6QDL_CLK_AHB,
-	       imx_clk_busy_divider("ahb", "periph", base + 0x14, 10, 3,
+	       imx_clk_busy_divider(dev, "ahb", "periph", base + 0x14, 10, 3,
 				    base + 0x48, 1));
 	clk_dm(IMX6QDL_CLK_IPG,
-	       imx_clk_divider("ipg", "ahb", base + 0x14, 8, 2));
+	       imx_clk_divider(dev, "ipg", "ahb", base + 0x14, 8, 2));
 	clk_dm(IMX6QDL_CLK_IPG_PER,
-	       imx_clk_divider("ipg_per", "ipg", base + 0x1c, 0, 6));
+	       imx_clk_divider(dev, "ipg_per", "ipg", base + 0x1c, 0, 6));
 	clk_dm(IMX6QDL_CLK_I2C1,
 	       imx_clk_gate2(dev, "i2c1", "ipg_per", base + 0x70, 6));
 	clk_dm(IMX6QDL_CLK_I2C2,
drivers/clk/imx/clk-imx8mm.c +2 -2
index 07e0f6da33e..05b864dd34b 100644
@@ -296,14 +296,14 @@ static int imx8mm_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MM_CLK_A53_CG,
 	       imx_clk_gate3(dev, "arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
 	clk_dm(IMX8MM_CLK_A53_DIV,
-	       imx_clk_divider2("arm_a53_div", "arm_a53_cg",
+	       imx_clk_divider2(dev, "arm_a53_div", "arm_a53_cg",
 				base + 0x8000, 0, 3));
 
 	clk_dm(IMX8MM_CLK_AHB,
 	       imx8m_clk_composite_critical(dev, "ahb", imx8mm_ahb_sels,
 					    base + 0x9000));
 	clk_dm(IMX8MM_CLK_IPG_ROOT,
-	       imx_clk_divider2("ipg_root", "ahb", base + 0x9080, 0, 1));
+	       imx_clk_divider2(dev, "ipg_root", "ahb", base + 0x9080, 0, 1));
 
 	clk_dm(IMX8MM_CLK_NAND_USDHC_BUS,
 	       imx8m_clk_composite_critical(dev, "nand_usdhc_bus",
drivers/clk/imx/clk-imx8mn.c +2 -2
index 5f7530eafc8..540726f0c9c 100644
@@ -293,14 +293,14 @@ static int imx8mn_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MN_CLK_A53_CG,
 	       imx_clk_gate3(dev, "arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
 	clk_dm(IMX8MN_CLK_A53_DIV,
-	       imx_clk_divider2("arm_a53_div", "arm_a53_cg",
+	       imx_clk_divider2(dev, "arm_a53_div", "arm_a53_cg",
 				base + 0x8000, 0, 3));
 
 	clk_dm(IMX8MN_CLK_AHB,
 	       imx8m_clk_composite_critical(dev, "ahb", imx8mn_ahb_sels,
 					    base + 0x9000));
 	clk_dm(IMX8MN_CLK_IPG_ROOT,
-	       imx_clk_divider2("ipg_root", "ahb", base + 0x9080, 0, 1));
+	       imx_clk_divider2(dev, "ipg_root", "ahb", base + 0x9080, 0, 1));
 
 	clk_dm(IMX8MN_CLK_ENET_AXI,
 	       imx8m_clk_composite(dev, "enet_axi", imx8mn_enet_axi_sels,
drivers/clk/imx/clk-imx8mp.c +2 -2
index 7c6b5322427..ed11d751af0 100644
@@ -264,7 +264,7 @@ static int imx8mp_clk_probe(struct udevice *dev)
 
 	clk_dm(IMX8MP_CLK_A53_SRC, imx_clk_mux2(dev, "arm_a53_src", base + 0x8000, 24, 3, imx8mp_a53_sels, ARRAY_SIZE(imx8mp_a53_sels)));
 	clk_dm(IMX8MP_CLK_A53_CG, imx_clk_gate3(dev, "arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
-	clk_dm(IMX8MP_CLK_A53_DIV, imx_clk_divider2("arm_a53_div", "arm_a53_cg", base + 0x8000, 0, 3));
+	clk_dm(IMX8MP_CLK_A53_DIV, imx_clk_divider2(dev, "arm_a53_div", "arm_a53_cg", base + 0x8000, 0, 3));
 
 	clk_dm(IMX8MP_CLK_HSIO_AXI, imx8m_clk_composite(dev, "hsio_axi", imx8mp_hsio_axi_sels, base + 0x8380));
 	clk_dm(IMX8MP_CLK_MAIN_AXI, imx8m_clk_composite_critical(dev, "main_axi", imx8mp_main_axi_sels, base + 0x8800));
@@ -275,7 +275,7 @@ static int imx8mp_clk_probe(struct udevice *dev)
 
 	clk_dm(IMX8MP_CLK_AHB, imx8m_clk_composite_critical(dev, "ahb_root", imx8mp_ahb_sels, base + 0x9000));
 
-	clk_dm(IMX8MP_CLK_IPG_ROOT, imx_clk_divider2("ipg_root", "ahb_root", base + 0x9080, 0, 1));
+	clk_dm(IMX8MP_CLK_IPG_ROOT, imx_clk_divider2(dev, "ipg_root", "ahb_root", base + 0x9080, 0, 1));
 
 	clk_dm(IMX8MP_CLK_DRAM_ALT, imx8m_clk_composite(dev, "dram_alt", imx8mp_dram_alt_sels, base + 0xa000));
 	clk_dm(IMX8MP_CLK_DRAM_APB, imx8m_clk_composite_critical(dev, "dram_apb", imx8mp_dram_apb_sels, base + 0xa080));
drivers/clk/imx/clk-imx8mq.c +13 -13
index 5faa2d20224..7632ffe72e7 100644
@@ -313,27 +313,27 @@ static int imx8mq_clk_probe(struct udevice *dev)
 	       imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1));
 
 	clk_dm(IMX8MQ_CLK_MON_AUDIO_PLL1_DIV,
-	       imx_clk_divider("audio_pll1_out_monitor", "audio_pll1_bypass", base + 0x78, 0, 3));
+	       imx_clk_divider(dev, "audio_pll1_out_monitor", "audio_pll1_bypass", base + 0x78, 0, 3));
 	clk_dm(IMX8MQ_CLK_MON_AUDIO_PLL2_DIV,
-	       imx_clk_divider("audio_pll2_out_monitor", "audio_pll2_bypass", base + 0x78, 4, 3));
+	       imx_clk_divider(dev, "audio_pll2_out_monitor", "audio_pll2_bypass", base + 0x78, 4, 3));
 	clk_dm(IMX8MQ_CLK_MON_VIDEO_PLL1_DIV,
-	       imx_clk_divider("video_pll1_out_monitor", "video_pll1_bypass", base + 0x78, 8, 3));
+	       imx_clk_divider(dev, "video_pll1_out_monitor", "video_pll1_bypass", base + 0x78, 8, 3));
 	clk_dm(IMX8MQ_CLK_MON_GPU_PLL_DIV,
-	       imx_clk_divider("gpu_pll_out_monitor", "gpu_pll_bypass", base + 0x78, 12, 3));
+	       imx_clk_divider(dev, "gpu_pll_out_monitor", "gpu_pll_bypass", base + 0x78, 12, 3));
 	clk_dm(IMX8MQ_CLK_MON_VPU_PLL_DIV,
-	       imx_clk_divider("vpu_pll_out_monitor", "vpu_pll_bypass", base + 0x78, 16, 3));
+	       imx_clk_divider(dev, "vpu_pll_out_monitor", "vpu_pll_bypass", base + 0x78, 16, 3));
 	clk_dm(IMX8MQ_CLK_MON_ARM_PLL_DIV,
-	       imx_clk_divider("arm_pll_out_monitor", "arm_pll_bypass", base + 0x78, 20, 3));
+	       imx_clk_divider(dev, "arm_pll_out_monitor", "arm_pll_bypass", base + 0x78, 20, 3));
 	clk_dm(IMX8MQ_CLK_MON_SYS_PLL1_DIV,
-	       imx_clk_divider("sys_pll1_out_monitor", "sys_pll1_out", base + 0x7c, 0, 3));
+	       imx_clk_divider(dev, "sys_pll1_out_monitor", "sys_pll1_out", base + 0x7c, 0, 3));
 	clk_dm(IMX8MQ_CLK_MON_SYS_PLL2_DIV,
-	       imx_clk_divider("sys_pll2_out_monitor", "sys_pll2_out", base + 0x7c, 4, 3));
+	       imx_clk_divider(dev, "sys_pll2_out_monitor", "sys_pll2_out", base + 0x7c, 4, 3));
 	clk_dm(IMX8MQ_CLK_MON_SYS_PLL3_DIV,
-	       imx_clk_divider("sys_pll3_out_monitor", "sys_pll3_out", base + 0x7c, 8, 3));
+	       imx_clk_divider(dev, "sys_pll3_out_monitor", "sys_pll3_out", base + 0x7c, 8, 3));
 	clk_dm(IMX8MQ_CLK_MON_DRAM_PLL_DIV,
-	       imx_clk_divider("dram_pll_out_monitor", "dram_pll_out", base + 0x7c, 12, 3));
+	       imx_clk_divider(dev, "dram_pll_out_monitor", "dram_pll_out", base + 0x7c, 12, 3));
 	clk_dm(IMX8MQ_CLK_MON_VIDEO_PLL2_DIV,
-	       imx_clk_divider("video_pll2_out_monitor", "video_pll2_out", base + 0x7c, 16, 3));
+	       imx_clk_divider(dev, "video_pll2_out_monitor", "video_pll2_out", base + 0x7c, 16, 3));
 	clk_dm(IMX8MQ_CLK_MON_SEL,
 	       imx_clk_mux_flags(dev, "pllout_monitor_sel", base + 0x74, 0, 4,
 				 pllout_monitor_sels,
@@ -354,7 +354,7 @@ static int imx8mq_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MQ_CLK_A53_CG,
 	       imx_clk_gate3(dev, "arm_a53_cg", "arm_a53_src", base + 0x8000, 28));
 	clk_dm(IMX8MQ_CLK_A53_DIV,
-	       imx_clk_divider2("arm_a53_div", "arm_a53_cg",
+	       imx_clk_divider2(dev, "arm_a53_div", "arm_a53_cg",
 				base + 0x8000, 0, 3));
 	clk_dm(IMX8MQ_CLK_A53_CORE,
 	       imx_clk_mux2(dev, "arm_a53_src", base + 0x9880, 24, 1,
@@ -364,7 +364,7 @@ static int imx8mq_clk_probe(struct udevice *dev)
 	       imx8m_clk_composite_critical(dev, "ahb", imx8mq_ahb_sels,
 					    base + 0x9000));
 	clk_dm(IMX8MQ_CLK_IPG_ROOT,
-	       imx_clk_divider2("ipg_root", "ahb", base + 0x9080, 0, 1));
+	       imx_clk_divider2(dev, "ipg_root", "ahb", base + 0x9080, 0, 1));
 
 	clk_dm(IMX8MQ_CLK_ENET_AXI,
 	       imx8m_clk_composite(dev, "enet_axi", imx8mq_enet_axi_sels,
drivers/clk/imx/clk-imxrt1020.c +5 -5
index 62c00ba3314..775cc73b4db 100644
@@ -100,19 +100,19 @@ static int imxrt1020_clk_probe(struct udevice *dev)
 			   semc_sels, ARRAY_SIZE(semc_sels)));
 
 	clk_dm(IMXRT1020_CLK_AHB_PODF,
-	       imx_clk_divider("ahb_podf", "periph_sel",
+	       imx_clk_divider(dev, "ahb_podf", "periph_sel",
 			       base + 0x14, 10, 3));
 	clk_dm(IMXRT1020_CLK_USDHC1_PODF,
-	       imx_clk_divider("usdhc1_podf", "usdhc1_sel",
+	       imx_clk_divider(dev, "usdhc1_podf", "usdhc1_sel",
 			       base + 0x24, 11, 3));
 	clk_dm(IMXRT1020_CLK_USDHC2_PODF,
-	       imx_clk_divider("usdhc2_podf", "usdhc2_sel",
+	       imx_clk_divider(dev, "usdhc2_podf", "usdhc2_sel",
 			       base + 0x24, 16, 3));
 	clk_dm(IMXRT1020_CLK_LPUART_PODF,
-	       imx_clk_divider("lpuart_podf", "lpuart_sel",
+	       imx_clk_divider(dev, "lpuart_podf", "lpuart_sel",
 			       base + 0x24, 0, 6));
 	clk_dm(IMXRT1020_CLK_SEMC_PODF,
-	       imx_clk_divider("semc_podf", "semc_sel",
+	       imx_clk_divider(dev, "semc_podf", "semc_sel",
 			       base + 0x14, 16, 3));
 
 	clk_dm(IMXRT1020_CLK_USDHC1,
drivers/clk/imx/clk-imxrt1050.c +11 -11
index 02f7b05da5f..c8ac3103dc9 100644
@@ -85,10 +85,10 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 				 CLK_SET_RATE_PARENT));
 
 	clk_dm(IMXRT1050_CLK_VIDEO_POST_DIV_SEL,
-	       imx_clk_divider("video_post_div_sel", "pll5_video",
+	       imx_clk_divider(dev, "video_post_div_sel", "pll5_video",
 			       base + 0xa0, 19, 2));
 	clk_dm(IMXRT1050_CLK_VIDEO_DIV,
-	       imx_clk_divider("video_div", "video_post_div_sel",
+	       imx_clk_divider(dev, "video_div", "video_post_div_sel",
 			       base + 0x170, 30, 2));
 
 	clk_dm(IMXRT1050_CLK_PLL3_80M,
@@ -113,7 +113,7 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 		return -EINVAL;
 
 	clk_dm(IMXRT1050_CLK_ARM_PODF,
-	       imx_clk_divider("arm_podf", "pll1_arm",
+	       imx_clk_divider(dev, "arm_podf", "pll1_arm",
 			       base + 0x10, 0, 3));
 
 	clk_dm(IMXRT1050_CLK_PRE_PERIPH_SEL,
@@ -142,28 +142,28 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 			   lcdif_sels, ARRAY_SIZE(lcdif_sels)));
 
 	clk_dm(IMXRT1050_CLK_AHB_PODF,
-	       imx_clk_divider("ahb_podf", "periph_sel",
+	       imx_clk_divider(dev, "ahb_podf", "periph_sel",
 			       base + 0x14, 10, 3));
 	clk_dm(IMXRT1050_CLK_IPG_PDOF,
-	       imx_clk_divider("ipg_podf", "ahb_podf",
+	       imx_clk_divider(dev, "ipg_podf", "ahb_podf",
 			       base + 0x14, 8, 2));
 	clk_dm(IMXRT1050_CLK_USDHC1_PODF,
-	       imx_clk_divider("usdhc1_podf", "usdhc1_sel",
+	       imx_clk_divider(dev, "usdhc1_podf", "usdhc1_sel",
 			       base + 0x24, 11, 3));
 	clk_dm(IMXRT1050_CLK_USDHC2_PODF,
-	       imx_clk_divider("usdhc2_podf", "usdhc2_sel",
+	       imx_clk_divider(dev, "usdhc2_podf", "usdhc2_sel",
 			       base + 0x24, 16, 3));
 	clk_dm(IMXRT1050_CLK_LPUART_PODF,
-	       imx_clk_divider("lpuart_podf", "lpuart_sel",
+	       imx_clk_divider(dev, "lpuart_podf", "lpuart_sel",
 			       base + 0x24, 0, 6));
 	clk_dm(IMXRT1050_CLK_SEMC_PODF,
-	       imx_clk_divider("semc_podf", "semc_sel",
+	       imx_clk_divider(dev, "semc_podf", "semc_sel",
 			       base + 0x14, 16, 3));
 	clk_dm(IMXRT1050_CLK_LCDIF_PRED,
-	       imx_clk_divider("lcdif_pred", "lcdif_sel",
+	       imx_clk_divider(dev, "lcdif_pred", "lcdif_sel",
 			       base + 0x38, 12, 3));
 	clk_dm(IMXRT1050_CLK_LCDIF_PODF,
-	       imx_clk_divider("lcdif_podf", "lcdif_pred",
+	       imx_clk_divider(dev, "lcdif_podf", "lcdif_pred",
 			       base + 0x18, 23, 3));
 
 	clk_dm(IMXRT1050_CLK_USDHC1,
drivers/clk/imx/clk-imxrt1170.c +4 -4
index caf34a55459..043c400559e 100644
@@ -160,28 +160,28 @@ static int imxrt1170_clk_probe(struct udevice *dev)
 	       imx_clk_mux(dev, "lpuart1_sel", base + (25 * 0x80), 8, 3,
 			   lpuart1_sels, ARRAY_SIZE(lpuart1_sels)));
 	clk_dm(IMXRT1170_CLK_LPUART1,
-	       imx_clk_divider("lpuart1", "lpuart1_sel",
+	       imx_clk_divider(dev, "lpuart1", "lpuart1_sel",
 			       base + (25 * 0x80), 0, 8));
 
 	clk_dm(IMXRT1170_CLK_USDHC1_SEL,
 	       imx_clk_mux(dev, "usdhc1_sel", base + (58 * 0x80), 8, 3,
 			   usdhc1_sels, ARRAY_SIZE(usdhc1_sels)));
 	clk_dm(IMXRT1170_CLK_USDHC1,
-	       imx_clk_divider("usdhc1", "usdhc1_sel",
+	       imx_clk_divider(dev, "usdhc1", "usdhc1_sel",
 			       base + (58 * 0x80), 0, 8));
 
 	clk_dm(IMXRT1170_CLK_GPT1_SEL,
 	       imx_clk_mux(dev, "gpt1_sel", base + (14 * 0x80), 8, 3,
 			   gpt1_sels, ARRAY_SIZE(gpt1_sels)));
 	clk_dm(IMXRT1170_CLK_GPT1,
-	       imx_clk_divider("gpt1", "gpt1_sel",
+	       imx_clk_divider(dev, "gpt1", "gpt1_sel",
 			       base + (14 * 0x80), 0, 8));
 
 	clk_dm(IMXRT1170_CLK_SEMC_SEL,
 	       imx_clk_mux(dev, "semc_sel", base + (4 * 0x80), 8, 3,
 			   semc_sels, ARRAY_SIZE(semc_sels)));
 	clk_dm(IMXRT1170_CLK_SEMC,
-	       imx_clk_divider("semc", "semc_sel",
+	       imx_clk_divider(dev, "semc", "semc_sel",
 			       base + (4 * 0x80), 0, 8));
 	struct clk *clk, *clk1;
 
drivers/clk/imx/clk.h +12 -9
index 4caf3b053d4..32fa832f856 100644
@@ -138,25 +138,28 @@ static inline struct clk *imx_clk_fixed_factor(const char *name,
 			CLK_SET_RATE_PARENT, mult, div);
 }
 
-static inline struct clk *imx_clk_divider(const char *name, const char *parent,
-		void __iomem *reg, u8 shift, u8 width)
+static inline struct clk *imx_clk_divider(struct udevice *dev, const char *name,
+					  const char *parent, void __iomem *reg,
+					  u8 shift, u8 width)
 {
-	return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
+	return clk_register_divider(dev, name, parent, CLK_SET_RATE_PARENT,
 			reg, shift, width, 0);
 }
 
 static inline struct clk *
-imx_clk_busy_divider(const char *name, const char *parent, void __iomem *reg,
-		     u8 shift, u8 width, void __iomem *busy_reg, u8 busy_shift)
+imx_clk_busy_divider(struct udevice *dev, const char *name,
+		     const char *parent, void __iomem *reg, u8 shift, u8 width,
+		     void __iomem *busy_reg, u8 busy_shift)
 {
-	return clk_register_divider(NULL, name, parent, CLK_SET_RATE_PARENT,
+	return clk_register_divider(dev, name, parent, CLK_SET_RATE_PARENT,
 			reg, shift, width, 0);
 }
 
-static inline struct clk *imx_clk_divider2(const char *name, const char *parent,
-		void __iomem *reg, u8 shift, u8 width)
+static inline struct clk *imx_clk_divider2(struct udevice *dev, const char *name,
+					   const char *parent, void __iomem *reg,
+					   u8 shift, u8 width)
 {
-	return clk_register_divider(NULL, name, parent,
+	return clk_register_divider(dev, name, parent,
 			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
 			reg, shift, width, 0);
 }
Signature · 1 line
2.47.2
#47 lore raw

PATCH v2 21/24 clk: clk-divider: Resolve parent clock by name

In reply to Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-divider.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/clk-divider.c +2 -1
index 3b4b3c4fa5f..e692b9c2167 100644
@@ -218,7 +218,8 @@ static struct clk *_register_divider(struct udevice *dev, const char *name,
 	clk = &div->clk;
 	clk->flags = flags;
 
-	ret = clk_register(clk, UBOOT_DM_CLK_CCF_DIVIDER, name, parent_name);
+	ret = clk_register(clk, UBOOT_DM_CLK_CCF_DIVIDER, name,
+			   clk_resolve_parent_clk(dev, parent_name));
 	if (ret) {
 		kfree(div);
 		return ERR_PTR(ret);
Signature · 1 line
2.47.2
#48 lore raw

PATCH v2 22/24 clk: clk-fixed-factor: Use struct udevice instead of struct device

In reply to Marek Vasut

Use U-Boot specific struct udevice instead of Linux compatibility struct device in clk-fixed-factor registration.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-fixed-factor.c | 4 ++--
 include/linux/clk-provider.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clk-fixed-factor.c +2 -2
index 068798cf9b0..ff61fb4d706 100644
@@ -37,7 +37,7 @@ const struct clk_ops ccf_clk_fixed_factor_ops = {
 	.get_rate = clk_factor_recalc_rate,
 };
 
-struct clk *clk_hw_register_fixed_factor(struct device *dev,
+struct clk *clk_hw_register_fixed_factor(struct udevice *dev,
 		const char *name, const char *parent_name, unsigned long flags,
 		unsigned int mult, unsigned int div)
 {
@@ -65,7 +65,7 @@ struct clk *clk_hw_register_fixed_factor(struct device *dev,
 	return clk;
 }
 
-struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
+struct clk *clk_register_fixed_factor(struct udevice *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		unsigned int mult, unsigned int div)
 {
include/linux/clk-provider.h +1 -1
index 198f3ff0e42..5ea2171492e 100644
@@ -233,7 +233,7 @@ struct clk *clk_register_composite(struct udevice *dev, const char *name,
 int clk_register(struct clk *clk, const char *drv_name, const char *name,
 		 const char *parent_name);
 
-struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
+struct clk *clk_register_fixed_factor(struct udevice *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		unsigned int mult, unsigned int div);
 
Signature · 1 line
2.47.2
#49 lore raw

PATCH v2 23/24 clk: clk-fixed-factor: Resolve parent clock by name

In reply to Marek Vasut

Use clock-names property which is accessible via parent clock OF node to look up the parent clock by name instead of depending on unreliable global clock name to perform look up.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/clk-fixed-factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-fixed-factor.c +1 -1
index ff61fb4d706..4eb8be728e6 100644
@@ -56,7 +56,7 @@ struct clk *clk_hw_register_fixed_factor(struct udevice *dev,
 	clk->flags = flags;
 
 	ret = clk_register(clk, UBOOT_DM_CLK_IMX_FIXED_FACTOR, name,
-			   parent_name);
+			   clk_resolve_parent_clk(dev, parent_name));
 	if (ret) {
 		kfree(fix);
 		return ERR_PTR(ret);
Signature · 1 line
2.47.2
#50 lore raw

PATCH v2 24/24 clk: imx: Pass struct udevice into imx_clk_fixed_factor*()

In reply to Marek Vasut

Pass struct udevice * into imx_clk_fixed_factor*() functions, so the clock core would have access to parent struct udevice *.

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
V2: Rebase on u-boot/next with additional clock patches

---
 drivers/clk/imx/clk-imx6q.c     |  4 ++--
 drivers/clk/imx/clk-imx8mm.c    | 36 ++++++++++++++---------------
 drivers/clk/imx/clk-imx8mn.c    | 36 ++++++++++++++---------------
 drivers/clk/imx/clk-imx8mp.c    | 40 ++++++++++++++++-----------------
 drivers/clk/imx/clk-imx8mq.c    | 38 +++++++++++++++----------------
 drivers/clk/imx/clk-imx93.c     |  6 ++---
 drivers/clk/imx/clk-imxrt1020.c |  2 +-
 drivers/clk/imx/clk-imxrt1050.c |  2 +-
 drivers/clk/imx/clk-imxrt1170.c |  8 +++----
 drivers/clk/imx/clk.h           |  7 +++---
 10 files changed, 90 insertions(+), 89 deletions(-)
drivers/clk/imx/clk-imx6q.c +2 -2
index 5313db9e757..13239f2f64d 100644
@@ -52,7 +52,7 @@ static int imx6q_clk_probe(struct udevice *dev)
 	       imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3_usb_otg", "osc",
 			     base + 0x10, 0x3));
 	clk_dm(IMX6QDL_CLK_PLL3_60M,
-	       imx_clk_fixed_factor("pll3_60m",  "pll3_usb_otg",   1, 8));
+	       imx_clk_fixed_factor(dev, "pll3_60m",  "pll3_usb_otg",   1, 8));
 	clk_dm(IMX6QDL_CLK_PLL2_PFD0_352M,
 	       imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0));
 	clk_dm(IMX6QDL_CLK_PLL2_PFD2_396M,
@@ -159,7 +159,7 @@ static int imx6q_clk_probe(struct udevice *dev)
 
 	clk_dm(IMX6QDL_CLK_ENET, imx_clk_gate2(dev, "enet", "ipg", base + 0x6c, 10));
 	clk_dm(IMX6QDL_CLK_ENET_REF,
-	       imx_clk_fixed_factor("enet_ref", "pll6_enet", 1, 1));
+	       imx_clk_fixed_factor(dev, "enet_ref", "pll6_enet", 1, 1));
 
 	return 0;
 }
drivers/clk/imx/clk-imx8mm.c +18 -18
index 05b864dd34b..b81db516a69 100644
@@ -249,42 +249,42 @@ static int imx8mm_clk_probe(struct udevice *dev)
 
 	/* SYS PLL fixed output */
 	clk_dm(IMX8MM_SYS_PLL1_40M,
-	       imx_clk_fixed_factor("sys_pll1_40m", "sys_pll1_out", 1, 20));
+	       imx_clk_fixed_factor(dev, "sys_pll1_40m", "sys_pll1_out", 1, 20));
 	clk_dm(IMX8MM_SYS_PLL1_80M,
-	       imx_clk_fixed_factor("sys_pll1_80m", "sys_pll1_out", 1, 10));
+	       imx_clk_fixed_factor(dev, "sys_pll1_80m", "sys_pll1_out", 1, 10));
 	clk_dm(IMX8MM_SYS_PLL1_100M,
-	       imx_clk_fixed_factor("sys_pll1_100m", "sys_pll1_out", 1, 8));
+	       imx_clk_fixed_factor(dev, "sys_pll1_100m", "sys_pll1_out", 1, 8));
 	clk_dm(IMX8MM_SYS_PLL1_133M,
-	       imx_clk_fixed_factor("sys_pll1_133m", "sys_pll1_out", 1, 6));
+	       imx_clk_fixed_factor(dev, "sys_pll1_133m", "sys_pll1_out", 1, 6));
 	clk_dm(IMX8MM_SYS_PLL1_160M,
-	       imx_clk_fixed_factor("sys_pll1_160m", "sys_pll1_out", 1, 5));
+	       imx_clk_fixed_factor(dev, "sys_pll1_160m", "sys_pll1_out", 1, 5));
 	clk_dm(IMX8MM_SYS_PLL1_200M,
-	       imx_clk_fixed_factor("sys_pll1_200m", "sys_pll1_out", 1, 4));
+	       imx_clk_fixed_factor(dev, "sys_pll1_200m", "sys_pll1_out", 1, 4));
 	clk_dm(IMX8MM_SYS_PLL1_266M,
-	       imx_clk_fixed_factor("sys_pll1_266m", "sys_pll1_out", 1, 3));
+	       imx_clk_fixed_factor(dev, "sys_pll1_266m", "sys_pll1_out", 1, 3));
 	clk_dm(IMX8MM_SYS_PLL1_400M,
-	       imx_clk_fixed_factor("sys_pll1_400m", "sys_pll1_out", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll1_400m", "sys_pll1_out", 1, 2));
 	clk_dm(IMX8MM_SYS_PLL1_800M,
-	       imx_clk_fixed_factor("sys_pll1_800m", "sys_pll1_out", 1, 1));
+	       imx_clk_fixed_factor(dev, "sys_pll1_800m", "sys_pll1_out", 1, 1));
 
 	clk_dm(IMX8MM_SYS_PLL2_50M,
-	       imx_clk_fixed_factor("sys_pll2_50m", "sys_pll2_out", 1, 20));
+	       imx_clk_fixed_factor(dev, "sys_pll2_50m", "sys_pll2_out", 1, 20));
 	clk_dm(IMX8MM_SYS_PLL2_100M,
-	       imx_clk_fixed_factor("sys_pll2_100m", "sys_pll2_out", 1, 10));
+	       imx_clk_fixed_factor(dev, "sys_pll2_100m", "sys_pll2_out", 1, 10));
 	clk_dm(IMX8MM_SYS_PLL2_125M,
-	       imx_clk_fixed_factor("sys_pll2_125m", "sys_pll2_out", 1, 8));
+	       imx_clk_fixed_factor(dev, "sys_pll2_125m", "sys_pll2_out", 1, 8));
 	clk_dm(IMX8MM_SYS_PLL2_166M,
-	       imx_clk_fixed_factor("sys_pll2_166m", "sys_pll2_out", 1, 6));
+	       imx_clk_fixed_factor(dev, "sys_pll2_166m", "sys_pll2_out", 1, 6));
 	clk_dm(IMX8MM_SYS_PLL2_200M,
-	       imx_clk_fixed_factor("sys_pll2_200m", "sys_pll2_out", 1, 5));
+	       imx_clk_fixed_factor(dev, "sys_pll2_200m", "sys_pll2_out", 1, 5));
 	clk_dm(IMX8MM_SYS_PLL2_250M,
-	       imx_clk_fixed_factor("sys_pll2_250m", "sys_pll2_out", 1, 4));
+	       imx_clk_fixed_factor(dev, "sys_pll2_250m", "sys_pll2_out", 1, 4));
 	clk_dm(IMX8MM_SYS_PLL2_333M,
-	       imx_clk_fixed_factor("sys_pll2_333m", "sys_pll2_out", 1, 3));
+	       imx_clk_fixed_factor(dev, "sys_pll2_333m", "sys_pll2_out", 1, 3));
 	clk_dm(IMX8MM_SYS_PLL2_500M,
-	       imx_clk_fixed_factor("sys_pll2_500m", "sys_pll2_out", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll2_500m", "sys_pll2_out", 1, 2));
 	clk_dm(IMX8MM_SYS_PLL2_1000M,
-	       imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1));
+	       imx_clk_fixed_factor(dev, "sys_pll2_1000m", "sys_pll2_out", 1, 1));
 
 	base = dev_read_addr_ptr(dev);
 	if (!base)
drivers/clk/imx/clk-imx8mn.c +18 -18
index 540726f0c9c..be5b7933a8d 100644
@@ -241,42 +241,42 @@ static int imx8mn_clk_probe(struct udevice *dev)
 
 	/* SYS PLL fixed output */
 	clk_dm(IMX8MN_SYS_PLL1_40M,
-	       imx_clk_fixed_factor("sys_pll1_40m", "sys_pll1_out", 1, 20));
+	       imx_clk_fixed_factor(dev, "sys_pll1_40m", "sys_pll1_out", 1, 20));
 	clk_dm(IMX8MN_SYS_PLL1_80M,
-	       imx_clk_fixed_factor("sys_pll1_80m", "sys_pll1_out", 1, 10));
+	       imx_clk_fixed_factor(dev, "sys_pll1_80m", "sys_pll1_out", 1, 10));
 	clk_dm(IMX8MN_SYS_PLL1_100M,
-	       imx_clk_fixed_factor("sys_pll1_100m", "sys_pll1_out", 1, 8));
+	       imx_clk_fixed_factor(dev, "sys_pll1_100m", "sys_pll1_out", 1, 8));
 	clk_dm(IMX8MN_SYS_PLL1_133M,
-	       imx_clk_fixed_factor("sys_pll1_133m", "sys_pll1_out", 1, 6));
+	       imx_clk_fixed_factor(dev, "sys_pll1_133m", "sys_pll1_out", 1, 6));
 	clk_dm(IMX8MN_SYS_PLL1_160M,
-	       imx_clk_fixed_factor("sys_pll1_160m", "sys_pll1_out", 1, 5));
+	       imx_clk_fixed_factor(dev, "sys_pll1_160m", "sys_pll1_out", 1, 5));
 	clk_dm(IMX8MN_SYS_PLL1_200M,
-	       imx_clk_fixed_factor("sys_pll1_200m", "sys_pll1_out", 1, 4));
+	       imx_clk_fixed_factor(dev, "sys_pll1_200m", "sys_pll1_out", 1, 4));
 	clk_dm(IMX8MN_SYS_PLL1_266M,
-	       imx_clk_fixed_factor("sys_pll1_266m", "sys_pll1_out", 1, 3));
+	       imx_clk_fixed_factor(dev, "sys_pll1_266m", "sys_pll1_out", 1, 3));
 	clk_dm(IMX8MN_SYS_PLL1_400M,
-	       imx_clk_fixed_factor("sys_pll1_400m", "sys_pll1_out", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll1_400m", "sys_pll1_out", 1, 2));
 	clk_dm(IMX8MN_SYS_PLL1_800M,
-	       imx_clk_fixed_factor("sys_pll1_800m", "sys_pll1_out", 1, 1));
+	       imx_clk_fixed_factor(dev, "sys_pll1_800m", "sys_pll1_out", 1, 1));
 
 	clk_dm(IMX8MN_SYS_PLL2_50M,
-	       imx_clk_fixed_factor("sys_pll2_50m", "sys_pll2_out", 1, 20));
+	       imx_clk_fixed_factor(dev, "sys_pll2_50m", "sys_pll2_out", 1, 20));
 	clk_dm(IMX8MN_SYS_PLL2_100M,
-	       imx_clk_fixed_factor("sys_pll2_100m", "sys_pll2_out", 1, 10));
+	       imx_clk_fixed_factor(dev, "sys_pll2_100m", "sys_pll2_out", 1, 10));
 	clk_dm(IMX8MN_SYS_PLL2_125M,
-	       imx_clk_fixed_factor("sys_pll2_125m", "sys_pll2_out", 1, 8));
+	       imx_clk_fixed_factor(dev, "sys_pll2_125m", "sys_pll2_out", 1, 8));
 	clk_dm(IMX8MN_SYS_PLL2_166M,
-	       imx_clk_fixed_factor("sys_pll2_166m", "sys_pll2_out", 1, 6));
+	       imx_clk_fixed_factor(dev, "sys_pll2_166m", "sys_pll2_out", 1, 6));
 	clk_dm(IMX8MN_SYS_PLL2_200M,
-	       imx_clk_fixed_factor("sys_pll2_200m", "sys_pll2_out", 1, 5));
+	       imx_clk_fixed_factor(dev, "sys_pll2_200m", "sys_pll2_out", 1, 5));
 	clk_dm(IMX8MN_SYS_PLL2_250M,
-	       imx_clk_fixed_factor("sys_pll2_250m", "sys_pll2_out", 1, 4));
+	       imx_clk_fixed_factor(dev, "sys_pll2_250m", "sys_pll2_out", 1, 4));
 	clk_dm(IMX8MN_SYS_PLL2_333M,
-	       imx_clk_fixed_factor("sys_pll2_333m", "sys_pll2_out", 1, 3));
+	       imx_clk_fixed_factor(dev, "sys_pll2_333m", "sys_pll2_out", 1, 3));
 	clk_dm(IMX8MN_SYS_PLL2_500M,
-	       imx_clk_fixed_factor("sys_pll2_500m", "sys_pll2_out", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll2_500m", "sys_pll2_out", 1, 2));
 	clk_dm(IMX8MN_SYS_PLL2_1000M,
-	       imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1));
+	       imx_clk_fixed_factor(dev, "sys_pll2_1000m", "sys_pll2_out", 1, 1));
 
 	ret = clk_get_by_name(dev, "osc_24m", &osc_24m_clk);
 	if (ret)
drivers/clk/imx/clk-imx8mp.c +20 -20
index ed11d751af0..bad579f8d5e 100644
@@ -228,25 +228,25 @@ static int imx8mp_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MP_SYS_PLL2_OUT, imx_clk_gate(dev, "sys_pll2_out", "sys_pll2_bypass", base + 0x104, 11));
 	clk_dm(IMX8MP_SYS_PLL3_OUT, imx_clk_gate(dev, "sys_pll3_out", "sys_pll3_bypass", base + 0x114, 11));
 
-	clk_dm(IMX8MP_SYS_PLL1_40M, imx_clk_fixed_factor("sys_pll1_40m", "sys_pll1_out", 1, 20));
-	clk_dm(IMX8MP_SYS_PLL1_80M, imx_clk_fixed_factor("sys_pll1_80m", "sys_pll1_out", 1, 10));
-	clk_dm(IMX8MP_SYS_PLL1_100M, imx_clk_fixed_factor("sys_pll1_100m", "sys_pll1_out", 1, 8));
-	clk_dm(IMX8MP_SYS_PLL1_133M, imx_clk_fixed_factor("sys_pll1_133m", "sys_pll1_out", 1, 6));
-	clk_dm(IMX8MP_SYS_PLL1_160M, imx_clk_fixed_factor("sys_pll1_160m", "sys_pll1_out", 1, 5));
-	clk_dm(IMX8MP_SYS_PLL1_200M, imx_clk_fixed_factor("sys_pll1_200m", "sys_pll1_out", 1, 4));
-	clk_dm(IMX8MP_SYS_PLL1_266M, imx_clk_fixed_factor("sys_pll1_266m", "sys_pll1_out", 1, 3));
-	clk_dm(IMX8MP_SYS_PLL1_400M, imx_clk_fixed_factor("sys_pll1_400m", "sys_pll1_out", 1, 2));
-	clk_dm(IMX8MP_SYS_PLL1_800M, imx_clk_fixed_factor("sys_pll1_800m", "sys_pll1_out", 1, 1));
-
-	clk_dm(IMX8MP_SYS_PLL2_50M, imx_clk_fixed_factor("sys_pll2_50m", "sys_pll2_out", 1, 20));
-	clk_dm(IMX8MP_SYS_PLL2_100M, imx_clk_fixed_factor("sys_pll2_100m", "sys_pll2_out", 1, 10));
-	clk_dm(IMX8MP_SYS_PLL2_125M, imx_clk_fixed_factor("sys_pll2_125m", "sys_pll2_out", 1, 8));
-	clk_dm(IMX8MP_SYS_PLL2_166M, imx_clk_fixed_factor("sys_pll2_166m", "sys_pll2_out", 1, 6));
-	clk_dm(IMX8MP_SYS_PLL2_200M, imx_clk_fixed_factor("sys_pll2_200m", "sys_pll2_out", 1, 5));
-	clk_dm(IMX8MP_SYS_PLL2_250M, imx_clk_fixed_factor("sys_pll2_250m", "sys_pll2_out", 1, 4));
-	clk_dm(IMX8MP_SYS_PLL2_333M, imx_clk_fixed_factor("sys_pll2_333m", "sys_pll2_out", 1, 3));
-	clk_dm(IMX8MP_SYS_PLL2_500M, imx_clk_fixed_factor("sys_pll2_500m", "sys_pll2_out", 1, 2));
-	clk_dm(IMX8MP_SYS_PLL2_1000M, imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1));
+	clk_dm(IMX8MP_SYS_PLL1_40M, imx_clk_fixed_factor(dev, "sys_pll1_40m", "sys_pll1_out", 1, 20));
+	clk_dm(IMX8MP_SYS_PLL1_80M, imx_clk_fixed_factor(dev, "sys_pll1_80m", "sys_pll1_out", 1, 10));
+	clk_dm(IMX8MP_SYS_PLL1_100M, imx_clk_fixed_factor(dev, "sys_pll1_100m", "sys_pll1_out", 1, 8));
+	clk_dm(IMX8MP_SYS_PLL1_133M, imx_clk_fixed_factor(dev, "sys_pll1_133m", "sys_pll1_out", 1, 6));
+	clk_dm(IMX8MP_SYS_PLL1_160M, imx_clk_fixed_factor(dev, "sys_pll1_160m", "sys_pll1_out", 1, 5));
+	clk_dm(IMX8MP_SYS_PLL1_200M, imx_clk_fixed_factor(dev, "sys_pll1_200m", "sys_pll1_out", 1, 4));
+	clk_dm(IMX8MP_SYS_PLL1_266M, imx_clk_fixed_factor(dev, "sys_pll1_266m", "sys_pll1_out", 1, 3));
+	clk_dm(IMX8MP_SYS_PLL1_400M, imx_clk_fixed_factor(dev, "sys_pll1_400m", "sys_pll1_out", 1, 2));
+	clk_dm(IMX8MP_SYS_PLL1_800M, imx_clk_fixed_factor(dev, "sys_pll1_800m", "sys_pll1_out", 1, 1));
+
+	clk_dm(IMX8MP_SYS_PLL2_50M, imx_clk_fixed_factor(dev, "sys_pll2_50m", "sys_pll2_out", 1, 20));
+	clk_dm(IMX8MP_SYS_PLL2_100M, imx_clk_fixed_factor(dev, "sys_pll2_100m", "sys_pll2_out", 1, 10));
+	clk_dm(IMX8MP_SYS_PLL2_125M, imx_clk_fixed_factor(dev, "sys_pll2_125m", "sys_pll2_out", 1, 8));
+	clk_dm(IMX8MP_SYS_PLL2_166M, imx_clk_fixed_factor(dev, "sys_pll2_166m", "sys_pll2_out", 1, 6));
+	clk_dm(IMX8MP_SYS_PLL2_200M, imx_clk_fixed_factor(dev, "sys_pll2_200m", "sys_pll2_out", 1, 5));
+	clk_dm(IMX8MP_SYS_PLL2_250M, imx_clk_fixed_factor(dev, "sys_pll2_250m", "sys_pll2_out", 1, 4));
+	clk_dm(IMX8MP_SYS_PLL2_333M, imx_clk_fixed_factor(dev, "sys_pll2_333m", "sys_pll2_out", 1, 3));
+	clk_dm(IMX8MP_SYS_PLL2_500M, imx_clk_fixed_factor(dev, "sys_pll2_500m", "sys_pll2_out", 1, 2));
+	clk_dm(IMX8MP_SYS_PLL2_1000M, imx_clk_fixed_factor(dev, "sys_pll2_1000m", "sys_pll2_out", 1, 1));
 
 	ret = clk_get_by_name(dev, "osc_24m", &osc_24m_clk);
 	if (ret)
@@ -313,7 +313,7 @@ static int imx8mp_clk_probe(struct udevice *dev)
 	clk_dm(IMX8MP_CLK_WDOG, imx8m_clk_composite(dev, "wdog", imx8mp_wdog_sels, base + 0xb900));
 	clk_dm(IMX8MP_CLK_USDHC3, imx8m_clk_composite(dev, "usdhc3", imx8mp_usdhc3_sels, base + 0xbc80));
 
-	clk_dm(IMX8MP_CLK_DRAM_ALT_ROOT, imx_clk_fixed_factor("dram_alt_root", "dram_alt", 1, 4));
+	clk_dm(IMX8MP_CLK_DRAM_ALT_ROOT, imx_clk_fixed_factor(dev, "dram_alt_root", "dram_alt", 1, 4));
 	clk_dm(IMX8MP_CLK_DRAM_CORE, imx_clk_mux2_flags(dev, "dram_core_clk", base + 0x9800, 24, 1, imx8mp_dram_core_sels, ARRAY_SIZE(imx8mp_dram_core_sels), CLK_IS_CRITICAL));
 
 	clk_dm(IMX8MP_CLK_DRAM1_ROOT, imx_clk_gate4_flags(dev, "dram1_root_clk", "dram_core_clk", base + 0x4050, 0, CLK_IS_CRITICAL));
drivers/clk/imx/clk-imx8mq.c +19 -19
index 7632ffe72e7..fe6cba19758 100644
@@ -275,42 +275,42 @@ static int imx8mq_clk_probe(struct udevice *dev)
 
 	/* SYS PLL fixed output */
 	clk_dm(IMX8MQ_SYS1_PLL_40M,
-	       imx_clk_fixed_factor("sys_pll1_40m", "sys_pll1_out", 1, 20));
+	       imx_clk_fixed_factor(dev, "sys_pll1_40m", "sys_pll1_out", 1, 20));
 	clk_dm(IMX8MQ_SYS1_PLL_80M,
-	       imx_clk_fixed_factor("sys_pll1_80m", "sys_pll1_out", 1, 10));
+	       imx_clk_fixed_factor(dev, "sys_pll1_80m", "sys_pll1_out", 1, 10));
 	clk_dm(IMX8MQ_SYS1_PLL_100M,
-	       imx_clk_fixed_factor("sys_pll1_100m", "sys_pll1_out", 1, 8));
+	       imx_clk_fixed_factor(dev, "sys_pll1_100m", "sys_pll1_out", 1, 8));
 	clk_dm(IMX8MQ_SYS1_PLL_133M,
-	       imx_clk_fixed_factor("sys_pll1_133m", "sys_pll1_out", 1, 6));
+	       imx_clk_fixed_factor(dev, "sys_pll1_133m", "sys_pll1_out", 1, 6));
 	clk_dm(IMX8MQ_SYS1_PLL_160M,
-	       imx_clk_fixed_factor("sys_pll1_160m", "sys_pll1_out", 1, 5));
+	       imx_clk_fixed_factor(dev, "sys_pll1_160m", "sys_pll1_out", 1, 5));
 	clk_dm(IMX8MQ_SYS1_PLL_200M,
-	       imx_clk_fixed_factor("sys_pll1_200m", "sys_pll1_out", 1, 4));
+	       imx_clk_fixed_factor(dev, "sys_pll1_200m", "sys_pll1_out", 1, 4));
 	clk_dm(IMX8MQ_SYS1_PLL_266M,
-	       imx_clk_fixed_factor("sys_pll1_266m", "sys_pll1_out", 1, 3));
+	       imx_clk_fixed_factor(dev, "sys_pll1_266m", "sys_pll1_out", 1, 3));
 	clk_dm(IMX8MQ_SYS1_PLL_400M,
-	       imx_clk_fixed_factor("sys_pll1_400m", "sys_pll1_out", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll1_400m", "sys_pll1_out", 1, 2));
 	clk_dm(IMX8MQ_SYS1_PLL_800M,
-	       imx_clk_fixed_factor("sys_pll1_800m", "sys_pll1_out", 1, 1));
+	       imx_clk_fixed_factor(dev, "sys_pll1_800m", "sys_pll1_out", 1, 1));
 
 	clk_dm(IMX8MQ_SYS2_PLL_50M,
-	       imx_clk_fixed_factor("sys_pll2_50m", "sys_pll2_out", 1, 20));
+	       imx_clk_fixed_factor(dev, "sys_pll2_50m", "sys_pll2_out", 1, 20));
 	clk_dm(IMX8MQ_SYS2_PLL_100M,
-	       imx_clk_fixed_factor("sys_pll2_100m", "sys_pll2_out", 1, 10));
+	       imx_clk_fixed_factor(dev, "sys_pll2_100m", "sys_pll2_out", 1, 10));
 	clk_dm(IMX8MQ_SYS2_PLL_125M,
-	       imx_clk_fixed_factor("sys_pll2_125m", "sys_pll2_out", 1, 8));
+	       imx_clk_fixed_factor(dev, "sys_pll2_125m", "sys_pll2_out", 1, 8));
 	clk_dm(IMX8MQ_SYS2_PLL_166M,
-	       imx_clk_fixed_factor("sys_pll2_166m", "sys_pll2_out", 1, 6));
+	       imx_clk_fixed_factor(dev, "sys_pll2_166m", "sys_pll2_out", 1, 6));
 	clk_dm(IMX8MQ_SYS2_PLL_200M,
-	       imx_clk_fixed_factor("sys_pll2_200m", "sys_pll2_out", 1, 5));
+	       imx_clk_fixed_factor(dev, "sys_pll2_200m", "sys_pll2_out", 1, 5));
 	clk_dm(IMX8MQ_SYS2_PLL_250M,
-	       imx_clk_fixed_factor("sys_pll2_250m", "sys_pll2_out", 1, 4));
+	       imx_clk_fixed_factor(dev, "sys_pll2_250m", "sys_pll2_out", 1, 4));
 	clk_dm(IMX8MQ_SYS2_PLL_333M,
-	       imx_clk_fixed_factor("sys_pll2_333m", "sys_pll2_out", 1, 3));
+	       imx_clk_fixed_factor(dev, "sys_pll2_333m", "sys_pll2_out", 1, 3));
 	clk_dm(IMX8MQ_SYS2_PLL_500M,
-	       imx_clk_fixed_factor("sys_pll2_500m", "sys_pll2_out", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll2_500m", "sys_pll2_out", 1, 2));
 	clk_dm(IMX8MQ_SYS2_PLL_1000M,
-	       imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1));
+	       imx_clk_fixed_factor(dev, "sys_pll2_1000m", "sys_pll2_out", 1, 1));
 
 	clk_dm(IMX8MQ_CLK_MON_AUDIO_PLL1_DIV,
 	       imx_clk_divider(dev, "audio_pll1_out_monitor", "audio_pll1_bypass", base + 0x78, 0, 3));
@@ -482,7 +482,7 @@ static int imx8mq_clk_probe(struct udevice *dev)
 			     base + 0x40a0, 0));
 
 	clk_dm(IMX8MQ_CLK_DRAM_ALT_ROOT,
-	       imx_clk_fixed_factor("dram_alt_root", "dram_alt", 1, 4));
+	       imx_clk_fixed_factor(dev, "dram_alt_root", "dram_alt", 1, 4));
 
 	return 0;
 }
drivers/clk/imx/clk-imx93.c +3 -3
index 0caec91fd9a..c3112968c17 100644
@@ -291,15 +291,15 @@ static int imx93_clk_probe(struct udevice *dev)
 	clk_dm(IMX93_CLK_SYS_PLL_PFD0,
 	       clk_register_fixed_rate(NULL, "sys_pll_pfd0", 1000000000));
 	clk_dm(IMX93_CLK_SYS_PLL_PFD0_DIV2,
-	       imx_clk_fixed_factor("sys_pll_pfd0_div2", "sys_pll_pfd0", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll_pfd0_div2", "sys_pll_pfd0", 1, 2));
 	clk_dm(IMX93_CLK_SYS_PLL_PFD1,
 	       clk_register_fixed_rate(NULL, "sys_pll_pfd1", 800000000));
 	clk_dm(IMX93_CLK_SYS_PLL_PFD1_DIV2,
-	       imx_clk_fixed_factor("sys_pll_pfd1_div2", "sys_pll_pfd1", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll_pfd1_div2", "sys_pll_pfd1", 1, 2));
 	clk_dm(IMX93_CLK_SYS_PLL_PFD2,
 	       clk_register_fixed_rate(NULL, "sys_pll_pfd2", 625000000));
 	clk_dm(IMX93_CLK_SYS_PLL_PFD2_DIV2,
-	       imx_clk_fixed_factor("sys_pll_pfd2_div2", "sys_pll_pfd2", 1, 2));
+	       imx_clk_fixed_factor(dev, "sys_pll_pfd2_div2", "sys_pll_pfd2", 1, 2));
 
 	anatop_base = (void *)ANATOP_BASE_ADDR;
 
drivers/clk/imx/clk-imxrt1020.c +1 -1
index 775cc73b4db..c14afdaf236 100644
@@ -57,7 +57,7 @@ static int imxrt1020_clk_probe(struct udevice *dev)
 				 CLK_SET_RATE_PARENT));
 
 	clk_dm(IMXRT1020_CLK_PLL3_80M,
-	       imx_clk_fixed_factor("pll3_80m",  "pll3_usb_otg",   1, 6));
+	       imx_clk_fixed_factor(dev, "pll3_80m",  "pll3_usb_otg",   1, 6));
 
 	clk_dm(IMXRT1020_CLK_PLL2_PFD0_352M,
 	       imx_clk_pfd("pll2_pfd0_352m", "pll2_sys", base + 0x100, 0));
drivers/clk/imx/clk-imxrt1050.c +1 -1
index c8ac3103dc9..ba5b48748ef 100644
@@ -92,7 +92,7 @@ static int imxrt1050_clk_probe(struct udevice *dev)
 			       base + 0x170, 30, 2));
 
 	clk_dm(IMXRT1050_CLK_PLL3_80M,
-	       imx_clk_fixed_factor("pll3_80m",  "pll3_usb_otg",   1, 6));
+	       imx_clk_fixed_factor(dev, "pll3_80m",  "pll3_usb_otg",   1, 6));
 
 	clk_dm(IMXRT1050_CLK_PLL2_PFD0_352M,
 	       imx_clk_pfd("pll2_pfd0_352m", "pll2_sys", base + 0x100, 0));
drivers/clk/imx/clk-imxrt1170.c +4 -4
index 043c400559e..3f55d0d0127 100644
@@ -114,11 +114,11 @@ static int imxrt1170_clk_probe(struct udevice *dev)
 	base = (void *)ofnode_get_addr(ofnode_by_compatible(ofnode_null(), "fsl,imxrt-anatop"));
 
 	clk_dm(IMXRT1170_CLK_RCOSC_48M,
-	       imx_clk_fixed_factor("rcosc48M", "rcosc16M", 3, 1));
+	       imx_clk_fixed_factor(dev, "rcosc48M", "rcosc16M", 3, 1));
 	clk_dm(IMXRT1170_CLK_RCOSC_400M,
-	       imx_clk_fixed_factor("rcosc400M",  "rcosc16M", 25, 1));
+	       imx_clk_fixed_factor(dev, "rcosc400M",  "rcosc16M", 25, 1));
 	clk_dm(IMXRT1170_CLK_RCOSC_48M_DIV2,
-	       imx_clk_fixed_factor("rcosc48M_div2",  "rcosc48M", 1, 2));
+	       imx_clk_fixed_factor(dev, "rcosc48M_div2",  "rcosc48M", 1, 2));
 
 	clk_dm(IMXRT1170_CLK_PLL_ARM,
 	       imx_clk_pllv3(dev, IMX_PLLV3_SYS, "pll_arm", "osc",
@@ -149,7 +149,7 @@ static int imxrt1170_clk_probe(struct udevice *dev)
 	       imx_clk_pfd("pll2_pfd3", "pll2_sys", base + 0x270, 3));
 
 	clk_dm(IMXRT1170_CLK_PLL3_DIV2,
-	       imx_clk_fixed_factor("pll3_div2", "pll3_sys", 1, 2));
+	       imx_clk_fixed_factor(dev, "pll3_div2", "pll3_sys", 1, 2));
 
 	/* CCM clocks */
 	base = dev_read_addr_ptr(dev);
drivers/clk/imx/clk.h +4 -3
index 32fa832f856..7d14dbc395f 100644
@@ -131,10 +131,11 @@ static inline struct clk *imx_clk_gate4_flags(struct udevice *dev, const char *n
 			reg, shift, 0x3, 0, NULL);
 }
 
-static inline struct clk *imx_clk_fixed_factor(const char *name,
-		const char *parent, unsigned int mult, unsigned int div)
+static inline struct clk *
+imx_clk_fixed_factor(struct udevice *dev, const char *name, const char *parent,
+		     unsigned int mult, unsigned int div)
 {
-	return clk_register_fixed_factor(NULL, name, parent,
+	return clk_register_fixed_factor(dev, name, parent,
 			CLK_SET_RATE_PARENT, mult, div);
 }
 
Signature · 1 line
2.47.2
Tested-by on the v2 series
#51 lore raw
In reply to Marek Vasut
Quoted 51 lines · Marek Vasut

Add clk_resolve_parent_clk() to resolve parent clock udevice name based on clock-names DT property. This is used in SoC clock drivers to look up the clock name in clock tables, which matches a clock name in DT clock-names property, and convert it into udevice name which is used by U-Boot clock framework to look up parent clock in e.g. clk_register() using uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);

Pass struct udevice pointer through the various iMX clock drivers.

Marek Vasut (24):
clk: Add clk_resolve_parent_clk()
clk: clk-mux: Fold clk_register_mux()
clk: clk-mux: Use struct udevice instead of struct device
clk: clk-mux: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_mux*()
clk: imx: Pass struct udevice to clk_register_mux()
clk: clk-gate: Use struct udevice instead of struct device
clk: clk-gate: Resolve parent clock by name
clk: imx: gate2: Use struct udevice instead of struct device
clk: imx: gate2: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_gate*()
clk: imx: Pass struct udevice to clk_register_gate*()
clk: clk-composite: Use struct udevice instead of struct device
clk: clk-composite: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_composite*()
clk: imx: Convert clock-osc-* back to osc_*
clk: imx: Pass struct udevice into imx_clk_pllv3*()
clk: imx: pllv3: Resolve parent clock by name
clk: clk-divider: Use struct udevice instead of struct device
clk: imx: Pass struct udevice into imx_clk_divider*()
clk: clk-divider: Resolve parent clock by name
clk: clk-fixed-factor: Use struct udevice instead of struct device
clk: clk-fixed-factor: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_fixed_factor*()

 drivers/clk/clk-composite.c        |   4 +-
 drivers/clk/clk-divider.c          |   7 +-
 drivers/clk/clk-fixed-factor.c     |   6 +-
 drivers/clk/clk-gate.c             |   5 +-
 drivers/clk/clk-mux.c              |  47 +---
 drivers/clk/clk-uclass.c           |  18 ++
 drivers/clk/imx/clk-composite-8m.c |   4 +-
 drivers/clk/imx/clk-gate2.c        |   5 +-
 drivers/clk/imx/clk-imx6q.c        |  80 +++----
 drivers/clk/imx/clk-imx8mm.c       | 254 +++++++++++----------
 drivers/clk/imx/clk-imx8mn.c       | 246 ++++++++++----------
 drivers/clk/imx/clk-imx8mp.c       | 348 ++++++++++++++---------------
 drivers/clk/imx/clk-imx8mq.c       | 226 +++++++++----------
 drivers/clk/imx/clk-imx93.c        |   8 +-
Quoted 8 lines
 drivers/clk/imx/clk-imxrt1020.c    |  42 ++--
 drivers/clk/imx/clk-imxrt1050.c    |  78 +++----
 drivers/clk/imx/clk-imxrt1170.c    |  30 +--
 drivers/clk/imx/clk-pllv3.c        |   9 +-
 drivers/clk/imx/clk.h              | 116 +++++-----
 include/clk.h                      |   9 +
 include/linux/clk-provider.h       |  10 +-
 21 files changed, 783 insertions(+), 769 deletions(-)

For the series:

Quoted 17 lines

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

--
2.47.2

#52 lore raw
Quoted 62 lines · Adam Ford
Quoted 51 lines · Marek Vasut

Add clk_resolve_parent_clk() to resolve parent clock udevice name based on clock-names DT property. This is used in SoC clock drivers to look up the clock name in clock tables, which matches a clock name in DT clock-names property, and convert it into udevice name which is used by U-Boot clock framework to look up parent clock in e.g. clk_register() using uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);

Pass struct udevice pointer through the various iMX clock drivers.

Marek Vasut (24):
clk: Add clk_resolve_parent_clk()
clk: clk-mux: Fold clk_register_mux()
clk: clk-mux: Use struct udevice instead of struct device
clk: clk-mux: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_mux*()
clk: imx: Pass struct udevice to clk_register_mux()
clk: clk-gate: Use struct udevice instead of struct device
clk: clk-gate: Resolve parent clock by name
clk: imx: gate2: Use struct udevice instead of struct device
clk: imx: gate2: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_gate*()
clk: imx: Pass struct udevice to clk_register_gate*()
clk: clk-composite: Use struct udevice instead of struct device
clk: clk-composite: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_composite*()
clk: imx: Convert clock-osc-* back to osc_*
clk: imx: Pass struct udevice into imx_clk_pllv3*()
clk: imx: pllv3: Resolve parent clock by name
clk: clk-divider: Use struct udevice instead of struct device
clk: imx: Pass struct udevice into imx_clk_divider*()
clk: clk-divider: Resolve parent clock by name
clk: clk-fixed-factor: Use struct udevice instead of struct device
clk: clk-fixed-factor: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_fixed_factor*()

  drivers/clk/clk-composite.c        |   4 +-
  drivers/clk/clk-divider.c          |   7 +-
  drivers/clk/clk-fixed-factor.c     |   6 +-
  drivers/clk/clk-gate.c             |   5 +-
  drivers/clk/clk-mux.c              |  47 +---
  drivers/clk/clk-uclass.c           |  18 ++
  drivers/clk/imx/clk-composite-8m.c |   4 +-
  drivers/clk/imx/clk-gate2.c        |   5 +-
  drivers/clk/imx/clk-imx6q.c        |  80 +++----
  drivers/clk/imx/clk-imx8mm.c       | 254 +++++++++++----------
  drivers/clk/imx/clk-imx8mn.c       | 246 ++++++++++----------
  drivers/clk/imx/clk-imx8mp.c       | 348 ++++++++++++++---------------
  drivers/clk/imx/clk-imx8mq.c       | 226 +++++++++----------
  drivers/clk/imx/clk-imx93.c        |   8 +-
Quoted 8 lines
  drivers/clk/imx/clk-imxrt1020.c    |  42 ++--
  drivers/clk/imx/clk-imxrt1050.c    |  78 +++----
  drivers/clk/imx/clk-imxrt1170.c    |  30 +--
  drivers/clk/imx/clk-pllv3.c        |   9 +-
  drivers/clk/imx/clk.h              | 116 +++++-----
  include/clk.h                      |   9 +
  include/linux/clk-provider.h       |  10 +-
  21 files changed, 783 insertions(+), 769 deletions(-)
Quoted 3 lines

For the series:

Thank you !

Acked-by on the v2 series
#53 lore raw
In reply to Marek Vasut
Quoted 9 lines · Marek Vasut

Add clk_resolve_parent_clk() to resolve parent clock udevice name based on clock-names DT property. This is used in SoC clock drivers to look up the clock name in clock tables, which matches a clock name in DT clock-names property, and convert it into udevice name which is used by U-Boot clock framework to look up parent clock in e.g. clk_register() using uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);

Pass struct udevice pointer through the various iMX clock drivers.

Thanks for the effort.

BTW: this could only fix partial of the current clk code.

The current clock framework is kind of a bit mess. There is more issue is not support multiple clk provider, name should be unique.

I was thinking to drop using device for clk, following linux clk driver to use a clk_hw structure for each clk.

Regards,
Peng

Quoted 66 lines

Marek Vasut (24):
clk: Add clk_resolve_parent_clk()
clk: clk-mux: Fold clk_register_mux()
clk: clk-mux: Use struct udevice instead of struct device
clk: clk-mux: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_mux*()
clk: imx: Pass struct udevice to clk_register_mux()
clk: clk-gate: Use struct udevice instead of struct device
clk: clk-gate: Resolve parent clock by name
clk: imx: gate2: Use struct udevice instead of struct device
clk: imx: gate2: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_gate*()
clk: imx: Pass struct udevice to clk_register_gate*()
clk: clk-composite: Use struct udevice instead of struct device
clk: clk-composite: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_composite*()
clk: imx: Convert clock-osc-* back to osc_*
clk: imx: Pass struct udevice into imx_clk_pllv3*()
clk: imx: pllv3: Resolve parent clock by name
clk: clk-divider: Use struct udevice instead of struct device
clk: imx: Pass struct udevice into imx_clk_divider*()
clk: clk-divider: Resolve parent clock by name
clk: clk-fixed-factor: Use struct udevice instead of struct device
clk: clk-fixed-factor: Resolve parent clock by name
clk: imx: Pass struct udevice into imx_clk_fixed_factor*()

drivers/clk/clk-composite.c        |   4 +-
drivers/clk/clk-divider.c          |   7 +-
drivers/clk/clk-fixed-factor.c     |   6 +-
drivers/clk/clk-gate.c             |   5 +-
drivers/clk/clk-mux.c              |  47 +---
drivers/clk/clk-uclass.c           |  18 ++
drivers/clk/imx/clk-composite-8m.c |   4 +-
drivers/clk/imx/clk-gate2.c        |   5 +-
drivers/clk/imx/clk-imx6q.c        |  80 +++----
drivers/clk/imx/clk-imx8mm.c       | 254 +++++++++++----------
drivers/clk/imx/clk-imx8mn.c       | 246 ++++++++++----------
drivers/clk/imx/clk-imx8mp.c       | 348 ++++++++++++++---------------
drivers/clk/imx/clk-imx8mq.c       | 226 +++++++++----------
drivers/clk/imx/clk-imx93.c        |   8 +-
drivers/clk/imx/clk-imxrt1020.c    |  42 ++--
drivers/clk/imx/clk-imxrt1050.c    |  78 +++----
drivers/clk/imx/clk-imxrt1170.c    |  30 +--
drivers/clk/imx/clk-pllv3.c        |   9 +-
drivers/clk/imx/clk.h              | 116 +++++-----
include/clk.h                      |   9 +
include/linux/clk-provider.h       |  10 +-
21 files changed, 783 insertions(+), 769 deletions(-)

---
Cc: Adam Ford <[email protected]>
Cc: Christoph Niedermaier <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Hou Zhiqiang <[email protected]>
Cc: Michael Trimarchi <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

Signature · 1 line
2.47.2
reviewer
#54 lore raw
In reply to Marek Vasut
Quoted 10 lines · Marek Vasut

Add clk_resolve_parent_clk() to resolve parent clock udevice name based on clock-names DT property. This is used in SoC clock drivers to look up the clock name in clock tables, which matches a clock name in DT clock-names property, and convert it into udevice name which is used by U-Boot clock framework to look up parent clock in e.g. clk_register() using uclass_get_device_by_name(UCLASS_CLK, parent_name, &parent);

Pass struct udevice pointer through the various iMX clock drivers.

Applied to u-boot-imx/next, thanks.