Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5765780rdb; Wed, 13 Dec 2023 20:59:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNl/9EoIPxV59yDCENfREsFO0TwtWTVvNHGpeGVvr693flU6P0xqGvF4ICsVcMg7uBP/o4 X-Received: by 2002:a05:6808:384b:b0:3ba:f08:6d06 with SMTP id ej11-20020a056808384b00b003ba0f086d06mr9848655oib.111.1702529956329; Wed, 13 Dec 2023 20:59:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702529956; cv=none; d=google.com; s=arc-20160816; b=JS9pmNdpKEYOGbvnmc6ABGI7m3oDNJ+gYFuQLLiTrF2PjToEHGZvDAq8ZKtKIcJaKN PoU56BRu/uRQm1TxkB5SDEKNycqN91vL0xIHtruuK9jORXi5E3HsFI5umXEi79H6BQqp Uew6//FyHt+R5ewGp0tzt+GRgaiWPWBS8dgzEdKBwHNrc/nl5OVFIUFsogWqx0lNPt75 oP9obezWsIBhAG1YFB2Ml4oJfOKy6JQmKg409uFYT7oi4xrh8lJ1JeHvAya5iW3/ELfc HQhig0tf+GTDsNY1JM+hyrbxR3uNCfLkPj2eba/HulEh1V4/xSyPIwCpzMY4qakvNktx ZMQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=UmyYjKOw9pwdZPYGxJ9gRt+5SLkPidLRqb9vGm21xYc=; fh=sX5gscjVvBE0HT037ipwQJEw8OfbPLa+qEjtNf1yjw8=; b=Se2NYEEmYsiyD6nn3+P2IKPPaNUQKG3e17E2OM+pW6urzmwIY7tYJQ6SrXEs5J95IA FRg8Riw1kkKU4JC78kYIOIoUnLXftqieHoKtTtMxzQGHeEmme8DQnjMk9HwIb0xvZ+uc M7GtBK0LqeXfkGGLle8zwCFbe02+3x7D+zBT8GlDlTJf6BtfY4577AZzWAPB9H58fTgy S+0AYb7/nWwb7IhCYa6m9UYTDeiDY9X4cKbKvzmyzP6bady3GzZQkF/Z/Ll4SaFgtU2a 96Byt4mWRqRgK1UamgrGk7mBM8ePKNXKOSi2AN9s0cEOGCrGn53UBVW5/4GQMhe03mzR 6Xvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Saz6U9DY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id g21-20020aa78195000000b006ce7f143603si10515867pfi.184.2023.12.13.20.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 20:59:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Saz6U9DY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D9FA78030A32; Wed, 13 Dec 2023 20:59:13 -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 S231375AbjLNE4z (ORCPT + 99 others); Wed, 13 Dec 2023 23:56:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbjLNE4y (ORCPT ); Wed, 13 Dec 2023 23:56:54 -0500 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0977F5 for ; Wed, 13 Dec 2023 20:57:00 -0800 (PST) Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-35f56f06142so20914095ab.1 for ; Wed, 13 Dec 2023 20:57:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702529820; x=1703134620; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=UmyYjKOw9pwdZPYGxJ9gRt+5SLkPidLRqb9vGm21xYc=; b=Saz6U9DY44dJwVooHdYOebOiVpxYS02C0haevBWk6q5lNhLnnVbtEQsxFnJjFGKZrt R+Mf/t17xVaW8i21LGDNVaweA+YQbPzRLs9rTyMlfsf3nEoH1glpdtx78PNgPlPbXqDK ZFdiHbUugeBYUt9VMy6IRi2Mbri+bowLumifoUomTaDimAsTMZOt0TqWWuaL1xiaHvVh 95xcOpEBxPyBO12l1MyrnbV+OHRMlZRWPDFQDLnl9XbQCMM4Hn7EbdGdmLgy1IFktm44 yG4jaRPHWzO6ZQA8b3CSgJt2iaXljUpNDzuh+Ak9Y7n3meUJoVW2qKxm7cZiRl4VqyDB uYEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702529820; x=1703134620; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UmyYjKOw9pwdZPYGxJ9gRt+5SLkPidLRqb9vGm21xYc=; b=LTRfz5mXPMd//GryIe1nVQRvr5gD8XK9RD6JxvcYs87LFMzDsqONmOx/QgMYWXMv2v 5V65HSYrewpka6X5/RIwR+iyoGr06LS5WZJ7hF6WM3TBlheExZmzc7/uzsM7JyETVMlw /28cuRHivoPp+zPJowiMuqOqI1UyV66gqhc966cA/dCjJ2TJcwE1R+SU2cpWsaz5C5Zm Yr4lhZ3WrtQNE8C6LqL4lkGf7d4qmklN7LOYhBidUsYko8sZNaRjv7QApbjbjrgEMlN8 gyo67y6sJVNARzzbXs4ztF1OLhMrWPknBTqWELXdjlwOg1sCF3IQE7cxIXF2UDRUjKLV Ntvw== X-Gm-Message-State: AOJu0YzpD34tg/nWtkp9SpEeXbbBwgykTH/eS8cXVavgb7RPGNte9JhP n2jGL0ctd7o4hWhphXts7eas X-Received: by 2002:a05:6e02:156f:b0:35d:a285:14b4 with SMTP id k15-20020a056e02156f00b0035da28514b4mr14961159ilu.50.1702529819982; Wed, 13 Dec 2023 20:56:59 -0800 (PST) Received: from thinkpad ([117.213.102.12]) by smtp.gmail.com with ESMTPSA id u1-20020a17090341c100b001d33c85ce1bsm3992546ple.2.2023.12.13.20.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 20:56:59 -0800 (PST) Date: Thu, 14 Dec 2023 10:26:50 +0530 From: Manivannan Sadhasivam To: Andrew Halaney Cc: martin.petersen@oracle.com, jejb@linux.ibm.com, andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, quic_nitirawa@quicinc.com Subject: Re: [PATCH v2 16/17] scsi: ufs: qcom: Use ufshcd_rmwl() where applicable Message-ID: <20231214045650.GA2938@thinkpad> References: <20231208065902.11006-1-manivannan.sadhasivam@linaro.org> <20231208065902.11006-17-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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]); Wed, 13 Dec 2023 20:59:14 -0800 (PST) On Fri, Dec 08, 2023 at 12:02:03PM -0600, Andrew Halaney wrote: > On Fri, Dec 08, 2023 at 12:29:01PM +0530, Manivannan Sadhasivam wrote: > > Instead of using both ufshcd_readl() and ufshcd_writel() to read/modify/ > > write a register, let's make use of the existing helper. > > > > Signed-off-by: Manivannan Sadhasivam > > --- > > drivers/ufs/host/ufs-qcom.c | 12 ++++-------- > > drivers/ufs/host/ufs-qcom.h | 3 +++ > > 2 files changed, 7 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > > index 26aa8904c823..549a08645391 100644 > > --- a/drivers/ufs/host/ufs-qcom.c > > +++ b/drivers/ufs/host/ufs-qcom.c > > @@ -387,9 +387,8 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) > > */ > > static void ufs_qcom_enable_hw_clk_gating(struct ufs_hba *hba) > > { > > - ufshcd_writel(hba, > > - ufshcd_readl(hba, REG_UFS_CFG2) | REG_UFS_CFG2_CGC_EN_ALL, > > - REG_UFS_CFG2); > > + ufshcd_rmwl(hba, REG_UFS_CFG2_CGC_EN_ALL, REG_UFS_CFG2_CGC_EN_ALL, > > + REG_UFS_CFG2); > > > > /* Ensure that HW clock gating is enabled before next operations */ > > mb(); > > @@ -1689,11 +1688,8 @@ static int ufs_qcom_config_esi(struct ufs_hba *hba) > > platform_msi_domain_free_irqs(hba->dev); > > } else { > > if (host->hw_ver.major == 6 && host->hw_ver.minor == 0 && > > - host->hw_ver.step == 0) { > > - ufshcd_writel(hba, > > - ufshcd_readl(hba, REG_UFS_CFG3) | 0x1F000, > > - REG_UFS_CFG3); > > - } > > + host->hw_ver.step == 0) > > + ufshcd_rmwl(hba, ESI_VEC_MASK, 0x1f00, REG_UFS_CFG3); > > Is this right? I feel like you accidentally just shifted what was written > prior >> 4 bits. > > Before: 0x1f000 > After: 0x01f00 > Doh! you are right, I accidentally missed one 0. Since the series is already merged, I will send a follow up patch. > > ufshcd_mcq_enable_esi(hba); > > } > > > > diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h > > index 385480499e71..2ce63a1c7f2f 100644 > > --- a/drivers/ufs/host/ufs-qcom.h > > +++ b/drivers/ufs/host/ufs-qcom.h > > @@ -102,6 +102,9 @@ enum { > > #define TMRLUT_HW_CGC_EN BIT(6) > > #define OCSC_HW_CGC_EN BIT(7) > > > > +/* bit definitions for REG_UFS_CFG3 register */ > > +#define ESI_VEC_MASK GENMASK(22, 12) > > + > > I'll leave it to someone with the docs to review this field. It at least > contains the bits set above, fwiw. It would be neat to see that > converted to using the field + a FIELD_PREP to set the bits IMO, but I > honestly don't have a lot of experience using those APIs so feel free to > reject that. > Fair point. The reason for hardcoding the value in this patch was I didn't get information on how the value works. But now I got that info, so will address this in the follow up patch I mentioned above. - Mani > > /* bit definitions for REG_UFS_PARAM0 */ > > #define MAX_HS_GEAR_MASK GENMASK(6, 4) > > #define UFS_QCOM_MAX_GEAR(x) FIELD_GET(MAX_HS_GEAR_MASK, (x)) > > -- > > 2.25.1 > > > -- மணிவண்ணன் சதாசிவம்