From: Biju Das <biju.das.au@gmail.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Ulf Hansson <ulfh@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-mmc@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Biju Das <biju.das.jz@bp.renesas.com>
Subject: [PATCH v4 1/3] mmc: renesas_sdhi: Save and restore IOVS across suspend/resume
Date: Tue, 24 Nov 2026 16:31:19 +0000 [thread overview]
Message-ID: <20261124-sdhi_hs400-v4-1-df452ccd9bca@bp.renesas.com> (raw)
In-Reply-To: <20261124-sdhi_hs400-v4-0-df452ccd9bca@bp.renesas.com>
From: Biju Das <biju.das.jz@bp.renesas.com>
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
whole register is saved and restored, as IOVS shares it with other bits.
The save/restore is only performed when a regulator device (rdev) is
present, as the IOVS bit is only relevant in that context.
Fixes: dcbce328d3a2 ("mmc: renesas_sdhi: Add suspend/resume hooks")
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
- No change.
v2->v3:
- No change.
v1->v2:
- Added fixes tag
---
drivers/mmc/host/renesas_sdhi.h | 2 ++
drivers/mmc/host/renesas_sdhi_core.c | 26 +++++++++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index 4f8ed1d8efee..a93e613e9821 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -106,6 +106,8 @@ struct renesas_sdhi {
struct reset_control *rstc_axim;
struct tmio_mmc_host *host;
struct regulator_dev *rdev;
+
+ 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 5e649ef20990..56286431fd2c 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1465,6 +1465,15 @@ int renesas_sdhi_suspend(struct device *dev)
};
int ret;
+ if (priv->rdev) {
+ PM_RUNTIME_ACQUIRE_IF_ENABLED(dev, pm);
+ ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
+ if (ret < 0)
+ return ret;
+
+ priv->cache_sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
+ }
+
ret = pm_runtime_force_suspend(dev);
if (ret)
return ret;
@@ -1494,8 +1503,23 @@ int renesas_sdhi_resume(struct device *dev)
ret = pm_runtime_force_resume(dev);
if (ret)
- reset_control_bulk_assert(ARRAY_SIZE(resets), resets);
+ goto err_assert;
+
+ if (priv->rdev) {
+ PM_RUNTIME_ACQUIRE_IF_ENABLED(dev, pm);
+ ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
+ if (ret < 0)
+ goto err_pm;
+
+ sd_ctrl_write32(host, CTL_SD_STATUS, priv->cache_sd_status);
+ }
+
+ return 0;
+err_pm:
+ pm_runtime_force_suspend(dev);
+err_assert:
+ reset_control_bulk_assert(ARRAY_SIZE(resets), resets);
return ret;
}
EXPORT_SYMBOL_GPL(renesas_sdhi_resume);
--
2.43.0
next prev parent reply other threads:[~2026-11-24 16:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 16:31 [PATCH v4 0/3] Add RZ/G3L HS400 support Biju Das
2026-11-24 16:31 ` Biju Das [this message]
2026-11-24 16:31 ` [PATCH v4 2/3] mmc: renesas_sdhi: Make HS400 OSEL bit configurable per SoC Biju Das
2026-11-24 16:31 ` [PATCH v4 3/3] mmc: renesas_sdhi: Add RZ/G3L HS400 support Biju Das
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124-sdhi_hs400-v4-1-df452ccd9bca@bp.renesas.com \
--to=biju.das.au@gmail.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=ulfh@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®