Skip to contentSkip to conversation

clk: imx: add i.MX6UL clk driver

PATCH Superseded Michael Trimarchi 3 participants 10 messages May 26, 2025 – Jun 29, 2025

Subsystems (5)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 clk: imx: add i.MX6UL clk driver

Add i.MX6UL clk driver for i.MX6UL CLK driver model usage

---

Changes in v2:
- Add review tag

 drivers/clk/imx/Kconfig      |   8 ++
 drivers/clk/imx/Makefile     |   1 +
 drivers/clk/imx/clk-imx6ul.c | 270 +++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx6ul.c
drivers/clk/imx/Kconfig +8 -0
index d17a54fb9b3..705d4a8e2ac 100644
@@ -14,6 +14,14 @@ config CLK_IMX6Q
 	help
 	  This enables DM/DTS support for clock driver in i.MX6Q platforms.
 
+config CLK_IMX6UL
+	bool "Clock support for i.MXUL"
+	depends on ARCH_MX6
+	select CLK
+	select CLK_CCF
+	help
+	  This enables DM/DTS support for clock driver in i.MX6UL platforms.
+
 config CLK_IMX8
 	bool "Clock support for i.MX8"
 	depends on ARCH_IMX8
drivers/clk/imx/Makefile +1 -0
index a89ee7acb12..b10221a195c 100644
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk-gate2.o clk-pllv3.o clk-pfd.o
 obj-$(CONFIG_$(PHASE_)CLK_IMX6Q) += clk-imx6q.o
+obj-$(CONFIG_$(PHASE_)CLK_IMX6UL) += clk-imx6ul.o
 obj-$(CONFIG_CLK_IMX8) += clk-imx8.o
 
 ifdef CONFIG_CLK_IMX8
drivers/clk/imx/clk-imx6ul.c new file +270 -0

270 lines not on this page · raw message

Signature · 3 lines
2.43.0

base-commit: df2ed552f0b05591090369a7fe7ddc92439dea5c
#1 lore raw

PATCH v2 2/4 mtd: mxs_nand_dt: Move from clk_get/clk_enable to clk_bulk api

Make simple the clock registration and enable and allow later to add support for other platforms

---

Changes in v2:
- no changes

 drivers/mtd/nand/raw/mxs_nand_dt.c | 48 ++++--------------------------
 1 file changed, 5 insertions(+), 43 deletions(-)
drivers/mtd/nand/raw/mxs_nand_dt.c +5 -43
index 11dbcbbf442..b62474bc5ab 100644
@@ -100,9 +100,7 @@ static int mxs_nand_dt_probe(struct udevice *dev)
 
 	if (IS_ENABLED(CONFIG_CLK) &&
 	    (IS_ENABLED(CONFIG_IMX8) || IS_ENABLED(CONFIG_IMX8M))) {
-		/* Assigned clock already set clock */
-		struct clk gpmi_clk;
-
+		struct clk_bulk clk_bulk;
 		info->gpmi_clk = devm_clk_get(dev, "gpmi_io");
 
 		if (IS_ERR(info->gpmi_clk)) {
@@ -111,47 +109,11 @@ static int mxs_nand_dt_probe(struct udevice *dev)
 			return ret;
 		}
 
-		ret = clk_enable(info->gpmi_clk);
-		if (ret < 0) {
-			debug("Can't enable gpmi io clk: %d\n", ret);
-			return ret;
-		}
-
-		if (IS_ENABLED(CONFIG_IMX8)) {
-			ret = clk_get_by_name(dev, "gpmi_apb", &gpmi_clk);
-			if (ret < 0) {
-				debug("Can't get gpmi_apb clk: %d\n", ret);
-				return ret;
-			}
-
-			ret = clk_enable(&gpmi_clk);
-			if (ret < 0) {
-				debug("Can't enable gpmi_apb clk: %d\n", ret);
-				return ret;
-			}
-
-			ret = clk_get_by_name(dev, "gpmi_bch", &gpmi_clk);
-			if (ret < 0) {
-				debug("Can't get gpmi_bch clk: %d\n", ret);
-				return ret;
-			}
-
-			ret = clk_enable(&gpmi_clk);
-			if (ret < 0) {
-				debug("Can't enable gpmi_bch clk: %d\n", ret);
-				return ret;
-			}
-		}
-
-		ret = clk_get_by_name(dev, "gpmi_bch_apb", &gpmi_clk);
-		if (ret < 0) {
-			debug("Can't get gpmi_bch_apb clk: %d\n", ret);
-			return ret;
-		}
-
-		ret = clk_enable(&gpmi_clk);
+		ret = clk_get_bulk(dev, &clk_bulk);
+		if (!ret)
+			ret = clk_enable_bulk(&clk_bulk);
 		if (ret < 0) {
-			debug("Can't enable gpmi_bch_apb clk: %d\n", ret);
+			debug("Can't enable gpmi clks: %d\n", ret);
 			return ret;
 		}
 	}
Signature · 3 lines
2.43.0

base-commit: df2ed552f0b05591090369a7fe7ddc92439dea5c
#2 lore raw

PATCH v2 3/4 mtd: nand: Add support for EDO mode 1-5 to IMX6ULL platform

In reply to Michael Trimarchi

The clock driver allows to boost the NAND performance controller. Make changes to let it use the new clock driver

=> time nand read ${loadaddr} kernel

NAND read: device 0 offset 0x500000, size 0x800000
8388608 bytes read: OK

time: 0.488 seconds

---

Changes in v2:
- Adjust commit message and include speed test result
- remove not needed { }

 drivers/mtd/nand/raw/mxs_nand.c    | 10 ++++++++++
 drivers/mtd/nand/raw/mxs_nand_dt.c |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/mxs_nand.c +10 -0
index 80d9307cdd1..ba67466069b 100644
@@ -1507,8 +1507,18 @@ static void mxs_compute_timings(struct nand_chip *chip,
 	writel(GPMI_CTRL1_CLEAR_MASK, &nand_info->gpmi_regs->hw_gpmi_ctrl1_clr);
 	writel(ctrl1n, &nand_info->gpmi_regs->hw_gpmi_ctrl1_set);
 
+	/* Clock dividers do NOT guarantee a clean clock signal on its output
+	 * during the change of the divide factor on i.MX6Q/UL/SX. On i.MX7/8,
+	 * all clock dividers provide these guarantee.
+	 */
+	if (IS_ENABLED(CONFIG_MX6ULL))
+		clk_disable(nand_info->gpmi_clk);
+
 	clk_set_rate(nand_info->gpmi_clk, clk_rate);
 
+	if (IS_ENABLED(CONFIG_MX6ULL))
+		clk_enable(nand_info->gpmi_clk);
+
 	/* Wait 64 clock cycles before using the GPMI after enabling the DLL */
 	dll_wait_time_us = USEC_PER_SEC / clk_rate * 64;
 	if (!dll_wait_time_us)
drivers/mtd/nand/raw/mxs_nand_dt.c +1 -1
index b62474bc5ab..90eefa2558d 100644
@@ -99,7 +99,7 @@ static int mxs_nand_dt_probe(struct udevice *dev)
 	info->use_minimum_ecc = dev_read_bool(dev, "fsl,use-minimum-ecc");
 
 	if (IS_ENABLED(CONFIG_CLK) &&
-	    (IS_ENABLED(CONFIG_IMX8) || IS_ENABLED(CONFIG_IMX8M))) {
+	    (IS_ENABLED(CONFIG_IMX8) || IS_ENABLED(CONFIG_IMX8M) || IS_ENABLED(CONFIG_MX6ULL))) {
 		struct clk_bulk clk_bulk;
 		info->gpmi_clk = devm_clk_get(dev, "gpmi_io");
 
Signature · 3 lines
2.43.0

base-commit: df2ed552f0b05591090369a7fe7ddc92439dea5c
reviewer
#3 lore raw

Re: [PATCH v2 3/4] mtd: nand: Add support for EDO mode 1-5 to IMX6ULL platform

Hi Michael,

Quoted 10 lines · Michael Trimarchi

The clock driver allows to boost the NAND performance controller. Make changes to let it use the new clock driver

=> time nand read ${loadaddr} kernel

NAND read: device 0 offset 0x500000, size 0x800000
8388608 bytes read: OK

time: 0.488 seconds

Out of curiosity: what was the original read time without the clock driver being used?

#4 lore raw

Re: [PATCH v2 3/4] mtd: nand: Add support for EDO mode 1-5 to IMX6ULL platform

Hi Fabio

Quoted 11 lines · Fabio Estevam

Hi Michael,

Quoted 6 lines · Michael Trimarchi

The clock driver allows to boost the NAND performance controller. Make changes to let it use the new clock driver

=> time nand read ${loadaddr} kernel

Quoted 7 lines
Quoted 4 lines

NAND read: device 0 offset 0x500000, size 0x800000
8388608 bytes read: OK

time: 0.488 seconds

Out of curiosity: what was the original read time without the clock driver being used?

The downstream driver I made 2 years ago before this change was around 3/3.5mB/sec, if I remember correctly.
One point all the IMX6 platforms can then be migrated but I don't have any board with me.

Michael

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#5 lore raw

Re: [PATCH v2 3/4] mtd: nand: Add support for EDO mode 1-5 to IMX6ULL platform

Hi Fabio

Are you going to pick up my last series?

Michael

Quoted 43 lines · Michael Nazzareno Trimarchi

Hi Fabio

Quoted 11 lines · Fabio Estevam

Hi Michael,

Quoted 6 lines · Michael Trimarchi

The clock driver allows to boost the NAND performance controller. Make changes to let it use the new clock driver

=> time nand read ${loadaddr} kernel

Quoted 7 lines
Quoted 4 lines

NAND read: device 0 offset 0x500000, size 0x800000
8388608 bytes read: OK

time: 0.488 seconds

Out of curiosity: what was the original read time without the clock driver being used?

The downstream driver I made 2 years ago before this change was around 3/3.5mB/sec, if I remember correctly.
One point all the IMX6 platforms can then be migrated but I don't have any board with me.

Michael

--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
reviewer
#6 lore raw

Re: [PATCH v2 3/4] mtd: nand: Add support for EDO mode 1-5 to IMX6ULL platform

Quoted 4 lines · Michael Nazzareno Trimarchi

Hi Fabio

Are you going to pick up my last series?

This series is already in the u-boot/next branch.

#7 lore raw

PATCH v2 4/4 configs/imx6ulz_smm_m2_defconfig: Enable clock framework

In reply to Michael Trimarchi

Enable the clock framework on the m2 platform. This helps to increase the NAND controller performance.

---

Changes in v2:
- Ajust commit message
- drop CONFIG_DM_MTD selected already by MXS_NAND_DT

 configs/imx6ulz_smm_m2_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/imx6ulz_smm_m2_defconfig +2 -0
index 436bfb78cc2..6e425d6e52d 100644
@@ -43,6 +43,8 @@ CONFIG_ENV_IS_IN_NAND=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NO_NET=y
 CONFIG_BOUNCE_BUFFER=y
+CONFIG_CLK_COMPOSITE_CCF=y
+CONFIG_CLK_IMX6UL=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x82000000
 CONFIG_FASTBOOT_FLASH=y
Signature · 3 lines
2.43.0

base-commit: df2ed552f0b05591090369a7fe7ddc92439dea5c
#8 lore raw
In reply to Michael Trimarchi

From: U-Boot <[email protected]> On Behalf Of Michael Trimarchi
Sent: Monday, May 26, 2025 9:48 PM

Hello,

Quoted 115 lines

Subject: [PATCH v2 1/4] clk: imx: add i.MX6UL clk driver

Add i.MX6UL clk driver for i.MX6UL CLK driver model usage

---

Changes in v2:
- Add review tag

 drivers/clk/imx/Kconfig      |   8 ++
 drivers/clk/imx/Makefile     |   1 +
 drivers/clk/imx/clk-imx6ul.c | 270 +++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx6ul.c
drivers/clk/imx/Kconfig +8 -0
index d17a54fb9b3..705d4a8e2ac 100644
@@ -14,6 +14,14 @@ config CLK_IMX6Q
 	help
 	  This enables DM/DTS support for clock driver in i.MX6Q platforms.
 
+config CLK_IMX6UL
+	bool "Clock support for i.MXUL"
+	depends on ARCH_MX6
+	select CLK
+	select CLK_CCF
+	help
+	  This enables DM/DTS support for clock driver in i.MX6UL platforms.
+
 config CLK_IMX8
 	bool "Clock support for i.MX8"
 	depends on ARCH_IMX8
drivers/clk/imx/Makefile +1 -0
index a89ee7acb12..b10221a195c 100644
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk-gate2.o clk-pllv3.o clk-pfd.o
 obj-$(CONFIG_$(PHASE_)CLK_IMX6Q) += clk-imx6q.o
+obj-$(CONFIG_$(PHASE_)CLK_IMX6UL) += clk-imx6ul.o
 obj-$(CONFIG_CLK_IMX8) += clk-imx8.o
 
 ifdef CONFIG_CLK_IMX8
drivers/clk/imx/clk-imx6ul.c new file +4 -0
new file mode 100644
index 00000000000..941c9352248
@@ -0,0 +1,270 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 Amarula Solutions Software Engineering
+ * Michael Trimarchi, Amarula Solutions Software Engineering,

[email protected]
+ */

drivers/clk/imx/clk-imx6ul.c new file +36 -0
+
+#include <clk-uclass.h>
+#include <dm.h>
+#include <log.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
+#include <dt-bindings/clock/imx6ul-clock.h>
+
+#include "clk.h"
+
+static int imx6ul_clk_request(struct clk *clk)
+{
+	debug("%s: request clk id %ld\n", __func__, clk->id);
+
+	if (clk->id < IMX6UL_CLK_DUMMY || clk->id >= IMX6UL_CLK_END) {
+		printf("%s: Invalid clk ID #%lu\n", __func__, clk->id);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static struct clk_ops imx6ul_clk_ops = {
+	.request = imx6ul_clk_request,
+	.set_rate = ccf_clk_set_rate,
+	.get_rate = ccf_clk_get_rate,
+	.enable = ccf_clk_enable,
+	.disable = ccf_clk_disable,
+};
+
+static const char *const pll_bypass_src_sels[] = { "osc", "dummy", };
+static const char *const pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", };
+static const char *const bch_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
+static const char *const gpmi_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
+
+static const char *const enfc_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg",

"pll2_pfd2_396m",

drivers/clk/imx/clk-imx6ul.c new file +4 -0
+					 "pll3_pfd3_454m", "dummy", "dummy", "dummy", };
+static const char *const usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
+static const char *const periph_sels[] = { "periph_pre", "periph_clk2", };
+static const char *const periph2_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m",

"pll2_pfd0_352m",

drivers/clk/imx/clk-imx6ul.c new file +2 -0
+						"pll4_audio_div", };
+static const char *const periph_clk2_sels[] = { "pll3_usb_otg", "osc", "pll2_bypass_src",

};

drivers/clk/imx/clk-imx6ul.c new file +4 -0
+static const char *const periph2_clk2_sels[] = { "pll3_usb_otg", "osc", };
+static const char *const perclk_sels[] = { "ipg", "osc", };
+
+static const char *const periph_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m",

"pll2_pfd0_352m",

drivers/clk/imx/clk-imx6ul.c new file +4 -0
+					       "pll2_198m", };
+static const char *const uart_sels[] = { "pll3_80m", "osc", };
+static const char *const ecspi_sels[] = { "pll3_60m", "osc", };
+

drivers/clk/imx/clk-imx6ul.c line 65

Quoted 10 lines
drivers/clk/imx/clk-imx6ul.c new file +10 -0
+static int imx6ul_clk_probe(struct udevice *dev)
+{
+	struct clk osc_clk;
+	void *base;
+	int ret;
+
+	/* Anatop clocks */
+	base = (void *)ANATOP_BASE_ADDR;
+
+	clk_dm(IMX6UL_CLK_DUMMY, clk_register_fixed_rate(NULL, "dummy", 0));

I think you should move your clk_get_by_name of "osc" etc. from below to this place, because you refer to it in the next lines.

drivers/clk/imx/clk-imx6ul.c line 72

Quoted 6 lines
drivers/clk/imx/clk-imx6ul.c new file +6 -0
+	clk_dm(IMX6UL_CLK_PLL2,
+	       imx_clk_pllv3(dev, IMX_PLLV3_GENERIC, "pll2_bus", "osc",
+			     base + 0x30, 0x1));
+	clk_dm(IMX6UL_CLK_PLL3_USB_OTG,
+	       imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3_bypass", "osc",
+			     base + 0x10, 0x3));

From my point of view the line with "pll3_bypass" here looks not correct and should be removed.

drivers/clk/imx/clk-imx6ul.c line 75

Quoted 3 lines
drivers/clk/imx/clk-imx6ul.c new file +3 -0
+	clk_dm(IMX6UL_CLK_PLL3,
+	       imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3", "osc",
+			     base + 0x10, 0x3));

I think you should move your definition of "pll3_bypass_src" and "pll3_bypass" from below to this place, because you refer to it in the next lines.

Quoted 133 lines
drivers/clk/imx/clk-imx6ul.c new file +133 -0
+	clk_dm(IMX6UL_CLK_PLL3_USB_OTG,
+	       imx_clk_gate(dev, "pll3_usb_otg", "pll3_bypass", base + 0x10,
+			    13));
+	clk_dm(IMX6UL_CLK_PLL3_80M,
+	       imx_clk_fixed_factor(dev, "pll3_80m", "pll3_usb_otg", 1, 6));
+	clk_dm(IMX6UL_CLK_PLL3_60M,
+	       imx_clk_fixed_factor(dev, "pll3_60m", "pll3_usb_otg", 1, 8));
+	clk_dm(IMX6UL_CLK_PLL2_PFD0,
+	       imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0));
+	clk_dm(IMX6UL_CLK_PLL2_PFD1,
+	       imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1));
+	clk_dm(IMX6UL_CLK_PLL2_PFD2,
+	       imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2));
+	clk_dm(IMX6UL_CLK_PLL2_PFD3,
+	       imx_clk_pfd("pll2_pfd3_396m", "pll2_bus", base + 0x100, 3));
+	clk_dm(IMX6UL_CLK_PLL6,
+	       imx_clk_pllv3(dev, IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0,
+			     0x3));
+	clk_dm(IMX6UL_CLK_PLL6_ENET,
+	       imx_clk_gate(dev, "pll6_enet", "pll6", base + 0xe0, 13));
+	clk_dm(IMX6UL_PLL3_BYPASS_SRC,
+	       imx_clk_mux(dev, "pll3_bypass_src", base + 0x10, 14, 1,
+			   pll_bypass_src_sels,
+			   ARRAY_SIZE(pll_bypass_src_sels)));
+	clk_dm(IMX6UL_PLL3_BYPASS,
+	       imx_clk_mux_flags(dev, "pll3_bypass", base + 0x10, 16, 1,
+				 pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels),
+				 CLK_SET_RATE_PARENT));
+
+	ret = clk_get_by_name(dev, "osc", &osc_clk);
+	if (ret)
+		return ret;
+	clk_dm(IMX6UL_CLK_OSC, dev_get_clk_ptr(osc_clk.dev));
+
+	/* CCM clocks */
+	base = dev_read_addr_ptr(dev);
+	if (!base)
+		return -EINVAL;
+
+	clk_dm(IMX6UL_CLK_GPMI_SEL,
+	       imx_clk_mux(dev, "gpmi_sel", base + 0x1c, 19, 1, gpmi_sels,
+			   ARRAY_SIZE(gpmi_sels)));
+	clk_dm(IMX6UL_CLK_BCH_SEL,
+	       imx_clk_mux(dev, "bch_sel", base + 0x1c, 18, 1, bch_sels,
+			   ARRAY_SIZE(bch_sels)));
+	clk_dm(IMX6UL_CLK_USDHC1_SEL,
+	       imx_clk_mux(dev, "usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels,
+			   ARRAY_SIZE(usdhc_sels)));
+	clk_dm(IMX6UL_CLK_USDHC2_SEL,
+	       imx_clk_mux(dev, "usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels,
+			   ARRAY_SIZE(usdhc_sels)));
+	clk_dm(IMX6UL_CLK_ECSPI_SEL,
+	       imx_clk_mux(dev, "ecspi_sel", base + 0x38, 18, 1, ecspi_sels,
+			   ARRAY_SIZE(ecspi_sels)));
+	clk_dm(IMX6UL_CLK_UART_SEL,
+	       imx_clk_mux(dev, "uart_sel", base + 0x24, 6, 1, uart_sels,
+			   ARRAY_SIZE(uart_sels)));
+	clk_dm(IMX6UL_CLK_ENFC_SEL,
+	       imx_clk_mux(dev, "enfc_sel", base + 0x2c, 15, 3, enfc_sels,
+			   ARRAY_SIZE(enfc_sels)));
+	clk_dm(IMX6UL_CLK_PERCLK_SEL,
+	       imx_clk_mux(dev, "perclk_sel", base + 0x1c, 6, 1, perclk_sels,
+			   ARRAY_SIZE(perclk_sels)));
+	clk_dm(IMX6UL_CLK_PERIPH_PRE,
+	       imx_clk_mux(dev, "periph_pre", base + 0x18, 18, 2,
+			   periph_pre_sels, ARRAY_SIZE(periph_pre_sels)));
+	clk_dm(IMX6UL_CLK_PERIPH2_PRE,
+	       imx_clk_mux(dev, "periph2_pre", base + 0x18, 21, 2,
+			   periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)));
+	clk_dm(IMX6UL_CLK_PERIPH_CLK2_SEL,
+	       imx_clk_mux(dev, "periph_clk2_sel", base + 0x18, 12, 2,
+			   periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)));
+	clk_dm(IMX6UL_CLK_PERIPH2_CLK2_SEL,
+	       imx_clk_mux(dev, "periph2_clk2_sel", base + 0x18, 20, 1,
+			   periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)));
+	clk_dm(IMX6UL_CLK_PERIPH,
+	       imx_clk_busy_mux(dev, "periph", base + 0x14, 25, 1, base + 0x48,
+				5, periph_sels, ARRAY_SIZE(periph_sels)));
+	clk_dm(IMX6UL_CLK_AHB,
+	       imx_clk_busy_divider(dev, "ahb", "periph", base + 0x14, 10, 3,
+				    base + 0x48, 1));
+	clk_dm(IMX6UL_CLK_PERIPH_CLK2,
+	       imx_clk_divider(dev, "periph_clk2", "periph_clk2_sel",
+			       base + 0x14, 27, 3));
+	clk_dm(IMX6UL_CLK_PERIPH2_CLK2,
+	       imx_clk_divider(dev, "periph2_clk2", "periph2_clk2_sel",
+			       base + 0x14, 0, 3));
+	clk_dm(IMX6UL_CLK_IPG,
+	       imx_clk_divider(dev, "ipg", "ahb", base + 0x14, 8, 2));
+	clk_dm(IMX6UL_CLK_ENFC_PRED,
+	       imx_clk_divider(dev, "enfc_pred", "enfc_sel", base + 0x2c, 18,
+			       3));
+	clk_dm(IMX6UL_CLK_ENFC_PODF,
+	       imx_clk_divider(dev, "enfc_podf", "enfc_pred", base + 0x2c, 21,
+			       6));
+	clk_dm(IMX6UL_CLK_GPMI_PODF,
+	       imx_clk_divider(dev, "gpmi_podf", "gpmi_sel", base + 0x24, 22,
+			       3));
+	clk_dm(IMX6UL_CLK_BCH_PODF,
+	       imx_clk_divider(dev, "bch_podf", "bch_sel", base + 0x24, 19, 3));
+	clk_dm(IMX6UL_CLK_PERCLK,
+	       imx_clk_divider(dev, "perclk", "perclk_sel", base + 0x1c, 0, 6));
+	clk_dm(IMX6UL_CLK_UART_PODF,
+	       imx_clk_divider(dev, "uart_podf", "uart_sel", base + 0x24, 0,
+			       6));
+	clk_dm(IMX6UL_CLK_USDHC1_PODF,
+	       imx_clk_divider(dev, "usdhc1_podf", "usdhc1_sel", base + 0x24,
+			       11, 3));
+	clk_dm(IMX6UL_CLK_USDHC2_PODF,
+	       imx_clk_divider(dev, "usdhc2_podf", "usdhc2_sel", base + 0x24,
+			       16, 3));
+	clk_dm(IMX6UL_CLK_ECSPI_PODF,
+	       imx_clk_divider(dev, "ecspi_podf", "ecspi_sel", base + 0x38, 19,
+			       6));
+
+	clk_dm(IMX6UL_CLK_APBHDMA,
+	       imx_clk_gate2(dev, "apbh_dma", "bch_podf", base + 0x68, 4));
+	clk_dm(IMX6UL_CLK_ECSPI1,
+	       imx_clk_gate2(dev, "ecspi1", "ecspi_podf", base + 0x6c, 0));
+	clk_dm(IMX6UL_CLK_ECSPI2,
+	       imx_clk_gate2(dev, "ecspi2", "ecspi_podf", base + 0x6c, 2));
+	clk_dm(IMX6UL_CLK_ECSPI3,
+	       imx_clk_gate2(dev, "ecspi3", "ecspi_podf", base + 0x6c, 4));
+	clk_dm(IMX6UL_CLK_ECSPI4,
+	       imx_clk_gate2(dev, "ecspi4", "ecspi_podf", base + 0x6c, 6));
+
+	clk_dm(IMX6UL_CLK_USBOH3,
+	       imx_clk_gate2(dev, "usboh3", "ipg", base + 0x80, 0));
+	clk_dm(IMX6UL_CLK_USDHC1,
+	       imx_clk_gate2(dev, "usdhc1", "usdhc1_podf", base + 0x80, 2));
+	clk_dm(IMX6UL_CLK_USDHC2,
+	       imx_clk_gate2(dev, "usdhc2", "usdhc2_podf", base + 0x80, 4));
+

drivers/clk/imx/clk-imx6ul.c line 219

Quoted 10 lines
drivers/clk/imx/clk-imx6ul.c new file +10 -0
+	clk_dm(IMX6UL_CLK_UART3_IPG,
+	       imx_clk_gate2(dev, "uart3_ipg", "ipg", base + 0x6c, 10));
+	clk_dm(IMX6UL_CLK_UART3_SERIAL,
+	       imx_clk_gate2(dev, "uart3_serial", "uart_podf", base + 0x6c,
+			     10));
+	clk_dm(IMX6UL_CLK_UART4_IPG,
+	       imx_clk_gate2(dev, "uart4_ipg", "ipg", base + 0x6c, 24));
+	clk_dm(IMX6UL_CLK_UART4_SERIAL,
+	       imx_clk_gate2(dev, "uart4_serial", "uart_podf", base + 0x6c,
+			     24));

My Console doesn't work with this driver, because it is on UART1. Could you define all UARTs for imx6UL/i.MX6ULL/i.MX6ULZ here?

clk_dm(IMX6UL_CLK_UART1_IPG,

       imx_clk_gate2(dev, "uart1_ipg", "ipg", base + 0x7c, 24));
clk_dm(IMX6UL_CLK_UART1_SERIAL,
       imx_clk_gate2(dev, "uart1_serial", "uart_podf", base + 0x7c, 24));
clk_dm(IMX6UL_CLK_UART2_IPG,
       imx_clk_gate2(dev, "uart2_ipg", "ipg", base + 0x68, 28));
clk_dm(IMX6UL_CLK_UART2_SERIAL,
       imx_clk_gate2(dev, "uart2_serial", "uart_podf", base + 0x68, 28));
clk_dm(IMX6UL_CLK_UART3_IPG,
       imx_clk_gate2(dev, "uart3_ipg", "ipg", base + 0x6c, 10));
clk_dm(IMX6UL_CLK_UART3_SERIAL,
       imx_clk_gate2(dev, "uart3_serial", "uart_podf", base + 0x6c, 10));
clk_dm(IMX6UL_CLK_UART4_IPG,
       imx_clk_gate2(dev, "uart4_ipg", "ipg", base + 0x6c, 24));
clk_dm(IMX6UL_CLK_UART4_SERIAL,
       imx_clk_gate2(dev, "uart4_serial", "uart_podf", base + 0x6c, 24));
clk_dm(IMX6UL_CLK_UART5_IPG,
       imx_clk_gate2(dev, "uart5_ipg", "ipg", base + 0x74, 2));
clk_dm(IMX6UL_CLK_UART5_SERIAL,
       imx_clk_gate2(dev, "uart5_serial", "uart_podf", base + 0x74, 2));
clk_dm(IMX6UL_CLK_UART6_IPG,
       imx_clk_gate2(dev, "uart6_ipg", "ipg", base + 0x74, 6));
clk_dm(IMX6UL_CLK_UART6_SERIAL,
       imx_clk_gate2(dev, "uart6_serial", "uart_podf", base + 0x74, 6));
clk_dm(IMX6UL_CLK_UART7_IPG,
       imx_clk_gate2(dev, "uart7_ipg", "ipg", base + 0x7c, 26));
clk_dm(IMX6UL_CLK_UART7_SERIAL,
       imx_clk_gate2(dev, "uart7_serial", "uart_podf", base + 0x7c, 26));
clk_dm(IMX6UL_CLK_UART8_IPG,
       imx_clk_gate2(dev, "uart8_ipg", "ipg", base + 0x80, 14));
clk_dm(IMX6UL_CLK_UART8_SERIAL,
       imx_clk_gate2(dev, "uart8_serial", "uart_podf", base + 0x80, 14));

Regards
Christoph

#9 lore raw

Hi

Quoted 126 lines · Christoph Niedermaier

From: U-Boot <[email protected]> On Behalf Of Michael Trimarchi
Sent: Monday, May 26, 2025 9:48 PM

Hello,

Quoted 120 lines

Subject: [PATCH v2 1/4] clk: imx: add i.MX6UL clk driver

Add i.MX6UL clk driver for i.MX6UL CLK driver model usage

---

Changes in v2:
- Add review tag

 drivers/clk/imx/Kconfig      |   8 ++
 drivers/clk/imx/Makefile     |   1 +
 drivers/clk/imx/clk-imx6ul.c | 270 +++++++++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx6ul.c
drivers/clk/imx/Kconfig +8 -0
index d17a54fb9b3..705d4a8e2ac 100644
@@ -14,6 +14,14 @@ config CLK_IMX6Q
      help
        This enables DM/DTS support for clock driver in i.MX6Q platforms.
 
+config CLK_IMX6UL
+     bool "Clock support for i.MXUL"
+     depends on ARCH_MX6
+     select CLK
+     select CLK_CCF
+     help
+       This enables DM/DTS support for clock driver in i.MX6UL platforms.
+
 config CLK_IMX8
      bool "Clock support for i.MX8"
      depends on ARCH_IMX8
drivers/clk/imx/Makefile +1 -0
index a89ee7acb12..b10221a195c 100644
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_$(PHASE_)CLK_CCF) += clk-gate2.o clk-pllv3.o clk-pfd.o
 obj-$(CONFIG_$(PHASE_)CLK_IMX6Q) += clk-imx6q.o
+obj-$(CONFIG_$(PHASE_)CLK_IMX6UL) += clk-imx6ul.o
 obj-$(CONFIG_CLK_IMX8) += clk-imx8.o
 
 ifdef CONFIG_CLK_IMX8
drivers/clk/imx/clk-imx6ul.c new file +4 -0
new file mode 100644
index 00000000000..941c9352248
@@ -0,0 +1,270 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2025 Amarula Solutions Software Engineering
+ * Michael Trimarchi, Amarula Solutions Software Engineering,

[email protected]
+ */

drivers/clk/imx/clk-imx6ul.c new file +36 -0
+
+#include <clk-uclass.h>
+#include <dm.h>
+#include <log.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
+#include <dt-bindings/clock/imx6ul-clock.h>
+
+#include "clk.h"
+
+static int imx6ul_clk_request(struct clk *clk)
+{
+     debug("%s: request clk id %ld\n", __func__, clk->id);
+
+     if (clk->id < IMX6UL_CLK_DUMMY || clk->id >= IMX6UL_CLK_END) {
+             printf("%s: Invalid clk ID #%lu\n", __func__, clk->id);
+             return -EINVAL;
+     }
+
+     return 0;
+}
+
+static struct clk_ops imx6ul_clk_ops = {
+     .request = imx6ul_clk_request,
+     .set_rate = ccf_clk_set_rate,
+     .get_rate = ccf_clk_get_rate,
+     .enable = ccf_clk_enable,
+     .disable = ccf_clk_disable,
+};
+
+static const char *const pll_bypass_src_sels[] = { "osc", "dummy", };
+static const char *const pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", };
+static const char *const bch_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
+static const char *const gpmi_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
+
+static const char *const enfc_sels[] = { "pll2_pfd0_352m", "pll2_bus", "pll3_usb_otg",

"pll2_pfd2_396m",

drivers/clk/imx/clk-imx6ul.c new file +4 -0
+                                      "pll3_pfd3_454m", "dummy", "dummy", "dummy", };
+static const char *const usdhc_sels[] = { "pll2_pfd2_396m", "pll2_pfd0_352m", };
+static const char *const periph_sels[] = { "periph_pre", "periph_clk2", };
+static const char *const periph2_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m",

"pll2_pfd0_352m",

drivers/clk/imx/clk-imx6ul.c new file +2 -0
+                                             "pll4_audio_div", };
+static const char *const periph_clk2_sels[] = { "pll3_usb_otg", "osc", "pll2_bypass_src",

};

drivers/clk/imx/clk-imx6ul.c new file +4 -0
+static const char *const periph2_clk2_sels[] = { "pll3_usb_otg", "osc", };
+static const char *const perclk_sels[] = { "ipg", "osc", };
+
+static const char *const periph_pre_sels[] = { "pll2_bus", "pll2_pfd2_396m",

"pll2_pfd0_352m",

drivers/clk/imx/clk-imx6ul.c new file +9 -0
+                                            "pll2_198m", };
+static const char *const uart_sels[] = { "pll3_80m", "osc", };
+static const char *const ecspi_sels[] = { "pll3_60m", "osc", };
+
+static int imx6ul_clk_probe(struct udevice *dev)
+{
+     struct clk osc_clk;
+     void *base;
+     int ret;
Quoted 8 lines

drivers/clk/imx/clk-imx6ul.c line 65

Quoted 5 lines
drivers/clk/imx/clk-imx6ul.c new file +5 -0
+
+     /* Anatop clocks */
+     base = (void *)ANATOP_BASE_ADDR;
+
+     clk_dm(IMX6UL_CLK_DUMMY, clk_register_fixed_rate(NULL, "dummy", 0));

I think you should move your clk_get_by_name of "osc" etc. from below to this place, because you refer to it in the next lines.

Ok

Quoted 10 lines

drivers/clk/imx/clk-imx6ul.c line 72

Quoted 7 lines
drivers/clk/imx/clk-imx6ul.c new file +6 -0
+     clk_dm(IMX6UL_CLK_PLL2,
+            imx_clk_pllv3(dev, IMX_PLLV3_GENERIC, "pll2_bus", "osc",
+                          base + 0x30, 0x1));
+     clk_dm(IMX6UL_CLK_PLL3_USB_OTG,
+            imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3_bypass", "osc",
+                          base + 0x10, 0x3));

From my point of view the line with "pll3_bypass" here looks not correct and should be removed.

I need to check but please give more info about it. I have only one design so, I have based most of the clk driver on what I can test

Quoted 8 lines

drivers/clk/imx/clk-imx6ul.c line 75

Quoted 4 lines
drivers/clk/imx/clk-imx6ul.c new file +3 -0
+     clk_dm(IMX6UL_CLK_PLL3,
+            imx_clk_pllv3(dev, IMX_PLLV3_USB, "pll3", "osc",
+                          base + 0x10, 0x3));

I think you should move your definition of "pll3_bypass_src" and "pll3_bypass" from below to this place, because you refer to it in the next lines.

Ok

Quoted 138 lines
Quoted 138 lines
drivers/clk/imx/clk-imx6ul.c new file +138 -0
+     clk_dm(IMX6UL_CLK_PLL3_USB_OTG,
+            imx_clk_gate(dev, "pll3_usb_otg", "pll3_bypass", base + 0x10,
+                         13));
+     clk_dm(IMX6UL_CLK_PLL3_80M,
+            imx_clk_fixed_factor(dev, "pll3_80m", "pll3_usb_otg", 1, 6));
+     clk_dm(IMX6UL_CLK_PLL3_60M,
+            imx_clk_fixed_factor(dev, "pll3_60m", "pll3_usb_otg", 1, 8));
+     clk_dm(IMX6UL_CLK_PLL2_PFD0,
+            imx_clk_pfd("pll2_pfd0_352m", "pll2_bus", base + 0x100, 0));
+     clk_dm(IMX6UL_CLK_PLL2_PFD1,
+            imx_clk_pfd("pll2_pfd1_594m", "pll2_bus", base + 0x100, 1));
+     clk_dm(IMX6UL_CLK_PLL2_PFD2,
+            imx_clk_pfd("pll2_pfd2_396m", "pll2_bus", base + 0x100, 2));
+     clk_dm(IMX6UL_CLK_PLL2_PFD3,
+            imx_clk_pfd("pll2_pfd3_396m", "pll2_bus", base + 0x100, 3));
+     clk_dm(IMX6UL_CLK_PLL6,
+            imx_clk_pllv3(dev, IMX_PLLV3_ENET, "pll6", "osc", base + 0xe0,
+                          0x3));
+     clk_dm(IMX6UL_CLK_PLL6_ENET,
+            imx_clk_gate(dev, "pll6_enet", "pll6", base + 0xe0, 13));
+     clk_dm(IMX6UL_PLL3_BYPASS_SRC,
+            imx_clk_mux(dev, "pll3_bypass_src", base + 0x10, 14, 1,
+                        pll_bypass_src_sels,
+                        ARRAY_SIZE(pll_bypass_src_sels)));
+     clk_dm(IMX6UL_PLL3_BYPASS,
+            imx_clk_mux_flags(dev, "pll3_bypass", base + 0x10, 16, 1,
+                              pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels),
+                              CLK_SET_RATE_PARENT));
+
+     ret = clk_get_by_name(dev, "osc", &osc_clk);
+     if (ret)
+             return ret;
+     clk_dm(IMX6UL_CLK_OSC, dev_get_clk_ptr(osc_clk.dev));
+
+     /* CCM clocks */
+     base = dev_read_addr_ptr(dev);
+     if (!base)
+             return -EINVAL;
+
+     clk_dm(IMX6UL_CLK_GPMI_SEL,
+            imx_clk_mux(dev, "gpmi_sel", base + 0x1c, 19, 1, gpmi_sels,
+                        ARRAY_SIZE(gpmi_sels)));
+     clk_dm(IMX6UL_CLK_BCH_SEL,
+            imx_clk_mux(dev, "bch_sel", base + 0x1c, 18, 1, bch_sels,
+                        ARRAY_SIZE(bch_sels)));
+     clk_dm(IMX6UL_CLK_USDHC1_SEL,
+            imx_clk_mux(dev, "usdhc1_sel", base + 0x1c, 16, 1, usdhc_sels,
+                        ARRAY_SIZE(usdhc_sels)));
+     clk_dm(IMX6UL_CLK_USDHC2_SEL,
+            imx_clk_mux(dev, "usdhc2_sel", base + 0x1c, 17, 1, usdhc_sels,
+                        ARRAY_SIZE(usdhc_sels)));
+     clk_dm(IMX6UL_CLK_ECSPI_SEL,
+            imx_clk_mux(dev, "ecspi_sel", base + 0x38, 18, 1, ecspi_sels,
+                        ARRAY_SIZE(ecspi_sels)));
+     clk_dm(IMX6UL_CLK_UART_SEL,
+            imx_clk_mux(dev, "uart_sel", base + 0x24, 6, 1, uart_sels,
+                        ARRAY_SIZE(uart_sels)));
+     clk_dm(IMX6UL_CLK_ENFC_SEL,
+            imx_clk_mux(dev, "enfc_sel", base + 0x2c, 15, 3, enfc_sels,
+                        ARRAY_SIZE(enfc_sels)));
+     clk_dm(IMX6UL_CLK_PERCLK_SEL,
+            imx_clk_mux(dev, "perclk_sel", base + 0x1c, 6, 1, perclk_sels,
+                        ARRAY_SIZE(perclk_sels)));
+     clk_dm(IMX6UL_CLK_PERIPH_PRE,
+            imx_clk_mux(dev, "periph_pre", base + 0x18, 18, 2,
+                        periph_pre_sels, ARRAY_SIZE(periph_pre_sels)));
+     clk_dm(IMX6UL_CLK_PERIPH2_PRE,
+            imx_clk_mux(dev, "periph2_pre", base + 0x18, 21, 2,
+                        periph2_pre_sels, ARRAY_SIZE(periph2_pre_sels)));
+     clk_dm(IMX6UL_CLK_PERIPH_CLK2_SEL,
+            imx_clk_mux(dev, "periph_clk2_sel", base + 0x18, 12, 2,
+                        periph_clk2_sels, ARRAY_SIZE(periph_clk2_sels)));
+     clk_dm(IMX6UL_CLK_PERIPH2_CLK2_SEL,
+            imx_clk_mux(dev, "periph2_clk2_sel", base + 0x18, 20, 1,
+                        periph2_clk2_sels, ARRAY_SIZE(periph2_clk2_sels)));
+     clk_dm(IMX6UL_CLK_PERIPH,
+            imx_clk_busy_mux(dev, "periph", base + 0x14, 25, 1, base + 0x48,
+                             5, periph_sels, ARRAY_SIZE(periph_sels)));
+     clk_dm(IMX6UL_CLK_AHB,
+            imx_clk_busy_divider(dev, "ahb", "periph", base + 0x14, 10, 3,
+                                 base + 0x48, 1));
+     clk_dm(IMX6UL_CLK_PERIPH_CLK2,
+            imx_clk_divider(dev, "periph_clk2", "periph_clk2_sel",
+                            base + 0x14, 27, 3));
+     clk_dm(IMX6UL_CLK_PERIPH2_CLK2,
+            imx_clk_divider(dev, "periph2_clk2", "periph2_clk2_sel",
+                            base + 0x14, 0, 3));
+     clk_dm(IMX6UL_CLK_IPG,
+            imx_clk_divider(dev, "ipg", "ahb", base + 0x14, 8, 2));
+     clk_dm(IMX6UL_CLK_ENFC_PRED,
+            imx_clk_divider(dev, "enfc_pred", "enfc_sel", base + 0x2c, 18,
+                            3));
+     clk_dm(IMX6UL_CLK_ENFC_PODF,
+            imx_clk_divider(dev, "enfc_podf", "enfc_pred", base + 0x2c, 21,
+                            6));
+     clk_dm(IMX6UL_CLK_GPMI_PODF,
+            imx_clk_divider(dev, "gpmi_podf", "gpmi_sel", base + 0x24, 22,
+                            3));
+     clk_dm(IMX6UL_CLK_BCH_PODF,
+            imx_clk_divider(dev, "bch_podf", "bch_sel", base + 0x24, 19, 3));
+     clk_dm(IMX6UL_CLK_PERCLK,
+            imx_clk_divider(dev, "perclk", "perclk_sel", base + 0x1c, 0, 6));
+     clk_dm(IMX6UL_CLK_UART_PODF,
+            imx_clk_divider(dev, "uart_podf", "uart_sel", base + 0x24, 0,
+                            6));
+     clk_dm(IMX6UL_CLK_USDHC1_PODF,
+            imx_clk_divider(dev, "usdhc1_podf", "usdhc1_sel", base + 0x24,
+                            11, 3));
+     clk_dm(IMX6UL_CLK_USDHC2_PODF,
+            imx_clk_divider(dev, "usdhc2_podf", "usdhc2_sel", base + 0x24,
+                            16, 3));
+     clk_dm(IMX6UL_CLK_ECSPI_PODF,
+            imx_clk_divider(dev, "ecspi_podf", "ecspi_sel", base + 0x38, 19,
+                            6));
+
+     clk_dm(IMX6UL_CLK_APBHDMA,
+            imx_clk_gate2(dev, "apbh_dma", "bch_podf", base + 0x68, 4));
+     clk_dm(IMX6UL_CLK_ECSPI1,
+            imx_clk_gate2(dev, "ecspi1", "ecspi_podf", base + 0x6c, 0));
+     clk_dm(IMX6UL_CLK_ECSPI2,
+            imx_clk_gate2(dev, "ecspi2", "ecspi_podf", base + 0x6c, 2));
+     clk_dm(IMX6UL_CLK_ECSPI3,
+            imx_clk_gate2(dev, "ecspi3", "ecspi_podf", base + 0x6c, 4));
+     clk_dm(IMX6UL_CLK_ECSPI4,
+            imx_clk_gate2(dev, "ecspi4", "ecspi_podf", base + 0x6c, 6));
+
+     clk_dm(IMX6UL_CLK_USBOH3,
+            imx_clk_gate2(dev, "usboh3", "ipg", base + 0x80, 0));
+     clk_dm(IMX6UL_CLK_USDHC1,
+            imx_clk_gate2(dev, "usdhc1", "usdhc1_podf", base + 0x80, 2));
+     clk_dm(IMX6UL_CLK_USDHC2,
+            imx_clk_gate2(dev, "usdhc2", "usdhc2_podf", base + 0x80, 4));
+
+     clk_dm(IMX6UL_CLK_UART3_IPG,
+            imx_clk_gate2(dev, "uart3_ipg", "ipg", base + 0x6c, 10));
+     clk_dm(IMX6UL_CLK_UART3_SERIAL,
+            imx_clk_gate2(dev, "uart3_serial", "uart_podf", base + 0x6c,
+                          10));
Quoted 8 lines

drivers/clk/imx/clk-imx6ul.c line 219

Quoted 5 lines
drivers/clk/imx/clk-imx6ul.c new file +5 -0
+     clk_dm(IMX6UL_CLK_UART4_IPG,
+            imx_clk_gate2(dev, "uart4_ipg", "ipg", base + 0x6c, 24));
+     clk_dm(IMX6UL_CLK_UART4_SERIAL,
+            imx_clk_gate2(dev, "uart4_serial", "uart_podf", base + 0x6c,
+                          24));

My Console doesn't work with this driver, because it is on UART1. Could you define all UARTs for imx6UL/i.MX6ULL/i.MX6ULZ here?

Yes I can

Quoted 25 lines

clk_dm(IMX6UL_CLK_UART1_IPG,

       imx_clk_gate2(dev, "uart1_ipg", "ipg", base + 0x7c, 24));
clk_dm(IMX6UL_CLK_UART1_SERIAL,
       imx_clk_gate2(dev, "uart1_serial", "uart_podf", base + 0x7c, 24));
clk_dm(IMX6UL_CLK_UART2_IPG,
       imx_clk_gate2(dev, "uart2_ipg", "ipg", base + 0x68, 28));
clk_dm(IMX6UL_CLK_UART2_SERIAL,
       imx_clk_gate2(dev, "uart2_serial", "uart_podf", base + 0x68, 28));
clk_dm(IMX6UL_CLK_UART3_IPG,
       imx_clk_gate2(dev, "uart3_ipg", "ipg", base + 0x6c, 10));
clk_dm(IMX6UL_CLK_UART3_SERIAL,
       imx_clk_gate2(dev, "uart3_serial", "uart_podf", base + 0x6c, 10));
clk_dm(IMX6UL_CLK_UART4_IPG,
       imx_clk_gate2(dev, "uart4_ipg", "ipg", base + 0x6c, 24));
clk_dm(IMX6UL_CLK_UART4_SERIAL,
       imx_clk_gate2(dev, "uart4_serial", "uart_podf", base + 0x6c, 24));
clk_dm(IMX6UL_CLK_UART5_IPG,
       imx_clk_gate2(dev, "uart5_ipg", "ipg", base + 0x74, 2));
clk_dm(IMX6UL_CLK_UART5_SERIAL,
       imx_clk_gate2(dev, "uart5_serial", "uart_podf", base + 0x74, 2));
clk_dm(IMX6UL_CLK_UART6_IPG,
       imx_clk_gate2(dev, "uart6_ipg", "ipg", base + 0x74, 6));
clk_dm(IMX6UL_CLK_UART6_SERIAL,
       imx_clk_gate2(dev, "uart6_serial", "uart_podf", base + 0x74, 6));
Quoted 9 lines

clk_dm(IMX6UL_CLK_UART7_IPG,

       imx_clk_gate2(dev, "uart7_ipg", "ipg", base + 0x7c, 26));
clk_dm(IMX6UL_CLK_UART7_SERIAL,
       imx_clk_gate2(dev, "uart7_serial", "uart_podf", base + 0x7c, 26));
clk_dm(IMX6UL_CLK_UART8_IPG,
       imx_clk_gate2(dev, "uart8_ipg", "ipg", base + 0x80, 14));
clk_dm(IMX6UL_CLK_UART8_SERIAL,
       imx_clk_gate2(dev, "uart8_serial", "uart_podf", base + 0x80, 14));

I have an imx6ulz, so be patient but I can add them but I can not test them at all.
I will check tonight what else to add but I was thinking of letting other people contribute
more using their board.

Michael

Quoted 2 lines

Regards
Christoph

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com