From patchwork Thu Nov 7 08:05:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarthak Garg X-Patchwork-Id: 841608 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 081A41940AA; Thu, 7 Nov 2024 08:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730966722; cv=none; b=trMOMBp/wk84JiK/Ao6PkNQcj93z8MgNAiJNtbm2z/S406yhP2dXVoItpgfO9KVqvMJzPEruV4BX3Shqrcc4Qr14+AQUhS3jzk/7Qqu4vgRWY1e/FtbFt8ajjDkqhkQF/D4c3MFt7aLMl7wkQVruXhiuuAgkpjl5q/Hkv0+mtxI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730966722; c=relaxed/simple; bh=GLmTUcYPw4pbNYmT3E03uu9pnXnKM46hoZT26/ON8B4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=V3W3qy1k5xzKuhj2yOxmwVQYVnG9SrbMqxsua/LsCxC/SEm5xmaT86pyOAgsilCxNPSDmb7tQq/NbQ0T4FduzdcHFnEJ2uLXMkHS8XT+n1vjyQ7JzB5uVn8InpvPHBLeshEx0GZTk8iUo2WZ8VfKxxoIS9UeOpd0G+ie0K8kamQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=dQ2voKJQ; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="dQ2voKJQ" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A750soN031719; Thu, 7 Nov 2024 08:05:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:date:from:in-reply-to:message-id:references:subject:to; s= qcppdkim1; bh=7PQYx5IpkhZkNsQ7e0vwVnMVVhNCA7qjIYald4fu3oo=; b=dQ 2voKJQf4sLd8zvXh83vDS2elGRzNJYaNCjSI4kw+vNtPaoyQdCspYJ/VWUatA2zy Ty7XERAyGSUekVSoErvsKvW5SXiB8EzlBluIyoEnoIZad+lNT6QL2aN91tm5AgFM 7eaBmWnNdjXz/TjSd7JIKpFg5n12skAZTFD9LRdx6KLJj6QLPhwBuj5A7uTmhqsq WsTbefLKXItlh9lq++gDhmP0+4+rldQseqXTJ2/y+wIOb+COVDN6QIgOwwYbX8z2 ZYGWnc6stMpFmvjFQ6h3zrJSLLuEzn59F1gm7Ij7GrsBtY7FkgOlCgfqUHtll413 Kcs2l2qPHo4g4qAdktVg== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42qfdx6t3v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 08:05:15 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A785CUF004490; Thu, 7 Nov 2024 08:05:12 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 42nd5mu5ne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 08:05:12 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4A785CWX004484; Thu, 7 Nov 2024 08:05:12 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-sartgarg-hyd.qualcomm.com [10.213.105.147]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 4A785BTQ004463; Thu, 07 Nov 2024 08:05:12 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 2339771) id 65F4B5013D2; Thu, 7 Nov 2024 13:35:11 +0530 (+0530) From: Sarthak Garg To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Adrian Hunter , Bhupesh Sharma 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, Sarthak Garg Subject: [PATCH V1 1/3] dt-bindings: mmc: qcom: Document level shifter flag for SD card Date: Thu, 7 Nov 2024 13:35:03 +0530 Message-Id: <20241107080505.29244-2-quic_sartgarg@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241107080505.29244-1-quic_sartgarg@quicinc.com> References: <20241107080505.29244-1-quic_sartgarg@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: JvrNl5VErNbgcvviwDdhmQ1PeBAtB0Z5 X-Proofpoint-ORIG-GUID: JvrNl5VErNbgcvviwDdhmQ1PeBAtB0Z5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411070060 Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Introduce a flag to indicate if the Qualcomm platform has a level shifter for SD cards. With level shifter addition some extra delay is seen on RX data path leading to CRC errors. To compensate these delays and avoid CRC errors below things needs to be done: 1) Enable tuning for SDR50 mode 2) Limit HS mode frequency to 37.5MHz from 50MHz Add this flag for all targets with a level shifter to handle these issues for SD card. Signed-off-by: Sarthak Garg --- Documentation/devicetree/bindings/mmc/sdhci-msm.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml b/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml index b32253c60919..14f1ec9ae5bd 100644 --- a/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml +++ b/Documentation/devicetree/bindings/mmc/sdhci-msm.yaml @@ -131,6 +131,9 @@ properties: $ref: /schemas/types.yaml#/definitions/uint32 description: platform specific settings for DLL_CONFIG reg. + qcom,use-level-shifter: + description: Flag to indicate if platform has level shifter for SD card. + iommus: minItems: 1 maxItems: 8 From patchwork Thu Nov 7 08:05:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarthak Garg X-Patchwork-Id: 842261 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE7D91D54D3; Thu, 7 Nov 2024 08:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730966723; cv=none; b=QC8+zsj2JHco7QY6OGJUtAKHjgbhZ3E8ZQOsu8XgKnXZheibaGlgequ32woJUuw0tHWaliGFTrQxiDueVy/rtJk885c+dQtSdd3X1Hnutx5/IjDc/TbQ5EibSogGBl+yCf4AIySr6qPQ32GUa6DXmu3WfVKNMU4Eors5pjysVic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730966723; c=relaxed/simple; bh=faJHThjz7GY5khQjB3VMy/x+ezycfM3lGBpNUnGd8r4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=MrIe3mIL1IHNXSmn8sbYuzc1j3SjaexJvWl2ngIGGdQibN/uALBVLmYetW5fSXbk6bk6aBQcINq9FrJEO5bdhAjCDqA/8JFVncoH5xMPu0WZLFTtS0XSNvWdz0hIKYeFbuNnZAYvHuMomkuDPjf8OXQy1/7OmBfu03N4ACiG7dg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=MocoW4b3; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MocoW4b3" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A76Zkvv010532; Thu, 7 Nov 2024 08:05:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:date:from:in-reply-to:message-id:references:subject:to; s= qcppdkim1; bh=8N1qvanPBz21BJTMju92ge9xmlJRM1woQ6p4wQj7eHw=; b=Mo coW4b3V1XbicC9KLzKeLNUr3kOPmRNpDc+qomNd+Tn6fGiId0J2BJJ+4TyQwvz6K ZXuWBG7/CAvv7OArqTQFqX2DwHBEuy5jMYHyTUQ4/HQuOcXRmzUNinKbnFpMixNp LoWBwli86hboDpfHo3SrreDLhK/etdw+Foe/oLMto8f65LRCcrjkZ5PqFTswx+OX 98n0FA0sn+MX5EgbyJpfbv3Xpc7kRYXYKR8Q8+74L0r+QLMysaQHHLO62neLsrkL hEWQvvM/h0CfS8tFyuD2pwgjKovGBFE1Ew533dv/2dM8kuELZx99mEcRy0eeqLjI Jq7nsy8oGoGRMWtGlpWg== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42qn73dnrp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 08:05:17 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A785EUl004504; Thu, 7 Nov 2024 08:05:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 42nd5mu5nn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 08:05:14 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4A785DfG004498; Thu, 7 Nov 2024 08:05:13 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-sartgarg-hyd.qualcomm.com [10.213.105.147]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 4A785DBW004497; Thu, 07 Nov 2024 08:05:13 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 2339771) id EB08C5013D2; Thu, 7 Nov 2024 13:35:12 +0530 (+0530) From: Sarthak Garg To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Adrian Hunter , Bhupesh Sharma 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, Sarthak Garg Subject: [PATCH V1 2/3] mmc: sdhci-msm: Enable tuning for SDR50 mode for SD card Date: Thu, 7 Nov 2024 13:35:04 +0530 Message-Id: <20241107080505.29244-3-quic_sartgarg@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241107080505.29244-1-quic_sartgarg@quicinc.com> References: <20241107080505.29244-1-quic_sartgarg@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: GPwoXT1SiJF8lCQw0ks1YqylnfKqbKtY X-Proofpoint-GUID: GPwoXT1SiJF8lCQw0ks1YqylnfKqbKtY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 suspectscore=0 spamscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411070060 Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 --- 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) + 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) { + 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; + writel_relaxed(config, host->ioaddr + msm_offset->core_vendor_spec); + } + /* * For HS400 tuning in HS200 timing requires: * - select MCLK/2 in VENDOR_SPEC From patchwork Thu Nov 7 08:05:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sarthak Garg X-Patchwork-Id: 841607 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D5A51DB372; Thu, 7 Nov 2024 08:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730966725; cv=none; b=OR7gMfRodkU41jv8UrWOWzXkjNNNn0spRiCY7T7nCGlQj3IM0YtlDCO/1KkgtfSv9gCSQMsoYEdg1bnbZzApFXwkOO7VG83nmi9EvqTV4MFei3DvJjJf/PU4F9ZkSdhrM7StE/fa5fnrBqnBaxGK0OhKAVVH0xmB35MaJT8NCuU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730966725; c=relaxed/simple; bh=+Qv4Z6158Iv+7BItSSfBSo/w9yMs1NxgL3uRJbM2cjc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=HcAxrCdtB9RIiSuKIDKhVNPcnHEbPLNhUG1BtCyPBaqWcGao9BVMBwd9x8pAVunKLYGYE3oLJb6UWD1VQU0HSYRGNfHBnU8dHh3shKYGI+g45bypPq9wo0HjRE7nFfKZ2HfrxENUBTSrb5X9rPXo94xa1RXhfct8Quq4VYEg6as= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=nOENropn; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="nOENropn" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A71HEOr005306; Thu, 7 Nov 2024 08:05:21 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:date:from:in-reply-to:message-id:references:subject:to; s= qcppdkim1; bh=MNn9gnfQccnQWE3qEzReoQ4ozshVH41Oucj/8xiR6Lc=; b=nO ENropnDKqLHTrBHMAZCNnWViyfAo5E1a/k72vD+BCmq9IOMYawtUMchOuRwNUC/R HdxgHZiyZpMaijq08wZ5c6hVNTgdQkOUpKNAE7ZuoXoZJUsnJMcazWAdEoJo/MTn P6hZ4CcA2M32mnXag/5fjfn9vGES8/iLtfSZUnfmd5jATwouQkiDHAyJftgf/G1p Tf+tfV4CyflFvLCKiUXNajvRTZlMNXOpBM/WUEZKKh0hs7RaBCMUqpLWGCmMwgNw akcP56rLv+Y7QKOD7XN6/YEq4cDSKCqwLfKJqVw1ZtmpjvP1BhWj00K8nsv8fsOW YE93ojAWREWSL40W71Cg== Received: from apblrppmta01.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42qvg3vf9j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2024 08:05:20 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTP id 4A785G1d004533; Thu, 7 Nov 2024 08:05:16 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTPS id 42nd5mu5nw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 07 Nov 2024 08:05:16 +0000 Received: from APBLRPPMTA01.qualcomm.com (APBLRPPMTA01.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4A785DfI004498; Thu, 7 Nov 2024 08:05:15 GMT Received: from hu-maiyas-hyd.qualcomm.com (hu-sartgarg-hyd.qualcomm.com [10.213.105.147]) by APBLRPPMTA01.qualcomm.com (PPS) with ESMTP id 4A785FUa004527; Thu, 07 Nov 2024 08:05:15 +0000 Received: by hu-maiyas-hyd.qualcomm.com (Postfix, from userid 2339771) id E2F105013D2; Thu, 7 Nov 2024 13:35:14 +0530 (+0530) From: Sarthak Garg To: Ulf Hansson , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Adrian Hunter , Bhupesh Sharma 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, Sarthak Garg Subject: [PATCH V1 3/3] mmc: sdhci-msm: Limit HS mode frequency to 37.5MHz Date: Thu, 7 Nov 2024 13:35:05 +0530 Message-Id: <20241107080505.29244-4-quic_sartgarg@quicinc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20241107080505.29244-1-quic_sartgarg@quicinc.com> References: <20241107080505.29244-1-quic_sartgarg@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: LkANyD9lYgCDZA9MYRePx1y3Fhq-FenZ X-Proofpoint-GUID: LkANyD9lYgCDZA9MYRePx1y3Fhq-FenZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 spamscore=0 suspectscore=0 bulkscore=0 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2411070060 Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 --- 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 + && msm_host->uses_level_shifter) + desired_rate = LEVEL_SHIFTER_HIGH_SPEED_FREQ; + 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; }