RE: [PATCH v18 09/12] mmc: renesas_sdhi: Save and restore IOVS across suspend/resume
From: Biju Das
Date: Tue Jul 07 2026 - 08:04:54 EST
Hi Wolfram,
> -----Original Message-----
> From: Biju <biju.das.au@xxxxxxxxx>
> Sent: 22 June 2026 16:56
> Subject: [PATCH v18 09/12] mmc: renesas_sdhi: Save and restore IOVS across suspend/resume
>
> From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
>
> The SD_STATUS register, specifically the IOVS (I/O Voltage Switch) bit, is not automatically restored
> after a suspend/resume cycle, causing the regulator to report an incorrect voltage on resume.
>
> Fix this by caching the CTL_SD_STATUS register value in the renesas_sdhi private struct at suspend time
> and writing it back during resume. The save/restore is only performed when a regulator device (rdev) is
> present, as the IOVS bit is only relevant in that context.
>
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> ---
> v17->v18:
> * No change.
> v1->v17:
> * No change.
> ---
> drivers/mmc/host/renesas_sdhi.h | 1 +
> drivers/mmc/host/renesas_sdhi_core.c | 6 ++++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h index
> 9ac5cb25ee98..9d5e591ef2f5 100644
> --- a/drivers/mmc/host/renesas_sdhi.h
> +++ b/drivers/mmc/host/renesas_sdhi.h
> @@ -106,6 +106,7 @@ struct renesas_sdhi {
> struct regulator_dev *rdev;
>
> unsigned int divider;
> + u32 cache_sd_status;
> };
>
> #define host_to_priv(host) \
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index 8e14ce3ca7ba..f77985d305c0 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -1391,6 +1391,9 @@ int renesas_sdhi_suspend(struct device *dev)
> };
> int ret;
>
> + if (priv->rdev)
> + priv->cache_sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
> +
> ret = pm_runtime_force_suspend(dev);
> if (ret)
> return ret;
> @@ -1422,6 +1425,9 @@ int renesas_sdhi_resume(struct device *dev)
> if (ret)
> reset_control_bulk_assert(ARRAY_SIZE(resets), resets);
>
> + if (priv->rdev)
> + sd_ctrl_write32(host, CTL_SD_STATUS, priv->cache_sd_status);
> +
> return ret;
> }
> EXPORT_SYMBOL_GPL(renesas_sdhi_resume);
> --
> 2.43.0
[1] https://sashiko.dev/#/patchset/20260622155610.184271-1-biju.das.jz%40bp.renesas.com
OK will add the scoped pm calls before accessing the register.
+ PM_RUNTIME_ACQUIRE_IF_ENABLED(lvds->dev, pm);
+ ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
Cheers,
Biju