From patchwork Fri Dec 1 05:03:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Can Guo X-Patchwork-Id: 172240 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp887661vqy; Thu, 30 Nov 2023 21:05:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkZEcnXGe79K4+AOYv1fBRDE390d1S/EmEa1Nm9xT1TorUuaMg4XyHVCTxc9aRg8SuYuYK X-Received: by 2002:a05:6a21:2c94:b0:18b:ada6:b70d with SMTP id ua20-20020a056a212c9400b0018bada6b70dmr20078554pzb.46.1701407120340; Thu, 30 Nov 2023 21:05:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701407120; cv=none; d=google.com; s=arc-20160816; b=WI9LQEdYumJy4oG6EwZOQS95Gc7e7eb5KV2ZYS3PCHezhD0QdsvXwEYZ/WLbBZTn5g xCJNyFx2+ScCQeSV9Ndy7tPyfk28s6le9y0YAVoHm/INQU3yNr850iv1AKuANjkygAa2 8KGjY+beCfP42zfs2SjUSCbOnqoLJvIGEVvxi0EDN0DDx7GC5Cy0IiTDpKeab6+Ah0dV D64wz0IN1+fuIpOiHlsYZACqyPTiOZv0WOVndM+YslQZBc2icesSbEJbp3qjuRATtdDb z8+F4XDt0duERnG+trNWWvAsWA8BpPpTHL2cgIho8mXmCHhdFKGsIsjFMrReLlIS9nFg TuAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=OyKiuUDodWiYtj2DgO5yfQd7glArFtEh/Ov8j266V3Y=; fh=qjyuAZtnBDAP5VV5yupeXWqG7dBA1spPLDpGIgUrZDc=; b=ySaEmzIl747XDCf3BDbqAAlORTY9/T08uHSQX0ERcxahO8h5jcS2VO4RRHIrnB+kqB WP4ousfauMvQXCQdM26cl46ky7tDqwnpVBRB1UVbuorJmi2NvU9DV7trlu0c2992AhxO AUxWr11/YglhhDk8IVGe8OI4j66TGCRX4nQIK1Pw+IKwppvrZI1SlCfSrKim1zfT4Rtt IFiFlTJ1VASbkUUcBykXeq8LEFq38oWlAdL/yWzLA47fsTCGU8kR6LDWKoGt40LEcbDT ReFsFO5IpJp3QibfjDU28X9cVClzexaQRrrt5uawY5BqG4sSOC/hGydB/xL+YBAixqXO 4Qag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=L0XU67Bg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id nu15-20020a17090b1b0f00b002810ae70420si4929228pjb.121.2023.11.30.21.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 21:05:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=L0XU67Bg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 81FF580FC161; Thu, 30 Nov 2023 21:05:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377449AbjLAFEr (ORCPT + 99 others); Fri, 1 Dec 2023 00:04:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377397AbjLAFEi (ORCPT ); Fri, 1 Dec 2023 00:04:38 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43CD91736; Thu, 30 Nov 2023 21:04:44 -0800 (PST) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B14RAXf008379; Fri, 1 Dec 2023 05:04:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=qcppdkim1; bh=OyKiuUDodWiYtj2DgO5yfQd7glArFtEh/Ov8j266V3Y=; b=L0XU67Bgs1LUMa2Ykn3ZdNW+pR1xe7nebKTp0x79sdwGIoqXtlPhUFGLVlWFbSXtNlQ9 JYZ32Vo5lf+/mYKfH41Pv6xuLUOQCYMvWt0ng3kSDXKNph/TzDniGHm2lk4w++gS6q8E o6fzugAgLrlzMUrANSAZ12WnVz+aO/CY93kE5LRHQZNsO8vDuMimC4nVVkLyiPRSIquw xgE1h5uD87MjtVrP1HTMvMrITi0xPBzBRn9UO6QLYYUgDGUZTbuu307tM5lTMe9c+7fU T24Scj/tEvnFEuYaHIZrHrjOKgrGq/vshWY6hJemPTOO9rvoU/zjguBTUNSkmgF/qPUP gg== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uq3r2gk3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Dec 2023 05:04:05 +0000 Received: from pps.filterd (NASANPPMTA02.qualcomm.com [127.0.0.1]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3B14uBth009175; Fri, 1 Dec 2023 05:04:04 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NASANPPMTA02.qualcomm.com (PPS) with ESMTP id 3unmewbg4e-1; Fri, 01 Dec 2023 05:04:04 +0000 Received: from NASANPPMTA02.qualcomm.com (NASANPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3B14qHiR004580; Fri, 1 Dec 2023 05:04:04 GMT Received: from stor-dylan.qualcomm.com (stor-dylan.qualcomm.com [192.168.140.207]) by NASANPPMTA02.qualcomm.com (PPS) with ESMTP id 3B154453021362; Fri, 01 Dec 2023 05:04:04 +0000 Received: by stor-dylan.qualcomm.com (Postfix, from userid 359480) id E12B620A73; Thu, 30 Nov 2023 21:04:02 -0800 (PST) From: Can Guo To: quic_cang@quicinc.com, bvanassche@acm.org, mani@kernel.org, adrian.hunter@intel.com, vkoul@kernel.org, beanhuo@micron.com, avri.altman@wdc.com, junwoo80.lee@samsung.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andy Gross , Bjorn Andersson , Konrad Dybcio , "James E.J. Bottomley" , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v7 05/10] scsi: ufs: ufs-qcom: Limit HS-G5 Rate-A to hosts with HW version 5 Date: Thu, 30 Nov 2023 21:03:15 -0800 Message-Id: <1701407001-471-6-git-send-email-quic_cang@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1701407001-471-1-git-send-email-quic_cang@quicinc.com> References: <1701407001-471-1-git-send-email-quic_cang@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: w0OSGiRaY3c2aKRtJoemJfuC3orsQqsQ X-Proofpoint-ORIG-GUID: w0OSGiRaY3c2aKRtJoemJfuC3orsQqsQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-01_02,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxlogscore=798 bulkscore=0 spamscore=0 priorityscore=1501 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312010028 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 30 Nov 2023 21:05:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784054672653471833 X-GMAIL-MSGID: 1784054672653471833 Qcom UFS hosts, with HW ver 5, can only support up to HS-G5 Rate-A due to HW limitations. If the HS-G5 PHY gear is used, update host_params->hs_rate to Rate-A, so that the subsequent power mode changes shall stick to Rate-A. Reviewed-by: Nitin Rawat Reviewed-by: Manivannan Sadhasivam Signed-off-by: Can Guo --- drivers/ufs/host/ufs-qcom.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 81056b9..aca6199 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -442,9 +442,25 @@ static u32 ufs_qcom_get_hs_gear(struct ufs_hba *hba) static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) { struct ufs_qcom_host *host = ufshcd_get_variant(hba); + struct ufs_host_params *host_params = &host->host_params; struct phy *phy = host->generic_phy; + enum phy_mode mode; int ret; + /* + * HW ver 5 can only support up to HS-G5 Rate-A due to HW limitations. + * If the HS-G5 PHY gear is used, update host_params->hs_rate to Rate-A, + * so that the subsequent power mode change shall stick to Rate-A. + */ + if (host->hw_ver.major == 0x5) { + if (host->phy_gear == UFS_HS_G5) + host_params->hs_rate = PA_HS_MODE_A; + else + host_params->hs_rate = PA_HS_MODE_B; + } + + mode = host_params->hs_rate == PA_HS_MODE_B ? PHY_MODE_UFS_HS_B : PHY_MODE_UFS_HS_A; + /* Reset UFS Host Controller and PHY */ ret = ufs_qcom_host_reset(hba); if (ret) @@ -459,7 +475,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) return ret; } - phy_set_mode_ext(phy, PHY_MODE_UFS_HS_B, host->phy_gear); + phy_set_mode_ext(phy, mode, host->phy_gear); /* power on phy - start serdes and phy's power and clocks */ ret = phy_power_on(phy);