linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] This patch set did some clean up and add runtime pm support for flexspi driver
@ 2025-04-24  7:33 Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 1/5] spi: spi-nxp-fspi: remove the goto in probe Haibo Chen
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Haibo Chen @ 2025-04-24  7:33 UTC (permalink / raw)
  To: Haibo Chen, Han Xu, Yogesh Gaur, Mark Brown; +Cc: linux-spi, imx, linux-kernel

PATCH1/3/4 to clean up the code, make the code more readable
PATCH2 add the runtime pm support
PATCH5 use devm_add_action_or_reset() to replace remove() callback, this can avoid
       oops when do bind/unbind test

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
Changes in v2:
- only change the PATCH2, add #ifdef CONFIG_PM_SLEEP for nxp_fspi_suspend() to avoid build error
  if CONFIG_PM=n and CONFIG_PM_SLEEP=y, no change for all other patches.

- Link to v1: https://lore.kernel.org/r/20250423-flexspipatch-v1-0-292e530509d3@nxp.com

---
Haibo Chen (4):
      spi: spi-nxp-fspi: remove the goto in probe
      spi: spi-nxp-fspi: enable runtime pm for fspi
      spi: spi-nxp-fspi: use guard(mutex) to simplify the code
      spi: spi-nxp-fspi: remove the unchecked return value for nxp_fspi_clk_disable_unprep

Han Xu (1):
      spi: nxp-fspi: use devm instead of remove for driver detach

 drivers/spi/spi-nxp-fspi.c | 191 ++++++++++++++++++++++++++-------------------
 1 file changed, 111 insertions(+), 80 deletions(-)
---
base-commit: 2c9c612abeb38aab0e87d48496de6fd6daafb00b
change-id: 20250421-flexspipatch-1cf724d4213d

Best regards,
-- 
Haibo Chen <haibo.chen@nxp.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/5] spi: spi-nxp-fspi: remove the goto in probe
  2025-04-24  7:33 [PATCH v2 0/5] This patch set did some clean up and add runtime pm support for flexspi driver Haibo Chen
@ 2025-04-24  7:33 ` Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi Haibo Chen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Haibo Chen @ 2025-04-24  7:33 UTC (permalink / raw)
  To: Haibo Chen, Han Xu, Yogesh Gaur, Mark Brown; +Cc: linux-spi, imx, linux-kernel

Remove all the goto in probe to simplify the driver.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/spi/spi-nxp-fspi.c | 87 ++++++++++++++--------------------------------
 1 file changed, 27 insertions(+), 60 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index bad6b30bab0ecb90d0aaf603b6de5bc834d19de6..00da184be88a026bf562c9808e18e2335a0959e9 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -1161,10 +1161,10 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct resource *res;
 	struct nxp_fspi *f;
-	int ret;
+	int ret, irq;
 	u32 reg;
 
-	ctlr = spi_alloc_host(&pdev->dev, sizeof(*f));
+	ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*f));
 	if (!ctlr)
 		return -ENOMEM;
 
@@ -1174,10 +1174,8 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 	f = spi_controller_get_devdata(ctlr);
 	f->dev = dev;
 	f->devtype_data = (struct nxp_fspi_devtype_data *)device_get_match_data(dev);
-	if (!f->devtype_data) {
-		ret = -ENODEV;
-		goto err_put_ctrl;
-	}
+	if (!f->devtype_data)
+		return -ENODEV;
 
 	platform_set_drvdata(pdev, f);
 
@@ -1186,11 +1184,8 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 		f->iobase = devm_platform_ioremap_resource(pdev, 0);
 	else
 		f->iobase = devm_platform_ioremap_resource_byname(pdev, "fspi_base");
-
-	if (IS_ERR(f->iobase)) {
-		ret = PTR_ERR(f->iobase);
-		goto err_put_ctrl;
-	}
+	if (IS_ERR(f->iobase))
+		return PTR_ERR(f->iobase);
 
 	/* find the resources - controller memory mapped space */
 	if (is_acpi_node(dev_fwnode(f->dev)))
@@ -1198,11 +1193,8 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 	else
 		res = platform_get_resource_byname(pdev,
 				IORESOURCE_MEM, "fspi_mmap");
-
-	if (!res) {
-		ret = -ENODEV;
-		goto err_put_ctrl;
-	}
+	if (!res)
+		return -ENODEV;
 
 	/* assign memory mapped starting address and mapped size. */
 	f->memmap_phy = res->start;
@@ -1211,69 +1203,46 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 	/* find the clocks */
 	if (dev_of_node(&pdev->dev)) {
 		f->clk_en = devm_clk_get(dev, "fspi_en");
-		if (IS_ERR(f->clk_en)) {
-			ret = PTR_ERR(f->clk_en);
-			goto err_put_ctrl;
-		}
+		if (IS_ERR(f->clk_en))
+			return PTR_ERR(f->clk_en);
 
 		f->clk = devm_clk_get(dev, "fspi");
-		if (IS_ERR(f->clk)) {
-			ret = PTR_ERR(f->clk);
-			goto err_put_ctrl;
-		}
-
-		ret = nxp_fspi_clk_prep_enable(f);
-		if (ret) {
-			dev_err(dev, "can not enable the clock\n");
-			goto err_put_ctrl;
-		}
+		if (IS_ERR(f->clk))
+			return PTR_ERR(f->clk);
 	}
 
+	/* find the irq */
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return dev_err_probe(dev, irq, "Failed to get irq source");
+
+	ret = nxp_fspi_clk_prep_enable(f);
+	if (ret)
+		return dev_err_probe(dev, ret, "Can't enable the clock\n");
+
 	/* Clear potential interrupts */
 	reg = fspi_readl(f, f->iobase + FSPI_INTR);
 	if (reg)
 		fspi_writel(f, reg, f->iobase + FSPI_INTR);
 
-	/* find the irq */
-	ret = platform_get_irq(pdev, 0);
-	if (ret < 0)
-		goto err_disable_clk;
+	nxp_fspi_default_setup(f);
 
-	ret = devm_request_irq(dev, ret,
+	ret = devm_request_irq(dev, irq,
 			nxp_fspi_irq_handler, 0, pdev->name, f);
 	if (ret) {
-		dev_err(dev, "failed to request irq: %d\n", ret);
-		goto err_disable_clk;
+		nxp_fspi_clk_disable_unprep(f);
+		return dev_err_probe(dev, ret, "Failed to request irq\n");
 	}
 
-	mutex_init(&f->lock);
+	devm_mutex_init(dev, &f->lock);
 
 	ctlr->bus_num = -1;
 	ctlr->num_chipselect = NXP_FSPI_MAX_CHIPSELECT;
 	ctlr->mem_ops = &nxp_fspi_mem_ops;
 	ctlr->mem_caps = &nxp_fspi_mem_caps;
-
-	nxp_fspi_default_setup(f);
-
 	ctlr->dev.of_node = np;
 
-	ret = devm_spi_register_controller(&pdev->dev, ctlr);
-	if (ret)
-		goto err_destroy_mutex;
-
-	return 0;
-
-err_destroy_mutex:
-	mutex_destroy(&f->lock);
-
-err_disable_clk:
-	nxp_fspi_clk_disable_unprep(f);
-
-err_put_ctrl:
-	spi_controller_put(ctlr);
-
-	dev_err(dev, "NXP FSPI probe failed\n");
-	return ret;
+	return devm_spi_register_controller(&pdev->dev, ctlr);
 }
 
 static void nxp_fspi_remove(struct platform_device *pdev)
@@ -1285,8 +1254,6 @@ static void nxp_fspi_remove(struct platform_device *pdev)
 
 	nxp_fspi_clk_disable_unprep(f);
 
-	mutex_destroy(&f->lock);
-
 	if (f->ahb_addr)
 		iounmap(f->ahb_addr);
 }

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi
  2025-04-24  7:33 [PATCH v2 0/5] This patch set did some clean up and add runtime pm support for flexspi driver Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 1/5] spi: spi-nxp-fspi: remove the goto in probe Haibo Chen
@ 2025-04-24  7:33 ` Haibo Chen
  2025-04-24 22:12   ` Han Xu
  2025-04-24  7:33 ` [PATCH v2 3/5] spi: spi-nxp-fspi: use guard(mutex) to simplify the code Haibo Chen
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Haibo Chen @ 2025-04-24  7:33 UTC (permalink / raw)
  To: Haibo Chen, Han Xu, Yogesh Gaur, Mark Brown; +Cc: linux-spi, imx, linux-kernel

Enable the runtime PM in fspi driver.
Also for system PM, On some board like i.MX8ULP-EVK board,
after system suspend, IOMUX module will lost power, so all
the pinctrl setting will lost when system resume back, need
driver to save/restore the pinctrl setting.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/spi/spi-nxp-fspi.c | 95 ++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 79 insertions(+), 16 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 00da184be88a026bf562c9808e18e2335a0959e9..438a9c103c5969bcae06b4e02d98397ffdcaa345 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -48,6 +48,8 @@
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/pm_runtime.h>
 #include <linux/pm_qos.h>
 #include <linux/regmap.h>
 #include <linux/sizes.h>
@@ -57,6 +59,9 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/spi-mem.h>
 
+/* runtime pm timeout */
+#define FSPI_RPM_TIMEOUT 50	/* 50ms */
+
 /* Registers used by the driver */
 #define FSPI_MCR0			0x00
 #define FSPI_MCR0_AHB_TIMEOUT(x)	((x) << 24)
@@ -394,6 +399,8 @@ struct nxp_fspi {
 	struct mutex lock;
 	struct pm_qos_request pm_qos_req;
 	int selected;
+#define FSPI_NEED_INIT		(1 << 0)
+	int flags;
 };
 
 static inline int needs_ip_only(struct nxp_fspi *f)
@@ -927,6 +934,13 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 
 	mutex_lock(&f->lock);
 
+	err = pm_runtime_get_sync(f->dev);
+	if (err < 0) {
+		mutex_unlock(&f->lock);
+		dev_err(f->dev, "Failed to enable clock %d\n", __LINE__);
+		return err;
+	}
+
 	/* Wait for controller being ready. */
 	err = fspi_readl_poll_tout(f, f->iobase + FSPI_STS0,
 				   FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true);
@@ -955,8 +969,10 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 	/* Invalidate the data in the AHB buffer. */
 	nxp_fspi_invalid(f);
 
-	mutex_unlock(&f->lock);
+	pm_runtime_mark_last_busy(f->dev);
+	pm_runtime_put_autosuspend(f->dev);
 
+	mutex_unlock(&f->lock);
 	return err;
 }
 
@@ -1216,9 +1232,14 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return dev_err_probe(dev, irq, "Failed to get irq source");
 
-	ret = nxp_fspi_clk_prep_enable(f);
-	if (ret)
-		return dev_err_probe(dev, ret, "Can't enable the clock\n");
+	pm_runtime_enable(dev);
+	pm_runtime_set_autosuspend_delay(dev, FSPI_RPM_TIMEOUT);
+	pm_runtime_use_autosuspend(dev);
+
+	/* enable clock */
+	ret = pm_runtime_get_sync(f->dev);
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Failed to enable clock");
 
 	/* Clear potential interrupts */
 	reg = fspi_readl(f, f->iobase + FSPI_INTR);
@@ -1227,12 +1248,14 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 
 	nxp_fspi_default_setup(f);
 
+	ret = pm_runtime_put_sync(dev);
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Failed to disable clock");
+
 	ret = devm_request_irq(dev, irq,
 			nxp_fspi_irq_handler, 0, pdev->name, f);
-	if (ret) {
-		nxp_fspi_clk_disable_unprep(f);
+	if (ret)
 		return dev_err_probe(dev, ret, "Failed to request irq\n");
-	}
 
 	devm_mutex_init(dev, &f->lock);
 
@@ -1249,28 +1272,73 @@ static void nxp_fspi_remove(struct platform_device *pdev)
 {
 	struct nxp_fspi *f = platform_get_drvdata(pdev);
 
+	/* enable clock first since there is reigster access */
+	pm_runtime_get_sync(f->dev);
+
 	/* disable the hardware */
 	fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);
 
+	pm_runtime_disable(f->dev);
+	pm_runtime_put_noidle(f->dev);
 	nxp_fspi_clk_disable_unprep(f);
 
 	if (f->ahb_addr)
 		iounmap(f->ahb_addr);
 }
 
-static int nxp_fspi_suspend(struct device *dev)
+#ifdef CONFIG_PM
+static int nxp_fspi_runtime_suspend(struct device *dev)
 {
+	struct nxp_fspi *f = dev_get_drvdata(dev);
+
+	nxp_fspi_clk_disable_unprep(f);
+
 	return 0;
 }
 
-static int nxp_fspi_resume(struct device *dev)
+static int nxp_fspi_runtime_resume(struct device *dev)
 {
 	struct nxp_fspi *f = dev_get_drvdata(dev);
+	int ret;
 
-	nxp_fspi_default_setup(f);
+	ret = nxp_fspi_clk_prep_enable(f);
+	if (ret)
+		return ret;
 
-	return 0;
+	if (f->flags & FSPI_NEED_INIT) {
+		nxp_fspi_default_setup(f);
+		ret = pinctrl_pm_select_default_state(dev);
+		if (ret)
+			dev_err(dev, "select flexspi default pinctrl failed!\n");
+		f->flags &= ~FSPI_NEED_INIT;
+	}
+
+	return ret;
 }
+#endif	/* CONFIG_PM */
+
+#ifdef CONFIG_PM_SLEEP
+static int nxp_fspi_suspend(struct device *dev)
+{
+	struct nxp_fspi *f = dev_get_drvdata(dev);
+	int ret;
+
+	ret = pinctrl_pm_select_sleep_state(dev);
+	if (ret) {
+		dev_err(dev, "select flexspi sleep pinctrl failed!\n");
+		return ret;
+	}
+
+	f->flags |= FSPI_NEED_INIT;
+
+	return pm_runtime_force_suspend(dev);
+}
+#endif	/* CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops nxp_fspi_pm_ops = {
+	SET_RUNTIME_PM_OPS(nxp_fspi_runtime_suspend, nxp_fspi_runtime_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(nxp_fspi_suspend, pm_runtime_force_resume)
+};
 
 static const struct of_device_id nxp_fspi_dt_ids[] = {
 	{ .compatible = "nxp,lx2160a-fspi", .data = (void *)&lx2160a_data, },
@@ -1291,11 +1359,6 @@ static const struct acpi_device_id nxp_fspi_acpi_ids[] = {
 MODULE_DEVICE_TABLE(acpi, nxp_fspi_acpi_ids);
 #endif
 
-static const struct dev_pm_ops nxp_fspi_pm_ops = {
-	.suspend	= nxp_fspi_suspend,
-	.resume		= nxp_fspi_resume,
-};
-
 static struct platform_driver nxp_fspi_driver = {
 	.driver = {
 		.name	= "nxp-fspi",

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/5] spi: spi-nxp-fspi: use guard(mutex) to simplify the code
  2025-04-24  7:33 [PATCH v2 0/5] This patch set did some clean up and add runtime pm support for flexspi driver Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 1/5] spi: spi-nxp-fspi: remove the goto in probe Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi Haibo Chen
@ 2025-04-24  7:33 ` Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 4/5] spi: spi-nxp-fspi: remove the unchecked return value for nxp_fspi_clk_disable_unprep Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver detach Haibo Chen
  4 siblings, 0 replies; 10+ messages in thread
From: Haibo Chen @ 2025-04-24  7:33 UTC (permalink / raw)
  To: Haibo Chen, Han Xu, Yogesh Gaur, Mark Brown; +Cc: linux-spi, imx, linux-kernel

Use guard(mutex) to simplify the code logic.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/spi/spi-nxp-fspi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 438a9c103c5969bcae06b4e02d98397ffdcaa345..e001c7241269ec8d3fcae25cb6a36b5e47600066 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -932,11 +932,10 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 	struct nxp_fspi *f = spi_controller_get_devdata(mem->spi->controller);
 	int err = 0;
 
-	mutex_lock(&f->lock);
+	guard(mutex)(&f->lock);
 
 	err = pm_runtime_get_sync(f->dev);
 	if (err < 0) {
-		mutex_unlock(&f->lock);
 		dev_err(f->dev, "Failed to enable clock %d\n", __LINE__);
 		return err;
 	}
@@ -972,7 +971,6 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 	pm_runtime_mark_last_busy(f->dev);
 	pm_runtime_put_autosuspend(f->dev);
 
-	mutex_unlock(&f->lock);
 	return err;
 }
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 4/5] spi: spi-nxp-fspi: remove the unchecked return value for nxp_fspi_clk_disable_unprep
  2025-04-24  7:33 [PATCH v2 0/5] This patch set did some clean up and add runtime pm support for flexspi driver Haibo Chen
                   ` (2 preceding siblings ...)
  2025-04-24  7:33 ` [PATCH v2 3/5] spi: spi-nxp-fspi: use guard(mutex) to simplify the code Haibo Chen
@ 2025-04-24  7:33 ` Haibo Chen
  2025-04-24  7:33 ` [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver detach Haibo Chen
  4 siblings, 0 replies; 10+ messages in thread
From: Haibo Chen @ 2025-04-24  7:33 UTC (permalink / raw)
  To: Haibo Chen, Han Xu, Yogesh Gaur, Mark Brown; +Cc: linux-spi, imx, linux-kernel

For nxp_fspi_clk_disable_unprep(), no caller check the return value,
so remove the unchecked return value.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/spi/spi-nxp-fspi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index e001c7241269ec8d3fcae25cb6a36b5e47600066..5be7809b4a494e22ac79c07b99cfe8b2fa430ebe 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -634,15 +634,15 @@ static int nxp_fspi_clk_prep_enable(struct nxp_fspi *f)
 	return 0;
 }
 
-static int nxp_fspi_clk_disable_unprep(struct nxp_fspi *f)
+static void nxp_fspi_clk_disable_unprep(struct nxp_fspi *f)
 {
 	if (is_acpi_node(dev_fwnode(f->dev)))
-		return 0;
+		return;
 
 	clk_disable_unprepare(f->clk);
 	clk_disable_unprepare(f->clk_en);
 
-	return 0;
+	return;
 }
 
 static void nxp_fspi_dll_calibration(struct nxp_fspi *f)

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver detach
  2025-04-24  7:33 [PATCH v2 0/5] This patch set did some clean up and add runtime pm support for flexspi driver Haibo Chen
                   ` (3 preceding siblings ...)
  2025-04-24  7:33 ` [PATCH v2 4/5] spi: spi-nxp-fspi: remove the unchecked return value for nxp_fspi_clk_disable_unprep Haibo Chen
@ 2025-04-24  7:33 ` Haibo Chen
  2025-04-25 18:46   ` ALOK TIWARI
  4 siblings, 1 reply; 10+ messages in thread
From: Haibo Chen @ 2025-04-24  7:33 UTC (permalink / raw)
  To: Haibo Chen, Han Xu, Yogesh Gaur, Mark Brown; +Cc: linux-spi, imx, linux-kernel

From: Han Xu <han.xu@nxp.com>

fspi driver use devm APIs to manage clk/irq/resources and register the spi
controller, but the legacy remove function will be called first during
device detach and trigger kernel panic. Drop the remove function and use
devm_add_action_or_reset() for driver cleanup to ensure the release
sequence.

Signed-off-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
 drivers/spi/spi-nxp-fspi.c | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 5be7809b4a494e22ac79c07b99cfe8b2fa430ebe..15dc32b7a830079764520df10a143af1f2feeb43 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -1168,6 +1168,24 @@ static const struct spi_controller_mem_caps nxp_fspi_mem_caps = {
 	.per_op_freq = true,
 };
 
+static void nxp_fspi_cleanup(void *data)
+{
+	struct nxp_fspi *f = data;
+
+	/* enable clock first since there is reigster access */
+	pm_runtime_get_sync(f->dev);
+
+	/* disable the hardware */
+	fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);
+
+	pm_runtime_disable(f->dev);
+	pm_runtime_put_noidle(f->dev);
+	nxp_fspi_clk_disable_unprep(f);
+
+	if (f->ahb_addr)
+		iounmap(f->ahb_addr);
+}
+
 static int nxp_fspi_probe(struct platform_device *pdev)
 {
 	struct spi_controller *ctlr;
@@ -1263,25 +1281,11 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 	ctlr->mem_caps = &nxp_fspi_mem_caps;
 	ctlr->dev.of_node = np;
 
-	return devm_spi_register_controller(&pdev->dev, ctlr);
-}
-
-static void nxp_fspi_remove(struct platform_device *pdev)
-{
-	struct nxp_fspi *f = platform_get_drvdata(pdev);
-
-	/* enable clock first since there is reigster access */
-	pm_runtime_get_sync(f->dev);
-
-	/* disable the hardware */
-	fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);
-
-	pm_runtime_disable(f->dev);
-	pm_runtime_put_noidle(f->dev);
-	nxp_fspi_clk_disable_unprep(f);
+	ret = devm_add_action_or_reset(dev, nxp_fspi_cleanup, f);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to register nxp_fspi_cleanup\n");
 
-	if (f->ahb_addr)
-		iounmap(f->ahb_addr);
+	return devm_spi_register_controller(&pdev->dev, ctlr);
 }
 
 #ifdef CONFIG_PM
@@ -1365,7 +1369,6 @@ static struct platform_driver nxp_fspi_driver = {
 		.pm =   &nxp_fspi_pm_ops,
 	},
 	.probe          = nxp_fspi_probe,
-	.remove		= nxp_fspi_remove,
 };
 module_platform_driver(nxp_fspi_driver);
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi
  2025-04-24  7:33 ` [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi Haibo Chen
@ 2025-04-24 22:12   ` Han Xu
  2025-04-28  8:19     ` Bough Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Han Xu @ 2025-04-24 22:12 UTC (permalink / raw)
  To: Haibo Chen; +Cc: Yogesh Gaur, Mark Brown, linux-spi, imx, linux-kernel

On 25/04/24 03:33PM, Haibo Chen wrote:
> Enable the runtime PM in fspi driver.
> Also for system PM, On some board like i.MX8ULP-EVK board,
> after system suspend, IOMUX module will lost power, so all
> the pinctrl setting will lost when system resume back, need
> driver to save/restore the pinctrl setting.
> 
> Signed-off-by: Han Xu <han.xu@nxp.com>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> ---
>  drivers/spi/spi-nxp-fspi.c | 95 ++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 79 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> index 00da184be88a026bf562c9808e18e2335a0959e9..438a9c103c5969bcae06b4e02d98397ffdcaa345 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -48,6 +48,8 @@
>  #include <linux/mutex.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
> +#include <linux/pinctrl/consumer.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/pm_qos.h>
>  #include <linux/regmap.h>
>  #include <linux/sizes.h>
> @@ -57,6 +59,9 @@
>  #include <linux/spi/spi.h>
>  #include <linux/spi/spi-mem.h>
>  
> +/* runtime pm timeout */
> +#define FSPI_RPM_TIMEOUT 50	/* 50ms */
> +
>  /* Registers used by the driver */
>  #define FSPI_MCR0			0x00
>  #define FSPI_MCR0_AHB_TIMEOUT(x)	((x) << 24)
> @@ -394,6 +399,8 @@ struct nxp_fspi {
>  	struct mutex lock;
>  	struct pm_qos_request pm_qos_req;
>  	int selected;
> +#define FSPI_NEED_INIT		(1 << 0)
> +	int flags;
>  };
>  
>  static inline int needs_ip_only(struct nxp_fspi *f)
> @@ -927,6 +934,13 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
>  
>  	mutex_lock(&f->lock);
>  
> +	err = pm_runtime_get_sync(f->dev);
> +	if (err < 0) {
> +		mutex_unlock(&f->lock);
> +		dev_err(f->dev, "Failed to enable clock %d\n", __LINE__);
> +		return err;
> +	}
> +
>  	/* Wait for controller being ready. */
>  	err = fspi_readl_poll_tout(f, f->iobase + FSPI_STS0,
>  				   FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true);
> @@ -955,8 +969,10 @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
>  	/* Invalidate the data in the AHB buffer. */
>  	nxp_fspi_invalid(f);
>  
> -	mutex_unlock(&f->lock);
> +	pm_runtime_mark_last_busy(f->dev);
> +	pm_runtime_put_autosuspend(f->dev);
>  
> +	mutex_unlock(&f->lock);
>  	return err;
>  }
>  
> @@ -1216,9 +1232,14 @@ static int nxp_fspi_probe(struct platform_device *pdev)
>  	if (irq < 0)
>  		return dev_err_probe(dev, irq, "Failed to get irq source");
>  
> -	ret = nxp_fspi_clk_prep_enable(f);
> -	if (ret)
> -		return dev_err_probe(dev, ret, "Can't enable the clock\n");
> +	pm_runtime_enable(dev);
> +	pm_runtime_set_autosuspend_delay(dev, FSPI_RPM_TIMEOUT);
> +	pm_runtime_use_autosuspend(dev);
> +
> +	/* enable clock */
> +	ret = pm_runtime_get_sync(f->dev);
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to enable clock");
>  
>  	/* Clear potential interrupts */
>  	reg = fspi_readl(f, f->iobase + FSPI_INTR);
> @@ -1227,12 +1248,14 @@ static int nxp_fspi_probe(struct platform_device *pdev)
>  
>  	nxp_fspi_default_setup(f);
>  
> +	ret = pm_runtime_put_sync(dev);
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Failed to disable clock");
> +
>  	ret = devm_request_irq(dev, irq,
>  			nxp_fspi_irq_handler, 0, pdev->name, f);
> -	if (ret) {
> -		nxp_fspi_clk_disable_unprep(f);
> +	if (ret)
>  		return dev_err_probe(dev, ret, "Failed to request irq\n");
> -	}
>  
>  	devm_mutex_init(dev, &f->lock);
>  
> @@ -1249,28 +1272,73 @@ static void nxp_fspi_remove(struct platform_device *pdev)
>  {
>  	struct nxp_fspi *f = platform_get_drvdata(pdev);
>  
> +	/* enable clock first since there is reigster access */
> +	pm_runtime_get_sync(f->dev);
> +
>  	/* disable the hardware */
>  	fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);
>  
> +	pm_runtime_disable(f->dev);
> +	pm_runtime_put_noidle(f->dev);
>  	nxp_fspi_clk_disable_unprep(f);
>  
>  	if (f->ahb_addr)
>  		iounmap(f->ahb_addr);
>  }
>  
> -static int nxp_fspi_suspend(struct device *dev)
> +#ifdef CONFIG_PM
> +static int nxp_fspi_runtime_suspend(struct device *dev)
>  {
> +	struct nxp_fspi *f = dev_get_drvdata(dev);
> +
> +	nxp_fspi_clk_disable_unprep(f);
> +
>  	return 0;
>  }
>  
> -static int nxp_fspi_resume(struct device *dev)
> +static int nxp_fspi_runtime_resume(struct device *dev)
>  {
>  	struct nxp_fspi *f = dev_get_drvdata(dev);
> +	int ret;
>  
> -	nxp_fspi_default_setup(f);
> +	ret = nxp_fspi_clk_prep_enable(f);
> +	if (ret)
> +		return ret;
>  
> -	return 0;
> +	if (f->flags & FSPI_NEED_INIT) {
> +		nxp_fspi_default_setup(f);
> +		ret = pinctrl_pm_select_default_state(dev);
> +		if (ret)
> +			dev_err(dev, "select flexspi default pinctrl failed!\n");
> +		f->flags &= ~FSPI_NEED_INIT;
> +	}
> +
> +	return ret;
>  }
> +#endif	/* CONFIG_PM */
> +
> +#ifdef CONFIG_PM_SLEEP
> +static int nxp_fspi_suspend(struct device *dev)
> +{
> +	struct nxp_fspi *f = dev_get_drvdata(dev);
> +	int ret;
> +
> +	ret = pinctrl_pm_select_sleep_state(dev);
> +	if (ret) {
> +		dev_err(dev, "select flexspi sleep pinctrl failed!\n");
> +		return ret;
> +	}
> +
> +	f->flags |= FSPI_NEED_INIT;
> +
> +	return pm_runtime_force_suspend(dev);
> +}
> +#endif	/* CONFIG_PM_SLEEP */
> +
> +static const struct dev_pm_ops nxp_fspi_pm_ops = {
> +	SET_RUNTIME_PM_OPS(nxp_fspi_runtime_suspend, nxp_fspi_runtime_resume, NULL)
> +	SET_SYSTEM_SLEEP_PM_OPS(nxp_fspi_suspend, pm_runtime_force_resume)
> +};

We can use the newer RUNTIME_PM_OPS()/SYSTEM_SLEEP_PM_OPS() alternatives.

>  
>  static const struct of_device_id nxp_fspi_dt_ids[] = {
>  	{ .compatible = "nxp,lx2160a-fspi", .data = (void *)&lx2160a_data, },
> @@ -1291,11 +1359,6 @@ static const struct acpi_device_id nxp_fspi_acpi_ids[] = {
>  MODULE_DEVICE_TABLE(acpi, nxp_fspi_acpi_ids);
>  #endif
>  
> -static const struct dev_pm_ops nxp_fspi_pm_ops = {
> -	.suspend	= nxp_fspi_suspend,
> -	.resume		= nxp_fspi_resume,
> -};
> -
>  static struct platform_driver nxp_fspi_driver = {
>  	.driver = {
>  		.name	= "nxp-fspi",
> 
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver detach
  2025-04-24  7:33 ` [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver detach Haibo Chen
@ 2025-04-25 18:46   ` ALOK TIWARI
  2025-04-28  8:20     ` Bough Chen
  0 siblings, 1 reply; 10+ messages in thread
From: ALOK TIWARI @ 2025-04-25 18:46 UTC (permalink / raw)
  To: Haibo Chen, Han Xu, Yogesh Gaur, Mark Brown; +Cc: linux-spi, imx, linux-kernel



On 24-04-2025 13:03, Haibo Chen wrote:
> +	/* enable clock first since there is reigster access */

typo reigster

> +	pm_runtime_get_sync(f->dev);
> +
> +	/* disable the hardware */
> +	fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);


Thanks,
Alok

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi
  2025-04-24 22:12   ` Han Xu
@ 2025-04-28  8:19     ` Bough Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Bough Chen @ 2025-04-28  8:19 UTC (permalink / raw)
  To: Han Xu
  Cc: Yogesh Gaur, Mark Brown, linux-spi@vger.kernel.org,
	imx@lists.linux.dev, linux-kernel@vger.kernel.org

> -----Original Message-----
> From: Han Xu <han.xu@nxp.com>
> Sent: 2025年4月25日 6:13
> To: Bough Chen <haibo.chen@nxp.com>
> Cc: Yogesh Gaur <yogeshgaur.83@gmail.com>; Mark Brown
> <broonie@kernel.org>; linux-spi@vger.kernel.org; imx@lists.linux.dev;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi
> 
> On 25/04/24 03:33PM, Haibo Chen wrote:
> > Enable the runtime PM in fspi driver.
> > Also for system PM, On some board like i.MX8ULP-EVK board, after
> > system suspend, IOMUX module will lost power, so all the pinctrl
> > setting will lost when system resume back, need driver to save/restore
> > the pinctrl setting.
> >
> > Signed-off-by: Han Xu <han.xu@nxp.com>
> > Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
> > ---
> >  drivers/spi/spi-nxp-fspi.c | 95
> > ++++++++++++++++++++++++++++++++++++++--------
> >  1 file changed, 79 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> > index
> >
> 00da184be88a026bf562c9808e18e2335a0959e9..438a9c103c5969bcae06b4e0
> 2d98
> > 397ffdcaa345 100644
> > --- a/drivers/spi/spi-nxp-fspi.c
> > +++ b/drivers/spi/spi-nxp-fspi.c
> > @@ -48,6 +48,8 @@
> >  #include <linux/mutex.h>
> >  #include <linux/of.h>
> >  #include <linux/platform_device.h>
> > +#include <linux/pinctrl/consumer.h>
> > +#include <linux/pm_runtime.h>
> >  #include <linux/pm_qos.h>
> >  #include <linux/regmap.h>
> >  #include <linux/sizes.h>
> > @@ -57,6 +59,9 @@
> >  #include <linux/spi/spi.h>
> >  #include <linux/spi/spi-mem.h>
> >
> > +/* runtime pm timeout */
> > +#define FSPI_RPM_TIMEOUT 50	/* 50ms */
> > +
> >  /* Registers used by the driver */
> >  #define FSPI_MCR0			0x00
> >  #define FSPI_MCR0_AHB_TIMEOUT(x)	((x) << 24)
> > @@ -394,6 +399,8 @@ struct nxp_fspi {
> >  	struct mutex lock;
> >  	struct pm_qos_request pm_qos_req;
> >  	int selected;
> > +#define FSPI_NEED_INIT		(1 << 0)
> > +	int flags;
> >  };
> >
> >  static inline int needs_ip_only(struct nxp_fspi *f) @@ -927,6 +934,13
> > @@ static int nxp_fspi_exec_op(struct spi_mem *mem, const struct
> > spi_mem_op *op)
> >
> >  	mutex_lock(&f->lock);
> >
> > +	err = pm_runtime_get_sync(f->dev);
> > +	if (err < 0) {
> > +		mutex_unlock(&f->lock);
> > +		dev_err(f->dev, "Failed to enable clock %d\n", __LINE__);
> > +		return err;
> > +	}
> > +
> >  	/* Wait for controller being ready. */
> >  	err = fspi_readl_poll_tout(f, f->iobase + FSPI_STS0,
> >  				   FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true); @@ -955,8
> +969,10 @@
> > static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op
> *op)
> >  	/* Invalidate the data in the AHB buffer. */
> >  	nxp_fspi_invalid(f);
> >
> > -	mutex_unlock(&f->lock);
> > +	pm_runtime_mark_last_busy(f->dev);
> > +	pm_runtime_put_autosuspend(f->dev);
> >
> > +	mutex_unlock(&f->lock);
> >  	return err;
> >  }
> >
> > @@ -1216,9 +1232,14 @@ static int nxp_fspi_probe(struct platform_device
> *pdev)
> >  	if (irq < 0)
> >  		return dev_err_probe(dev, irq, "Failed to get irq source");
> >
> > -	ret = nxp_fspi_clk_prep_enable(f);
> > -	if (ret)
> > -		return dev_err_probe(dev, ret, "Can't enable the clock\n");
> > +	pm_runtime_enable(dev);
> > +	pm_runtime_set_autosuspend_delay(dev, FSPI_RPM_TIMEOUT);
> > +	pm_runtime_use_autosuspend(dev);
> > +
> > +	/* enable clock */
> > +	ret = pm_runtime_get_sync(f->dev);
> > +	if (ret < 0)
> > +		return dev_err_probe(dev, ret, "Failed to enable clock");
> >
> >  	/* Clear potential interrupts */
> >  	reg = fspi_readl(f, f->iobase + FSPI_INTR); @@ -1227,12 +1248,14 @@
> > static int nxp_fspi_probe(struct platform_device *pdev)
> >
> >  	nxp_fspi_default_setup(f);
> >
> > +	ret = pm_runtime_put_sync(dev);
> > +	if (ret < 0)
> > +		return dev_err_probe(dev, ret, "Failed to disable clock");
> > +
> >  	ret = devm_request_irq(dev, irq,
> >  			nxp_fspi_irq_handler, 0, pdev->name, f);
> > -	if (ret) {
> > -		nxp_fspi_clk_disable_unprep(f);
> > +	if (ret)
> >  		return dev_err_probe(dev, ret, "Failed to request irq\n");
> > -	}
> >
> >  	devm_mutex_init(dev, &f->lock);
> >
> > @@ -1249,28 +1272,73 @@ static void nxp_fspi_remove(struct
> > platform_device *pdev)  {
> >  	struct nxp_fspi *f = platform_get_drvdata(pdev);
> >
> > +	/* enable clock first since there is reigster access */
> > +	pm_runtime_get_sync(f->dev);
> > +
> >  	/* disable the hardware */
> >  	fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);
> >
> > +	pm_runtime_disable(f->dev);
> > +	pm_runtime_put_noidle(f->dev);
> >  	nxp_fspi_clk_disable_unprep(f);
> >
> >  	if (f->ahb_addr)
> >  		iounmap(f->ahb_addr);
> >  }
> >
> > -static int nxp_fspi_suspend(struct device *dev)
> > +#ifdef CONFIG_PM
> > +static int nxp_fspi_runtime_suspend(struct device *dev)
> >  {
> > +	struct nxp_fspi *f = dev_get_drvdata(dev);
> > +
> > +	nxp_fspi_clk_disable_unprep(f);
> > +
> >  	return 0;
> >  }
> >
> > -static int nxp_fspi_resume(struct device *dev)
> > +static int nxp_fspi_runtime_resume(struct device *dev)
> >  {
> >  	struct nxp_fspi *f = dev_get_drvdata(dev);
> > +	int ret;
> >
> > -	nxp_fspi_default_setup(f);
> > +	ret = nxp_fspi_clk_prep_enable(f);
> > +	if (ret)
> > +		return ret;
> >
> > -	return 0;
> > +	if (f->flags & FSPI_NEED_INIT) {
> > +		nxp_fspi_default_setup(f);
> > +		ret = pinctrl_pm_select_default_state(dev);
> > +		if (ret)
> > +			dev_err(dev, "select flexspi default pinctrl failed!\n");
> > +		f->flags &= ~FSPI_NEED_INIT;
> > +	}
> > +
> > +	return ret;
> >  }
> > +#endif	/* CONFIG_PM */
> > +
> > +#ifdef CONFIG_PM_SLEEP
> > +static int nxp_fspi_suspend(struct device *dev) {
> > +	struct nxp_fspi *f = dev_get_drvdata(dev);
> > +	int ret;
> > +
> > +	ret = pinctrl_pm_select_sleep_state(dev);
> > +	if (ret) {
> > +		dev_err(dev, "select flexspi sleep pinctrl failed!\n");
> > +		return ret;
> > +	}
> > +
> > +	f->flags |= FSPI_NEED_INIT;
> > +
> > +	return pm_runtime_force_suspend(dev); }
> > +#endif	/* CONFIG_PM_SLEEP */
> > +
> > +static const struct dev_pm_ops nxp_fspi_pm_ops = {
> > +	SET_RUNTIME_PM_OPS(nxp_fspi_runtime_suspend,
> nxp_fspi_runtime_resume, NULL)
> > +	SET_SYSTEM_SLEEP_PM_OPS(nxp_fspi_suspend,
> pm_runtime_force_resume)
> > +};
> 
> We can use the newer RUNTIME_PM_OPS()/SYSTEM_SLEEP_PM_OPS()
> alternatives.

Yes, according to commit 1a3c7bb08826 ("PM: core: Add new *_PM_OPS macros, deprecate old ones"), seems community aim to avoid the pm callbacks protected by CONFIG_PM guards.

I will send V3.

Regards
Haibo Chen
> 
> >
> >  static const struct of_device_id nxp_fspi_dt_ids[] = {
> >  	{ .compatible = "nxp,lx2160a-fspi", .data = (void *)&lx2160a_data,
> > }, @@ -1291,11 +1359,6 @@ static const struct acpi_device_id
> > nxp_fspi_acpi_ids[] = {  MODULE_DEVICE_TABLE(acpi, nxp_fspi_acpi_ids);
> > #endif
> >
> > -static const struct dev_pm_ops nxp_fspi_pm_ops = {
> > -	.suspend	= nxp_fspi_suspend,
> > -	.resume		= nxp_fspi_resume,
> > -};
> > -
> >  static struct platform_driver nxp_fspi_driver = {
> >  	.driver = {
> >  		.name	= "nxp-fspi",
> >
> > --
> > 2.34.1
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver detach
  2025-04-25 18:46   ` ALOK TIWARI
@ 2025-04-28  8:20     ` Bough Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Bough Chen @ 2025-04-28  8:20 UTC (permalink / raw)
  To: ALOK TIWARI, Han Xu, Yogesh Gaur, Mark Brown
  Cc: linux-spi@vger.kernel.org, imx@lists.linux.dev,
	linux-kernel@vger.kernel.org

> -----Original Message-----
> From: ALOK TIWARI <alok.a.tiwari@oracle.com>
> Sent: 2025年4月26日 2:46
> To: Bough Chen <haibo.chen@nxp.com>; Han Xu <han.xu@nxp.com>; Yogesh
> Gaur <yogeshgaur.83@gmail.com>; Mark Brown <broonie@kernel.org>
> Cc: linux-spi@vger.kernel.org; imx@lists.linux.dev; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver
> detach
> 
> 
> 
> On 24-04-2025 13:03, Haibo Chen wrote:
> > +	/* enable clock first since there is reigster access */
> 
> typo register

Thanks, will fix in next version.

Regards
Haibo Chen
> 
> > +	pm_runtime_get_sync(f->dev);
> > +
> > +	/* disable the hardware */
> > +	fspi_writel(f, FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0);
> 
> 
> Thanks,
> Alok


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-04-28  8:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24  7:33 [PATCH v2 0/5] This patch set did some clean up and add runtime pm support for flexspi driver Haibo Chen
2025-04-24  7:33 ` [PATCH v2 1/5] spi: spi-nxp-fspi: remove the goto in probe Haibo Chen
2025-04-24  7:33 ` [PATCH v2 2/5] spi: spi-nxp-fspi: enable runtime pm for fspi Haibo Chen
2025-04-24 22:12   ` Han Xu
2025-04-28  8:19     ` Bough Chen
2025-04-24  7:33 ` [PATCH v2 3/5] spi: spi-nxp-fspi: use guard(mutex) to simplify the code Haibo Chen
2025-04-24  7:33 ` [PATCH v2 4/5] spi: spi-nxp-fspi: remove the unchecked return value for nxp_fspi_clk_disable_unprep Haibo Chen
2025-04-24  7:33 ` [PATCH v2 5/5] spi: nxp-fspi: use devm instead of remove for driver detach Haibo Chen
2025-04-25 18:46   ` ALOK TIWARI
2025-04-28  8:20     ` Bough Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).