public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Sarthak Garg <quic_sartgarg@quicinc.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bhupesh Sharma <bhupesh.sharma@linaro.org>
Cc: <linux-mmc@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<quic_cang@quicinc.com>, <quic_nguyenb@quicinc.com>,
	<quic_rampraka@quicinc.com>, <quic_pragalla@quicinc.com>,
	<quic_sayalil@quicinc.com>, <quic_nitirawa@quicinc.com>,
	<quic_sachgupt@quicinc.com>, <quic_bhaskarv@quicinc.com>,
	<quic_narepall@quicinc.com>, <kernel@quicinc.com>
Subject: Re: [PATCH V1 3/3] mmc: sdhci-msm: Limit HS mode frequency to 37.5MHz
Date: Tue, 20 May 2025 12:32:24 +0530	[thread overview]
Message-ID: <09b3f318-0599-445b-8587-ee8ab9d42cbd@quicinc.com> (raw)
In-Reply-To: <8b415442-283a-4fc8-ad0d-fbd8892d2ba2@intel.com>



On 11/11/2024 2:28 PM, Adrian Hunter wrote:
> On 7/11/24 10:05, Sarthak Garg wrote:
>> For Qualcomm SoCs with level shifter delays are seen on receivers data
>> path due to latency added by level shifter.
>>
>> To bring these delays in normal range and avoid CMD CRC errors
>> reduce frequency for HS mode SD cards to 37.5MHz for targets which has
>> level shifter.
>>
>> Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
>> ---
>>   drivers/mmc/host/sdhci-msm.c | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
>> index 16325c21de52..5e1dc06c4707 100644
>> --- a/drivers/mmc/host/sdhci-msm.c
>> +++ b/drivers/mmc/host/sdhci-msm.c
>> @@ -138,6 +138,8 @@
>>   /* Max load for eMMC Vdd-io supply */
>>   #define MMC_VQMMC_MAX_LOAD_UA	325000
>>   
>> +#define LEVEL_SHIFTER_HIGH_SPEED_FREQ	37500000
>> +
>>   #define msm_host_readl(msm_host, host, offset) \
>>   	msm_host->var_ops->msm_readl_relaxed(host, offset)
>>   
>> @@ -287,6 +289,7 @@ struct sdhci_msm_host {
>>   	bool use_cdr;
>>   	u32 transfer_mode;
>>   	bool updated_ddr_cfg;
>> +	bool uses_level_shifter;
>>   	bool uses_tassadar_dll;
>>   	u32 dll_config;
>>   	u32 ddr_config;
>> @@ -366,6 +369,11 @@ static void msm_set_clock_rate_for_bus_mode(struct sdhci_host *host,
>>   
>>   	mult = msm_get_clock_mult_for_bus_mode(host);
>>   	desired_rate = clock * mult;
>> +
>> +	if (curr_ios.timing == MMC_TIMING_SD_HS && desired_rate == 50000000
> 
> Wouldn't desired_rate > LEVEL_SHIFTER_HIGH_SPEED_FREQ make more sense?
> 

Sure will update in V2.

>> +		&& msm_host->uses_level_shifter)
>> +		desired_rate = LEVEL_SHIFTER_HIGH_SPEED_FREQ;
> 
> As checkpatch says:
> 
> CHECK: Logical continuations should be on the previous line
> #46: FILE: drivers/mmc/host/sdhci-msm.c:374:
> +       if (curr_ios.timing == MMC_TIMING_SD_HS && desired_rate == 50000000
> +               && msm_host->uses_level_shifter)
> 
> total: 0 errors, 0 warnings, 1 checks, 34 lines checked
> 
> 

Sure will fix this in V2.

>> +
>>   	rc = dev_pm_opp_set_rate(mmc_dev(host->mmc), desired_rate);
>>   	if (rc) {
>>   		pr_err("%s: Failed to set clock at rate %u at timing %d\n",
>> @@ -2372,6 +2380,8 @@ static inline void sdhci_msm_get_of_property(struct platform_device *pdev,
>>   
>>   	of_property_read_u32(node, "qcom,dll-config", &msm_host->dll_config);
>>   
>> +	msm_host->uses_level_shifter = of_property_read_bool(node, "qcom,use-level-shifter");
>> +
>>   	if (of_device_is_compatible(node, "qcom,msm8916-sdhci"))
>>   		host->quirks2 |= SDHCI_QUIRK2_BROKEN_64_BIT_DMA;
>>   }
> 

      reply	other threads:[~2025-05-20  7:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07  8:05 [PATCH V1 0/3] Add level shifter support for qualcomm SOC's Sarthak Garg
2024-11-07  8:05 ` [PATCH V1 1/3] dt-bindings: mmc: qcom: Document level shifter flag for SD card Sarthak Garg
2024-11-07  9:28   ` Rob Herring (Arm)
2024-11-07  9:59   ` Krzysztof Kozlowski
2025-05-20  6:58     ` Sarthak Garg
2025-05-20  7:18       ` Krzysztof Kozlowski
2025-05-20  9:15         ` Sarthak Garg
2024-11-07  8:05 ` [PATCH V1 2/3] mmc: sdhci-msm: Enable tuning for SDR50 mode " Sarthak Garg
2024-11-11  8:51   ` Adrian Hunter
2025-05-20  7:00     ` Sarthak Garg
2024-11-07  8:05 ` [PATCH V1 3/3] mmc: sdhci-msm: Limit HS mode frequency to 37.5MHz Sarthak Garg
2024-11-11  8:58   ` Adrian Hunter
2025-05-20  7:02     ` Sarthak Garg [this message]

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=09b3f318-0599-445b-8587-ee8ab9d42cbd@quicinc.com \
    --to=quic_sartgarg@quicinc.com \
    --cc=adrian.hunter@intel.com \
    --cc=bhupesh.sharma@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@quicinc.com \
    --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_cang@quicinc.com \
    --cc=quic_narepall@quicinc.com \
    --cc=quic_nguyenb@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