public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mmc: renesas_sdhi: Handle resets
@ 2025-10-08  4:25 Claudiu
  2025-10-08  4:25 ` [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe Claudiu
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Claudiu @ 2025-10-08  4:25 UTC (permalink / raw)
  To: wsa+renesas, ulf.hansson, p.zabel
  Cc: claudiu.beznea, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Hi,

Series adds suspend/resume hooks for the Renesas SDHI driver. These
are necessary on RZ/G3{E, S}, that supports a power saving mode where
power to most of the SoC components (including SDHI) is turned off.
Resume from this suspend mode is done with the help of bootloader
and it may choose to disable the SDHI clocks, resets after it is
done with the SDHIs.

Reset signal was deasserted/asserted on probe/remove as well to
avoid relying on previous bootloaders. This is also useful for
unbind/bind operations.

Along with it, driver was converted to use
SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() helpers.

Thank you,
Claudiu

Claudiu Beznea (3):
  mmc: renesas_sdhi: Deassert the reset signal on probe
  mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS()
    and pm_ptr()
  mmc: renesas_sdhi: Add suspend/resume hooks

 drivers/mmc/host/renesas_sdhi.h               |  3 ++
 drivers/mmc/host/renesas_sdhi_core.c          | 39 ++++++++++++++++++-
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 12 +++---
 drivers/mmc/host/tmio_mmc.h                   |  2 -
 drivers/mmc/host/tmio_mmc_core.c              |  2 -
 5 files changed, 46 insertions(+), 12 deletions(-)

-- 
2.43.0


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

* [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe
  2025-10-08  4:25 [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu
@ 2025-10-08  4:25 ` Claudiu
  2025-10-10  7:51   ` Geert Uytterhoeven
  2025-11-13 21:06   ` Wolfram Sang
  2025-10-08  4:25 ` [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Claudiu
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 20+ messages in thread
From: Claudiu @ 2025-10-08  4:25 UTC (permalink / raw)
  To: wsa+renesas, ulf.hansson, p.zabel
  Cc: claudiu.beznea, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Deassert the reset signal of the SDHI controller during probe to avoid
relying on the previous bootloaders. Without deasserting the reset signal,
the SDHI controller will not function.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index f56fa2cd208d..c4aaf534868c 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1103,7 +1103,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 	if (IS_ERR(priv->clk_cd))
 		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk_cd), "cannot get cd clock");
 
-	priv->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
+	priv->rstc = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);
 	if (IS_ERR(priv->rstc))
 		return PTR_ERR(priv->rstc);
 
-- 
2.43.0


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

* [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()
  2025-10-08  4:25 [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu
  2025-10-08  4:25 ` [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe Claudiu
@ 2025-10-08  4:25 ` Claudiu
  2025-10-13 16:20   ` Geert Uytterhoeven
                     ` (2 more replies)
  2025-10-08  4:25 ` [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks Claudiu
  2025-11-10 15:36 ` [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu Beznea
  3 siblings, 3 replies; 20+ messages in thread
From: Claudiu @ 2025-10-08  4:25 UTC (permalink / raw)
  To: wsa+renesas, ulf.hansson, p.zabel
  Cc: claudiu.beznea, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
and require __maybe_unused protection against unused function warnings.
The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
the compiler to see the functions, thus suppressing the warning. Thus
drop the __maybe_unused markings.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/mmc/host/renesas_sdhi_internal_dmac.c | 11 +++++------
 drivers/mmc/host/tmio_mmc.h                   |  2 --
 drivers/mmc/host/tmio_mmc_core.c              |  2 --
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 9e3ed0bcddd6..7ceb7b977a0b 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -599,18 +599,17 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops renesas_sdhi_internal_dmac_dev_pm_ops = {
-	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
-				pm_runtime_force_resume)
-	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
-			   tmio_mmc_host_runtime_resume,
-			   NULL)
+	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
+	RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
+		       tmio_mmc_host_runtime_resume,
+		       NULL)
 };
 
 static struct platform_driver renesas_internal_dmac_sdhi_driver = {
 	.driver		= {
 		.name	= "renesas_sdhi_internal_dmac",
 		.probe_type = PROBE_PREFER_ASYNCHRONOUS,
-		.pm	= &renesas_sdhi_internal_dmac_dev_pm_ops,
+		.pm	= pm_ptr(&renesas_sdhi_internal_dmac_dev_pm_ops),
 		.of_match_table = renesas_sdhi_internal_dmac_of_match,
 	},
 	.probe		= renesas_sdhi_internal_dmac_probe,
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index c8cdb1c0722e..b9de03325c58 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -209,10 +209,8 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
 irqreturn_t tmio_mmc_irq(int irq, void *devid);
 
-#ifdef CONFIG_PM
 int tmio_mmc_host_runtime_suspend(struct device *dev);
 int tmio_mmc_host_runtime_resume(struct device *dev);
-#endif
 
 static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
 {
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 775e0d9353d5..8be642f737c7 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1286,7 +1286,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
 }
 EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
 
-#ifdef CONFIG_PM
 static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
 {
 	if (!host->clk_enable)
@@ -1331,7 +1330,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_resume);
-#endif
 
 MODULE_DESCRIPTION("TMIO MMC core driver");
 MODULE_LICENSE("GPL v2");
-- 
2.43.0


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

* [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks
  2025-10-08  4:25 [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu
  2025-10-08  4:25 ` [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe Claudiu
  2025-10-08  4:25 ` [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Claudiu
@ 2025-10-08  4:25 ` Claudiu
  2025-11-11 16:24   ` Ulf Hansson
  2025-11-13 21:09   ` Wolfram Sang
  2025-11-10 15:36 ` [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu Beznea
  3 siblings, 2 replies; 20+ messages in thread
From: Claudiu @ 2025-10-08  4:25 UTC (permalink / raw)
  To: wsa+renesas, ulf.hansson, p.zabel
  Cc: claudiu.beznea, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Add suspend/resume hooks which assert/deassert the reset signals, along
with forcing runtime suspend/resume. This allows using the driver in
scenarios where the resume is done with the help of bootloader and the
bootloader disables the SDHI clocks, resets, IRQs before passing execution
to Linux.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/mmc/host/renesas_sdhi.h               |  3 ++
 drivers/mmc/host/renesas_sdhi_core.c          | 37 +++++++++++++++++++
 drivers/mmc/host/renesas_sdhi_internal_dmac.c |  3 +-
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index 084964cecf9d..afc36a407c2c 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -9,6 +9,7 @@
 #ifndef RENESAS_SDHI_H
 #define RENESAS_SDHI_H
 
+#include <linux/device.h>
 #include <linux/dmaengine.h>
 #include <linux/platform_device.h>
 #include <linux/workqueue.h>
@@ -107,4 +108,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 		       const struct renesas_sdhi_of_data *of_data,
 		       const struct renesas_sdhi_quirks *quirks);
 void renesas_sdhi_remove(struct platform_device *pdev);
+int renesas_sdhi_suspend(struct device *dev);
+int renesas_sdhi_resume(struct device *dev);
 #endif
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index c4aaf534868c..2a310a145785 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -31,6 +31,7 @@
 #include <linux/platform_data/tmio.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
+#include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 #include <linux/regulator/driver.h>
 #include <linux/regulator/of_regulator.h>
@@ -1317,5 +1318,41 @@ void renesas_sdhi_remove(struct platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(renesas_sdhi_remove);
 
+int renesas_sdhi_suspend(struct device *dev)
+{
+	struct tmio_mmc_host *host = dev_get_drvdata(dev);
+	struct renesas_sdhi *priv = host_to_priv(host);
+	int ret;
+
+	ret = pm_runtime_force_suspend(dev);
+	if (ret)
+		return ret;
+
+	ret = reset_control_assert(priv->rstc);
+	if (ret)
+		pm_runtime_force_resume(dev);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(renesas_sdhi_suspend);
+
+int renesas_sdhi_resume(struct device *dev)
+{
+	struct tmio_mmc_host *host = dev_get_drvdata(dev);
+	struct renesas_sdhi *priv = host_to_priv(host);
+	int ret;
+
+	ret = reset_control_deassert(priv->rstc);
+	if (ret)
+		return ret;
+
+	ret = pm_runtime_force_resume(dev);
+	if (ret)
+		reset_control_assert(priv->rstc);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(renesas_sdhi_resume);
+
 MODULE_DESCRIPTION("Renesas SDHI core driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
index 7ceb7b977a0b..9347017d47c4 100644
--- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
+++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
@@ -18,7 +18,6 @@
 #include <linux/pagemap.h>
 #include <linux/platform_data/tmio.h>
 #include <linux/platform_device.h>
-#include <linux/pm_runtime.h>
 #include <linux/scatterlist.h>
 #include <linux/sys_soc.h>
 
@@ -599,7 +598,7 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
 }
 
 static const struct dev_pm_ops renesas_sdhi_internal_dmac_dev_pm_ops = {
-	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
+	SYSTEM_SLEEP_PM_OPS(renesas_sdhi_suspend, renesas_sdhi_resume)
 	RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
 		       tmio_mmc_host_runtime_resume,
 		       NULL)
-- 
2.43.0


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

* Re: [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe
  2025-10-08  4:25 ` [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe Claudiu
@ 2025-10-10  7:51   ` Geert Uytterhoeven
  2025-10-10  9:35     ` Claudiu Beznea
  2025-11-13 21:06   ` Wolfram Sang
  1 sibling, 1 reply; 20+ messages in thread
From: Geert Uytterhoeven @ 2025-10-10  7:51 UTC (permalink / raw)
  To: Claudiu
  Cc: wsa+renesas, ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc,
	linux-kernel, Claudiu Beznea

Hi Claudiu,

On Fri, 10 Oct 2025 at 07:06, Claudiu <claudiu.beznea@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Deassert the reset signal of the SDHI controller during probe to avoid
> relying on the previous bootloaders. Without deasserting the reset signal,
> the SDHI controller will not function.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Thanks for your patch!

> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -1103,7 +1103,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>         if (IS_ERR(priv->clk_cd))
>                 return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk_cd), "cannot get cd clock");
>
> -       priv->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
> +       priv->rstc = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);

Note that this has the side effect of asserting reset again on probe
failure or unbind.  Also on SoCs that boot with reset already deasserted
(e.g. R-Car).  I don't know if that would be a problem.

>         if (IS_ERR(priv->rstc))
>                 return PTR_ERR(priv->rstc);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe
  2025-10-10  7:51   ` Geert Uytterhoeven
@ 2025-10-10  9:35     ` Claudiu Beznea
  0 siblings, 0 replies; 20+ messages in thread
From: Claudiu Beznea @ 2025-10-10  9:35 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: wsa+renesas, ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc,
	linux-kernel, Claudiu Beznea

Hi, Geert,

On 10/10/25 10:51, Geert Uytterhoeven wrote:
> Hi Claudiu,
> 
> On Fri, 10 Oct 2025 at 07:06, Claudiu <claudiu.beznea@tuxon.dev> wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> Deassert the reset signal of the SDHI controller during probe to avoid
>> relying on the previous bootloaders. Without deasserting the reset signal,
>> the SDHI controller will not function.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Thanks for your patch!
> 
>> --- a/drivers/mmc/host/renesas_sdhi_core.c
>> +++ b/drivers/mmc/host/renesas_sdhi_core.c
>> @@ -1103,7 +1103,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>>         if (IS_ERR(priv->clk_cd))
>>                 return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk_cd), "cannot get cd clock");
>>
>> -       priv->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
>> +       priv->rstc = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, NULL);
> 
> Note that this has the side effect of asserting reset again on probe
> failure or unbind.

I agree. I've tested unbind/bind on RZ/G3S and I saw no issue.

>  Also on SoCs that boot with reset already deasserted
> (e.g. R-Car).  I don't know if that would be a problem.

I think all SoCs boot with resets de-asserted as the driver does register
configuration before calling reset_control_reset() in renesas_sdhi_reset(),
e.g:
- one register configuration is just above reset_control_reset()
- one register configuration, through sd_ctrl_write32_as_16_and_16(), in
  renesas_sdhi_probe()
- register writes in tmio_mmc_reset() before host->reset() call

I did bonnie++ tests after boot on RZ/G2{H, M, N, L, UL}, RZ/V2L and saw no
issue.

Thank you for your review,
Claudiu

> 
>>         if (IS_ERR(priv->rstc))
>>                 return PTR_ERR(priv->rstc);
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 


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

* Re: [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()
  2025-10-08  4:25 ` [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Claudiu
@ 2025-10-13 16:20   ` Geert Uytterhoeven
  2025-11-12 18:28     ` Wolfram Sang
  2025-11-11 16:22   ` Ulf Hansson
  2025-11-13 21:08   ` Wolfram Sang
  2 siblings, 1 reply; 20+ messages in thread
From: Geert Uytterhoeven @ 2025-10-13 16:20 UTC (permalink / raw)
  To: Claudiu
  Cc: wsa+renesas, ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc,
	linux-kernel, Claudiu Beznea

Hi Claudiu,

On Fri, 10 Oct 2025 at 22:16, Claudiu <claudiu.beznea@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
> and require __maybe_unused protection against unused function warnings.
> The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
> the compiler to see the functions, thus suppressing the warning. Thus
> drop the __maybe_unused markings.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Thanks for your patch!

> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -599,18 +599,17 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
>  }
>
>  static const struct dev_pm_ops renesas_sdhi_internal_dmac_dev_pm_ops = {
> -       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> -                               pm_runtime_force_resume)
> -       SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
> -                          tmio_mmc_host_runtime_resume,
> -                          NULL)
> +       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> +       RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
> +                      tmio_mmc_host_runtime_resume,
> +                      NULL)
>  };
>
>  static struct platform_driver renesas_internal_dmac_sdhi_driver = {
>         .driver         = {
>                 .name   = "renesas_sdhi_internal_dmac",
>                 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> -               .pm     = &renesas_sdhi_internal_dmac_dev_pm_ops,
> +               .pm     = pm_ptr(&renesas_sdhi_internal_dmac_dev_pm_ops),
>                 .of_match_table = renesas_sdhi_internal_dmac_of_match,
>         },
>         .probe          = renesas_sdhi_internal_dmac_probe,
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index c8cdb1c0722e..b9de03325c58 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -209,10 +209,8 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
>  void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
>  irqreturn_t tmio_mmc_irq(int irq, void *devid);
>
> -#ifdef CONFIG_PM
>  int tmio_mmc_host_runtime_suspend(struct device *dev);
>  int tmio_mmc_host_runtime_resume(struct device *dev);
> -#endif

This change is indeed needed, because RUNTIME_PM_OPS() now
references these two functions unconditionally...

>
>  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
>  {
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index 775e0d9353d5..8be642f737c7 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -1286,7 +1286,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
>  }
>  EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
>
> -#ifdef CONFIG_PM
>  static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
>  {
>         if (!host->clk_enable)
> @@ -1331,7 +1330,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
>         return 0;
>  }
>  EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_resume);
> -#endif

... however, no actual code referencing them is emitted in the
CONFIG_PM=n case, as renesas_sdhi_internal_dmac_dev_pm_ops is not used
due to the use of pm_ptr().  Hence the changes to this file are needed.
(verified with m68k allmodconfig/allyesconfig builds)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 0/3] mmc: renesas_sdhi: Handle resets
  2025-10-08  4:25 [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu
                   ` (2 preceding siblings ...)
  2025-10-08  4:25 ` [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks Claudiu
@ 2025-11-10 15:36 ` Claudiu Beznea
  2025-11-12 18:25   ` Wolfram Sang
  3 siblings, 1 reply; 20+ messages in thread
From: Claudiu Beznea @ 2025-11-10 15:36 UTC (permalink / raw)
  To: wsa+renesas, ulf.hansson, p.zabel
  Cc: linux-mmc, linux-renesas-soc, linux-kernel, Claudiu Beznea

Hi,

On 10/8/25 07:25, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Hi,
> 
> Series adds suspend/resume hooks for the Renesas SDHI driver. These
> are necessary on RZ/G3{E, S}, that supports a power saving mode where
> power to most of the SoC components (including SDHI) is turned off.
> Resume from this suspend mode is done with the help of bootloader
> and it may choose to disable the SDHI clocks, resets after it is
> done with the SDHIs.
> 
> Reset signal was deasserted/asserted on probe/remove as well to
> avoid relying on previous bootloaders. This is also useful for
> unbind/bind operations.
> 
> Along with it, driver was converted to use
> SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() helpers.
> 
> Thank you,
> Claudiu
> 
> Claudiu Beznea (3):
>   mmc: renesas_sdhi: Deassert the reset signal on probe
>   mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS()
>     and pm_ptr()
>   mmc: renesas_sdhi: Add suspend/resume hooks
Gentle ping on this series.

Thank you,
Claudiu

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

* Re: [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()
  2025-10-08  4:25 ` [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Claudiu
  2025-10-13 16:20   ` Geert Uytterhoeven
@ 2025-11-11 16:22   ` Ulf Hansson
  2025-11-13  8:01     ` Claudiu Beznea
  2025-11-13 21:08   ` Wolfram Sang
  2 siblings, 1 reply; 20+ messages in thread
From: Ulf Hansson @ 2025-11-11 16:22 UTC (permalink / raw)
  To: Claudiu
  Cc: wsa+renesas, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

On Wed, 8 Oct 2025 at 06:25, Claudiu <claudiu.beznea@tuxon.dev> wrote:
>
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
> and require __maybe_unused protection against unused function warnings.

I don't see them marked deprecated, is that really the case?

> The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
> the compiler to see the functions, thus suppressing the warning. Thus
> drop the __maybe_unused markings.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Other than the above, this looks fine to me!

Kind regards
Uffe

> ---
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 11 +++++------
>  drivers/mmc/host/tmio_mmc.h                   |  2 --
>  drivers/mmc/host/tmio_mmc_core.c              |  2 --
>  3 files changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> index 9e3ed0bcddd6..7ceb7b977a0b 100644
> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -599,18 +599,17 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
>  }
>
>  static const struct dev_pm_ops renesas_sdhi_internal_dmac_dev_pm_ops = {
> -       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> -                               pm_runtime_force_resume)
> -       SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
> -                          tmio_mmc_host_runtime_resume,
> -                          NULL)
> +       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> +       RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
> +                      tmio_mmc_host_runtime_resume,
> +                      NULL)
>  };
>
>  static struct platform_driver renesas_internal_dmac_sdhi_driver = {
>         .driver         = {
>                 .name   = "renesas_sdhi_internal_dmac",
>                 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> -               .pm     = &renesas_sdhi_internal_dmac_dev_pm_ops,
> +               .pm     = pm_ptr(&renesas_sdhi_internal_dmac_dev_pm_ops),
>                 .of_match_table = renesas_sdhi_internal_dmac_of_match,
>         },
>         .probe          = renesas_sdhi_internal_dmac_probe,
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index c8cdb1c0722e..b9de03325c58 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -209,10 +209,8 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
>  void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
>  irqreturn_t tmio_mmc_irq(int irq, void *devid);
>
> -#ifdef CONFIG_PM
>  int tmio_mmc_host_runtime_suspend(struct device *dev);
>  int tmio_mmc_host_runtime_resume(struct device *dev);
> -#endif
>
>  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
>  {
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index 775e0d9353d5..8be642f737c7 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -1286,7 +1286,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
>  }
>  EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
>
> -#ifdef CONFIG_PM
>  static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
>  {
>         if (!host->clk_enable)
> @@ -1331,7 +1330,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
>         return 0;
>  }
>  EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_resume);
> -#endif
>
>  MODULE_DESCRIPTION("TMIO MMC core driver");
>  MODULE_LICENSE("GPL v2");
> --
> 2.43.0
>

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

* Re: [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks
  2025-10-08  4:25 ` [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks Claudiu
@ 2025-11-11 16:24   ` Ulf Hansson
  2025-11-13 21:09   ` Wolfram Sang
  1 sibling, 0 replies; 20+ messages in thread
From: Ulf Hansson @ 2025-11-11 16:24 UTC (permalink / raw)
  To: Claudiu
  Cc: wsa+renesas, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

On Wed, 8 Oct 2025 at 06:25, Claudiu <claudiu.beznea@tuxon.dev> wrote:
>
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Add suspend/resume hooks which assert/deassert the reset signals, along
> with forcing runtime suspend/resume. This allows using the driver in
> scenarios where the resume is done with the help of bootloader and the
> bootloader disables the SDHI clocks, resets, IRQs before passing execution
> to Linux.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

FYI, this looks good to me.

Kind regards
Uffe

> ---
>  drivers/mmc/host/renesas_sdhi.h               |  3 ++
>  drivers/mmc/host/renesas_sdhi_core.c          | 37 +++++++++++++++++++
>  drivers/mmc/host/renesas_sdhi_internal_dmac.c |  3 +-
>  3 files changed, 41 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
> index 084964cecf9d..afc36a407c2c 100644
> --- a/drivers/mmc/host/renesas_sdhi.h
> +++ b/drivers/mmc/host/renesas_sdhi.h
> @@ -9,6 +9,7 @@
>  #ifndef RENESAS_SDHI_H
>  #define RENESAS_SDHI_H
>
> +#include <linux/device.h>
>  #include <linux/dmaengine.h>
>  #include <linux/platform_device.h>
>  #include <linux/workqueue.h>
> @@ -107,4 +108,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>                        const struct renesas_sdhi_of_data *of_data,
>                        const struct renesas_sdhi_quirks *quirks);
>  void renesas_sdhi_remove(struct platform_device *pdev);
> +int renesas_sdhi_suspend(struct device *dev);
> +int renesas_sdhi_resume(struct device *dev);
>  #endif
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index c4aaf534868c..2a310a145785 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -31,6 +31,7 @@
>  #include <linux/platform_data/tmio.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_domain.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/regulator/driver.h>
>  #include <linux/regulator/of_regulator.h>
> @@ -1317,5 +1318,41 @@ void renesas_sdhi_remove(struct platform_device *pdev)
>  }
>  EXPORT_SYMBOL_GPL(renesas_sdhi_remove);
>
> +int renesas_sdhi_suspend(struct device *dev)
> +{
> +       struct tmio_mmc_host *host = dev_get_drvdata(dev);
> +       struct renesas_sdhi *priv = host_to_priv(host);
> +       int ret;
> +
> +       ret = pm_runtime_force_suspend(dev);
> +       if (ret)
> +               return ret;
> +
> +       ret = reset_control_assert(priv->rstc);
> +       if (ret)
> +               pm_runtime_force_resume(dev);
> +
> +       return ret;
> +}
> +EXPORT_SYMBOL_GPL(renesas_sdhi_suspend);
> +
> +int renesas_sdhi_resume(struct device *dev)
> +{
> +       struct tmio_mmc_host *host = dev_get_drvdata(dev);
> +       struct renesas_sdhi *priv = host_to_priv(host);
> +       int ret;
> +
> +       ret = reset_control_deassert(priv->rstc);
> +       if (ret)
> +               return ret;
> +
> +       ret = pm_runtime_force_resume(dev);
> +       if (ret)
> +               reset_control_assert(priv->rstc);
> +
> +       return ret;
> +}
> +EXPORT_SYMBOL_GPL(renesas_sdhi_resume);
> +
>  MODULE_DESCRIPTION("Renesas SDHI core driver");
>  MODULE_LICENSE("GPL v2");
> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> index 7ceb7b977a0b..9347017d47c4 100644
> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
> @@ -18,7 +18,6 @@
>  #include <linux/pagemap.h>
>  #include <linux/platform_data/tmio.h>
>  #include <linux/platform_device.h>
> -#include <linux/pm_runtime.h>
>  #include <linux/scatterlist.h>
>  #include <linux/sys_soc.h>
>
> @@ -599,7 +598,7 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
>  }
>
>  static const struct dev_pm_ops renesas_sdhi_internal_dmac_dev_pm_ops = {
> -       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> +       SYSTEM_SLEEP_PM_OPS(renesas_sdhi_suspend, renesas_sdhi_resume)
>         RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
>                        tmio_mmc_host_runtime_resume,
>                        NULL)
> --
> 2.43.0
>

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

* Re: [PATCH 0/3] mmc: renesas_sdhi: Handle resets
  2025-11-10 15:36 ` [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu Beznea
@ 2025-11-12 18:25   ` Wolfram Sang
  2025-11-13  8:12     ` Claudiu Beznea
  0 siblings, 1 reply; 20+ messages in thread
From: Wolfram Sang @ 2025-11-12 18:25 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 125 bytes --]


> Gentle ping on this series.

I had a look already but want to test this series on R-Car SoCs. Which
tests did you apply?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()
  2025-10-13 16:20   ` Geert Uytterhoeven
@ 2025-11-12 18:28     ` Wolfram Sang
  2025-11-13  8:32       ` Geert Uytterhoeven
  0 siblings, 1 reply; 20+ messages in thread
From: Wolfram Sang @ 2025-11-12 18:28 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Claudiu, ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc,
	linux-kernel, Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 1482 bytes --]

Hi Geert,

> > -#ifdef CONFIG_PM
> >  int tmio_mmc_host_runtime_suspend(struct device *dev);
> >  int tmio_mmc_host_runtime_resume(struct device *dev);
> > -#endif
> 
> This change is indeed needed, because RUNTIME_PM_OPS() now
> references these two functions unconditionally...
> 
> >
> >  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
> >  {
> > diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> > index 775e0d9353d5..8be642f737c7 100644
> > --- a/drivers/mmc/host/tmio_mmc_core.c
> > +++ b/drivers/mmc/host/tmio_mmc_core.c
> > @@ -1286,7 +1286,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
> >  }
> >  EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
> >
> > -#ifdef CONFIG_PM
> >  static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
> >  {
> >         if (!host->clk_enable)
> > @@ -1331,7 +1330,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
> >         return 0;
> >  }
> >  EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_resume);
> > -#endif
> 
> ... however, no actual code referencing them is emitted in the
> CONFIG_PM=n case, as renesas_sdhi_internal_dmac_dev_pm_ops is not used
> due to the use of pm_ptr().  Hence the changes to this file are needed.
> (verified with m68k allmodconfig/allyesconfig builds)

Since you confirmed all this, did you forget a Rev-by? Or do you
actually describe an issue which I am overlooking?

Happy hacking,

   Wolfram

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()
  2025-11-11 16:22   ` Ulf Hansson
@ 2025-11-13  8:01     ` Claudiu Beznea
  0 siblings, 0 replies; 20+ messages in thread
From: Claudiu Beznea @ 2025-11-13  8:01 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: wsa+renesas, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

Hi, Uffe,

On 11/11/25 18:22, Ulf Hansson wrote:
> On Wed, 8 Oct 2025 at 06:25, Claudiu <claudiu.beznea@tuxon.dev> wrote:
>>
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
>> and require __maybe_unused protection against unused function warnings.
> 
> I don't see them marked deprecated, is that really the case?

You're right, I got confused myself by some comments on pm.h. I'll update
it in the next version.

Thank you,
Claudiu

> 
>> The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
>> the compiler to see the functions, thus suppressing the warning. Thus
>> drop the __maybe_unused markings.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Other than the above, this looks fine to me!
> 
> Kind regards
> Uffe
> 
>> ---
>>  drivers/mmc/host/renesas_sdhi_internal_dmac.c | 11 +++++------
>>  drivers/mmc/host/tmio_mmc.h                   |  2 --
>>  drivers/mmc/host/tmio_mmc_core.c              |  2 --
>>  3 files changed, 5 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/mmc/host/renesas_sdhi_internal_dmac.c b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
>> index 9e3ed0bcddd6..7ceb7b977a0b 100644
>> --- a/drivers/mmc/host/renesas_sdhi_internal_dmac.c
>> +++ b/drivers/mmc/host/renesas_sdhi_internal_dmac.c
>> @@ -599,18 +599,17 @@ static int renesas_sdhi_internal_dmac_probe(struct platform_device *pdev)
>>  }
>>
>>  static const struct dev_pm_ops renesas_sdhi_internal_dmac_dev_pm_ops = {
>> -       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
>> -                               pm_runtime_force_resume)
>> -       SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
>> -                          tmio_mmc_host_runtime_resume,
>> -                          NULL)
>> +       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
>> +       RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
>> +                      tmio_mmc_host_runtime_resume,
>> +                      NULL)
>>  };
>>
>>  static struct platform_driver renesas_internal_dmac_sdhi_driver = {
>>         .driver         = {
>>                 .name   = "renesas_sdhi_internal_dmac",
>>                 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
>> -               .pm     = &renesas_sdhi_internal_dmac_dev_pm_ops,
>> +               .pm     = pm_ptr(&renesas_sdhi_internal_dmac_dev_pm_ops),
>>                 .of_match_table = renesas_sdhi_internal_dmac_of_match,
>>         },
>>         .probe          = renesas_sdhi_internal_dmac_probe,
>> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
>> index c8cdb1c0722e..b9de03325c58 100644
>> --- a/drivers/mmc/host/tmio_mmc.h
>> +++ b/drivers/mmc/host/tmio_mmc.h
>> @@ -209,10 +209,8 @@ void tmio_mmc_enable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
>>  void tmio_mmc_disable_mmc_irqs(struct tmio_mmc_host *host, u32 i);
>>  irqreturn_t tmio_mmc_irq(int irq, void *devid);
>>
>> -#ifdef CONFIG_PM
>>  int tmio_mmc_host_runtime_suspend(struct device *dev);
>>  int tmio_mmc_host_runtime_resume(struct device *dev);
>> -#endif
>>
>>  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
>>  {
>> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
>> index 775e0d9353d5..8be642f737c7 100644
>> --- a/drivers/mmc/host/tmio_mmc_core.c
>> +++ b/drivers/mmc/host/tmio_mmc_core.c
>> @@ -1286,7 +1286,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
>>  }
>>  EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
>>
>> -#ifdef CONFIG_PM
>>  static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
>>  {
>>         if (!host->clk_enable)
>> @@ -1331,7 +1330,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
>>         return 0;
>>  }
>>  EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_resume);
>> -#endif
>>
>>  MODULE_DESCRIPTION("TMIO MMC core driver");
>>  MODULE_LICENSE("GPL v2");
>> --
>> 2.43.0
>>


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

* Re: [PATCH 0/3] mmc: renesas_sdhi: Handle resets
  2025-11-12 18:25   ` Wolfram Sang
@ 2025-11-13  8:12     ` Claudiu Beznea
  2025-11-13 21:13       ` Wolfram Sang
  0 siblings, 1 reply; 20+ messages in thread
From: Claudiu Beznea @ 2025-11-13  8:12 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

Hi, Wolfram,

On 11/12/25 20:25, Wolfram Sang wrote:
> 
>> Gentle ping on this series.
> 
> I had a look already but want to test this series on R-Car SoCs. Which
> tests did you apply?
> 

On RZ/G3S the following were checked:
- run bonnie++ on all the SDHIs (with SD card and eMMC, where possible)
- unbind/bind on all the SDHIs and run bonnie++ (with SD card and eMMC,
  where possible) after re-bind
- 32 consecutive suspend/resume (s2idle and deep) and run bonnie++ (with SD
  card and eMMC where possible) after resume

bonnie++ tests were executed after boot on RZ/G2{H, M, N, L, UL}, RZ/V2L.

Thank you,
Claudiu



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

* Re: [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()
  2025-11-12 18:28     ` Wolfram Sang
@ 2025-11-13  8:32       ` Geert Uytterhoeven
  0 siblings, 0 replies; 20+ messages in thread
From: Geert Uytterhoeven @ 2025-11-13  8:32 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Claudiu, ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc,
	linux-kernel, Claudiu Beznea

Hi Wolfram,

On Wed, 12 Nov 2025 at 19:28, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> > > -#ifdef CONFIG_PM
> > >  int tmio_mmc_host_runtime_suspend(struct device *dev);
> > >  int tmio_mmc_host_runtime_resume(struct device *dev);
> > > -#endif
> >
> > This change is indeed needed, because RUNTIME_PM_OPS() now
> > references these two functions unconditionally...
> >
> > >
> > >  static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr)
> > >  {
> > > diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> > > index 775e0d9353d5..8be642f737c7 100644
> > > --- a/drivers/mmc/host/tmio_mmc_core.c
> > > +++ b/drivers/mmc/host/tmio_mmc_core.c
> > > @@ -1286,7 +1286,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
> > >  }
> > >  EXPORT_SYMBOL_GPL(tmio_mmc_host_remove);
> > >
> > > -#ifdef CONFIG_PM
> > >  static int tmio_mmc_clk_enable(struct tmio_mmc_host *host)
> > >  {
> > >         if (!host->clk_enable)
> > > @@ -1331,7 +1330,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
> > >         return 0;
> > >  }
> > >  EXPORT_SYMBOL_GPL(tmio_mmc_host_runtime_resume);
> > > -#endif
> >
> > ... however, no actual code referencing them is emitted in the
> > CONFIG_PM=n case, as renesas_sdhi_internal_dmac_dev_pm_ops is not used
> > due to the use of pm_ptr().  Hence the changes to this file are needed.

Oops, I intended to write "are not needed"!

> > (verified with m68k allmodconfig/allyesconfig builds)
>
> Since you confirmed all this, did you forget a Rev-by? Or do you
> actually describe an issue which I am overlooking?

Thank you for pushing me to rethink why I didn't provide an Rb-tag!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe
  2025-10-08  4:25 ` [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe Claudiu
  2025-10-10  7:51   ` Geert Uytterhoeven
@ 2025-11-13 21:06   ` Wolfram Sang
  1 sibling, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2025-11-13 21:06 UTC (permalink / raw)
  To: Claudiu
  Cc: ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

On Wed, Oct 08, 2025 at 07:25:23AM +0300, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Deassert the reset signal of the SDHI controller during probe to avoid
> relying on the previous bootloaders. Without deasserting the reset signal,
> the SDHI controller will not function.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()
  2025-10-08  4:25 ` [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Claudiu
  2025-10-13 16:20   ` Geert Uytterhoeven
  2025-11-11 16:22   ` Ulf Hansson
@ 2025-11-13 21:08   ` Wolfram Sang
  2 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2025-11-13 21:08 UTC (permalink / raw)
  To: Claudiu
  Cc: ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 722 bytes --]

On Wed, Oct 08, 2025 at 07:25:24AM +0300, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() are deprecated now
> and require __maybe_unused protection against unused function warnings.
> The usage of pm_ptr() and SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() allows
> the compiler to see the functions, thus suppressing the warning. Thus
> drop the __maybe_unused markings.

Well, #ifdefs, not __maybe_unused.

> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

I removed the chunk mentioned by Geert. I didn't dive into the details,
just tested it.

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks
  2025-10-08  4:25 ` [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks Claudiu
  2025-11-11 16:24   ` Ulf Hansson
@ 2025-11-13 21:09   ` Wolfram Sang
  1 sibling, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2025-11-13 21:09 UTC (permalink / raw)
  To: Claudiu
  Cc: ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 631 bytes --]

On Wed, Oct 08, 2025 at 07:25:25AM +0300, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Add suspend/resume hooks which assert/deassert the reset signals, along
> with forcing runtime suspend/resume. This allows using the driver in
> scenarios where the resume is done with the help of bootloader and the
> bootloader disables the SDHI clocks, resets, IRQs before passing execution
> to Linux.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 0/3] mmc: renesas_sdhi: Handle resets
  2025-11-13  8:12     ` Claudiu Beznea
@ 2025-11-13 21:13       ` Wolfram Sang
  2025-11-17  9:11         ` Claudiu Beznea
  0 siblings, 1 reply; 20+ messages in thread
From: Wolfram Sang @ 2025-11-13 21:13 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

[-- Attachment #1: Type: text/plain, Size: 656 bytes --]


> On RZ/G3S the following were checked:
> - run bonnie++ on all the SDHIs (with SD card and eMMC, where possible)
> - unbind/bind on all the SDHIs and run bonnie++ (with SD card and eMMC,
>   where possible) after re-bind
> - 32 consecutive suspend/resume (s2idle and deep) and run bonnie++ (with SD
>   card and eMMC where possible) after resume
> 
> bonnie++ tests were executed after boot on RZ/G2{H, M, N, L, UL}, RZ/V2L.

Thanks, I did some lighter testing on R-Car D3 with bind/unbind and
suspend-to-ram. Focussing on areas you modified. No regressions, all
worked fine.

Can I get the I3C pinctrl patch for G3S now as a reward? :)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 0/3] mmc: renesas_sdhi: Handle resets
  2025-11-13 21:13       ` Wolfram Sang
@ 2025-11-17  9:11         ` Claudiu Beznea
  0 siblings, 0 replies; 20+ messages in thread
From: Claudiu Beznea @ 2025-11-17  9:11 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: ulf.hansson, p.zabel, linux-mmc, linux-renesas-soc, linux-kernel,
	Claudiu Beznea

Hi, Wolfram,

On 11/13/25 23:13, Wolfram Sang wrote:
> 
>> On RZ/G3S the following were checked:
>> - run bonnie++ on all the SDHIs (with SD card and eMMC, where possible)
>> - unbind/bind on all the SDHIs and run bonnie++ (with SD card and eMMC,
>>   where possible) after re-bind
>> - 32 consecutive suspend/resume (s2idle and deep) and run bonnie++ (with SD
>>   card and eMMC where possible) after resume
>>
>> bonnie++ tests were executed after boot on RZ/G2{H, M, N, L, UL}, RZ/V2L.
> 
> Thanks, I did some lighter testing on R-Car D3 with bind/unbind and
> suspend-to-ram. Focussing on areas you modified. No regressions, all
> worked fine.

Thank you for checking it!

> 
> Can I get the I3C pinctrl patch for G3S now as a reward? :)
> 
I'll do my best :)

Thank you,
Claudiu


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

end of thread, other threads:[~2025-11-17  9:11 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08  4:25 [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu
2025-10-08  4:25 ` [PATCH 1/3] mmc: renesas_sdhi: Deassert the reset signal on probe Claudiu
2025-10-10  7:51   ` Geert Uytterhoeven
2025-10-10  9:35     ` Claudiu Beznea
2025-11-13 21:06   ` Wolfram Sang
2025-10-08  4:25 ` [PATCH 2/3] mmc: renesas_sdhi: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr() Claudiu
2025-10-13 16:20   ` Geert Uytterhoeven
2025-11-12 18:28     ` Wolfram Sang
2025-11-13  8:32       ` Geert Uytterhoeven
2025-11-11 16:22   ` Ulf Hansson
2025-11-13  8:01     ` Claudiu Beznea
2025-11-13 21:08   ` Wolfram Sang
2025-10-08  4:25 ` [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks Claudiu
2025-11-11 16:24   ` Ulf Hansson
2025-11-13 21:09   ` Wolfram Sang
2025-11-10 15:36 ` [PATCH 0/3] mmc: renesas_sdhi: Handle resets Claudiu Beznea
2025-11-12 18:25   ` Wolfram Sang
2025-11-13  8:12     ` Claudiu Beznea
2025-11-13 21:13       ` Wolfram Sang
2025-11-17  9:11         ` Claudiu Beznea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox