Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4199777rdb; Thu, 14 Sep 2023 15:15:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfXRMidMPQnK+FQU0t6AjVL2OP22zeCLvIR6krfgv5m8nu+/hcnijS7JF4088nRyx13ACd X-Received: by 2002:aa7:9535:0:b0:68f:be13:6c16 with SMTP id c21-20020aa79535000000b0068fbe136c16mr7219807pfp.2.1694729709093; Thu, 14 Sep 2023 15:15:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694729709; cv=none; d=google.com; s=arc-20160816; b=mpT+sTE5hfMSZrFDfLRwUuce126Mxr1CmZYz9RFrjMjF0Ynru27KyDQffvF2CUbCq7 STAqrR9PWHFi6Z/XbW/hIGGveiXDpZcpYu57q68DJrS8JrLEWinLYzml/auuw1ur5oer Pgcp0wcDYSS9tzRCpTmlj8mV6lk9i3aMKWUDSLPdnyKu3h2mjip+noKl+2C4zcsParLa EekM4nYN3Us5kRsSjjS0TMQXD0pHFBFQND8KheWsmEBah4kn5BKHQ8ZIP1gJfNifgwcT Eh5uD5E8EL/kBiIWIbSVmoQNfHRhrs+SvrV7RWgd5h6UDl31tx5wlRezFlb9gdYDw96b E1UA== 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=qez4CXnGUw1IypJ0y5ikMWPHFvJWDjjYZe2toiWMvUU=; fh=MVv4cbCuSzUN8fWDq8V+FeKkUgiVA1bj+3ca0favmpg=; b=JzL/a7PIQ9OnzeNHTHT5QB/0oYLZdu3ry0AQm84t3YvfmbNpEm8Nr7X1a/FVlqZa/h KQz+YpaoY4mAAr0DZH6wA4iViHz8BsiLWgR4r3KgJ7BcWYXi030CLMQAikGLIbYdP7P5 uT0wD/bWdUBlatioq+H6arISnnkQVIqd6hr3Qc6RK+zcOc/eiRkhOszxoSOq5AGBqalz i36UBpWP9RyCrJX1T2Kk0VGUgcEgk5WTj0gZl2JjxkhI9Jf8H3AaKgDy6gtS9+0ENEEr qNUBzucMkQOeSP8AcXib0Tr9m1xWfNosT2Fw8i2YsCHaTyI/+yo80zoim9k2PyrD0lbv EebQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=BWZsMU2g; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l2-20020a635702000000b005648d20203dsi2182672pgb.233.2023.09.14.15.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 15:15:09 -0700 (PDT) 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=BWZsMU2g; 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 DE3F2802D512; Thu, 14 Sep 2023 05:40:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238235AbjINMka (ORCPT + 99 others); Thu, 14 Sep 2023 08:40:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbjINMk3 (ORCPT ); Thu, 14 Sep 2023 08:40:29 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A22351FCC; Thu, 14 Sep 2023 05:40:25 -0700 (PDT) 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 38E5XEqF028349; Thu, 14 Sep 2023 12:40:16 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=qez4CXnGUw1IypJ0y5ikMWPHFvJWDjjYZe2toiWMvUU=; b=BWZsMU2gH4P8heNOb6AkE8zY4pcGgw8aLNU87BpwPNysTKj2P+LevDJuKDH1ezuolFWw gg3p1ItaVprjh0za0BfyLBLa0PCuoAg836F4CdSk9qFSzZ5STwQe4mH0E91M11J8+Ntz YYhKCbXUm5Wx7SONjVtMz7ickLeCBVHD6E/GT39zksYUBwaF4TIZyohVqKHrfa+MXOX9 rDu3yTu1Z7Ke91h6xP6Q5I9Ujtog1mnJli438Tx199s+Cn2kHheZVn9SxGhNtUSpjIrW V785793+cqP2sQqlxScbzkBczZsjDVOPxzxOyZpugiusGagu4UWvHGrLaRly8EHIYZ/x fw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t3v4h94q8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Sep 2023 12:40:16 +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 38ECeF9X015297 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Sep 2023 12:40:15 GMT Received: from [10.218.45.181] (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.36; Thu, 14 Sep 2023 05:40:11 -0700 Message-ID: <5a2dc1a8-6a69-2eaa-aa20-127b2ee3d4d0@quicinc.com> Date: Thu, 14 Sep 2023 18:10:08 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH 1/6] scsi: ufs: ufs-qcom: Setup host power mode during init Content-Language: en-US To: Can Guo , , , CC: , Andy Gross , "Bjorn Andersson" , Konrad Dybcio , "James E.J. Bottomley" , "open list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER..." , open list References: <1694411968-14413-1-git-send-email-quic_cang@quicinc.com> <1694411968-14413-2-git-send-email-quic_cang@quicinc.com> From: Nitin Rawat In-Reply-To: <1694411968-14413-2-git-send-email-quic_cang@quicinc.com> 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: T-PizfkFyaJOGysut6OsFsnTAyCdceIq X-Proofpoint-GUID: T-PizfkFyaJOGysut6OsFsnTAyCdceIq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-14_09,2023-09-14_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 clxscore=1015 spamscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309140109 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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 05:40:34 -0700 (PDT) On 9/11/2023 11:29 AM, Can Guo wrote: > Setup host power mode and its limitations during UFS host driver init to > avoid repetitive work during every power mode change. > > Co-developed-by: Bao D. Nguyen > Signed-off-by: Can Guo > Signed-off-by: Bao D. Nguyen Hi Can, Patch looks good. Please can you just change the order of Signed-off-by. I think it should be like below: Co-developed-by: Bao D. Nguyen Signed-off-by: Bao D. Nguyen Signed-off-by: Can Guo --Nitin > --- > drivers/ufs/host/ufs-qcom.c | 27 ++++++++++++++++++--------- > drivers/ufs/host/ufs-qcom.h | 1 + > 2 files changed, 19 insertions(+), 9 deletions(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index c3215d3..710f079 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -443,7 +443,11 @@ 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_dev_params *host_pwr_cap = &host->host_pwr_cap; > struct phy *phy = host->generic_phy; > + enum phy_mode mode = host_pwr_cap->hs_rate == PA_HS_MODE_B ? > + PHY_MODE_UFS_HS_B : > + PHY_MODE_UFS_HS_A; > int ret; > > /* Reset UFS Host Controller and PHY */ > @@ -460,7 +464,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); > @@ -884,7 +888,6 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, > struct ufs_pa_layer_attr *dev_req_params) > { > struct ufs_qcom_host *host = ufshcd_get_variant(hba); > - struct ufs_dev_params ufs_qcom_cap; > int ret = 0; > > if (!dev_req_params) { > @@ -894,13 +897,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, > > switch (status) { > case PRE_CHANGE: > - ufshcd_init_pwr_dev_param(&ufs_qcom_cap); > - ufs_qcom_cap.hs_rate = UFS_QCOM_LIMIT_HS_RATE; > - > - /* This driver only supports symmetic gear setting i.e., hs_tx_gear == hs_rx_gear */ > - ufs_qcom_cap.hs_tx_gear = ufs_qcom_cap.hs_rx_gear = ufs_qcom_get_hs_gear(hba); > - > - ret = ufshcd_get_pwr_dev_param(&ufs_qcom_cap, > + ret = ufshcd_get_pwr_dev_param(&host->host_pwr_cap, > dev_max_params, > dev_req_params); > if (ret) { > @@ -1037,6 +1034,17 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) > hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; > } > > +static void ufs_qcom_set_pwr_mode_limits(struct ufs_hba *hba) > +{ > + struct ufs_qcom_host *host = ufshcd_get_variant(hba); > + struct ufs_dev_params *host_pwr_cap = &host->host_pwr_cap; > + > + ufshcd_init_pwr_dev_param(host_pwr_cap); > + > + /* This driver only supports symmetic gear setting i.e., hs_tx_gear == hs_rx_gear */ > + host_pwr_cap->hs_tx_gear = host_pwr_cap->hs_rx_gear = ufs_qcom_get_hs_gear(hba); > +} > + > static void ufs_qcom_set_caps(struct ufs_hba *hba) > { > struct ufs_qcom_host *host = ufshcd_get_variant(hba); > @@ -1259,6 +1267,7 @@ static int ufs_qcom_init(struct ufs_hba *hba) > if (err) > goto out_variant_clear; > > + ufs_qcom_set_pwr_mode_limits(hba); > ufs_qcom_set_caps(hba); > ufs_qcom_advertise_quirks(hba); > > diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h > index fa54248..4db64d9 100644 > --- a/drivers/ufs/host/ufs-qcom.h > +++ b/drivers/ufs/host/ufs-qcom.h > @@ -227,6 +227,7 @@ struct ufs_qcom_host { > > struct gpio_desc *device_reset; > > + struct ufs_dev_params host_pwr_cap; > u32 phy_gear; > > bool esi_enabled;