Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4280345ybe; Mon, 16 Sep 2019 09:29:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVk6HcFCLUSYoBWdnKl7XQuXjmiV8JChiOMy0MHXLkhPbCsgloIE6Y84tnfRCtC8AmcnXp X-Received: by 2002:a05:6402:13c2:: with SMTP id a2mr163892edx.21.1568651373977; Mon, 16 Sep 2019 09:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568651373; cv=none; d=google.com; s=arc-20160816; b=Yk0nuXYXO14i0ubBMPjb1KgFhoTktB8gnMM2BzNZ4giSD0qUfqyVFAWNWAmpKoXWyK EnlOy1eb6e0JNGAcd7MFipFVs+M++a+/W5l9G+05xWubWxsOghGKfmvkKh3vTCwzyVLx ztcko2PeVapgtazPUnopqs7fWFKTWD42Bo1K1y6EKLh/dENNIvx3ZIWpD1AtkaR40APP Wwtj05xlCGJZQBnYokoPTNCljFrxP/kASGE7GU/5yo6JrRqXkxgZneaGevCS7V9ZRTWv SzLTQdB97UogIin7Ft4TMYb56h+Ucfx3XdLetUI3kiWszkUwNJdRM++Qepbju1/febGp G2dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0d8LjF5h34GqwFOoC/FdiYawnzO2u2NXaZtYvlc84Cs=; b=gAFns3wBzQmLcRu3CDrUuhdb9RaqLBPDGNtkj2eD8sFS3l4moxC1KwaEWFKy8XgasK 2kuElpYsGJhdclzNq7VZq4D6/PPKBqVePrMa7iND3bGX7OBVx9AIzKscdJZ15OXH/8Y7 Xjp8SjEhH8FKbj+Pkuy6Z6naADfs9b+8vD5LpckKJ2w5l8tmr8nSwfL5jaHAUbzjHVY7 fmOGIipdJeUBHqQlpRqdzLzbyONwlDNT4s1QlVgb9ntIdKVLMZ1oUzHy5QLDxX9O9vdY g4D+H/gUvNqya2WoSaXUQrKsNikHsI4bGJ8dINd+8jO7PCLGp0YQNTdjwZPqxJilz2n1 1YeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g32si23609259eda.330.2019.09.16.09.29.09; Mon, 16 Sep 2019 09:29:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732477AbfIPMYE (ORCPT + 99 others); Mon, 16 Sep 2019 08:24:04 -0400 Received: from foss.arm.com ([217.140.110.172]:44130 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727783AbfIPMYE (ORCPT ); Mon, 16 Sep 2019 08:24:04 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 41D32337; Mon, 16 Sep 2019 05:24:03 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC5173F575; Mon, 16 Sep 2019 05:24:02 -0700 (PDT) Date: Mon, 16 Sep 2019 13:24:01 +0100 From: Andrew Murray To: Pankaj Dubey Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, lorenzo.pieralisi@arm.com, bhelgaas@google.com, 'Anvesh Salveru' Subject: Re: [PATCH v2] PCI: dwc: Add support to add GEN3 related equalization quirks Message-ID: <20190916122400.GO9720@e119886-lin.cambridge.arm.com> References: <1568371190-14590-1-git-send-email-pankaj.dubey@samsung.com> <20190916101543.GM9720@e119886-lin.cambridge.arm.com> <00a401d56c7e$cf3abd30$6db03790$@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00a401d56c7e$cf3abd30$6db03790$@samsung.com> User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 16, 2019 at 04:36:33PM +0530, Pankaj Dubey wrote: > > > > -----Original Message----- > > From: Andrew Murray > > Sent: Monday, September 16, 2019 3:46 PM > > To: Pankaj Dubey > > Cc: linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org; > > jingoohan1@gmail.com; gustavo.pimentel@synopsys.com; > > lorenzo.pieralisi@arm.com; bhelgaas@google.com; Anvesh Salveru > > > > Subject: Re: [PATCH v2] PCI: dwc: Add support to add GEN3 related > equalization > > quirks > > > > On Fri, Sep 13, 2019 at 04:09:50PM +0530, Pankaj Dubey wrote: > > > From: Anvesh Salveru > > > > > > In some platforms, PCIe PHY may have issues which will prevent linkup > > > to happen in GEN3 or higher speed. In case equalization fails, link > > > will fallback to GEN1. > > > > > > DesignWare controller gives flexibility to disable GEN3 equalization > > > completely or only phase 2 and 3 of equalization. > > > > > > This patch enables the DesignWare driver to disable the PCIe GEN3 > > > equalization by enabling one of the following quirks: > > > - DWC_EQUALIZATION_DISABLE: To disable GEN3 equalization all phases > > > - DWC_EQ_PHASE_2_3_DISABLE: To disable GEN3 equalization phase 2 & 3 > > > > > > Platform drivers can set these quirks via "quirk" variable of "dw_pcie" > > > struct. > > > > > > Signed-off-by: Anvesh Salveru > > > Signed-off-by: Pankaj Dubey > > > --- > > > Patchset v1 can be found at: > > > - 1/2: https://lkml.org/lkml/2019/9/10/443 > > > - 2/2: https://lkml.org/lkml/2019/9/10/444 > > > > > > Changes w.r.t v1: > > > - Squashed two patches from v1 into one as suggested by Gustavo > > > - Addressed review comments from Andrew > > > > > > drivers/pci/controller/dwc/pcie-designware.c | 12 ++++++++++++ > > > drivers/pci/controller/dwc/pcie-designware.h | 9 +++++++++ > > > 2 files changed, 21 insertions(+) > > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c > > > b/drivers/pci/controller/dwc/pcie-designware.c > > > index 7d25102..97fb18d 100644 > > > --- a/drivers/pci/controller/dwc/pcie-designware.c > > > +++ b/drivers/pci/controller/dwc/pcie-designware.c > > > @@ -466,4 +466,16 @@ void dw_pcie_setup(struct dw_pcie *pci) > > > break; > > > } > > > dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, val); > > > + > > > + if (pci->quirk & DWC_EQUALIZATION_DISABLE) { > > > + val = dw_pcie_readl_dbi(pci, PCIE_PORT_GEN3_RELATED); > > > + val |= PORT_LOGIC_GEN3_EQ_DISABLE; > > > + dw_pcie_writel_dbi(pci, PCIE_PORT_GEN3_RELATED, val); > > > + } > > > + > > > + if (pci->quirk & DWC_EQ_PHASE_2_3_DISABLE) { > > > + val = dw_pcie_readl_dbi(pci, PCIE_PORT_GEN3_RELATED); > > > + val |= PORT_LOGIC_GEN3_EQ_PHASE_2_3_DISABLE; > > > + dw_pcie_writel_dbi(pci, PCIE_PORT_GEN3_RELATED, val); > > > + } > > > } > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.h > > > b/drivers/pci/controller/dwc/pcie-designware.h > > > index ffed084..e428b62 100644 > > > --- a/drivers/pci/controller/dwc/pcie-designware.h > > > +++ b/drivers/pci/controller/dwc/pcie-designware.h > > > @@ -29,6 +29,10 @@ > > > #define LINK_WAIT_MAX_IATU_RETRIES 5 > > > #define LINK_WAIT_IATU 9 > > > > > > +/* Parameters for GEN3 related quirks */ > > > +#define DWC_EQUALIZATION_DISABLE BIT(1) > > > +#define DWC_EQ_PHASE_2_3_DISABLE BIT(2) > > > + > > > /* Synopsys-specific PCIe configuration registers */ > > > #define PCIE_PORT_LINK_CONTROL 0x710 > > > #define PORT_LINK_MODE_MASK GENMASK(21, 16) > > > @@ -60,6 +64,10 @@ > > > #define PCIE_MSI_INTR0_MASK 0x82C > > > #define PCIE_MSI_INTR0_STATUS 0x830 > > > > > > +#define PCIE_PORT_GEN3_RELATED 0x890 > > > > I hadn't noticed this in the previous version - what is the proper name > for this > > register? Does it end in _RELATED? > > As per SNPS databook the name of the register is "GEN3_RELATED_OFF". It is > port logic register so, to keep similarity with other port logic registers > in this file we named it as "PCIE_PORT_GEN3_RELATED". OK. Reviewed-by: Andrew Murray Also is the SNPS databook publicly available? I'd be interested in reading it. Thanks, Andrew Murray > > > > > Thanks, > > > > Andrew Murray > > > > > +#define PORT_LOGIC_GEN3_EQ_PHASE_2_3_DISABLE BIT(9) > > > +#define PORT_LOGIC_GEN3_EQ_DISABLE BIT(16) > > > + > > > #define PCIE_ATU_VIEWPORT 0x900 > > > #define PCIE_ATU_REGION_INBOUND BIT(31) > > > #define PCIE_ATU_REGION_OUTBOUND 0 > > > @@ -244,6 +252,7 @@ struct dw_pcie { > > > struct dw_pcie_ep ep; > > > const struct dw_pcie_ops *ops; > > > unsigned int version; > > > + unsigned int quirk; > > > }; > > > > > > #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, > > > pp) > > > -- > > > 2.7.4 > > > >