Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3752827rdh; Tue, 28 Nov 2023 03:01:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQr6JcsxXrnYp9EQOrOgp3NbQhupSeiJWVcGCi4x2XVewXqBHVhWBJUhQcINq4Ycz+h3Fj X-Received: by 2002:a05:6808:2017:b0:3b8:643f:934b with SMTP id q23-20020a056808201700b003b8643f934bmr9829702oiw.46.1701169278970; Tue, 28 Nov 2023 03:01:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701169278; cv=none; d=google.com; s=arc-20160816; b=olm+4TqnFPw5QisJXQmR/RVVh1JPJ1sXHZmZztZZzrGjgvzCj2hhZ4vehoF5EwGS8d 1PDRQQOt3CqPF1nPqt0isBfFmpRe8qIxMnNCNHQTPq4lcsLh8tPsbqGhh1rb/ozGxP0y KJwYeZr6zvgwMtTipwkfjevK16HBt9UgylhjY4ElUe2FR+hOzCdsKcMF46tLk8xBBAZB HOWQ/k4PnN/b2fKmPHnbFLFeJ5zC/rBzxcJeJxzDX12JY4uMJEcA3jzNzDFH4xL468H7 Bphp4MyQOOPmVVB54qNTDIBM4BQLbBvJBY4aV98kGeGyw4jofJX6OxwqaNVCBCcT+k8X EcfQ== 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=CMvSo3+l07aKZg2M3+0zJOLmSaZeNzfKKgykk/9lmEg=; fh=YM0LD5VqvpMoleWDnL4CsnePzsLh2CfZ9fu6cAHHlME=; b=KZfzmxyOzL9LXsezY+ab7U7cr4HNMzUcqgiX4P2oyOBZ3Yxb+tMZ+GdPIif0l5Z1+x /aeyYHTupVF20CSL967l5BFmEBKGvdyI6ZpnCKAsL5RQqJxGvllArDllugUB/S6TJDd0 uMphsAB/lPIDUCptawEBfRec5qs6x/elNRG1q3j9o9t0RUD6oPV3vVuNT4bBU5QLvScc q6Jsv0GqQUwdFnvWJZ0Jc6sOxZxQL2JNrttF+UPjkUPt8+dpz3Mk+/4IqaPIxZJt3fY0 ilrctRGM66yafZ6b7DzqU+aDuIURCH8l9m3pQ+J+PvjICsttwGdZDJl+aiv7Fh7at6O+ VETQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=kYvhyKr3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bl28-20020a056808309c00b003a7ef91b24asi4734922oib.137.2023.11.28.03.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 03:01:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=kYvhyKr3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id DBA04807B497; Tue, 28 Nov 2023 03:00:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343778AbjK1K7x (ORCPT + 99 others); Tue, 28 Nov 2023 05:59:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232885AbjK1K7w (ORCPT ); Tue, 28 Nov 2023 05:59:52 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FD0618F; Tue, 28 Nov 2023 02:59:58 -0800 (PST) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ASAEBK9010595; Tue, 28 Nov 2023 10:59:45 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=CMvSo3+l07aKZg2M3+0zJOLmSaZeNzfKKgykk/9lmEg=; b=kYvhyKr32pbPd7/RyJv+OE3dZ5nNZ4tkRzQtA3hEyen5+9zILvhHsojfJ6gemF7evFDA b+bc/Uur0bfPCU79ktIaBSvIuketnS04eAFC6fhezqEAHlr79md1+eFCSYQSo9Hk2ILe VMqCDwjmOeIaRlLDIfgc4nfwsm7iW6a+yrLcx/zrmb6/x6jJqF/bPBTnkd3qEn759j2i sjB5ahTaITYsmS94UXHZA8pEnnln1ZVXZx4iTzCKf9lzqH522zsdrdajTMtPcr1E43JV craCsCttKc8tSoRKtYBT+dpwfguxDURBudhBCpGqyUmD7dXLMjzQOk4WYNec5fXJZKCf aQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3umsvak5k8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 10:59:45 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3ASAxiVO032519 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 10:59:44 GMT Received: from [10.253.11.37] (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; Tue, 28 Nov 2023 02:59:41 -0800 Message-ID: <46b24613-cffc-4a87-9232-8b93e09906f1@quicinc.com> Date: Tue, 28 Nov 2023 18:59:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 06/10] scsi: ufs: ufs-qcom: Limit HS-G5 Rate-A to hosts with HW version 5 Content-Language: en-US To: Manivannan Sadhasivam CC: , , , , , , , , Andy Gross , Bjorn Andersson , Konrad Dybcio , "James E.J. Bottomley" , open list References: <1700729190-17268-1-git-send-email-quic_cang@quicinc.com> <1700729190-17268-7-git-send-email-quic_cang@quicinc.com> <20231128055520.GG3088@thinkpad> <4648b6a0-92cb-4411-9b58-03219962505d@quicinc.com> <20231128105506.GO3088@thinkpad> From: Can Guo In-Reply-To: <20231128105506.GO3088@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-ORIG-GUID: SiENWPrHB3apQgZf_VdtwooeCgvhdGpQ X-Proofpoint-GUID: SiENWPrHB3apQgZf_VdtwooeCgvhdGpQ 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-28_10,2023-11-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 mlxlogscore=999 phishscore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311280087 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 agentk.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 (agentk.vger.email [0.0.0.0]); Tue, 28 Nov 2023 03:00:11 -0800 (PST) On 11/28/2023 6:55 PM, Manivannan Sadhasivam wrote: > On Tue, Nov 28, 2023 at 03:48:02PM +0800, Can Guo wrote: >> Hi Mani, >> >> On 11/28/2023 1:55 PM, Manivannan Sadhasivam wrote: >>> On Thu, Nov 23, 2023 at 12:46:26AM -0800, Can Guo wrote: >>>> 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 >>> >>> Reviewed-by: Manivannan Sadhasivam >>> >>> One question below... >>> >>>> --- >>>> 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; >>> >>> Is this 'else' part really needed? Since there wouldn't be any 2nd init, I think >>> we can skip that. >> >> We need it because, even there is only one init, if a UFS3.1 device is >> attached, phy_gear is given as UFS_HS_G4 in ufs_qcom_set_phy_gear(), hence >> we need to put the UFS at HS-G4 Rate B, not Rate A. >> > > But the default hs_rate is PA_HS_MODE_B only and the else condition would be not > needed for the 1st init. You are right, but still we need this in case the UFS device version is not populated, meaning dual init can also happen to SM8550. We need to apply the right hs_rate in case the 2nd init asks for HS_G4. Thanks, Can Guo. > > - Mani > >> Thanks, >> Can Guo. >> >>> >>> - Mani >>> >>>> + } >>>> + >>>> + 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 >>>> >>> >