Devicetree
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Ulf Hansson <ulf.hansson@linaro.org>,
	Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-rockchip@lists.infradead.org, linux-mmc@vger.kernel.org,
	devicetree@vger.kernel.org, FUKAUMI Naoki <naoki@radxa.com>,
	Marco Schirrmeister <mschirrmeister@gmail.com>,
	John Clark <inindev@gmail.com>, Tianling Shen <cnsztl@gmail.com>,
	Detlev Casanova <detlev.casanova@collabora.com>,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: Re: [PATCH v4 3/5] mmc: dw_mmc-rockchip: Fix runtime PM support for internal phase support
Date: Fri, 16 Jan 2026 11:28:13 +0100	[thread overview]
Message-ID: <15381717.O6BkTfRZtg@diego> (raw)
In-Reply-To: <1768524932-163929-4-git-send-email-shawn.lin@rock-chips.com>

Am Freitag, 16. Januar 2026, 01:55:30 Mitteleuropäische Normalzeit schrieb Shawn Lin:
> RK3576 is the first platform to introduce internal phase support, and
> subsequent platforms are expected to adopt a similar design. In this
> architecture, runtime suspend powers off the attached power domain, which
> resets registers, including vendor-specific ones such as SDMMC_TIMING_CON0,
> SDMMC_TIMING_CON1, and SDMMC_MISC_CON. These registers must be saved and
> restored, a requirement that falls outside the scope of the dw_mmc core.
> 
> Fixes: 59903441f5e4 ("mmc: dw_mmc-rockchip: Add internal phase support")
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> Tested-by: Marco Schirrmeister <mschirrmeister@gmail.com>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> ---
> 
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/mmc/host/dw_mmc-rockchip.c | 38 +++++++++++++++++++++++++++++++++++++-
>  1 file changed, 37 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c
> index 879188f..2fe0896 100644
> --- a/drivers/mmc/host/dw_mmc-rockchip.c
> +++ b/drivers/mmc/host/dw_mmc-rockchip.c
> @@ -36,6 +36,8 @@ struct dw_mci_rockchip_priv_data {
>  	int			default_sample_phase;
>  	int			num_phases;
>  	bool			internal_phase;
> +	int                     sample_phase;
> +	int                     drv_phase;
>  };
>  
>  /*
> @@ -573,9 +575,43 @@ static void dw_mci_rockchip_remove(struct platform_device *pdev)
>  	dw_mci_pltfm_remove(pdev);
>  }
>  
> +static int dw_mci_rockchip_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct dw_mci *host = platform_get_drvdata(pdev);
> +	struct dw_mci_rockchip_priv_data *priv = host->priv;
> +
> +	if (priv->internal_phase) {
> +		priv->sample_phase = rockchip_mmc_get_phase(host, true);
> +		priv->drv_phase = rockchip_mmc_get_phase(host, false);
> +	}
> +
> +	return dw_mci_runtime_suspend(dev);
> +}
> +
> +static int dw_mci_rockchip_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct dw_mci *host = platform_get_drvdata(pdev);
> +	struct dw_mci_rockchip_priv_data *priv = host->priv;
> +	int ret;
> +
> +	ret = dw_mci_runtime_resume(dev);
> +	if (ret)
> +		return ret;
> +
> +	if (priv->internal_phase) {
> +		rockchip_mmc_set_phase(host, true, priv->sample_phase);
> +		rockchip_mmc_set_phase(host, false, priv->drv_phase);
> +		mci_writel(host, MISC_CON, MEM_CLK_AUTOGATE_ENABLE);
> +	}
> +
> +	return ret;
> +}
> +
>  static const struct dev_pm_ops dw_mci_rockchip_dev_pm_ops = {
>  	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> -	RUNTIME_PM_OPS(dw_mci_runtime_suspend, dw_mci_runtime_resume, NULL)
> +	RUNTIME_PM_OPS(dw_mci_rockchip_runtime_suspend, dw_mci_rockchip_runtime_resume, NULL)
>  };
>  
>  static struct platform_driver dw_mci_rockchip_pltfm_driver = {
> 





  reply	other threads:[~2026-01-16 10:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16  0:55 [PATCH v4 0/5] Fix sd card support for RK3576 platform Shawn Lin
2026-01-16  0:55 ` [PATCH v4 1/5] soc: rockchip: grf: Fix wrong RK3576_IOCGRF_MISC_CON definition Shawn Lin
2026-01-16  0:55 ` [PATCH v4 2/5] soc: rockchip: grf: Support multiple grf to be handled Shawn Lin
2026-01-16  0:55 ` [PATCH v4 3/5] mmc: dw_mmc-rockchip: Fix runtime PM support for internal phase support Shawn Lin
2026-01-16 10:28   ` Heiko Stübner [this message]
2026-01-21 14:54   ` Ulf Hansson
2026-01-16  0:55 ` [PATCH v4 4/5] arm64: dts: rockchip: Fix SD card support for RK3576 EVB1 Shawn Lin
2026-01-16  0:55 ` [PATCH v4 5/5] arm64: dts: rockchip: Fix SD card support for RK3576 Nanopi R76s Shawn Lin
2026-01-16 14:04 ` (subset) [PATCH v4 0/5] Fix sd card support for RK3576 platform Heiko Stuebner
2026-01-16 14:24   ` Shawn Lin

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=15381717.O6BkTfRZtg@diego \
    --to=heiko@sntech.de \
    --cc=cnsztl@gmail.com \
    --cc=detlev.casanova@collabora.com \
    --cc=devicetree@vger.kernel.org \
    --cc=inindev@gmail.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mschirrmeister@gmail.com \
    --cc=naoki@radxa.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=ulf.hansson@linaro.org \
    /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