public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Ram Prakash Gupta <quic_rampraka@quicinc.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: <linux-mmc@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<dmitry.baryshkov@oss.qualcomm.com>, <quic_pragalla@quicinc.com>,
	<quic_sayalil@quicinc.com>, <quic_nitirawa@quicinc.com>,
	<quic_bhaskarv@quicinc.com>, <kernel@oss.qualcomm.com>,
	Sachin Gupta <quic_sachgupt@quicinc.com>
Subject: Re: [PATCH v5 3/4] mmc: sdhci-msm: Add device tree parsing logic for DLL settings
Date: Wed, 15 Oct 2025 21:28:55 +0300	[thread overview]
Message-ID: <1234c326-9950-48fa-815a-94337ff3cd7f@intel.com> (raw)
In-Reply-To: <20251013145316.1087274-4-quic_rampraka@quicinc.com>

On 13/10/2025 17:53, Ram Prakash Gupta wrote:
> From: Sachin Gupta <quic_sachgupt@quicinc.com>
> 
> Parse dll-presets from dt and introduces the capability to
> configure HS200 and HS400 DLL settings from device tree.
> 
> Signed-off-by: Sachin Gupta <quic_sachgupt@quicinc.com>
> Signed-off-by: Ram Prakash Gupta <quic_rampraka@quicinc.com>
> ---
>  drivers/mmc/host/sdhci-msm.c | 38 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 423e7cccab7d..8038b8def355 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -266,6 +266,19 @@ struct sdhci_msm_variant_info {
>  	const struct sdhci_msm_offset *offset;
>  };
>  
> +/*
> + * DLL registers which needs be programmed with HSR settings.
> + * Add any new register only at the end and don't change the
> + * sequence.
> + */
> +struct sdhci_msm_dll {
> +	u32 dll_config;
> +	u32 dll_config_2;
> +	u32 dll_config_3;
> +	u32 dll_usr_ctl;
> +	u32 ddr_config;
> +};
> +
>  struct sdhci_msm_host {
>  	struct platform_device *pdev;
>  	void __iomem *core_mem;	/* MSM SDCC mapped address */
> @@ -274,6 +287,7 @@ struct sdhci_msm_host {
>  	struct clk *xo_clk;	/* TCXO clk needed for FLL feature of cm_dll*/
>  	/* core, iface, cal and sleep clocks */
>  	struct clk_bulk_data bulk_clks[4];
> +	struct sdhci_msm_dll dll[2];
>  #ifdef CONFIG_MMC_CRYPTO
>  	struct qcom_ice *ice;
>  #endif
> @@ -302,6 +316,7 @@ struct sdhci_msm_host {
>  	u32 dll_config;
>  	u32 ddr_config;
>  	bool vqmmc_enabled;
> +	bool artanis_dll;
>  };
>  
>  static const struct sdhci_msm_offset *sdhci_priv_msm_offset(struct sdhci_host *host)
> @@ -2531,6 +2546,23 @@ static int sdhci_msm_gcc_reset(struct device *dev, struct sdhci_host *host)
>  	return ret;
>  }
>  
> +#define DLL_SIZE 10
> +static int sdhci_msm_dt_parse_dll(struct device *dev, struct sdhci_msm_host *msm_host)
> +{
> +	int ret;
> +	u32 *dll_table = &msm_host->dll[0].dll_config;

Local declarations in order of descending line length tends to
look neater, more readable e.g.

	u32 *dll_table = &msm_host->dll[0].dll_config;
	int ret;

> +
> +	msm_host->artanis_dll = false;
> +
> +	ret = of_property_read_variable_u32_array(dev->of_node,
> +						  "qcom,dll-presets",
> +						  dll_table, DLL_SIZE, DLL_SIZE);
> +	if (ret != -EINVAL)

Would rather have expected:

	if (ret == DLL_SIZE)
or
	if (ret > 0)

> +		msm_host->artanis_dll = true;
> +
> +	return ret;
> +}
> +
>  static int sdhci_msm_probe(struct platform_device *pdev)
>  {
>  	struct sdhci_host *host;
> @@ -2577,6 +2609,12 @@ static int sdhci_msm_probe(struct platform_device *pdev)
>  
>  	msm_host->saved_tuning_phase = INVALID_TUNING_PHASE;
>  
> +	ret = sdhci_msm_dt_parse_dll(&pdev->dev, msm_host);
> +	if (ret == -ENODATA || ret == -EOVERFLOW) {
> +		dev_err(&pdev->dev, "Bad DLL in dt (%d)\n", ret);
> +		return ret;
> +	}
> +
>  	ret = sdhci_msm_gcc_reset(&pdev->dev, host);
>  	if (ret)
>  		return ret;


  reply	other threads:[~2025-10-15 18:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 14:53 [PATCH v5 0/4] mmc: sdhci-msm: Rectify DLL programming sequence for SDCC Ram Prakash Gupta
2025-10-13 14:53 ` [PATCH v5 1/4] dt-bindings: mmc: Add dll-presets values for HS400 and HS200 modes Ram Prakash Gupta
2025-10-14  0:06   ` Krzysztof Kozlowski
2025-10-20 10:09     ` Krzysztof Kozlowski
2025-10-22  6:47       ` Ram Prakash Gupta
2025-10-13 14:53 ` [PATCH v5 2/4] mmc: sdhci-msm: Add core_major, minor to msm_host structure Ram Prakash Gupta
2025-10-13 14:53 ` [PATCH v5 3/4] mmc: sdhci-msm: Add device tree parsing logic for DLL settings Ram Prakash Gupta
2025-10-15 18:28   ` Adrian Hunter [this message]
2025-10-13 14:53 ` [PATCH v5 4/4] mmc: sdhci-msm: Rectify DLL programming sequence for SDCC Ram Prakash Gupta
2025-10-16  6:24   ` Adrian Hunter
2025-10-22  6:45     ` Ram Prakash Gupta

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=1234c326-9950-48fa-815a-94337ff3cd7f@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=kernel@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=quic_bhaskarv@quicinc.com \
    --cc=quic_nitirawa@quicinc.com \
    --cc=quic_pragalla@quicinc.com \
    --cc=quic_rampraka@quicinc.com \
    --cc=quic_sachgupt@quicinc.com \
    --cc=quic_sayalil@quicinc.com \
    --cc=robh@kernel.org \
    --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