All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Eichenberger <eichest@gmail.com>
To: trini@konsulko.com, ilias.apalodimas@linaro.org,
	peng.fan@nxp.com, jh80.chung@samsung.com,
	tanmay.kathpalia@altera.com, sbabic@nabladev.com,
	festevam@gmail.com, uboot-imx@nxp.com,
	francesco.dolcini@toradex.com, lukma@nabladev.com,
	dlechner@baylibre.com, msp@baylibre.com,
	stefan.eichenberger@toradex.com, Max.Merchel@ew.tq-group.com,
	nora.schiffer@ew.tq-group.com, primoz.fiser@norik.com,
	jbx6244@gmail.com, aford173@gmail.com,
	cniedermaier@dh-electronics.com
Cc: u-boot@lists.u-boot-project.org
Subject: [PATCH v1 7/7] board: toradex: colibri-imx6ull: enable the clock framework
Date: Fri, 20 Nov 2026 12:10:13 +0100	[thread overview]
Message-ID: <20261120111037.110741-8-eichest@gmail.com> (raw)
In-Reply-To: <20261120111037.110741-1-eichest@gmail.com>

From: Francesco Dolcini <francesco.dolcini@toradex.com>

The PHY supply is a regulator-fixed-clock, and since commit a5d990854f2c
("regulator: fixed: fix regulator-fixed-clock") gave that driver a probe
hook calling devm_clk_get() it cannot probe without CONFIG_CLK, so its
150ms startup delay is skipped and the first FEC probe finds no PHY.
Enable the clock framework, which also makes the hand-rolled FEC clock
setup redundant. The ENET2 reference clock selector (gpr1[14]) is now
the IMX6UL_CLK_ENET2_REF_SEL clock, its parent set through
assigned-clock-parents. Only the ENET2_TX_CLK direction (gpr1[18]),
which no clock models, stays in board code.

Drop setup_gpmi_nand() as well. The regulator probe now probes the CCM
in initr_dm, before board_init(), and the CCM driver sets ENFC_SEL to
pll2_pfd2. setup_gpmi_io_clk() then writes MXC_CCM_CS2CDR_ENFC_CLK_SEL(3),
which on i.MX6ULL only covers bits 17:16 of the 3-bit field, leaving
ENFC_SEL at the reserved value 7 behind the back of the clock framework.
The GPMI loses its clock and every NAND command times out. With the
clock framework the CCM driver selects the ENFC parent and the mxs_nand
driver enables the GPMI clocks and sets their rate.

The serial driver probes the CCM before relocation, and the ~80 clocks it
registers need around 13 KiB from the pre-relocation malloc pool, more
than the 8 KiB default. Raise SYS_MALLOC_F_LEN to 32 KiB.

With the clock framework the usdhc, i2c and gpmi drivers take their
rates from the CCM driver instead of mxc_get_clock(), and the usdhc
assigned-clocks in the device tree are now applied.

Tested-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
---
 .../dts/imx6ull-colibri-eval-v3-u-boot.dtsi   |  6 ++++
 .../toradex/colibri-imx6ull/colibri-imx6ull.c | 34 +++----------------
 configs/colibri-imx6ull-emmc_defconfig        |  2 ++
 configs/colibri-imx6ull_defconfig             |  2 ++
 4 files changed, 15 insertions(+), 29 deletions(-)

diff --git a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
index 8494b1a2c60..1712f38edbf 100644
--- a/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
+++ b/arch/arm/dts/imx6ull-colibri-eval-v3-u-boot.dtsi
@@ -29,6 +29,12 @@
 	bootph-all;
 };
 
+/* RMII reference clock from the internal ENET PLL, not from the pad */
+&fec2 {
+	assigned-clocks = <&clks IMX6UL_CLK_ENET2_REF_SEL>;
+	assigned-clock-parents = <&clks IMX6UL_CLK_ENET2_REF_125M>;
+};
+
 &lcdif {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_lcdif_dat
diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
index 01387e87294..ea83d53c27b 100644
--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
@@ -7,10 +7,7 @@
 #include <asm/global_data.h>
 #include <linux/delay.h>
 
-#include <asm/arch/clock.h>
-#include <asm/arch/crm_regs.h>
 #include <asm/arch/imx-regs.h>
-#include <asm/arch-mx6/clock.h>
 #include <asm/arch-mx6/imx-regs.h>
 #include <asm/arch-mx6/mx6ull_pins.h>
 #include <asm/arch/sys_proto.h>
@@ -57,15 +54,6 @@ int dram_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_NAND_MXS
-static void setup_gpmi_nand(void)
-{
-	setup_gpmi_io_clk((MXC_CCM_CS2CDR_ENFC_CLK_PODF(0) |
-			   MXC_CCM_CS2CDR_ENFC_CLK_PRED(3) |
-			   MXC_CCM_CS2CDR_ENFC_CLK_SEL(3)));
-}
-#endif /* CONFIG_NAND_MXS */
-
 #ifdef CONFIG_VIDEO
 static const iomux_v3_cfg_t backlight_pads[] = {
 	/* Backlight On */
@@ -94,25 +82,16 @@ static int setup_lcd(void)
 #endif
 
 #ifdef CONFIG_FEC_MXC
-static int setup_fec(void)
+static void setup_fec(void)
 {
 	struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
-	int ret;
 
 	/*
-	 * Use 50MHz anatop loopback REF_CLK2 for ENET2,
-	 * clear gpr1[14], set gpr1[18].
+	 * Drive the ENET2 reference clock out to the PHY: ENET2_TX_CLK_DIR
+	 * (gpr1[18]) output. The ENET2_CLK_SEL (gpr1[14]) half is the
+	 * IMX6UL_CLK_ENET2_REF_SEL clock, set up from the device tree.
 	 */
-	clrsetbits_le32(&iomuxc_regs->gpr[1], IOMUX_GPR1_FEC2_MASK,
-			IOMUX_GPR1_FEC2_CLOCK_MUX1_SEL_MASK);
-
-	ret = enable_fec_anatop_clock(1, ENET_50MHZ);
-	if (ret)
-		return ret;
-
-	enable_enet_clk(1);
-
-	return 0;
+	setbits_le32(&iomuxc_regs->gpr[1], IOMUX_GPR1_FEC2_CLOCK_MUX1_SEL_MASK);
 }
 #endif /* CONFIG_FEC_MXC */
 
@@ -135,9 +114,6 @@ int board_init(void)
 	setup_fec();
 #endif
 
-#ifdef CONFIG_NAND_MXS
-	setup_gpmi_nand();
-#endif
 	return 0;
 }
 
diff --git a/configs/colibri-imx6ull-emmc_defconfig b/configs/colibri-imx6ull-emmc_defconfig
index c56e9a90bc1..82f1d9e8b83 100644
--- a/configs/colibri-imx6ull-emmc_defconfig
+++ b/configs/colibri-imx6ull-emmc_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_TEXT_BASE=0x87800000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0xFFFFDE00
@@ -64,6 +65,7 @@ CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_CLK_IMX6UL=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_FASTBOOT_BUF_ADDR=0x81100000
 CONFIG_FASTBOOT_UUU_SUPPORT=y
diff --git a/configs/colibri-imx6ull_defconfig b/configs/colibri-imx6ull_defconfig
index d65e5c16957..55990719f28 100644
--- a/configs/colibri-imx6ull_defconfig
+++ b/configs/colibri-imx6ull_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_TEXT_BASE=0x87800000
 CONFIG_SYS_MALLOC_LEN=0x2000000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x20000
 CONFIG_ENV_OFFSET=0x380000
@@ -74,6 +75,7 @@ CONFIG_TFTP_BLOCKSIZE=16352
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOOTCOUNT_LIMIT=y
 CONFIG_BOOTCOUNT_ENV=y
+CONFIG_CLK_IMX6UL=y
 CONFIG_DFU_NAND=y
 CONFIG_SYS_DFU_DATA_BUF_SIZE=0x1000000
 CONFIG_USB_FUNCTION_FASTBOOT=y
-- 
2.56.1


      parent reply	other threads:[~2026-11-20 13:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 11:10 [PATCH v1 0/7] colibri-imx6ull: fix the Ethernet PHY detection Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 1/7] clk: imx: imx6ul: fix the enet clock gate register Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 2/7] clk: imx: pllv3: wait for the ENET PLL to lock Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 3/7] clk: imx: pllv3: do not touch the ENET output gate Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 4/7] clk: imx: imx6ul: add the enet clock tree Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 5/7] board: toradex: colibri-imx6ull: drop the static serial device Stefan Eichenberger
2026-11-20 11:10 ` [PATCH v1 6/7] arm: dts: imx6ull-colibri: migrate to OF_UPSTREAM Stefan Eichenberger
2026-11-20 11:10 ` Stefan Eichenberger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120111037.110741-8-eichest@gmail.com \
    --to=eichest@gmail.com \
    --cc=Max.Merchel@ew.tq-group.com \
    --cc=aford173@gmail.com \
    --cc=cniedermaier@dh-electronics.com \
    --cc=dlechner@baylibre.com \
    --cc=festevam@gmail.com \
    --cc=francesco.dolcini@toradex.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jbx6244@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=lukma@nabladev.com \
    --cc=msp@baylibre.com \
    --cc=nora.schiffer@ew.tq-group.com \
    --cc=peng.fan@nxp.com \
    --cc=primoz.fiser@norik.com \
    --cc=sbabic@nabladev.com \
    --cc=stefan.eichenberger@toradex.com \
    --cc=tanmay.kathpalia@altera.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=uboot-imx@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.