Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp908196rdf; Tue, 21 Nov 2023 23:17:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvIcRhj1aKur+oQvCP/1QqPZhtGFNUgG0yafxV5DaOS9lKC2ypC9NUqqfLjuTlzFGYI3RL X-Received: by 2002:a17:90b:1bcf:b0:27d:4278:ba53 with SMTP id oa15-20020a17090b1bcf00b0027d4278ba53mr1633808pjb.47.1700637431809; Tue, 21 Nov 2023 23:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700637431; cv=none; d=google.com; s=arc-20160816; b=csrbHO8hOvxkuWQrnAbg2HZrFIeoIaCIOJMsX2jwtSgu2kr92cI4pB0MMtw3v86an/ BPH14QcvDGU1Ya1mofZsGJkUHr2pIbHxWupN8ZqsPQb7MLYQUsi7AtZP7QiNyCzsGj23 1pVIVeI2+QZJp0onzpUWDPoAIEcFmVApoOlHyTUzB3PadFcXQsREFtHaohrw3bpoGsN7 qO9fMP635Qyarvub+exRMMwZHKWyKbaJ0qB7SxdyPLrUrShYxJYb/tqdyJl100vww/mf jusJMr7fdfZ+VA7qxAW8ZpDo+EPs5bDb+ki57PJACuYvDeQ6NS+xLsHDPNW917yxY35M qaOA== 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=bOrJSSNFsLGbiSSB8YF589JZQLsAbNb5oTKc3fog6kw=; fh=fyPT5phGKeBfoOC/BOPzKJl/xgSxxu2I+EcBl6g/Bns=; b=syafN8L7wzh1LMsdOW632IRRodYcrAoOJn4XQSEL/cdYTHnw4GLRAe5IXYT/lbB1+0 V89y9Wv4lwm4P6CGg4qVmf+0utuS/S/E0ZVEGpnVCo7Ri8/W8fpx/goJ/r7RRvsVTVHD sQjjOJC2ib+eJaSJ3A2ffxTM1V++UORiLC+eYmvbF6GguE7MkxgAefCIUZLBtWjI3Eef qZeujQEwGUJyAZsOUfxMxhvuyG/RHz7kxpsKIXTpUSQjGvB7A8dck2WH87lR2Gqy6uZe s0Tj4+UV5KTaN3RV/70KxO1uVJOSg4T4cmF4SLUA9nPJOE0ZIRmvhccq2rzsxvMjelVU 8kog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WjPDWZKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id bw1-20020a17090af60100b0027450695a78si887256pjb.172.2023.11.21.23.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 23:17:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=WjPDWZKN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id 1E0048026685; Tue, 21 Nov 2023 23:17:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234924AbjKVHQY (ORCPT + 99 others); Wed, 22 Nov 2023 02:16:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234910AbjKVHQW (ORCPT ); Wed, 22 Nov 2023 02:16:22 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B100B1A8; Tue, 21 Nov 2023 23:16:18 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AM4xPue013945; Wed, 22 Nov 2023 07:11:07 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=bOrJSSNFsLGbiSSB8YF589JZQLsAbNb5oTKc3fog6kw=; b=WjPDWZKN/09jQNKi0ah89tf8VfXL+XzGG/wO2yVFtESpANDgG/dFj64ETThHf5OJFtRV u78Ww2WW1OF4kfnUId1lGZJB9OvuCuz6qZs4xB57bt8bKncnruRuaMLK38SIsFhfkDK6 i/4wXANO6B+IAYH5zlYX+5wrFSJ++5l6wMyT3v8shpR4niuZmJ0D//lpI+SBGFbM4Iqa seHjn7xGtz44B8olkMeSyxK0ZwQITvLzmn1DCds1EZ65gZ9MI4QV892XzB6JL6D3Iolm Q0/8uvGq4xx8RX74S7odEsqEnE1waYYJnzp/kLI82rYc5HVoA85q/Vhl89dOA+lqHUys Bw== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ugxn8hy5w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Nov 2023 07:11:07 +0000 Received: from pps.filterd (NASANPPMTA03.qualcomm.com [127.0.0.1]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3AM77S71012224; Wed, 22 Nov 2023 07:11:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NASANPPMTA03.qualcomm.com (PPS) with ESMTP id 3uepbmpxr0-1; Wed, 22 Nov 2023 07:11:05 +0000 Received: from NASANPPMTA03.qualcomm.com (NASANPPMTA03.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AM76Fsr010658; Wed, 22 Nov 2023 07:11:04 GMT Received: from stor-dylan.qualcomm.com (stor-dylan.qualcomm.com [192.168.140.207]) by NASANPPMTA03.qualcomm.com (PPS) with ESMTP id 3AM7B4mO019539; Wed, 22 Nov 2023 07:11:04 +0000 Received: by stor-dylan.qualcomm.com (Postfix, from userid 359480) id 2C1EE20A65; Tue, 21 Nov 2023 23:11:04 -0800 (PST) From: Can Guo To: quic_cang@quicinc.com, bvanassche@acm.org, mani@kernel.org, stanley.chu@mediatek.com, adrian.hunter@intel.com, beanhuo@micron.com, avri.altman@wdc.com, junwoo80.lee@samsung.com, martin.petersen@oracle.com Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , "James E.J. Bottomley" , linux-arm-msm@vger.kernel.org (open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER...), linux-scsi@vger.kernel.org (open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER...), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 06/11] scsi: ufs: ufs-qcom: Limit HS-G5 Rate-A to hosts with HW version 5 Date: Tue, 21 Nov 2023 23:10:37 -0800 Message-Id: <1700637042-11104-7-git-send-email-quic_cang@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1700637042-11104-1-git-send-email-quic_cang@quicinc.com> References: <1700637042-11104-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-ORIG-GUID: _kxPYoqIHKLwuKA_tJ5i_nnB7zFiYxyw X-Proofpoint-GUID: _kxPYoqIHKLwuKA_tJ5i_nnB7zFiYxyw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-22_04,2023-11-21_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 impostorscore=0 adultscore=0 mlxlogscore=744 clxscore=1015 spamscore=0 phishscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311220050 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 groat.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 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 23:17:09 -0800 (PST) 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. 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 9613ad9..6756f8d 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); -- 2.7.4