[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <177e21cc-0a9b-4543-8135-f4da424f5713@intel.com>
Date: Wed, 28 May 2025 14:32:20 +0300
From: Adrian Hunter <adrian.hunter@...el.com>
To: Sarthak Garg <quic_sartgarg@...cinc.com>, Bjorn Andersson
<andersson@...nel.org>, Konrad Dybcio <konradybcio@...nel.org>, Rob Herring
<robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Ulf Hansson <ulf.hansson@...aro.org>
CC: <linux-arm-msm@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-mmc@...r.kernel.org>,
<quic_cang@...cinc.com>, <quic_nguyenb@...cinc.com>,
<quic_rampraka@...cinc.com>, <quic_pragalla@...cinc.com>,
<quic_sayalil@...cinc.com>, <quic_nitirawa@...cinc.com>,
<quic_bhaskarv@...cinc.com>
Subject: Re: [PATCH V2 1/3] mmc: sdhci-msm: Enable tuning for SDR50 mode for
SD card
On 23/05/2025 13:57, 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. SDHCI_SDR50_NEEDS_TUNING caps will be set for targets
> with level shifter on Qualcomm SOC's.
>
> Signed-off-by: Sarthak Garg <quic_sartgarg@...cinc.com>
Assuming this is still needed even with new generic quirk approach:
Acked-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> drivers/mmc/host/sdhci-msm.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 66c0d1ba2a33..bf91cb96a0ea 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)
>
> @@ -1133,6 +1134,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)
> + return true;
> +
> /*
> * Tuning is required for SDR104, HS200 and HS400 cards and
> * if clock frequency is greater than 100MHz in these modes.
> @@ -1201,6 +1206,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;
> @@ -1217,6 +1224,14 @@ 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) {
> + config = readl_relaxed(host->ioaddr + msm_offset->core_vendor_spec);
> + config &= ~CORE_HC_SELECT_IN_MASK;
> + config |= CORE_HC_SELECT_IN_EN | CORE_HC_SELECT_IN_SDR50;
> + writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec);
> + }
> +
> /*
> * For HS400 tuning in HS200 timing requires:
> * - select MCLK/2 in VENDOR_SPEC
Powered by blists - more mailing lists