Skip to contentSkip to conversation

mtd: nand: raw: gpmi: fix clocks when CONFIG_PM=N

PATCH Applied Maarten Zanders 2 participants 4 messages Sep 22, 2025 – Sep 29, 2025

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

PATCH 1/1 mtd: nand: raw: gpmi: fix clocks when CONFIG_PM=N

Commit f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling") moved all clock handling into PM callbacks. With CONFIG_PM disabled, those callbacks are missing, leaving the driver unusable.

Add clock init/teardown for !CONFIG_PM builds to restore basic operation. Keeping the driver working without requiring CONFIG_PM is preferred over adding a Kconfig dependency.

Fixes f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling")
---
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +11 -3
index f4e68008ea03..a750f5839e34 100644
@@ -145,6 +145,9 @@ static int __gpmi_enable_clk(struct gpmi_nand_data *this, bool v)
 	return ret;
 }
 
+#define gpmi_enable_clk(x)	__gpmi_enable_clk(x, true)
+#define gpmi_disable_clk(x)	__gpmi_enable_clk(x, false)
+
 static int gpmi_init(struct gpmi_nand_data *this)
 {
 	struct resources *r = &this->resources;
@@ -2765,6 +2768,11 @@ static int gpmi_nand_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
 	pm_runtime_use_autosuspend(&pdev->dev);
+#ifndef CONFIG_PM
+	ret = gpmi_enable_clk(this);
+	if (ret)
+		goto exit_acquire_resources;
+#endif
 
 	ret = gpmi_init(this);
 	if (ret)
@@ -2800,6 +2808,9 @@ static void gpmi_nand_remove(struct platform_device *pdev)
 	release_resources(this);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
+#ifndef CONFIG_PM
+	gpmi_disable_clk(this);
+#endif
 }
 
 static int gpmi_pm_suspend(struct device *dev)
@@ -2846,9 +2857,6 @@ static int gpmi_pm_resume(struct device *dev)
 	return 0;
 }
 
-#define gpmi_enable_clk(x)	__gpmi_enable_clk(x, true)
-#define gpmi_disable_clk(x)	__gpmi_enable_clk(x, false)
-
 static int gpmi_runtime_suspend(struct device *dev)
 {
 	struct gpmi_nand_data *this = dev_get_drvdata(dev);
Signature · 1 line
2.51.0
maintainer
#1 lore raw

Hello,

Quoted 11 lines · Maarten Zanders

Commit f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling") moved all clock handling into PM callbacks. With CONFIG_PM disabled, those callbacks are missing, leaving the driver unusable.

Add clock init/teardown for !CONFIG_PM builds to restore basic operation. Keeping the driver working without requiring CONFIG_PM is preferred over adding a Kconfig dependency.

Fixes f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling")

This patch does not apply on nand/next. Can you please rebase on v6.18-rc1 when it will be out? I'll take it in a fixes PR.

Thanks,
Miquèl

maintainer
#2 lore raw
Quoted 12 lines · Miquel Raynal

Hello,

Quoted 8 lines · Maarten Zanders

Commit f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling") moved all clock handling into PM callbacks. With CONFIG_PM disabled, those callbacks are missing, leaving the driver unusable.

Add clock init/teardown for !CONFIG_PM builds to restore basic operation. Keeping the driver working without requiring CONFIG_PM is preferred over adding a Kconfig dependency.

Quoted 6 lines
Quoted 3 lines
Fixes f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling")

This patch does not apply on nand/next. Can you please rebase on v6.18-rc1 when it will be out? I'll take it in a fixes PR.

Nevermind, my fault, it's applying fine.

Thanks,
Miquèl

maintainer Applied
#3 lore raw
In reply to Maarten Zanders
Quoted 9 lines · Maarten Zanders

Commit f04ced6d545e ("mtd: nand: raw: gpmi: improve power management handling") moved all clock handling into PM callbacks. With CONFIG_PM disabled, those callbacks are missing, leaving the driver unusable.

Add clock init/teardown for !CONFIG_PM builds to restore basic operation. Keeping the driver working without requiring CONFIG_PM is preferred over adding a Kconfig dependency.

[...]

Applied to nand/next, thanks!

[1/1] mtd: nand: raw: gpmi: fix clocks when CONFIG_PM=N

      commit: 1001cc1171248ebb21d371fbe086b5d3f11b410b

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl