RE: [PATCH v19 07/12] mmc: renesas_sdhi: Add optional axis/axim reset controls

Biju Das <[email protected]>
Newsgroups org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mmc
Message-ID <TY3PR01MB11346721264D8D0454110707286FD2@TY3PR01MB11346.jpnprd01.prod.outlook.com>
Hi All,

> -----Original Message-----
> From: Biju <[email protected]>
> Sent: 09 July 2026 20:29
> Subject: [PATCH v19 07/12] mmc: renesas_sdhi: Add optional axis/axim reset controls
> 
> 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]>
> ---
> 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
> 438b2a7afe76..d46598190004 100644
> --- a/drivers/mmc/host/renesas_sdhi.h
> +++ b/drivers/mmc/host/renesas_sdhi.h
> @@ -100,6 +100,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 b6bba03316fe..6ec8dc96b581 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -623,6 +623,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);
> @@ -1137,6 +1139,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,
> @@ -1363,13 +1373,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 },
> +		{ .rstc = priv->rstc_axim },
> +		{ .rstc = priv->rstc_axis },
> +	};
>  	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);
> 
> @@ -1381,15 +1396,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 },
> +		{ .rstc = priv->rstc_axim },
> +		{ .rstc = priv->rstc_axis },
> +	};
>  	int ret;
> 
> -	ret = reset_control_deassert(priv->rstc);
> +	ret = reset_control_bulk_deassert(ARRAY_SIZE(resets), resets);

I will fix the reordering for resets as mentioned in [1]

[1] https://sashiko.dev/#/patchset/20260709192916.630794-1-biju.das.jz%40bp.renesas.com

Cheers,
Biju

>  	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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.