Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3614731rdh; Mon, 27 Nov 2023 21:07:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRfc0haoCJD5gmIAVr2nrlUkWS3kVI5U88hDKa5dgJ83OOVru8TNgfjIon8PMjA8hCAqKz X-Received: by 2002:a17:902:bc49:b0:1cf:a00c:16b2 with SMTP id t9-20020a170902bc4900b001cfa00c16b2mr12149775plz.60.1701148061263; Mon, 27 Nov 2023 21:07:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701148061; cv=none; d=google.com; s=arc-20160816; b=0s+woj1YBTKtuTXp52qWN81MGo9MYG3UlX7I1TZvaz/a13mJMw91M7XHNwBnuJRLZT 3REv9+/NcrNRhguW3/xgMPOLVMxpKi9FsWXdUq+Z1qWv4zLGxnvQfcdcrSfXDdze9Yrq N4cQLn05RuFkhRSsHbo3izwNrxYpT3bKbQhRQ2YXSEwL7xgN9CudwwH8Cizp/JnxY/s1 bcgdKa4h0ReyCygqd1VyYB3fpFbDOv2GcbYgSMHMDMjO22D+ck3sqDdk+xSghqFeL/rb 6E6aAxaITwilzjVjWtIiEZA0Z0uTz7iooe0l973kzkI7G4+uT3Jq6rfot2NOUuZ8kYzN jG9Q== 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=rTorXwx9wRIzEf1bgNEltR5+EBcNvvu6cixspUhxeag=; fh=b1TUR0UDJ7e3ToSwTuUUntV/zZ/tYH/sWUspW04Txi0=; b=DFxruPVvXL9IDeHWEcfxn5/8pyXkBSxUs+Gsmc4iEuNVUNdyGb6SOjGJ9hlQJeAFoA YUuMzgK66t00MZw8Kc+Rouob0FT39pGxS8luRw0XM/m/EhdGKaRx6Ji9O2mN+Dq6DJZY sC0RpRML6nkfT3P+KK5/qvQnzdkJmugm5zSDpfoPQZ8YxHQvcex7gpoOGuBEOjJ/yk+Q qzwR220ce2Uotb3J1/Is9nr4oTC7kLCrXWCk8oRD4dE1tPb4Na+YANGQeVkYpUFRmUNY +QoNgv1CyDM57s+od+zpTY5lrzCfZ7Iu/n3kNteXuQeK2eogaKuN+XfwfECPunkUJoKt yfiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=lRh1I0xz; 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 Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i13-20020a170902c94d00b001cfdd2fe630si2340253pla.281.2023.11.27.21.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 21:07:41 -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=lRh1I0xz; 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 7FEBF807501F; Mon, 27 Nov 2023 21:07:38 -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 S232891AbjK1FHX (ORCPT + 99 others); Tue, 28 Nov 2023 00:07:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjK1FHU (ORCPT ); Tue, 28 Nov 2023 00:07:20 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 892371A1; Mon, 27 Nov 2023 21:07:27 -0800 (PST) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AS4ogaO009256; Tue, 28 Nov 2023 05:07:08 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=rTorXwx9wRIzEf1bgNEltR5+EBcNvvu6cixspUhxeag=; b=lRh1I0xzh3NAK7FwisgpY9IlHGhUWkboGtHMSGJ+qdSfrNoRpLLppAYTOQL+GNyMPCtF 6HD5VTG344sM4XDD45vEd2j/vPrnAnhbBK6MZ36lHLU+iXVo4HdGzCps48y7AOt8nN54 +iLBXjbeEPW6PESdXKlALGvLoqo6p+8cXEHW4CXOHfmE8hB3X7VVU8igS+kGGHDtCY+q eMeDZ8INka6wkKl/0heVL8fXyBWG9TxfmIvKrBnBOdPVE9MgCgBtVsxcvkVjOLkPpNdL cv01v7dL6vghRf/sR9Nr/GD0Oh9Y7GXGJTpC3ydBBW4XYNb5IlHFYuLaJ4A8c24MWUZe Hg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3umqxh2mek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 05:07:07 +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 3AS576RL023527 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 05:07:06 GMT Received: from [10.50.30.106] (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; Mon, 27 Nov 2023 21:07:00 -0800 Message-ID: <47bf5549-56fc-0e00-6095-0b699691658e@quicinc.com> Date: Tue, 28 Nov 2023 10:36:55 +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 v5 03/10] scsi: ufs: ufs-qcom: Setup host power mode during init Content-Language: en-US To: Can Guo , , , , , , , CC: , , "Bao D . Nguyen" , 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-4-git-send-email-quic_cang@quicinc.com> From: Nitin Rawat In-Reply-To: <1700729190-17268-4-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-GUID: i7wWER3cnYTLMLtMf1bTWYaU_8O7qjUw X-Proofpoint-ORIG-GUID: i7wWER3cnYTLMLtMf1bTWYaU_8O7qjUw 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_03,2023-11-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 clxscore=1011 phishscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311280038 X-Spam-Status: No, score=-2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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: 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]); Mon, 27 Nov 2023 21:07:38 -0800 (PST) On 11/23/2023 2:16 PM, Can Guo wrote: > Setup host power mode and its limitations during UFS host driver init to > avoid repetitive work during every power mode change. > > Acked-by: Andrew Halaney > Co-developed-by: Bao D. Nguyen > Signed-off-by: Bao D. Nguyen > Signed-off-by: Can Guo > --- > drivers/ufs/host/ufs-qcom.c | 21 ++++++++++++++------- > drivers/ufs/host/ufs-qcom.h | 1 + > 2 files changed, 15 insertions(+), 7 deletions(-) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index cc30ad9..cc0eb37 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -898,7 +898,7 @@ 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_host_params host_params; > + struct ufs_host_params *host_params = &host->host_params; > int ret = 0; > > if (!dev_req_params) { > @@ -908,12 +908,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, > > switch (status) { > case PRE_CHANGE: > - ufshcd_init_host_param(&host_params); > - > - /* This driver only supports symmetic gear setting i.e., hs_tx_gear == hs_rx_gear */ > - host_params.hs_tx_gear = host_params.hs_rx_gear = ufs_qcom_get_hs_gear(hba); > - > - ret = ufshcd_negotiate_pwr_param(&host_params, dev_max_params, dev_req_params); > + ret = ufshcd_negotiate_pwr_param(host_params, dev_max_params, dev_req_params); > if (ret) { > dev_err(hba->dev, "%s: failed to determine capabilities\n", > __func__); > @@ -1048,6 +1043,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_host_params(struct ufs_hba *hba) > +{ > + struct ufs_qcom_host *host = ufshcd_get_variant(hba); > + struct ufs_host_params *host_params = &host->host_params; > + > + ufshcd_init_host_param(host_params); > + > + /* This driver only supports symmetic gear setting i.e., hs_tx_gear == hs_rx_gear */ > + host_params->hs_tx_gear = host_params->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); > @@ -1272,6 +1278,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); > > err = ufs_qcom_ice_init(host); > if (err) > diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h > index 82cd143..11419eb 100644 > --- a/drivers/ufs/host/ufs-qcom.h > +++ b/drivers/ufs/host/ufs-qcom.h > @@ -238,6 +238,7 @@ struct ufs_qcom_host { > > struct gpio_desc *device_reset; > > + struct ufs_host_params host_params; > u32 phy_gear; > > bool esi_enabled; Reviewed-by: Nitin Rawat