Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1864975lqz; Mon, 1 Apr 2024 22:48:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrwfvtCks3mmo+UkzgoIDgairXrhdn06P5KzsNDVp1wIoCDGx1xZbNrF56flqup3ywAyCDMpHA/k2bGXK1dEtxhgEWkkTl46ILHKP3IA== X-Google-Smtp-Source: AGHT+IG7lUB5YkF9oiZYApNhUvmQsK+mPtWRnQ4lQ8XZ2R12x1LObBruaxmeHoKlBmHjaU3jPGHg X-Received: by 2002:ac8:7f4b:0:b0:432:d73c:32f1 with SMTP id g11-20020ac87f4b000000b00432d73c32f1mr11137679qtk.11.1712036883328; Mon, 01 Apr 2024 22:48:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712036883; cv=pass; d=google.com; s=arc-20160816; b=u94apGjJj+Dgg0aKeB9i4qjV4tPDcxq4pFBxtDTU2xhXs4+IN5EzalqGxONjH1p/7t 0718ppmWTl7a1xAnTXo9slduSvpJN8RI+L4u1nGohLjTOQSnrNVs5itR3zsEhG/tRerf U0KhIBmOuLoHt8McRBCq9ImMe/JoD6n2Lb+br4hWTsgZeOcf+RvesmKCjoAAomweuJHx jwxflN6RzqPHUJkPEJ7tVflvJee87ymlBodWvGMjlzB/G9ryCbtErEKepyFqImwaNuG+ PUInyiqU672sizeZZ6J7eYbql3ZXA5ARoO6WvDl94xT21bz9XqgNrIj1NMPqBzxttEQa QDIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JpNPJxv9rR4RrivmkJz0/bRbG3cnJuS8GMRkzsxCdNI=; fh=79G7HJ9TNTDYm/Uspu7uB5M+4J4ThO6qM+mnJX14JK8=; b=HRWsC+SEEvS/ETtoYjYss6bUshPoyx7w+RQckLO/S/X9BkEjgKrpJ/wq8Xx2lH4y87 ow9RHHgvFaKyjKjtCuaB+Z8AooKUfuyqkPTOeGJTDydfBGMn+kxQnVrQNyI2x0UxW4oj MhFUW+qOlBkzAnwigzDuWGDEtJ57dYcR404W71wtmfNDDGSGnjW2npsepK5Py1z4/I5x GtT8OBcXGMvDabuApo1ls3AfZnD8y/GkYLT9vb77IPn4JYvmP/roeAkZ2/oE0fscHa84 pzBM11Evm7Z5tlzYkFEy4sONLXO/V2XWO0sUJpGhwJzB3uVecYyiSWQfTGKOiEq8KBws ArpA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rgEyTcHA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-127411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c6-20020ac87dc6000000b004316cf5dabfsi11271404qte.600.2024.04.01.22.48.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 22:48:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rgEyTcHA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-127411-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 122251C21F6B for ; Tue, 2 Apr 2024 05:48:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9DFC18633; Tue, 2 Apr 2024 05:47:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rgEyTcHA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECA82CA6F; Tue, 2 Apr 2024 05:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712036874; cv=none; b=kt5jzgXBuBip/x5F9wZOx222x8D5ZQzaw2IKj2/WTZ0sIM3iV+jAjJb81LiZsOuXGmn5cVQ8vo2fsseLYLCl+Cqy/UacXkIXsI0cxPMAHodH/YfIbnzypfvCaQgoLT+FQcWpm19AzCtOwPQeYLmq5woSlDkRh4mcm0aL4eZQdsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712036874; c=relaxed/simple; bh=zXPakjJ2DckR/x2jHlfc1cEl8Lm1K6qgdabV8nrqeMo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XSPU7GQiXNRk0mVYI7+5k4b7K1e9q3EJoNhtbjrM7gXaPaGfrxZRiBhaXXHM9miJaWIKKP0ccz0MQT1UnLcQytBi7ivdHXV5wUXEOsB9uJT6B5RLrcxCbW4wpLxhdYAi7pNec/3KoXoZDo2z87SObaq9r4ILTNRbG4GutEmH6oo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rgEyTcHA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C10FC433F1; Tue, 2 Apr 2024 05:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712036873; bh=zXPakjJ2DckR/x2jHlfc1cEl8Lm1K6qgdabV8nrqeMo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rgEyTcHA8nvqp5CpxkRw+PajIM+nTNglkN1Sh8ryp4T5XJmZqjK03HabsKNz9s80L eaIKCD2P9GyhYhRWLBWm/PPsKWPCb5oNMtwodhgMMSdoVLX12sIxw47C55LpXUQAuu SY9KO1nluGN5YG9Mo1cPDrcd1fUS/lglkKd+ZesY0mq4a+enePp0aL+Fi/sK6GNacd xw2515FRoylqAMSMwwb3NfKPNAcxBb0GKalUWBgqAsehK/S+0H9LtKFFS2X+THfoSB ZNnQPgGECfCrFIIkIkaJxsCxEuP4zpdN1/uxv/nbkTgehEHxCCLrBnGRl4XSu7OSTS sI9bDPFIhhvtw== Date: Tue, 2 Apr 2024 11:17:45 +0530 From: Manivannan Sadhasivam To: Shashank Babu Chinta Venkata Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, quic_msarkar@quicinc.com, quic_kraravin@quicinc.com, Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Serge Semin , Yoshihiro Shimoda , Conor Dooley , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v2 3/3] PCI: qcom: Add rx margining settings for gen4 Message-ID: <20240402054745.GK2933@thinkpad> References: <20240320071527.13443-1-quic_schintav@quicinc.com> <20240320071527.13443-4-quic_schintav@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240320071527.13443-4-quic_schintav@quicinc.com> On Wed, Mar 20, 2024 at 12:14:47AM -0700, Shashank Babu Chinta Venkata wrote: > Add rx margining settings for gen4 operation. > What is 'rx margining'? As mentioned in the previous patch, use 16 GT/s. > Signed-off-by: Shashank Babu Chinta Venkata > --- > drivers/pci/controller/dwc/pcie-designware.h | 23 +++++++++++++ > drivers/pci/controller/dwc/pcie-qcom-cmn.c | 35 ++++++++++++++++++++ > drivers/pci/controller/dwc/pcie-qcom-cmn.h | 11 +++++- > drivers/pci/controller/dwc/pcie-qcom-ep.c | 4 ++- > drivers/pci/controller/dwc/pcie-qcom.c | 4 ++- > 5 files changed, 74 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h > index 064744bfe35a..ce1c5f9c406a 100644 > --- a/drivers/pci/controller/dwc/pcie-designware.h > +++ b/drivers/pci/controller/dwc/pcie-designware.h > @@ -206,6 +206,29 @@ > > #define PCIE_PL_CHK_REG_ERR_ADDR 0xB28 > > +/* > + * GEN4 lane margining register definitions > + */ > +#define GEN4_LANE_MARGINING_1_OFF 0xb80 > +#define MARGINING_MAX_VOLTAGE_OFFSET_MASK GENMASK(29, 24) > +#define MARGINING_NUM_VOLTAGE_STEPS_MASK GENMASK(22, 16) > +#define MARGINING_MAX_TIMING_OFFSET_MASK GENMASK(13, 8) > +#define MARGINING_NUM_TIMING_STEPS_MASK GENMASK(5, 0) > +#define MARGINING_MAX_VOLTAGE_OFFSET_SHIFT 24 > +#define MARGINING_NUM_VOLTAGE_STEPS_SHIFT 16 > +#define MARGINING_MAX_TIMING_OFFSET_SHIFT 8 > + > +#define GEN4_LANE_MARGINING_2_OFF 0xb84 > +#define MARGINING_IND_ERROR_SAMPLER BIT(28) > +#define MARGINING_SAMPLE_REPORTING_METHOD BIT(27) > +#define MARGINING_IND_LEFT_RIGHT_TIMING BIT(26) > +#define MARGINING_IND_UP_DOWN_VOLTAGE BIT(25) > +#define MARGINING_VOLTAGE_SUPPORTED BIT(24) > +#define MARGINING_MAXLANES_MASK GENMASK(20, 16) > +#define MARGINING_SAMPLE_RATE_TIMING_MASK GENMASK(13, 8) > +#define MARGINING_SAMPLE_RATE_VOLTAGE_MASK GENMASK(5, 0) > +#define MARGINING_MAXLANES_SHIFT 16 > +#define MARGINING_SAMPLE_RATE_TIMING_SHIFT 8 Add a newline > /* > * iATU Unroll-specific register definitions > * From 4.80 core version the address translation will be made by unroll > diff --git a/drivers/pci/controller/dwc/pcie-qcom-cmn.c b/drivers/pci/controller/dwc/pcie-qcom-cmn.c > index 208a55e8e9a1..bf6b27ee8327 100644 > --- a/drivers/pci/controller/dwc/pcie-qcom-cmn.c > +++ b/drivers/pci/controller/dwc/pcie-qcom-cmn.c > @@ -53,6 +53,41 @@ void qcom_pcie_cmn_set_16gt_eq_settings(struct dw_pcie *pci) > } > EXPORT_SYMBOL_GPL(qcom_pcie_cmn_set_16gt_eq_settings); > > +void qcom_pcie_cmn_set_16gt_rx_margining_settings(struct dw_pcie *pci) > +{ > + u32 reg; > + > + reg = dw_pcie_readl_dbi(pci, GEN4_LANE_MARGINING_1_OFF); > + reg &= ~MARGINING_MAX_VOLTAGE_OFFSET_MASK; > + reg |= (MARGINING_MAX_VOLTAGE_OFFSET_VAL << > + MARGINING_MAX_VOLTAGE_OFFSET_SHIFT); Same comment as previous patch to use FIELD_* macros. - Mani -- மணிவண்ணன் சதாசிவம்