Skip to contentSkip to conversation

mtd: nand: mxc_nand: use clk_get_optional for clock handling

PATCH Applied Alexander Shiyan 2 participants 2 messages Jan 14 – Jan 16

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

PATCH 1/1 mtd: nand: mxc_nand: use clk_get_optional for clock handling

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.

---
 drivers/mtd/nand/raw/mxc_nand.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/mxc_nand.c +2 -1
index de2ad2a028..e328eb0815 100644
@@ -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);
 
Signature · 1 line
2.52.0
maintainer Applied
#1 lore raw
Quoted 9 lines · Alexander Shiyan

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.

[...]

Applied, thanks!

[1/1] mtd: nand: mxc_nand: use clk_get_optional for clock handling
https://git.pengutronix.de/cgit/barebox/commit/?id=092a3f95537b (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>