[v5,07/10] scsi: ufs: ufs-qcom: Set initial PHY gear to max HS gear for HW ver 5 and newer
Message ID | 1700729190-17268-8-git-send-email-quic_cang@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp306130vqx; Thu, 23 Nov 2023 00:53:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgzC42ziRhsNr6aDSJfXCz0Eq26ToXx1QIm4cUK56kr+GiSltSfDkBZEtAXJ76/ITzAAC5 X-Received: by 2002:a05:6a00:1302:b0:6c2:cb4a:73c3 with SMTP id j2-20020a056a00130200b006c2cb4a73c3mr5317843pfu.11.1700729615543; Thu, 23 Nov 2023 00:53:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700729615; cv=none; d=google.com; s=arc-20160816; b=i754nu/XQcycZwNlvXfhXvbFsdm7XGHIkSAVoUZODH0QaPLod1iWfpb4nKw+BE19w+ v12EUNiIAJCw/KxC+HrUQpT/AeOkF4rTjz3aHUL37bSQ02ZWRfUfjml0M/so+B+jhRR3 +bR/0Dc3TpQe0III34UaDyBe3u74Ydj0fbdcxoucVhhSZ0Wdd/j9/ztDehBJSMxvkKv6 GX44ad5CQXzw/tbdlp/VNPRfFQhKYNtNCO8OC4L0Gpd8R9zTElR66qnt9sPSVWzZP1Rk ExwesCuPx+0x+ZjN2dEE2UWZGA5KZ1It2wAgjOKG+b7TJTDngA1QvS2NZAUk8RltcPI8 /u4g== 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=IwN62VLEShy+VSKK0jRx0klroKj4fpZ9T+/MVP2hILs=; fh=Mo6TxgGzGLrlS+5dVlNWdqd+fZYn09cU+8+JAb6EqZk=; b=0xSjBCuKJxpc+l7UHBhEwuCvzzi43dSN/dlhAFHv6pxNOgGQGQo+zjZbttd1lk9C30 bsxgVA1om6MqC7JTGR529VHt7DhwQACronDPy9lvoA0iZ5F9QtnpgIwLwzUz3ri4xo1J b6AzPVoDHQAoiV32RsHqBFCyAiDPc0v2UBdvLcGF8L0pmS8czjH7vfa21Re+Q1xXG8lr AFs2gv5cGzEn3NNkcvztVAIg5gPr+Us1zCm3KvMslKJsN5JxMh+nltZEQHSrp8z3y5Fv p0CMS3U+QvjxlG9nBPg6BDOAJlCOamJ2j1WpyAtM2IQ3EbhrksS055ugYN3JjpqiykhH dWvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=OPEvdT3N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id fj42-20020a056a003a2a00b006cb68ae3b58si872282pfb.182.2023.11.23.00.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 00:53:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=OPEvdT3N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id EBF92829E5EB; Thu, 23 Nov 2023 00:52:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231488AbjKWIwV (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 23 Nov 2023 03:52:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbjKWIwS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Nov 2023 03:52:18 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3175BD47; Thu, 23 Nov 2023 00:52:25 -0800 (PST) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN8fL4t007760; Thu, 23 Nov 2023 08:47:12 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=IwN62VLEShy+VSKK0jRx0klroKj4fpZ9T+/MVP2hILs=; b=OPEvdT3N805RCFjM2YLvlHAYpGRiE67svHlQ0bYjg+Er5W8ktaVi7bBNPqk/0qtR745c DA8pyql4I0Kly6iMCww0J0VSl/CsjM7fIlYAX1yCYoxVx6YhcXjC66McW5dw8mHNVqdL bpsbzzj6bHh8vpidbjU6LCnU77V6bUDjqNOEJlqHCXZeqAzrEG7M/87j80mPtoYxGVoF a6m7q9eVa/4o4Tol2dLUrq2S/eRwkMK/cJ5D8scKq29sKu9b/WqxAvRbLGwYmdAFevWL Jse+tNMiftLpepCtf0spwluU20cKzBJoCFEJ0Mm3CotcS8pwJLHe/ERERFAsQcnk0foc wQ== Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uj3ec00db-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 08:47:11 +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 3AN8hkmB007795; Thu, 23 Nov 2023 08:47:10 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NASANPPMTA03.qualcomm.com (PPS) with ESMTP id 3uhwcrkkb6-1; Thu, 23 Nov 2023 08:47:10 +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 3AN8anaq029807; Thu, 23 Nov 2023 08:47:10 GMT Received: from stor-dylan.qualcomm.com (stor-dylan.qualcomm.com [192.168.140.207]) by NASANPPMTA03.qualcomm.com (PPS) with ESMTP id 3AN8lAno012040; Thu, 23 Nov 2023 08:47:10 +0000 Received: by stor-dylan.qualcomm.com (Postfix, from userid 359480) id 285CB20A68; Thu, 23 Nov 2023 00:47:10 -0800 (PST) From: Can Guo <quic_cang@quicinc.com> To: quic_cang@quicinc.com, bvanassche@acm.org, mani@kernel.org, adrian.hunter@intel.com, 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 <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, "James E.J. Bottomley" <jejb@linux.ibm.com>, linux-kernel@vger.kernel.org (open list) Subject: [PATCH v5 07/10] scsi: ufs: ufs-qcom: Set initial PHY gear to max HS gear for HW ver 5 and newer Date: Thu, 23 Nov 2023 00:46:27 -0800 Message-Id: <1700729190-17268-8-git-send-email-quic_cang@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1700729190-17268-1-git-send-email-quic_cang@quicinc.com> References: <1700729190-17268-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: IDsJu7vftQwSmB2iUqODQ_Ua3PGXbQUR X-Proofpoint-GUID: IDsJu7vftQwSmB2iUqODQ_Ua3PGXbQUR 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-23_06,2023-11-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 phishscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311230062 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 23 Nov 2023 00:52:31 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783344257415680138 X-GMAIL-MSGID: 1783344257415680138 |
Series |
Enable HS-G5 support on SM8550
|
|
Commit Message
Can Guo
Nov. 23, 2023, 8:46 a.m. UTC
Set the initial PHY gear to max HS gear for hosts with HW ver 5 and newer.
This patch is not changing any functionalities or logic but only a
preparation patch for the next patch in this series.
Signed-off-by: Can Guo <quic_cang@quicinc.com>
---
drivers/ufs/host/ufs-qcom.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
Comments
On Thu, Nov 23, 2023 at 12:46:27AM -0800, Can Guo wrote: > Set the initial PHY gear to max HS gear for hosts with HW ver 5 and newer. > MAX_GEAR will be used for hosts with hw_ver.major >= 4 > This patch is not changing any functionalities or logic but only a > preparation patch for the next patch in this series. > > Signed-off-by: Can Guo <quic_cang@quicinc.com> > --- > drivers/ufs/host/ufs-qcom.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index 6756f8d..7bbccf4 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -1067,6 +1067,20 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) > hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; > } > > +static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) > +{ > + struct ufs_host_params *host_params = &host->host_params; > + > + host->phy_gear = host_params->hs_tx_gear; > + > + /* > + * Power up the PHY using the minimum supported gear (UFS_HS_G2). > + * Switching to max gear will be performed during reinit if supported. You need to reword this comment too. > + */ > + if (host->hw_ver.major < 0x5) As I mentioned above, MAX_GEAR will be used if hw_ver.major is >=4 in ufs_qcom_get_hs_gear(). So this check should be (< 0x4). - Mani > + host->phy_gear = UFS_HS_G2; > +} > + > static void ufs_qcom_set_host_params(struct ufs_hba *hba) > { > struct ufs_qcom_host *host = ufshcd_get_variant(hba); > @@ -1303,6 +1317,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) > ufs_qcom_set_caps(hba); > ufs_qcom_advertise_quirks(hba); > ufs_qcom_set_host_params(hba); > + ufs_qcom_set_phy_gear(host); > > err = ufs_qcom_ice_init(host); > if (err) > @@ -1320,12 +1335,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) > dev_warn(dev, "%s: failed to configure the testbus %d\n", > __func__, err); > > - /* > - * Power up the PHY using the minimum supported gear (UFS_HS_G2). > - * Switching to max gear will be performed during reinit if supported. > - */ > - host->phy_gear = UFS_HS_G2; > - > return 0; > > out_variant_clear: > -- > 2.7.4 >
Hi Mani, On 11/28/2023 2:00 PM, Manivannan Sadhasivam wrote: > On Thu, Nov 23, 2023 at 12:46:27AM -0800, Can Guo wrote: >> Set the initial PHY gear to max HS gear for hosts with HW ver 5 and newer. >> > > MAX_GEAR will be used for hosts with hw_ver.major >= 4 I put it > 5 because I am not intent to touch any old targets which has proven working fine with starting with PHY gear HS_G2. If I put it >= 4, there would be many targets impacted by this change. I need to go back and test those platforms (HW ver == 4). Thanks, Can Guo. > >> This patch is not changing any functionalities or logic but only a >> preparation patch for the next patch in this series. >> >> Signed-off-by: Can Guo <quic_cang@quicinc.com> >> --- >> drivers/ufs/host/ufs-qcom.c | 21 +++++++++++++++------ >> 1 file changed, 15 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c >> index 6756f8d..7bbccf4 100644 >> --- a/drivers/ufs/host/ufs-qcom.c >> +++ b/drivers/ufs/host/ufs-qcom.c >> @@ -1067,6 +1067,20 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) >> hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; >> } >> >> +static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) >> +{ >> + struct ufs_host_params *host_params = &host->host_params; >> + >> + host->phy_gear = host_params->hs_tx_gear; >> + >> + /* >> + * Power up the PHY using the minimum supported gear (UFS_HS_G2). >> + * Switching to max gear will be performed during reinit if supported. > > You need to reword this comment too. > >> + */ >> + if (host->hw_ver.major < 0x5) > > As I mentioned above, MAX_GEAR will be used if hw_ver.major is >=4 in > ufs_qcom_get_hs_gear(). So this check should be (< 0x4). > > - Mani > >> + host->phy_gear = UFS_HS_G2; >> +} >> + >> static void ufs_qcom_set_host_params(struct ufs_hba *hba) >> { >> struct ufs_qcom_host *host = ufshcd_get_variant(hba); >> @@ -1303,6 +1317,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) >> ufs_qcom_set_caps(hba); >> ufs_qcom_advertise_quirks(hba); >> ufs_qcom_set_host_params(hba); >> + ufs_qcom_set_phy_gear(host); >> >> err = ufs_qcom_ice_init(host); >> if (err) >> @@ -1320,12 +1335,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) >> dev_warn(dev, "%s: failed to configure the testbus %d\n", >> __func__, err); >> >> - /* >> - * Power up the PHY using the minimum supported gear (UFS_HS_G2). >> - * Switching to max gear will be performed during reinit if supported. >> - */ >> - host->phy_gear = UFS_HS_G2; >> - >> return 0; >> >> out_variant_clear: >> -- >> 2.7.4 >> >
On Tue, Nov 28, 2023 at 03:58:42PM +0800, Can Guo wrote: > Hi Mani, > > On 11/28/2023 2:00 PM, Manivannan Sadhasivam wrote: > > On Thu, Nov 23, 2023 at 12:46:27AM -0800, Can Guo wrote: > > > Set the initial PHY gear to max HS gear for hosts with HW ver 5 and newer. > > > > > > > MAX_GEAR will be used for hosts with hw_ver.major >= 4 > > I put it > 5 because I am not intent to touch any old targets which has > proven working fine with starting with PHY gear HS_G2. If I put it >= 4, > there would be many targets impacted by this change. I need to go back and > test those platforms (HW ver == 4). > This assumption will make the code hard to maintain. I think if you happen to test it on atleast a couple of old targets it should be good since I do not see how others can fail. - Mani > Thanks, > Can Guo. > > > > > > This patch is not changing any functionalities or logic but only a > > > preparation patch for the next patch in this series. > > > > > > Signed-off-by: Can Guo <quic_cang@quicinc.com> > > > --- > > > drivers/ufs/host/ufs-qcom.c | 21 +++++++++++++++------ > > > 1 file changed, 15 insertions(+), 6 deletions(-) > > > > > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > > > index 6756f8d..7bbccf4 100644 > > > --- a/drivers/ufs/host/ufs-qcom.c > > > +++ b/drivers/ufs/host/ufs-qcom.c > > > @@ -1067,6 +1067,20 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) > > > hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; > > > } > > > +static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) > > > +{ > > > + struct ufs_host_params *host_params = &host->host_params; > > > + > > > + host->phy_gear = host_params->hs_tx_gear; > > > + > > > + /* > > > + * Power up the PHY using the minimum supported gear (UFS_HS_G2). > > > + * Switching to max gear will be performed during reinit if supported. > > > > You need to reword this comment too. > > > > > + */ > > > + if (host->hw_ver.major < 0x5) > > > > As I mentioned above, MAX_GEAR will be used if hw_ver.major is >=4 in > > ufs_qcom_get_hs_gear(). So this check should be (< 0x4). > > > > - Mani > > > > > + host->phy_gear = UFS_HS_G2; > > > +} > > > + > > > static void ufs_qcom_set_host_params(struct ufs_hba *hba) > > > { > > > struct ufs_qcom_host *host = ufshcd_get_variant(hba); > > > @@ -1303,6 +1317,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) > > > ufs_qcom_set_caps(hba); > > > ufs_qcom_advertise_quirks(hba); > > > ufs_qcom_set_host_params(hba); > > > + ufs_qcom_set_phy_gear(host); > > > err = ufs_qcom_ice_init(host); > > > if (err) > > > @@ -1320,12 +1335,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) > > > dev_warn(dev, "%s: failed to configure the testbus %d\n", > > > __func__, err); > > > - /* > > > - * Power up the PHY using the minimum supported gear (UFS_HS_G2). > > > - * Switching to max gear will be performed during reinit if supported. > > > - */ > > > - host->phy_gear = UFS_HS_G2; > > > - > > > return 0; > > > out_variant_clear: > > > -- > > > 2.7.4 > > > > >
On 11/28/2023 6:59 PM, Manivannan Sadhasivam wrote: > On Tue, Nov 28, 2023 at 03:58:42PM +0800, Can Guo wrote: >> Hi Mani, >> >> On 11/28/2023 2:00 PM, Manivannan Sadhasivam wrote: >>> On Thu, Nov 23, 2023 at 12:46:27AM -0800, Can Guo wrote: >>>> Set the initial PHY gear to max HS gear for hosts with HW ver 5 and newer. >>>> >>> >>> MAX_GEAR will be used for hosts with hw_ver.major >= 4 >> >> I put it > 5 because I am not intent to touch any old targets which has >> proven working fine with starting with PHY gear HS_G2. If I put it >= 4, >> there would be many targets impacted by this change. I need to go back and >> test those platforms (HW ver == 4). >> > > This assumption will make the code hard to maintain. I think if you happen to > test it on atleast a couple of old targets it should be good since I do not see > how others can fail. Point taken. I will put it >= 4 in next version and test it on platforms like SM8350 and SM8450. Thanks, Can Guo. > > - Mani > >> Thanks, >> Can Guo. >> >>> >>>> This patch is not changing any functionalities or logic but only a >>>> preparation patch for the next patch in this series. >>>> >>>> Signed-off-by: Can Guo <quic_cang@quicinc.com> >>>> --- >>>> drivers/ufs/host/ufs-qcom.c | 21 +++++++++++++++------ >>>> 1 file changed, 15 insertions(+), 6 deletions(-) >>>> >>>> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c >>>> index 6756f8d..7bbccf4 100644 >>>> --- a/drivers/ufs/host/ufs-qcom.c >>>> +++ b/drivers/ufs/host/ufs-qcom.c >>>> @@ -1067,6 +1067,20 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) >>>> hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; >>>> } >>>> +static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) >>>> +{ >>>> + struct ufs_host_params *host_params = &host->host_params; >>>> + >>>> + host->phy_gear = host_params->hs_tx_gear; >>>> + >>>> + /* >>>> + * Power up the PHY using the minimum supported gear (UFS_HS_G2). >>>> + * Switching to max gear will be performed during reinit if supported. >>> >>> You need to reword this comment too. >>> >>>> + */ >>>> + if (host->hw_ver.major < 0x5) >>> >>> As I mentioned above, MAX_GEAR will be used if hw_ver.major is >=4 in >>> ufs_qcom_get_hs_gear(). So this check should be (< 0x4). >>> >>> - Mani >>> >>>> + host->phy_gear = UFS_HS_G2; >>>> +} >>>> + >>>> static void ufs_qcom_set_host_params(struct ufs_hba *hba) >>>> { >>>> struct ufs_qcom_host *host = ufshcd_get_variant(hba); >>>> @@ -1303,6 +1317,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) >>>> ufs_qcom_set_caps(hba); >>>> ufs_qcom_advertise_quirks(hba); >>>> ufs_qcom_set_host_params(hba); >>>> + ufs_qcom_set_phy_gear(host); >>>> err = ufs_qcom_ice_init(host); >>>> if (err) >>>> @@ -1320,12 +1335,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) >>>> dev_warn(dev, "%s: failed to configure the testbus %d\n", >>>> __func__, err); >>>> - /* >>>> - * Power up the PHY using the minimum supported gear (UFS_HS_G2). >>>> - * Switching to max gear will be performed during reinit if supported. >>>> - */ >>>> - host->phy_gear = UFS_HS_G2; >>>> - >>>> return 0; >>>> out_variant_clear: >>>> -- >>>> 2.7.4 >>>> >>> >
On Tue, Nov 28, 2023 at 07:01:27PM +0800, Can Guo wrote: > > > On 11/28/2023 6:59 PM, Manivannan Sadhasivam wrote: > > On Tue, Nov 28, 2023 at 03:58:42PM +0800, Can Guo wrote: > > > Hi Mani, > > > > > > On 11/28/2023 2:00 PM, Manivannan Sadhasivam wrote: > > > > On Thu, Nov 23, 2023 at 12:46:27AM -0800, Can Guo wrote: > > > > > Set the initial PHY gear to max HS gear for hosts with HW ver 5 and newer. > > > > > > > > > > > > > MAX_GEAR will be used for hosts with hw_ver.major >= 4 > > > > > > I put it > 5 because I am not intent to touch any old targets which has > > > proven working fine with starting with PHY gear HS_G2. If I put it >= 4, > > > there would be many targets impacted by this change. I need to go back and > > > test those platforms (HW ver == 4). > > > > > > > This assumption will make the code hard to maintain. I think if you happen to > > test it on atleast a couple of old targets it should be good since I do not see > > how others can fail. > > Point taken. I will put it >= 4 in next version and test it on platforms > like SM8350 and SM8450. > Appreciated, thanks! - Mani > Thanks, > Can Guo. > > > > > - Mani > > > > > Thanks, > > > Can Guo. > > > > > > > > > > > > This patch is not changing any functionalities or logic but only a > > > > > preparation patch for the next patch in this series. > > > > > > > > > > Signed-off-by: Can Guo <quic_cang@quicinc.com> > > > > > --- > > > > > drivers/ufs/host/ufs-qcom.c | 21 +++++++++++++++------ > > > > > 1 file changed, 15 insertions(+), 6 deletions(-) > > > > > > > > > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > > > > > index 6756f8d..7bbccf4 100644 > > > > > --- a/drivers/ufs/host/ufs-qcom.c > > > > > +++ b/drivers/ufs/host/ufs-qcom.c > > > > > @@ -1067,6 +1067,20 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) > > > > > hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; > > > > > } > > > > > +static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) > > > > > +{ > > > > > + struct ufs_host_params *host_params = &host->host_params; > > > > > + > > > > > + host->phy_gear = host_params->hs_tx_gear; > > > > > + > > > > > + /* > > > > > + * Power up the PHY using the minimum supported gear (UFS_HS_G2). > > > > > + * Switching to max gear will be performed during reinit if supported. > > > > > > > > You need to reword this comment too. > > > > > > > > > + */ > > > > > + if (host->hw_ver.major < 0x5) > > > > > > > > As I mentioned above, MAX_GEAR will be used if hw_ver.major is >=4 in > > > > ufs_qcom_get_hs_gear(). So this check should be (< 0x4). > > > > > > > > - Mani > > > > > > > > > + host->phy_gear = UFS_HS_G2; > > > > > +} > > > > > + > > > > > static void ufs_qcom_set_host_params(struct ufs_hba *hba) > > > > > { > > > > > struct ufs_qcom_host *host = ufshcd_get_variant(hba); > > > > > @@ -1303,6 +1317,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) > > > > > ufs_qcom_set_caps(hba); > > > > > ufs_qcom_advertise_quirks(hba); > > > > > ufs_qcom_set_host_params(hba); > > > > > + ufs_qcom_set_phy_gear(host); > > > > > err = ufs_qcom_ice_init(host); > > > > > if (err) > > > > > @@ -1320,12 +1335,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) > > > > > dev_warn(dev, "%s: failed to configure the testbus %d\n", > > > > > __func__, err); > > > > > - /* > > > > > - * Power up the PHY using the minimum supported gear (UFS_HS_G2). > > > > > - * Switching to max gear will be performed during reinit if supported. > > > > > - */ > > > > > - host->phy_gear = UFS_HS_G2; > > > > > - > > > > > return 0; > > > > > out_variant_clear: > > > > > -- > > > > > 2.7.4 > > > > > > > > > > >
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 6756f8d..7bbccf4 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1067,6 +1067,20 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; } +static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) +{ + struct ufs_host_params *host_params = &host->host_params; + + host->phy_gear = host_params->hs_tx_gear; + + /* + * Power up the PHY using the minimum supported gear (UFS_HS_G2). + * Switching to max gear will be performed during reinit if supported. + */ + if (host->hw_ver.major < 0x5) + host->phy_gear = UFS_HS_G2; +} + static void ufs_qcom_set_host_params(struct ufs_hba *hba) { struct ufs_qcom_host *host = ufshcd_get_variant(hba); @@ -1303,6 +1317,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) ufs_qcom_set_caps(hba); ufs_qcom_advertise_quirks(hba); ufs_qcom_set_host_params(hba); + ufs_qcom_set_phy_gear(host); err = ufs_qcom_ice_init(host); if (err) @@ -1320,12 +1335,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) dev_warn(dev, "%s: failed to configure the testbus %d\n", __func__, err); - /* - * Power up the PHY using the minimum supported gear (UFS_HS_G2). - * Switching to max gear will be performed during reinit if supported. - */ - host->phy_gear = UFS_HS_G2; - return 0; out_variant_clear: