[PATCH] clk: imx6q: guard LDB clock init with CONFIG_SPL_BUILD

Md Shofiqul Islam shofiqtest at gmail.com
Sun May 17 11:35:47 CEST 2026


of_assigned_ldb_sels() and imx6q_init_ldb_clks() are called from
imx6q_clk_probe() which runs in SPL. SPL never initialises a display,
so pulling LDB clock selection code into SPL is unnecessary and causes
an SPL SRAM overflow of 112 bytes with the i.MX6Q LDB clock series.

Guard both functions with #if !defined(CONFIG_SPL_BUILD) to exclude
them from the SPL image. IS_ENABLED() cannot guard function definitions
so #if is intentional here. This reduces SPL text by ~688 bytes and
unblocks the patch series CI.

Signed-off-by: Md Shofiqul Islam <shofiqtest at gmail.com>
---
 drivers/clk/imx/clk-imx6q.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index a4649a1a9d9..379155096e8 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -156,6 +156,7 @@ static struct clk_div_table video_div_table[] = {
 
 static unsigned int share_count_mipi_core_cfg;
 
+#if !defined(CONFIG_SPL_BUILD)
 static void of_assigned_ldb_sels(struct udevice *dev, int *ldb_di0_sel,
 				 int *ldb_di1_sel)
 {
@@ -270,6 +271,7 @@ static void imx6q_init_ldb_clks(struct udevice *dev)
 
 	select_ldb_di_clock_source(ldb_di_clk[0], ldb_di_clk[1]);
 }
+#endif /* !CONFIG_SPL_BUILD */
 
 static int imx6q_clk_probe(struct udevice *dev)
 {
@@ -488,7 +490,9 @@ static int imx6q_clk_probe(struct udevice *dev)
 		 * Need to set the clocks now and make them read-only due to a
 		 * hardware bug. Fixed on the i.MX6 QuadPlus
 		 */
+#if !defined(CONFIG_SPL_BUILD)
 		imx6q_init_ldb_clks(dev);
+#endif
 		clk_dm(IMX6QDL_CLK_LDB_DI0_SEL,
 		       imx_clk_mux_flags(dev, "ldb_di0_sel", base + 0x2c, 9, 3,
 					 ldb_di_sels, ARRAY_SIZE(ldb_di_sels),
-- 
2.51.1



More information about the U-Boot mailing list