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 2/3] mmc: sdhci-msm: Enable tuning for SDR50 mode for SD card
Date: Tue, 20 May 2025 12:30:51 +0530 [thread overview]
Message-ID: <3d867490-0738-4baf-9fd0-e522aa8d2677@quicinc.com> (raw)
In-Reply-To: <4e4870b5-4491-4f65-9a41-1a5e9e1bdf68@intel.com>
On 11/11/2024 2:21 PM, Adrian Hunter wrote:
> On 7/11/24 10:05, Sarthak Garg wrote:
>> For Qualcomm SoCs which needs level shifter for SD card, extra delay is
>> seen on receiver data path.
>>
>> To compensate this delay enable tuning for SDR50 mode for targets which
>> has level shifter.
>>
>> Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
>> ---
>> drivers/mmc/host/sdhci-msm.c | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
>> index e00208535bd1..16325c21de52 100644
>> --- a/drivers/mmc/host/sdhci-msm.c
>> +++ b/drivers/mmc/host/sdhci-msm.c
>> @@ -81,6 +81,7 @@
>> #define CORE_IO_PAD_PWR_SWITCH_EN BIT(15)
>> #define CORE_IO_PAD_PWR_SWITCH BIT(16)
>> #define CORE_HC_SELECT_IN_EN BIT(18)
>> +#define CORE_HC_SELECT_IN_SDR50 (4 << 19)
>> #define CORE_HC_SELECT_IN_HS400 (6 << 19)
>> #define CORE_HC_SELECT_IN_MASK (7 << 19)
>>
>> @@ -1124,6 +1125,10 @@ static bool sdhci_msm_is_tuning_needed(struct sdhci_host *host)
>> {
>> struct mmc_ios *ios = &host->mmc->ios;
>>
>> + if (ios->timing == MMC_TIMING_UHS_SDR50 &&
>> + host->flags & SDHCI_SDR50_NEEDS_TUNING)
>
> Please do line up code as suggested by checkpatch:
>
> CHECK: Alignment should match open parenthesis
> #35: FILE: drivers/mmc/host/sdhci-msm.c:1129:
> + if (ios->timing == MMC_TIMING_UHS_SDR50 &&
> + host->flags & SDHCI_SDR50_NEEDS_TUNING)
>
> CHECK: Alignment should match open parenthesis
> #55: FILE: drivers/mmc/host/sdhci-msm.c:1219:
> + if (ios.timing == MMC_TIMING_UHS_SDR50 &&
> + host->flags & SDHCI_SDR50_NEEDS_TUNING) {
>
> total: 0 errors, 0 warnings, 2 checks, 40 lines checked
>
>
Sure will update in V2.
>> + return true;
>> +
>> /*
>> * Tuning is required for SDR104, HS200 and HS400 cards and
>> * if clock frequency is greater than 100MHz in these modes.
>> @@ -1192,6 +1197,8 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
>> struct mmc_ios ios = host->mmc->ios;
>> struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
>> + const struct sdhci_msm_offset *msm_offset = msm_host->offset;
>> + u32 config;
>>
>> if (!sdhci_msm_is_tuning_needed(host)) {
>> msm_host->use_cdr = false;
>> @@ -1208,6 +1215,15 @@ static int sdhci_msm_execute_tuning(struct mmc_host *mmc, u32 opcode)
>> */
>> msm_host->tuning_done = 0;
>>
>> + if (ios.timing == MMC_TIMING_UHS_SDR50 &&
>> + host->flags & SDHCI_SDR50_NEEDS_TUNING) {
>
> Ditto alignment
>
Sure will update in V2.
>> + config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec);
>> + config |= CORE_HC_SELECT_IN_EN;
>> + config &= ~CORE_HC_SELECT_IN_MASK;
>> + config |= CORE_HC_SELECT_IN_SDR50;
>
> Perhaps clear bits first, then set bits e.g.
>
> config &= ~CORE_HC_SELECT_IN_MASK;
> config |= CORE_HC_SELECT_IN_EN | CORE_HC_SELECT_IN_SDR50;
>
Sure will update in V2.
>> + writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec);
>> + }
>> +
>> /*
>> * For HS400 tuning in HS200 timing requires:
>> * - select MCLK/2 in VENDOR_SPEC
>
next prev parent reply other threads:[~2025-05-20 7:01 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 [this message]
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
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=3d867490-0738-4baf-9fd0-e522aa8d2677@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