Message ID | 1700729190-17268-5-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 o2csp304136vqx; Thu, 23 Nov 2023 00:47:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFI2qUsPFHTyG2ilei2lxo6Q6aQ8j7kEpQa32fgERCZRH4USWQeerldQfJXx2V08Z08IJuK X-Received: by 2002:a05:6808:1a0f:b0:3b8:3f9f:4c73 with SMTP id bk15-20020a0568081a0f00b003b83f9f4c73mr5221354oib.26.1700729265721; Thu, 23 Nov 2023 00:47:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700729265; cv=none; d=google.com; s=arc-20160816; b=F66t6/TUBlAh7ORliofsS1Sfi1gfKkSObGlD6JoM6k3rPDQY3lKwYkD8Otf9XVsZTi NDdoXz2GAg3CkTg/fo7R4NxaB+teI0X/+fZLE1IJ5USSguTZYnw09Q8nLaMztdqgg4vY I7TS5SkTZ6fYEjqnoO71y9QB/tH53wm1d9YNPjggcKszeIzD7GlvR9kmIbA8YXp1hbHD U5aBJjyDV0kdIbfQUsgPj4A+WbnuEqRjJXqRaLRo+G37jElNEUiEH5B9kpQoJDJqWPcH k2OGuEjuH/JAg9Aoh2JgjNCJyPXJ8tTjzdL0OOuUYyOkIAS2PIZMZDyVFLQsff2H2Uq6 WaAw== 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=zN12TslWlABlp9K+YRCFNUDSGb7EOJnrGrpMh/GCmsY=; fh=Mo6TxgGzGLrlS+5dVlNWdqd+fZYn09cU+8+JAb6EqZk=; b=cRotdeaf/mWZCXD39tMF+RR+fLETqIQ24DOAhKbZE0j9gd+1k55lsUy9K9/6p8izad SFFjDOMViRbeXYjZxmScBlbOguiSjBYW8IIaLuq7+rZ29nSTZs/qJW6Rrc6T58SxGnbb zOsGGmnAEOFRHk8NXc5gct9cG7A64WM2EvW1bR+1rfG4OC2RbAUxTDfhPTdQ2208IWah H+gGp2RDhl/dn6+ZFSrx/sLo5ppfyyb96fr494YvoYnn9Dj1mjU5F+R3Pn15Fg7TkXU3 cPCADheWIllM/VDoUkxjgxGdstPUad+XsLq7PgHW547afTOEag9jv70gcUaJXxL9FBVa FdXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Tfwmh2w8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 22-20020a630016000000b005b869e53b1csi847513pga.797.2023.11.23.00.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 00:47:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Tfwmh2w8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 3475183174B8; Thu, 23 Nov 2023 00:47:42 -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 S1345010AbjKWIrP (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Thu, 23 Nov 2023 03:47:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234702AbjKWIrL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Nov 2023 03:47:11 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40680D41; Thu, 23 Nov 2023 00:47:17 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AN8CUV6003228; Thu, 23 Nov 2023 08:47: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=zN12TslWlABlp9K+YRCFNUDSGb7EOJnrGrpMh/GCmsY=; b=Tfwmh2w8/wsgxjzk/wAePpkT4vlyhAnW4sTIAwxnY0pAt5PTK/6Nja1sVmgnYpNApfry RCCEtAaTLxIVLpyqlNL/HNkhpJmzNCAw7uPF7A0DKK7+c9XVjsQLea0enpz+qXPlP29Y EODFY5yyS3vYfZq3m6kC8VwOAPk3LVES3KUrZSIK2FcyUsoBLCi6H8LG1TPg2xf5oUN6 94lqRr+XJYlvUXUopDaQIwfJBJzhF3wP/OL2G7qY/k3v4BCqQ4AvMN/6A92HertJymKF obDWhnwgp9bKBUpD7Fym1hKw1QzLdjoPIYvi16uUK7OlGxmODktmPtL7x5rh3+x2MzgH tA== Received: from nasanppmta04.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uj25t06e0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Nov 2023 08:47:06 +0000 Received: from pps.filterd (NASANPPMTA04.qualcomm.com [127.0.0.1]) by NASANPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 3AN8l5Iw008419; Thu, 23 Nov 2023 08:47:05 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NASANPPMTA04.qualcomm.com (PPS) with ESMTP id 3uhpmqpm69-1; Thu, 23 Nov 2023 08:47:05 +0000 Received: from NASANPPMTA04.qualcomm.com (NASANPPMTA04.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3AN8l5oM008373; Thu, 23 Nov 2023 08:47:05 GMT Received: from stor-dylan.qualcomm.com (stor-dylan.qualcomm.com [192.168.140.207]) by NASANPPMTA04.qualcomm.com (PPS) with ESMTP id 3AN8l5Hq008366; Thu, 23 Nov 2023 08:47:05 +0000 Received: by stor-dylan.qualcomm.com (Postfix, from userid 359480) id F0C2220A68; Thu, 23 Nov 2023 00:47:04 -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 04/10] scsi: ufs: ufs-qcom: Limit negotiated gear to selected PHY gear Date: Thu, 23 Nov 2023 00:46:24 -0800 Message-Id: <1700729190-17268-5-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-GUID: N9yVuuf7beCv13PCChDtm4TW6fUZXh8M X-Proofpoint-ORIG-GUID: N9yVuuf7beCv13PCChDtm4TW6fUZXh8M 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 adultscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311230062 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: <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 (groat.vger.email [0.0.0.0]); Thu, 23 Nov 2023 00:47:42 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783343890507109970 X-GMAIL-MSGID: 1783343890507109970 |
Series |
Enable HS-G5 support on SM8550
|
|
Commit Message
Can Guo
Nov. 23, 2023, 8:46 a.m. UTC
In the dual init scenario, the initial PHY gear is set to HS-G2, and the
first Power Mode Change (PMC) is meant to find the best matching PHY gear
for the 2nd init. However, for the first PMC, if the negotiated gear (say
HS-G4) is higher than the initial PHY gear, we cannot go ahead let PMC to
the negotiated gear happen, because the programmed UFS PHY settings may not
support the negotiated gear. Fix it by overwriting the negotiated gear with
the PHY gear.
Signed-off-by: Can Guo <quic_cang@quicinc.com>
---
drivers/ufs/host/ufs-qcom.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Comments
On Thu, Nov 23, 2023 at 12:46:24AM -0800, Can Guo wrote: > In the dual init scenario, the initial PHY gear is set to HS-G2, and the > first Power Mode Change (PMC) is meant to find the best matching PHY gear > for the 2nd init. However, for the first PMC, if the negotiated gear (say > HS-G4) is higher than the initial PHY gear, we cannot go ahead let PMC to > the negotiated gear happen, because the programmed UFS PHY settings may not > support the negotiated gear. Fix it by overwriting the negotiated gear with > the PHY gear. > I don't quite understand this patch. If the phy_gear is G2 initially and the negotiated gear is G4, then as per this change, phy_gear = G4; negotiated gear = G2; Could you please explain how this make sense? - Mani > Signed-off-by: Can Guo <quic_cang@quicinc.com> > --- > drivers/ufs/host/ufs-qcom.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index cc0eb37..d4edf58 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -920,8 +920,13 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, > * because, the PHY gear settings are backwards compatible and we only need to > * change the PHY gear settings while scaling to higher gears. > */ > - if (dev_req_params->gear_tx > host->phy_gear) > + if (dev_req_params->gear_tx > host->phy_gear) { > + u32 old_phy_gear = host->phy_gear; > + > host->phy_gear = dev_req_params->gear_tx; > + dev_req_params->gear_tx = old_phy_gear; > + dev_req_params->gear_rx = old_phy_gear; > + } > > /* enable the device ref clock before changing to HS mode */ > if (!ufshcd_is_hs_mode(&hba->pwr_info) && > -- > 2.7.4 >
Hi Mani, On 11/28/2023 1:45 PM, Manivannan Sadhasivam wrote: > On Thu, Nov 23, 2023 at 12:46:24AM -0800, Can Guo wrote: >> In the dual init scenario, the initial PHY gear is set to HS-G2, and the >> first Power Mode Change (PMC) is meant to find the best matching PHY gear >> for the 2nd init. However, for the first PMC, if the negotiated gear (say >> HS-G4) is higher than the initial PHY gear, we cannot go ahead let PMC to >> the negotiated gear happen, because the programmed UFS PHY settings may not >> support the negotiated gear. Fix it by overwriting the negotiated gear with >> the PHY gear. >> > > I don't quite understand this patch. If the phy_gear is G2 initially and the > negotiated gear is G4, then as per this change, > > phy_gear = G4; > negotiated gear = G2; > > Could you please explain how this make sense? phy_gear was G2 (in the beginning) and just now changed to G4, but the PHY settings programmed in the beginning can only support no-G4 (not G4). Without this change, as the negotiated gear is G4, the power mode change is going to put UFS at HS-G4 mode, but the PHY settings programmed is no-G4. This change is to limit the negotiated gear to HS-G2 for the 1st init. In the 2nd init, as the new PHY gear is G4, G4 PHY settings would be programmed, it'd be safe to put the UFS at HS-G4 mode. Thanks, Can Guo. > > - Mani > >> Signed-off-by: Can Guo <quic_cang@quicinc.com> >> --- >> drivers/ufs/host/ufs-qcom.c | 7 ++++++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c >> index cc0eb37..d4edf58 100644 >> --- a/drivers/ufs/host/ufs-qcom.c >> +++ b/drivers/ufs/host/ufs-qcom.c >> @@ -920,8 +920,13 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, >> * because, the PHY gear settings are backwards compatible and we only need to >> * change the PHY gear settings while scaling to higher gears. >> */ >> - if (dev_req_params->gear_tx > host->phy_gear) >> + if (dev_req_params->gear_tx > host->phy_gear) { >> + u32 old_phy_gear = host->phy_gear; >> + >> host->phy_gear = dev_req_params->gear_tx; >> + dev_req_params->gear_tx = old_phy_gear; >> + dev_req_params->gear_rx = old_phy_gear; >> + } >> >> /* enable the device ref clock before changing to HS mode */ >> if (!ufshcd_is_hs_mode(&hba->pwr_info) && >> -- >> 2.7.4 >> >
On Tue, Nov 28, 2023 at 04:05:59PM +0800, Can Guo wrote: > Hi Mani, > > On 11/28/2023 1:45 PM, Manivannan Sadhasivam wrote: > > On Thu, Nov 23, 2023 at 12:46:24AM -0800, Can Guo wrote: > > > In the dual init scenario, the initial PHY gear is set to HS-G2, and the > > > first Power Mode Change (PMC) is meant to find the best matching PHY gear > > > for the 2nd init. However, for the first PMC, if the negotiated gear (say > > > HS-G4) is higher than the initial PHY gear, we cannot go ahead let PMC to > > > the negotiated gear happen, because the programmed UFS PHY settings may not > > > support the negotiated gear. Fix it by overwriting the negotiated gear with > > > the PHY gear. > > > > > > > I don't quite understand this patch. If the phy_gear is G2 initially and the > > negotiated gear is G4, then as per this change, > > > > phy_gear = G4; > > negotiated gear = G2; > > > > Could you please explain how this make sense? > > phy_gear was G2 (in the beginning) and just now changed to G4, but the PHY > settings programmed in the beginning can only support no-G4 (not G4). > Without this change, as the negotiated gear is G4, the power mode change is > going to put UFS at HS-G4 mode, but the PHY settings programmed is no-G4. But we are going to reinit the PHY anyway, isn't it? > This change is to limit the negotiated gear to HS-G2 for the 1st init. In > the 2nd init, as the new PHY gear is G4, G4 PHY settings would be > programmed, it'd be safe to put the UFS at HS-G4 mode. > Why do we need to limit it since we already have the logic in place to set whatever gear mode applicable for 1st init? - Mani > Thanks, > Can Guo. > > > > - Mani > > > > > Signed-off-by: Can Guo <quic_cang@quicinc.com> > > > --- > > > drivers/ufs/host/ufs-qcom.c | 7 ++++++- > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > > > index cc0eb37..d4edf58 100644 > > > --- a/drivers/ufs/host/ufs-qcom.c > > > +++ b/drivers/ufs/host/ufs-qcom.c > > > @@ -920,8 +920,13 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, > > > * because, the PHY gear settings are backwards compatible and we only need to > > > * change the PHY gear settings while scaling to higher gears. > > > */ > > > - if (dev_req_params->gear_tx > host->phy_gear) > > > + if (dev_req_params->gear_tx > host->phy_gear) { > > > + u32 old_phy_gear = host->phy_gear; > > > + > > > host->phy_gear = dev_req_params->gear_tx; > > > + dev_req_params->gear_tx = old_phy_gear; > > > + dev_req_params->gear_rx = old_phy_gear; > > > + } > > > /* enable the device ref clock before changing to HS mode */ > > > if (!ufshcd_is_hs_mode(&hba->pwr_info) && > > > -- > > > 2.7.4 > > > > >
On 11/28/2023 6:52 PM, Manivannan Sadhasivam wrote: > On Tue, Nov 28, 2023 at 04:05:59PM +0800, Can Guo wrote: >> Hi Mani, >> >> On 11/28/2023 1:45 PM, Manivannan Sadhasivam wrote: >>> On Thu, Nov 23, 2023 at 12:46:24AM -0800, Can Guo wrote: >>>> In the dual init scenario, the initial PHY gear is set to HS-G2, and the >>>> first Power Mode Change (PMC) is meant to find the best matching PHY gear >>>> for the 2nd init. However, for the first PMC, if the negotiated gear (say >>>> HS-G4) is higher than the initial PHY gear, we cannot go ahead let PMC to >>>> the negotiated gear happen, because the programmed UFS PHY settings may not >>>> support the negotiated gear. Fix it by overwriting the negotiated gear with >>>> the PHY gear. >>>> >>> >>> I don't quite understand this patch. If the phy_gear is G2 initially and the >>> negotiated gear is G4, then as per this change, >>> >>> phy_gear = G4; >>> negotiated gear = G2; >>> >>> Could you please explain how this make sense? >> >> phy_gear was G2 (in the beginning) and just now changed to G4, but the PHY >> settings programmed in the beginning can only support no-G4 (not G4). >> Without this change, as the negotiated gear is G4, the power mode change is >> going to put UFS at HS-G4 mode, but the PHY settings programmed is no-G4. > > But we are going to reinit the PHY anyway, isn't it? We are power mode changing to HS-G4 with no-G4 PHY settings programmed, the power mode change operation, in the 1st init, may immediately cause UIC errors and lead to probe fail. We are not seeing issues as of now, maybe because the amount of HW used for testing is not large enough. This change is not really related to this specific series, I can remove it in next version. Thanks, Can Guo. > >> This change is to limit the negotiated gear to HS-G2 for the 1st init. In >> the 2nd init, as the new PHY gear is G4, G4 PHY settings would be >> programmed, it'd be safe to put the UFS at HS-G4 mode. >> > > Why do we need to limit it since we already have the logic in place to set > whatever gear mode applicable for 1st init? > > - Mani > >> Thanks, >> Can Guo. >>> >>> - Mani >>> >>>> Signed-off-by: Can Guo <quic_cang@quicinc.com> >>>> --- >>>> drivers/ufs/host/ufs-qcom.c | 7 ++++++- >>>> 1 file changed, 6 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c >>>> index cc0eb37..d4edf58 100644 >>>> --- a/drivers/ufs/host/ufs-qcom.c >>>> +++ b/drivers/ufs/host/ufs-qcom.c >>>> @@ -920,8 +920,13 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, >>>> * because, the PHY gear settings are backwards compatible and we only need to >>>> * change the PHY gear settings while scaling to higher gears. >>>> */ >>>> - if (dev_req_params->gear_tx > host->phy_gear) >>>> + if (dev_req_params->gear_tx > host->phy_gear) { >>>> + u32 old_phy_gear = host->phy_gear; >>>> + >>>> host->phy_gear = dev_req_params->gear_tx; >>>> + dev_req_params->gear_tx = old_phy_gear; >>>> + dev_req_params->gear_rx = old_phy_gear; >>>> + } >>>> /* enable the device ref clock before changing to HS mode */ >>>> if (!ufshcd_is_hs_mode(&hba->pwr_info) && >>>> -- >>>> 2.7.4 >>>> >>> >
On Tue, Nov 28, 2023 at 07:03:41PM +0800, Can Guo wrote: > > > On 11/28/2023 6:52 PM, Manivannan Sadhasivam wrote: > > On Tue, Nov 28, 2023 at 04:05:59PM +0800, Can Guo wrote: > > > Hi Mani, > > > > > > On 11/28/2023 1:45 PM, Manivannan Sadhasivam wrote: > > > > On Thu, Nov 23, 2023 at 12:46:24AM -0800, Can Guo wrote: > > > > > In the dual init scenario, the initial PHY gear is set to HS-G2, and the > > > > > first Power Mode Change (PMC) is meant to find the best matching PHY gear > > > > > for the 2nd init. However, for the first PMC, if the negotiated gear (say > > > > > HS-G4) is higher than the initial PHY gear, we cannot go ahead let PMC to > > > > > the negotiated gear happen, because the programmed UFS PHY settings may not > > > > > support the negotiated gear. Fix it by overwriting the negotiated gear with > > > > > the PHY gear. > > > > > > > > > > > > > I don't quite understand this patch. If the phy_gear is G2 initially and the > > > > negotiated gear is G4, then as per this change, > > > > > > > > phy_gear = G4; > > > > negotiated gear = G2; > > > > > > > > Could you please explain how this make sense? > > > > > > phy_gear was G2 (in the beginning) and just now changed to G4, but the PHY > > > settings programmed in the beginning can only support no-G4 (not G4). > > > Without this change, as the negotiated gear is G4, the power mode change is > > > going to put UFS at HS-G4 mode, but the PHY settings programmed is no-G4. > > > > But we are going to reinit the PHY anyway, isn't it? > > We are power mode changing to HS-G4 with no-G4 PHY settings programmed, the > power mode change operation, in the 1st init, may immediately cause UIC > errors and lead to probe fail. We are not seeing issues as of now, maybe > because the amount of HW used for testing is not large enough. > I'm not sure what you are saying is what happening. Because, if we use the incompatible gear setting, we should immediately see the UIC error. > This change is not really related to this specific series, I can remove it > in next version. > Please do so. This needs to be reviewed separately. - Mani > Thanks, > Can Guo. > > > > > > This change is to limit the negotiated gear to HS-G2 for the 1st init. In > > > the 2nd init, as the new PHY gear is G4, G4 PHY settings would be > > > programmed, it'd be safe to put the UFS at HS-G4 mode. > > > > > > > Why do we need to limit it since we already have the logic in place to set > > whatever gear mode applicable for 1st init? > > > > - Mani > > > > > Thanks, > > > Can Guo. > > > > > > > > - Mani > > > > > > > > > Signed-off-by: Can Guo <quic_cang@quicinc.com> > > > > > --- > > > > > drivers/ufs/host/ufs-qcom.c | 7 ++++++- > > > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > > > > > index cc0eb37..d4edf58 100644 > > > > > --- a/drivers/ufs/host/ufs-qcom.c > > > > > +++ b/drivers/ufs/host/ufs-qcom.c > > > > > @@ -920,8 +920,13 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, > > > > > * because, the PHY gear settings are backwards compatible and we only need to > > > > > * change the PHY gear settings while scaling to higher gears. > > > > > */ > > > > > - if (dev_req_params->gear_tx > host->phy_gear) > > > > > + if (dev_req_params->gear_tx > host->phy_gear) { > > > > > + u32 old_phy_gear = host->phy_gear; > > > > > + > > > > > host->phy_gear = dev_req_params->gear_tx; > > > > > + dev_req_params->gear_tx = old_phy_gear; > > > > > + dev_req_params->gear_rx = old_phy_gear; > > > > > + } > > > > > /* enable the device ref clock before changing to HS mode */ > > > > > if (!ufshcd_is_hs_mode(&hba->pwr_info) && > > > > > -- > > > > > 2.7.4 > > > > > > > > > > >
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index cc0eb37..d4edf58 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -920,8 +920,13 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, * because, the PHY gear settings are backwards compatible and we only need to * change the PHY gear settings while scaling to higher gears. */ - if (dev_req_params->gear_tx > host->phy_gear) + if (dev_req_params->gear_tx > host->phy_gear) { + u32 old_phy_gear = host->phy_gear; + host->phy_gear = dev_req_params->gear_tx; + dev_req_params->gear_tx = old_phy_gear; + dev_req_params->gear_rx = old_phy_gear; + } /* enable the device ref clock before changing to HS mode */ if (!ufshcd_is_hs_mode(&hba->pwr_info) &&