Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5733219ybp; Tue, 15 Oct 2019 04:20:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzZOmy6fpDSIR9MSCME+HrCKTjDuQz8LJBtoWZne3tsDOhEHrrL0A/ZiQRlBgBuaXwp08s X-Received: by 2002:a17:906:3946:: with SMTP id g6mr33410888eje.49.1571138405853; Tue, 15 Oct 2019 04:20:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571138405; cv=none; d=google.com; s=arc-20160816; b=Jg5FavrI3tSIBGMMwDLau5GH2WzUxnYzKMGLZzBr4mt8Xf9XVun/hCLAtjrPGL4K87 s0W4BwUCCUUbD9S/aV01e1wfVegxTQ/BzYrVSxcU9TksP0dMjNwAE/5KdLIVhsaQdd05 4pgHC+1BMYiSsJGdzTLcFn8v04BjRo11GR6Vewyjbui5FV49j3IAJETt77e+NA3EXMi1 tB7/LSeHskme7Q+oLoYjbYZUCFIpe+Pvn/KONSFIFrQT3ux3lWDct2X+z2WfGloLd6J/ mUydXboGck2XkbIKTZvVPuMuaShudxC5cxTUPHgfgFUmQOd5UeTmCDRtRDv1Ql2sJLJs l/Wg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YIaOBNWN2tpG+RpI2kNEP0VXguIxNOWwrYW3F7DeUP8=; b=r8VMAg0BRPyMefBKk7jPabrL2Fnvv0OZ2+QtytDfG/jBX+rUWEyhoWQUs6g/eUlBOK uTa104KYaxg8w3vB/wOoY3fgIDv9HmhTwBc7lI4nOkrqtxhiJEAjrV8ku6WFFAQG16Rh lmTmVy4mf4BsPmZKgUWdK4fL1lidj7rIm86+EfVYR+fCzfI1t+fqPjoytDvHP+T00geM nALNVFUkAN6D0w3oYvd6LQp/KAqk/knR6rBpqfRnD+UkDdmL+WfC2sHQRnYQq0EFlM7J pCXV+TZkoidmvo2kxAyKbJdvEHAyWKnlfl2S+uVQEsIeL7Ae2Awq7kffZlKZpTN3unlO wLTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=OMkoqyY0; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x47si14820048eda.396.2019.10.15.04.19.41; Tue, 15 Oct 2019 04:20:05 -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; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=OMkoqyY0; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727548AbfJOJTI (ORCPT + 99 others); Tue, 15 Oct 2019 05:19:08 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:37304 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfJOJTI (ORCPT ); Tue, 15 Oct 2019 05:19:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YIaOBNWN2tpG+RpI2kNEP0VXguIxNOWwrYW3F7DeUP8=; b=OMkoqyY0vapTbGrlufm/6ayOY XSkrMEjXZT8h0b4GmtbZLBbtUTelQxluoeVreLNcdFjQ3+ceI/7EH9H4HSWoODT26X1rOm6DdWmFp oRnlqVuSs8zXTw94Yq1mm+GHmz1UGUrzmVH7IYyRo+jgQT3B8i/m8iH0trQB3tn7gCI+TPdIEYzZK elCvZorMO4eEfAhIZyeqFJDIvtEYWDvAKk4HK89yLFp02wurTrDCuj49xyFohoimuHy8BN0cGeEjN q95FWUIV9VfODFWWmp6L1Jy/QOmc+As8DcvxIfzkA17ySv7MKXHXiP+2hKUSt9WrkKF68LPUP2e+X 4tzF+1+5w==; Received: from shell.armlinux.org.uk ([2001:4d48:ad52:3201:5054:ff:fe00:4ec]:43734) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1iKIyh-0003VI-5O; Tue, 15 Oct 2019 10:18:51 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1iKIyf-0005C9-SU; Tue, 15 Oct 2019 10:18:49 +0100 Date: Tue, 15 Oct 2019 10:18:49 +0100 From: Russell King - ARM Linux admin To: Xiaowei Bao Cc: "Z.q. Hou" , "bhelgaas@google.com" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , Leo Li , "kishon@ti.com" , "lorenzo.pieralisi@arm.com" , "M.h. Lian" , "andrew.murray@arm.com" , Mingkai Hu , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 3/6] PCI: mobiveil: Add PCIe Gen4 EP driver for NXP Layerscape SoCs Message-ID: <20191015091849.GT25745@shell.armlinux.org.uk> References: <20190916021742.22844-1-xiaowei.bao@nxp.com> <20190916021742.22844-4-xiaowei.bao@nxp.com> <20190924163850.GY25745@shell.armlinux.org.uk> <20191015090756.GS25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 15, 2019 at 09:14:00AM +0000, Xiaowei Bao wrote: > > -----Original Message----- > > From: Russell King - ARM Linux admin > > Sent: 2019年10月15日 17:08 > > To: Xiaowei Bao > > Cc: Z.q. Hou ; bhelgaas@google.com; > > robh+dt@kernel.org; mark.rutland@arm.com; shawnguo@kernel.org; Leo Li > > ; kishon@ti.com; lorenzo.pieralisi@arm.com; M.h. Lian > > ; andrew.murray@arm.com; Mingkai Hu > > ; linux-pci@vger.kernel.org; > > linux-arm-kernel@lists.infradead.org; devicetree@vger.kernel.org; > > linux-kernel@vger.kernel.org > > Subject: Re: [PATCH 3/6] PCI: mobiveil: Add PCIe Gen4 EP driver for NXP > > Layerscape SoCs > > > > On Tue, Oct 15, 2019 at 07:46:12AM +0000, Xiaowei Bao wrote: > > > > > > > > > > -----Original Message----- > > > > From: Russell King - ARM Linux admin > > > > Sent: 2019年9月25日 0:39 > > > > To: Xiaowei Bao > > > > Cc: Z.q. Hou ; bhelgaas@google.com; > > > > robh+dt@kernel.org; mark.rutland@arm.com; shawnguo@kernel.org; Leo > > > > robh+Li > > > > ; kishon@ti.com; lorenzo.pieralisi@arm.com; M.h. > > > > Lian ; andrew.murray@arm.com; Mingkai Hu > > > > ; linux-pci@vger.kernel.org; > > > > linux-arm-kernel@lists.infradead.org; devicetree@vger.kernel.org; > > > > linux-kernel@vger.kernel.org > > > > Subject: Re: [PATCH 3/6] PCI: mobiveil: Add PCIe Gen4 EP driver for > > > > NXP Layerscape SoCs > > > > > > > > On Mon, Sep 16, 2019 at 10:17:39AM +0800, Xiaowei Bao wrote: > > > > > This PCIe controller is based on the Mobiveil GPEX IP, it work in > > > > > EP mode if select this config opteration. > > > > > > > > > > Signed-off-by: Xiaowei Bao > > > > > --- > > > > > MAINTAINERS | 2 > > + > > > > > drivers/pci/controller/mobiveil/Kconfig | 17 ++- > > > > > drivers/pci/controller/mobiveil/Makefile | 1 + > > > > > .../controller/mobiveil/pcie-layerscape-gen4-ep.c | 156 > > > > > +++++++++++++++++++++ > > > > > 4 files changed, 173 insertions(+), 3 deletions(-) create mode > > > > > 100644 drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c > > > > > > > > > > diff --git a/MAINTAINERS b/MAINTAINERS index b997056..0858b54 > > > > > 100644 > > > > > --- a/MAINTAINERS > > > > > +++ b/MAINTAINERS > > > > > @@ -12363,11 +12363,13 @@ F: > > > > drivers/pci/controller/dwc/*layerscape* > > > > > > > > > > PCI DRIVER FOR NXP LAYERSCAPE GEN4 CONTROLLER > > > > > M: Hou Zhiqiang > > > > > +M: Xiaowei Bao > > > > > L: linux-pci@vger.kernel.org > > > > > L: linux-arm-kernel@lists.infradead.org > > > > > S: Maintained > > > > > F: Documentation/devicetree/bindings/pci/layerscape-pcie-gen4.txt > > > > > F: drivers/pci/controller/mobibeil/pcie-layerscape-gen4.c > > > > > +F: drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c > > > > > > > > > > PCI DRIVER FOR GENERIC OF HOSTS > > > > > M: Will Deacon > > > > > diff --git a/drivers/pci/controller/mobiveil/Kconfig > > > > > b/drivers/pci/controller/mobiveil/Kconfig > > > > > index 2054950..0696b6e 100644 > > > > > --- a/drivers/pci/controller/mobiveil/Kconfig > > > > > +++ b/drivers/pci/controller/mobiveil/Kconfig > > > > > @@ -27,13 +27,24 @@ config PCIE_MOBIVEIL_PLAT > > > > > for address translation and it is a PCIe Gen4 IP. > > > > > > > > > > config PCIE_LAYERSCAPE_GEN4 > > > > > - bool "Freescale Layerscape PCIe Gen4 controller" > > > > > + bool "Freescale Layerscpe PCIe Gen4 controller in RC mode" > > > > > depends on PCI > > > > > depends on OF && (ARM64 || ARCH_LAYERSCAPE) > > > > > depends on PCI_MSI_IRQ_DOMAIN > > > > > select PCIE_MOBIVEIL_HOST > > > > > help > > > > > Say Y here if you want PCIe Gen4 controller support on > > > > > - Layerscape SoCs. The PCIe controller can work in RC or > > > > > - EP mode according to RCW[HOST_AGT_PEX] setting. > > > > > + Layerscape SoCs. And the PCIe controller work in RC mode > > > > > + by setting the RCW[HOST_AGT_PEX] to 0. > > > > > + > > > > > +config PCIE_LAYERSCAPE_GEN4_EP > > > > > + bool "Freescale Layerscpe PCIe Gen4 controller in EP mode" > > > > > + depends on PCI > > > > > + depends on OF && (ARM64 || ARCH_LAYERSCAPE) > > > > > + depends on PCI_ENDPOINT > > > > > + select PCIE_MOBIVEIL_EP > > > > > + help > > > > > + Say Y here if you want PCIe Gen4 controller support on > > > > > + Layerscape SoCs. And the PCIe controller work in EP mode > > > > > + by setting the RCW[HOST_AGT_PEX] to 1. > > > > > endmenu > > > > > diff --git a/drivers/pci/controller/mobiveil/Makefile > > > > > b/drivers/pci/controller/mobiveil/Makefile > > > > > index 686d41f..6f54856 100644 > > > > > --- a/drivers/pci/controller/mobiveil/Makefile > > > > > +++ b/drivers/pci/controller/mobiveil/Makefile > > > > > @@ -4,3 +4,4 @@ obj-$(CONFIG_PCIE_MOBIVEIL_HOST) += > > > > > pcie-mobiveil-host.o > > > > > obj-$(CONFIG_PCIE_MOBIVEIL_EP) += pcie-mobiveil-ep.o > > > > > obj-$(CONFIG_PCIE_MOBIVEIL_PLAT) += pcie-mobiveil-plat.o > > > > > obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4) += pcie-layerscape-gen4.o > > > > > +obj-$(CONFIG_PCIE_LAYERSCAPE_GEN4_EP) += > > > > pcie-layerscape-gen4-ep.o > > > > > diff --git > > > > > a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c > > > > > b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c > > > > > new file mode 100644 > > > > > index 0000000..7bfec51 > > > > > --- /dev/null > > > > > +++ b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4-ep.c > > > > > @@ -0,0 +1,156 @@ > > > > > +// SPDX-License-Identifier: GPL-2.0 > > > > > +/* > > > > > + * PCIe controller EP driver for Freescale Layerscape SoCs > > > > > + * > > > > > + * Copyright (C) 2019 NXP Semiconductor. > > > > > + * > > > > > + * Author: Xiaowei Bao */ > > > > > + > > > > > +#include > > > > > +#include > > > > > +#include > > > > > +#include > > > > > +#include > > > > > +#include > > > > > +#include #include > > > > > + > > > > > +#include "pcie-mobiveil.h" > > > > > + > > > > > +#define PCIE_LX2_BAR_NUM 4 > > > > > + > > > > > +#define to_ls_pcie_g4_ep(x) dev_get_drvdata((x)->dev) > > > > > + > > > > > +struct ls_pcie_g4_ep { > > > > > + struct mobiveil_pcie *mv_pci; > > > > > +}; > > > > > + > > > > > +static const struct of_device_id ls_pcie_g4_ep_of_match[] = { > > > > > + { .compatible = "fsl,lx2160a-pcie-ep",}, > > > > > + { }, > > > > > +}; > > > > > + > > > > > +static const struct pci_epc_features ls_pcie_g4_epc_features = { > > > > > + .linkup_notifier = false, > > > > > + .msi_capable = true, > > > > > + .msix_capable = true, > > > > > + .reserved_bar = (1 << BAR_4) | (1 << BAR_5), > > > > > > > > BIT(BAR_4) | BIT(BAR_5) ? > > > > > > I think use .reserved_bar = (1 << BAR_4) | (1 << BAR_5), is better, > > > because BAR_4 is not a bit of register. > > > > Why is whether it's a register or not relevent? > > My understand is that the BIT is used to register, refer to other EP driver files, > it also use 1 << BAR_4 method. > > [baoxw@titan controller]$ grep -r "reserved_bar" * > dwc/pci-keystone.c: .reserved_bar = 1 << BAR_0 | 1 << BAR_1, > mobiveil/pcie-layerscape-gen4-ep.c: .reserved_bar = (1 << BAR_4) | (1 << BAR_5), $ grep '\