[v6,06/10] scsi: ufs: ufs-qcom: Set initial PHY gear to max HS gear for HW ver 4 and newer
Message ID | 1701246516-11626-7-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:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp196226vqn; Wed, 29 Nov 2023 00:29:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IEUddhCa3dGjF1/rBFIzlbIZ9NMn1XVXdRT1jb4w1t+MTKr0iwr8SRSihK1oL17pwvmmuVG X-Received: by 2002:a05:6a21:a584:b0:18c:138e:f1a9 with SMTP id gd4-20020a056a21a58400b0018c138ef1a9mr21909228pzc.55.1701246594597; Wed, 29 Nov 2023 00:29:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701246594; cv=none; d=google.com; s=arc-20160816; b=SYSV61M5lKULxcsxsdab6lFUldug/l6UbgmqPyJ8CaJZbupe6KjU+XGSHQOLLhEsjf D5VZ/wMzU0qgH/vJQyjFvVuMI1+/9rsXDlyj1BntjhLJOU8YH0hEX6NDmXDzXt38KEIK hfhECAsze+MlPqgnHWHL2yel3KY7ALTusZ131BIOZkaH4WzdK2isyen77ImTUXud5J3A 49s5gDg/fqBAmWvKwApY6Gm0tWdmK2tP3e/Z/WL1PsQsK023ThTlPvsns8povFYomhw0 QEa95o7hzOLLBlLspCIgEOunOt5WANWWDCfbZRd8Srpr/9xk8mwx0Gu1d9pM4MBM6Poe pLfw== 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=3qRh83pvQAgfIrcOIyvWFSSKh0f4DJmsl0ckPvcfu/M=; fh=GfW6IokojBSM2WalA9WiQDdU1UuM8RK2I83+Pwj1klU=; b=BIjrmiLR9NogxEYl0RttWggOT5PJR0R2i5cINT2q9C2aqvAYVS+qAuJ/DOoOg5wprl KkFDwmAscJrJw6xJXNRU5RxmbtJajndGB6YZshos/+4DRXSS16HXNsM8Q6PYamyhsATu Gj423MAMPzcgtOtN6pl25HPJL616prCwUfIMCGfQyZr6JrZJNZnxbg1l9wIv9F2cmr+l MKpCADNKLm+ON6J/dbi70DGBtuOFm4ZFE2f7hfgLWBIJ8xq69gKCU0m67BY0Oy72vUqG hzM4/IDszZ6fwWCfuzHwGFNeg8q5tmBnMmkmo3unBvKkYv8MHMRAy75GA3jBTtpkUU72 CzuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iZNdTKEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p21-20020a17090adf9500b002851a58bd52si846959pjv.188.2023.11.29.00.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 00:29:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iZNdTKEP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id E225980A2181; Wed, 29 Nov 2023 00:29:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232622AbjK2I3a (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Wed, 29 Nov 2023 03:29:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230194AbjK2I3P (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 29 Nov 2023 03:29:15 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C155E19B0; Wed, 29 Nov 2023 00:29:21 -0800 (PST) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AT5r1Iw009338; Wed, 29 Nov 2023 08:29:00 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=3qRh83pvQAgfIrcOIyvWFSSKh0f4DJmsl0ckPvcfu/M=; b=iZNdTKEPT00nAetVt31VgjTAuSIjrrnqlMj5NZyGWO31awV8UZb1xKqKb8Fpryk3FNJh EKzyptrtZFtrBoL4soWOq2d7mVgDDPhn6WXL4+IWx4eeg+Acee71shaNsZc7nLPn/TB9 fY4QhlCXBFpgvBAZ9j1+ajxexgq4dzKIDRNk7y0I55gYtIuF0aph0ZmUmsS1E5l3RXia 4iyYENEq1SF7CFcJ4ZcHDlaw01JGJgeUC4dUexnN21t1QSu4g9A23d05rjUIUNU2xd/w Vzx45h3z/0TaptrUqZkHfDu2I8aDj6BLzMSpgbK1fp7EteZUMK6fVe2hSNIiXctGvPwQ oA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3unmra9s82-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 08:29:00 +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 3AT8Sxmh027627; Wed, 29 Nov 2023 08:28:59 GMT Received: from pps.reinject (localhost [127.0.0.1]) by NASANPPMTA02.qualcomm.com (PPS) with ESMTP id 3unmevpybn-1; Wed, 29 Nov 2023 08:28:59 +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 3AT8I6Af011850; Wed, 29 Nov 2023 08:28:59 GMT Received: from stor-dylan.qualcomm.com (stor-dylan.qualcomm.com [192.168.140.207]) by NASANPPMTA02.qualcomm.com (PPS) with ESMTP id 3AT8Sw4E027620; Wed, 29 Nov 2023 08:28:59 +0000 Received: by stor-dylan.qualcomm.com (Postfix, from userid 359480) id D0F8620A5D; Wed, 29 Nov 2023 00:28:58 -0800 (PST) From: Can Guo <quic_cang@quicinc.com> To: quic_cang@quicinc.com, bvanassche@acm.org, mani@kernel.org, adrian.hunter@intel.com, cmd4@qualcomm.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 v6 06/10] scsi: ufs: ufs-qcom: Set initial PHY gear to max HS gear for HW ver 4 and newer Date: Wed, 29 Nov 2023 00:28:31 -0800 Message-Id: <1701246516-11626-7-git-send-email-quic_cang@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1701246516-11626-1-git-send-email-quic_cang@quicinc.com> References: <1701246516-11626-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: Oahkjb8nFJ6UwpaLkvmqMj51nPRwZU-- X-Proofpoint-ORIG-GUID: Oahkjb8nFJ6UwpaLkvmqMj51nPRwZU-- 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-11-29_06,2023-11-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311290062 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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 00:29:48 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783886349590708314 X-GMAIL-MSGID: 1783886349590708314 |
Series |
Enable HS-G5 support on SM8550
|
|
Commit Message
Can Guo
Nov. 29, 2023, 8:28 a.m. UTC
Since HW ver 4, max HS gear can be get from UFS host controller's register,
use the max HS gear as the initial PHY gear instead of UFS_HS_G2, so that
we don't need to update the hard code for newer targets in future.
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 11/29/2023 1:58 PM, Can Guo wrote: > Since HW ver 4, max HS gear can be get from UFS host controller's register, > use the max HS gear as the initial PHY gear instead of UFS_HS_G2, so that > we don't need to update the hard code for newer targets in future. > > 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 aca6199..30f4ca6 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -1060,6 +1060,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 < 0x4) > + 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); > @@ -1296,6 +1310,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) > @@ -1313,12 +1328,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: Reviewed-by: Nitin Rawat <quic_nitirawa@quicinc.com>
On Wed, Nov 29, 2023 at 12:28:31AM -0800, Can Guo wrote: > Since HW ver 4, max HS gear can be get from UFS host controller's register, > use the max HS gear as the initial PHY gear instead of UFS_HS_G2, so that > we don't need to update the hard code for newer targets in future. > > Signed-off-by: Can Guo <quic_cang@quicinc.com> One comment below. With that addressed, Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > --- > 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 aca6199..30f4ca6 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -1060,6 +1060,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. As I mentioned in v5, you need to reword this comment to make it clear we are setting G2 only for platforms < v4. Something like below: "For controllers whose major version is < 4, power up the PHY using minimum supported gear (UFS_HS_G2). Switching to max gear will be performed during reinit if supported. For newer controllers (>= 4), PHY will be powered up using max supported gear." - Mani > + */ > + if (host->hw_ver.major < 0x4) > + 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); > @@ -1296,6 +1310,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) > @@ -1313,12 +1328,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/30/2023 2:47 PM, Manivannan Sadhasivam wrote: > On Wed, Nov 29, 2023 at 12:28:31AM -0800, Can Guo wrote: >> Since HW ver 4, max HS gear can be get from UFS host controller's register, >> use the max HS gear as the initial PHY gear instead of UFS_HS_G2, so that >> we don't need to update the hard code for newer targets in future. >> >> Signed-off-by: Can Guo <quic_cang@quicinc.com> > > One comment below. With that addressed, > > Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> > >> --- >> 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 aca6199..30f4ca6 100644 >> --- a/drivers/ufs/host/ufs-qcom.c >> +++ b/drivers/ufs/host/ufs-qcom.c >> @@ -1060,6 +1060,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. > > As I mentioned in v5, you need to reword this comment to make it clear we are > setting G2 only for platforms < v4. Something like below: > > "For controllers whose major version is < 4, power up the PHY using minimum > supported gear (UFS_HS_G2). Switching to max gear will be performed during > reinit if supported. For newer controllers (>= 4), PHY will be powered up using > max supported gear." Sorry that I missed this one, will add in next version. Thanks, Can Guo. > > - Mani > >> + */ >> + if (host->hw_ver.major < 0x4) >> + 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); >> @@ -1296,6 +1310,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) >> @@ -1313,12 +1328,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 aca6199..30f4ca6 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1060,6 +1060,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 < 0x4) + 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); @@ -1296,6 +1310,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) @@ -1313,12 +1328,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: