Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp131909rdb; Wed, 29 Nov 2023 23:50:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyGcB9ffZlxEKK0z/IMtOjl2erI8xPH3mz3LEjVU7Ls+eJFKCljxdWa+wB2fmY5mJyTkPP X-Received: by 2002:a05:6a00:4acb:b0:6cb:913d:2cce with SMTP id ds11-20020a056a004acb00b006cb913d2ccemr21804584pfb.15.1701330600732; Wed, 29 Nov 2023 23:50:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701330600; cv=none; d=google.com; s=arc-20160816; b=ma6SqIE8dQB/qLlNGPB4pWPs5oGnRqznN36rRVR30LuGHsi7BDRmzPhPKMNs8pgiim s1xoGAPy50z6XxtIH+1Mp0F6V+0zdVfsIFGDiCbLqs4D+8Hcg9SfPIv7Jpgmtz9NWFRa 8pP3VG8hBzH1oV8ksghEkr6vCLXSZiQUB34kcbtnkiJjOHcSlJTJFE26w46BDNyKIaQt VNWAYSaI3yeNbFNXSxECQcuuVRZeVHKyptugZJgT+NbtHBQ0FQ+rH3HivBZ8UEptCn8Q Zz6eM5Lq2+dYSrJ8nI7eH4Pjqe9A6NAIMZDp/6bf0sudI6ZJMVzWm19SQ3+4B8sVpvab iZcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=yvqvx5ZXXmbPnljimpZq97cMptAIaEhfTTf8X22A5pg=; fh=zKeZKV7m8RL4T/hGameio7kNSsQk0FMDz11cgD/wU3A=; b=QZubCc2D107huS5461++nR63Dy8VpbnKAUiQkdco5K1BQyf5kTxH3KfioZ0MqAMu/V 8cWsEmuiJGQ1VAZ1QlS0bRuykYIcPjQK65vtM4LytrU6/Mt9CZgwh/5jLmPgMlqhagFW KFSztHqSFq9STWF06tNW5RNfe2NgsnhBYzIMhjohkx7xH/osgQgakYzei9qkQI9/VrVM rlLLnKxmxZ9FdyUaCJYMpIvb8HboiFbQzbGuneH37UlRa3gBgpQKLbBmED9fS/QOdMtl u29BRIFVD4ZEwlUxam+lLnzsudjAVDmgWLWYWgw1GYB7GG0FsH0F9wcHkPEXnUNBACFl qw6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GEsXeYep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y127-20020a636485000000b005b8f0ff9b35si739969pgb.406.2023.11.29.23.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 23:50:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=GEsXeYep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 25CFC802FAAF; Wed, 29 Nov 2023 23:49:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbjK3Htm (ORCPT + 99 others); Thu, 30 Nov 2023 02:49:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjK3Htl (ORCPT ); Thu, 30 Nov 2023 02:49:41 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B71851A3; Wed, 29 Nov 2023 23:49:47 -0800 (PST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AU5xK0R001015; Thu, 30 Nov 2023 07:49:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=yvqvx5ZXXmbPnljimpZq97cMptAIaEhfTTf8X22A5pg=; b=GEsXeYepRTbmwpkBhMFGn+VgdPZl+wE0EZhkJpBH1AWEuvnOfJhrJj0FyOjV0Pgq33xB A00IVNSOObjV/X16ZN847ePk/Hv73C8f8uHMUCn4C5aCBrX/e4H1+qafzMuyzT4UDa/Y mvQ1cpjMUU4vEFYMCWJPxzlREYWb93ZxBM5pBouOwxqYzcxtHy++f2acEoQSK5lFqkeV TKgnlXO+Miizjdd788q6sNONooejyNhn8TPl+TNovf1ajyDYxAjXTSopaVsYP8M22U8u HbflKwVC7E4O5J5LrTxDMdlxqwJGZc+FgBp05vONXLw7R9BP7TcxgBjUJLXoLCYgJLSw JQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3up4cfaqpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Nov 2023 07:49:10 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AU7n8Fs000544 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Nov 2023 07:49:08 GMT Received: from [10.253.11.15] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 29 Nov 2023 23:49:05 -0800 Message-ID: <22a49deb-001d-4fa2-83e1-0fe6c7fe2a2e@quicinc.com> Date: Thu, 30 Nov 2023 15:49:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 06/10] scsi: ufs: ufs-qcom: Set initial PHY gear to max HS gear for HW ver 4 and newer Content-Language: en-US To: Manivannan Sadhasivam CC: , , , , , , , , , Andy Gross , Bjorn Andersson , Konrad Dybcio , "James E.J. Bottomley" , open list References: <1701246516-11626-1-git-send-email-quic_cang@quicinc.com> <1701246516-11626-7-git-send-email-quic_cang@quicinc.com> <20231130064757.GF3043@thinkpad> From: Can Guo In-Reply-To: <20231130064757.GF3043@thinkpad> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: NFwkfCEgPSvr7K-s6BB-UAXSrKYY2Mt9 X-Proofpoint-ORIG-GUID: NFwkfCEgPSvr7K-s6BB-UAXSrKYY2Mt9 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-30_05,2023-11-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 malwarescore=0 impostorscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 priorityscore=1501 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311300056 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 29 Nov 2023 23:49:58 -0800 (PST) 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 > > One comment below. With that addressed, > > Reviewed-by: Manivannan Sadhasivam > >> --- >> 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 >> >> >