Re: [PATCH 3/3] mmc: renesas_sdhi: Add suspend/resume hooks

From: Ulf Hansson

Date: Tue Nov 11 2025 - 11:24:54 EST


On Wed, 8 Oct 2025 at 06:25, Claudiu <claudiu.beznea@xxxxxxxxx> wrote:
>
> From: Claudiu Beznea <claudiu.beznea.uj@xxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxx>

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
>