Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1482798lqp; Fri, 22 Mar 2024 17:22:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBfL2gou/bD6z+pzF0dqzEQHQVPe4kqHfa2pu1WgWSBvNvSLKZiJWkxu1HJ1Qhw0a+G6eSMsNDDJf19+AFC2OVABqvqlfeHOrGCpbmKw== X-Google-Smtp-Source: AGHT+IE1DX9ImJgd1RmDpsni+eKGadwmqjTnzCrONT5fLDbstOLUTczmfVbgb47QnLSoBaaAtur+ X-Received: by 2002:a05:6214:ca9:b0:690:b85a:7030 with SMTP id s9-20020a0562140ca900b00690b85a7030mr937309qvs.1.1711153367774; Fri, 22 Mar 2024 17:22:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711153367; cv=pass; d=google.com; s=arc-20160816; b=KjsTBv27SM2RJOfWMntCyNfZ8dr+AbKi9ASsxR2DQbq3A7cee+lW9i16Ey+n/E/Gli G+viVrNRPsYAHhjAJ/6OGSGCgR46TX8saDCoV/juVM9zK1yt8eoyrilNiH9lAVI2DsAX EhZxoEXt162w7yxopbcw6gnHlsnYv7rEcURkRnzwzBL0W3+4DrPl/J8QuPo/1IFCNhNs vZAa/7ykSmqQNB20zvdxOv/rrG3w6tlbbMfZB39mnlxAkoCyHthi68gbgoDhwSu/QvmW h9SYp57PCrF9YqHWE+Y8BhpMDXUY9Qu9cd0Smr7iOo5uUAzF7k7AhMHxpN5v4N7ttv6N XUpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=58yjr++p7fDA387lI742mHf4CyLdjO1DHyQT9HaMHKk=; fh=tHURhn6eithwsFXw+Bhl99ogm4kCokQH8yh1PHhFtxE=; b=Vh6IIoOj2Ghsfv1tTKPuiHCPTQ2iGj/rtDOrbSJL5J3hJXLFiOdYaSvtDIkPa7wykr KKaJccWmIl8FVFIq3GqOD1q/HRNOn9wFawc9Y6s16D8G4GNYLQv+8uj93qSoZTB2EZbu /GcYMcTmyMZagTt19Hn5KH2h1sftZXYJzKKm+S0xCw+2lBDnLP5RGywZJH/wu0sGhOTv uouw+eZYnNfsrH01dv/itU8eQQeAiIMcyenJ7ebg2N4tcsV74z4HzFGlYeYZSkQp4aq3 f9CFu7adK1H38j+8qTfvJC8j3+z6BJ1tlb7MTGR/lATpQ9WtvwFWRpjbH37gdM+KC6y5 nUMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HmwdVPgT; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-112133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a22-20020a05620a16d600b00789ffa4a3a2si767959qkn.214.2024.03.22.17.22.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 17:22:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HmwdVPgT; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-112133-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5DCA31C20CDD for ; Sat, 23 Mar 2024 00:22:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C300FA31; Sat, 23 Mar 2024 00:22:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HmwdVPgT" Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DE877F for ; Sat, 23 Mar 2024 00:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711153359; cv=none; b=djzT3DRcRZakX081jxXR998QoSbcOKZwQj17nlUB7P0a7dlksB3ZYZ04cW1teHVyKtrsAthf1HuVQxSw3X2SHlue6V/I83H295mcveFUIQ5pYyy/4YAqpIlS4EomCikzzG9V0u9zRsdkFo3xuYfl9xd7LkaAGgtcaoljqStW3JM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711153359; c=relaxed/simple; bh=L7+9l9T2QmTtHUT05szPg/MIy2qIavylZgBbehnqygI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=c0rGkULaIRrADTszwZg/WU3toiuGmPJ73RC4EG2JU9LnCGmCSeojCBAQvC0xBy9nwHUxva0sORRVyG72OnPaKzxQnjTHEGeQiJvfG6u85AwSVMbICFDiS0V8GV3wowcma4iY4fcyD9+XI+LwDPtoYWg1YX4VteS4k5DwtUvdGyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=HmwdVPgT; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a46d0a8399aso624963366b.1 for ; Fri, 22 Mar 2024 17:22:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711153355; x=1711758155; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=58yjr++p7fDA387lI742mHf4CyLdjO1DHyQT9HaMHKk=; b=HmwdVPgTJ/W2Jd/dDiaSqxru72XoNkZzauNZnd1ubtiPyyz1C7q94lWyirBPj1iLsW 6zHMSqNnlEV//DiUmlhzZAXKccnIplQEC3f4nZpqxGEwk1ac1hCZIZqwx1q8lvTz6kv4 KnszWl3eckuyQuQkhBApDJgYLz62GbFH95tNqNElW4V24oqXlBZP81RWXRLSTMsRMct4 285ZDcYpaUXuVJYXPO/oSL8vUceazev0YK4348lErh0/gA139aaG8aPotBzomiLHp5nW vt2BUAjdMoZSuC89u+IznPzBCk8Viv8tliCJ/Bv/CheEJetgkolMgR8vWzvzmEpKwJux Pv4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711153355; x=1711758155; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=58yjr++p7fDA387lI742mHf4CyLdjO1DHyQT9HaMHKk=; b=WMd7U9hY1+24jpbk8LfIxS/wEkQl8VjsqnY3BJpboUmtZHcV50N9NCh6Nx0CgKf6Oc rydGX5n8XR+ATectP8RBSZZGLEfxWe0tX//2lbxk2GS58mNh6gM3oYz2kv0EK91MWaMw Q3xdYbdDFMDHwox1/P135pUvy7+VMhnZJ9N0S9nEJWAG0hcqNkcstQ+GCrh9QeK2hLwd broZEbXSXI0noDRVlsf90/wcpvKguOL8LETDNeMb+nNNdUxpYftAlg8Y7uPe65QNI+tD nko52tdtKUA0lbTZ0hH0FlPRR/II0Y6knskEUVfRJPq0jvu6VGbBdThmE5hgqN3DfRC3 GqFg== X-Forwarded-Encrypted: i=1; AJvYcCWvYjQMpoTrbLHm4vEbyAYPsED1lm6eyiBkBUxMwyK80y8iXzKIx9kl589/Uv8lIzY45BminybBh74PIhTNj6rPRngQY2dfvTerUiMH X-Gm-Message-State: AOJu0YwaCe0P8qlOkrawhD9o1wklcvXrhYiLlNdcz1IRY6znFmQX4H+y 8Pif8SfnEjNIJY7laxAOEmjpFQxeCE5sE+yLtLrB2298QuCKH+tGhAZDIVYGHDQ= X-Received: by 2002:a17:907:7625:b0:a46:fb47:7752 with SMTP id jy5-20020a170907762500b00a46fb477752mr395711ejc.23.1711153355480; Fri, 22 Mar 2024 17:22:35 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id l14-20020a1709067d4e00b00a46af0fbf5dsm344011ejp.103.2024.03.22.17.22.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Mar 2024 17:22:35 -0700 (PDT) Message-ID: Date: Sat, 23 Mar 2024 01:22:32 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/3] PCI: qcom: Add equalization settings for gen4 Content-Language: en-US To: Shashank Babu Chinta Venkata , agross@kernel.org, andersson@kernel.org, mani@kernel.org Cc: quic_msarkar@quicinc.com, quic_kraravin@quicinc.com, Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Yoshihiro Shimoda , Serge Semin , Conor Dooley , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20240320071527.13443-1-quic_schintav@quicinc.com> <20240320071527.13443-3-quic_schintav@quicinc.com> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymV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sF2BBgBCAAgFiEEU24if9oCL2zd AAQVR4cBcg5dfFgFAmQ5bvICGwwACgkQR4cBcg5dfFju1Q//Xta1ShwL0MLSC1KL1lXGXeRM 8arzfyiB5wJ9tb9U/nZvhhdfilEDLe0jKJY0RJErbdRHsalwQCrtq/1ewQpMpsRxXzAjgfRN jc4tgxRWmI+aVTzSRpywNahzZBT695hMz81cVZJoZzaV0KaMTlSnBkrviPz1nIGHYCHJxF9r cIu0GSIyUjZ/7xslxdvjpLth16H27JCWDzDqIQMtg61063gNyEyWgt1qRSaK14JIH/DoYRfn jfFQSC8bffFjat7BQGFz4ZpRavkMUFuDirn5Tf28oc5ebe2cIHp4/kajTx/7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <20240320071527.13443-3-quic_schintav@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 20.03.2024 08:14, Shashank Babu Chinta Venkata wrote: > GEN3_RELATED_OFFSET is being used as shadow register for generation4 and > generation5 data rates based on rate select mask settings on this register. > Select relevant mask and equalization settings for generation4 operation. > > Signed-off-by: Shashank Babu Chinta Venkata > --- [...] > + > +#define GEN3_EQ_FB_MODE_DIR_CHANGE_OFF 0x8ac > +#define GEN3_EQ_FMDC_T_MIN_PHASE23_MASK GENMASK(4, 0) > +#define GEN3_EQ_FMDC_N_EVALS_MASK GENMASK(9, 5) > +#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_MASK GENMASK(13, 10) > +#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_MASK GENMASK(17, 14) > +#define GEN3_EQ_FMDC_N_EVALS_SHIFT 5 > +#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_SHIFT 10 > +#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_SHIFT 14 The beauty of bitops.h is you no longer need to define these shifts.. Just use FIELD_GET/FIELD_PREP with the field! Please also drop _MASK from the leftover definitions. > +void qcom_pcie_cmn_set_16gt_eq_settings(struct dw_pcie *pci) > +{ > + u32 reg; > + > + /* > + * GEN3_RELATED_OFF is repurposed to be used with GEN4(16GT/s) rate > + * as well based on RATE_SHADOW_SEL_MASK settings on this register. > + */ Given this comment and the commit message, should setting of this field be factored out to a function that would accept a generation argument? > + reg = dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF); > + reg &= ~GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL; > + reg &= ~GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK; > + reg |= (0x1 << GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT); > + dw_pcie_writel_dbi(pci, GEN3_RELATED_OFF, reg); > + > + reg = dw_pcie_readl_dbi(pci, GEN3_EQ_FB_MODE_DIR_CHANGE_OFF); > + reg &= ~GEN3_EQ_FMDC_T_MIN_PHASE23_MASK; > + reg &= ~GEN3_EQ_FMDC_N_EVALS_MASK; > + reg |= (GEN3_EQ_FMDC_N_EVALS_16GT_VAL << > + GEN3_EQ_FMDC_N_EVALS_SHIFT); > + reg &= ~GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_MASK; > + reg |= (GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_16GT_VAL << > + GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_SHIFT); > + reg &= ~GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_MASK; > + reg |= (GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_16GT_VAL << > + GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_SHIFT); > + dw_pcie_writel_dbi(pci, GEN3_EQ_FB_MODE_DIR_CHANGE_OFF, reg); > + > + reg = dw_pcie_readl_dbi(pci, GEN3_EQ_CONTROL_OFF); > + reg &= ~GEN3_EQ_CONTROL_OFF_FB_MODE_MASK; > + reg &= ~GEN3_EQ_CONTROL_OFF_PHASE23_EXIT_MODE; > + reg &= ~GEN3_EQ_CONTROL_OFF_FOM_INC_INITIAL_EVAL; > + reg &= ~GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC_MASK; > + dw_pcie_writel_dbi(pci, GEN3_EQ_CONTROL_OFF, reg); > +}