[PATCH v23 08/14] mmc: renesas_sdhi: Add optional axis/axim reset controls
Biju <[email protected]> Thu, 30 Jul 2026 12:31:46 +0100
| Newsgroups | org.kernel.vger.linux-mmc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-renesas-soc |
|---|---|
| Message-ID | <[email protected]> |
From: Biju Das <[email protected]> The RZ/G3L SoC has axis/axim resets compared to other SoCs. Add two optional reset controls, rstc_axis and rstc_axim, to the renesas_sdhi struct. Both are acquired at probe time using devm_reset_control_get_optional_exclusive_deasserted() with the "axis" and "axim" reset names respectively. Include them alongside the existing rstc in bulk reset/assert/deassert operations: triggered together in renesas_sdhi_reset(), and managed via reset_control_bulk_assert/deassert() in the suspend and resume paths, replacing the previous single-control calls. Being optional, these resets are a no-op on platforms that do not provide them, so existing behaviour is preserved. Signed-off-by: Biju Das <[email protected]> --- v22->v23: * No change. v21->v22: * No change. v20->v21: * No change. v19->v20: * Fixed the ordering of resets in suspend/resume paths. V18->v19: * No change. v17->v18: * Fixed ordering of reset in renesas_sdhi_reset(). v1->v17: * No change. --- drivers/mmc/host/renesas_sdhi.h | 2 ++ drivers/mmc/host/renesas_sdhi_core.c | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h index 9c72eb78e31e..3b140cd4ee0c 100644 --- a/drivers/mmc/host/renesas_sdhi.h +++ b/drivers/mmc/host/renesas_sdhi.h @@ -101,6 +101,8 @@ struct renesas_sdhi { unsigned int tap_set; struct reset_control *rstc; + struct reset_control *rstc_axis; + struct reset_control *rstc_axim; struct tmio_mmc_host *host; struct regulator_dev *rdev; }; diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 655f0920c015..ebbce7f010be 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -641,6 +641,8 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host, bool preserve) sd_status = sd_ctrl_read32(host, CTL_SD_STATUS); reset_control_reset(priv->rstc); + reset_control_reset(priv->rstc_axim); + reset_control_reset(priv->rstc_axis); /* Unknown why but without polling reset status, it will hang */ read_poll_timeout(reset_control_status, ret, ret == 0, 1, 100, false, priv->rstc); @@ -1155,6 +1157,14 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (IS_ERR(priv->rstc)) return PTR_ERR(priv->rstc); + priv->rstc_axim = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, "axim"); + if (IS_ERR(priv->rstc_axim)) + return PTR_ERR(priv->rstc_axim); + + priv->rstc_axis = devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, "axis"); + if (IS_ERR(priv->rstc_axis)) + return PTR_ERR(priv->rstc_axis); + priv->pinctrl = devm_pinctrl_get(&pdev->dev); if (!IS_ERR(priv->pinctrl)) { priv->pins_default = pinctrl_lookup_state(priv->pinctrl, @@ -1385,13 +1395,18 @@ int renesas_sdhi_suspend(struct device *dev) { struct tmio_mmc_host *host = dev_get_drvdata(dev); struct renesas_sdhi *priv = host_to_priv(host); + struct reset_control_bulk_data resets[] = { + { .rstc = priv->rstc_axis }, + { .rstc = priv->rstc_axim }, + { .rstc = priv->rstc }, + }; int ret; ret = pm_runtime_force_suspend(dev); if (ret) return ret; - ret = reset_control_assert(priv->rstc); + ret = reset_control_bulk_assert(ARRAY_SIZE(resets), resets); if (ret) pm_runtime_force_resume(dev); @@ -1403,15 +1418,20 @@ int renesas_sdhi_resume(struct device *dev) { struct tmio_mmc_host *host = dev_get_drvdata(dev); struct renesas_sdhi *priv = host_to_priv(host); + struct reset_control_bulk_data resets[] = { + { .rstc = priv->rstc_axis }, + { .rstc = priv->rstc_axim }, + { .rstc = priv->rstc }, + }; int ret; - ret = reset_control_deassert(priv->rstc); + ret = reset_control_bulk_deassert(ARRAY_SIZE(resets), resets); if (ret) return ret; ret = pm_runtime_force_resume(dev); if (ret) - reset_control_assert(priv->rstc); + reset_control_bulk_assert(ARRAY_SIZE(resets), resets); return ret; } -- 2.43.0