[PATCH v2025.09.y 21/58] mtd: nand: mxc_nand: use clk_get_optional for clock handling
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Mar 13 06:25:05 PDT 2026
From: Alexander Shiyan <eagle.alexander923 at gmail.com>
On some platforms like i.MX51, the clock driver does not support GATE clocks,
and the clocks are always on. The current driver uses clk_get which fails
when the clock is not found, preventing the driver from probing.
This patch changes clk_get to clk_get_optional, allowing the driver to
continue probing even if the clock is not provided, assuming it is always
enabled.
(cherry picked from commit 092a3f95537b80c60bb9138cb4b3a7df1f751ed2)
Signed-off-by: Alexander Shiyan <eagle.alexander923 at gmail.com>
Link: https://lore.barebox.org/20260114100923.1164051-1-eagle.alexander923@gmail.com
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/mtd/nand/raw/mxc_nand.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index de2ad2a028cb..e328eb0815c7 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -1809,7 +1809,8 @@ static int mxcnd_probe(struct device *dev)
nand_set_controller_data(this, host);
nand_set_flash_node(this, dev->of_node);
- host->clk = clk_get(dev, NULL);
+ /* Clock support might not be implemented, so use the optional variant */
+ host->clk = clk_get_optional(dev, NULL);
if (IS_ERR(host->clk))
return PTR_ERR(host->clk);
--
2.47.3
More information about the barebox
mailing list