From patchwork Thu Apr 2 19:38:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 11471383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCCE117EA for ; Thu, 2 Apr 2020 19:39:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9EBD22077D for ; Thu, 2 Apr 2020 19:39:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kQVSkBY7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EBD22077D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=zUSiadZwApyoV1c4wW6skHKP4j3Yv6VD9gf5hwoVLCg=; b=kQV SkBY7iXlpr+br0HzycXXh4roRUEBp8I4p/mro3M6XQpFqnpmoCvbQZwgNn5EFetSLAp5gGF+tQaR4 kWFatHzWF8EO9cg7mzRMY/gql5qfnLXxn6m55SqEHkbNRwRgXG4qent50inv9XYNBmwGF3GmBL4wu a9y8Es0H6oBlgO4eOfmzUlR62LPDm11qr82DY1X2ZGxLWo8cB5HTiZro0v1cte9Luw1IyAOfS1fCe 9eIlW1EeC+aO9S6z3XJt6/GS22pPEL0SjH77YaDaJnjOcr64l52lCESDkl90XlgpyX9NYcFO3hSx3 NUJb10Ai9I04D8hqOH/clYfxKB0MsFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jK5gD-0005QC-7g; Thu, 02 Apr 2020 19:39:09 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie6.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jK5g2-0005Fs-N6; Thu, 02 Apr 2020 19:39:00 +0000 X-IronPort-AV: E=Sophos;i="5.72,336,1580742000"; d="scan'208";a="43341491" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 03 Apr 2020 04:38:51 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 6DFF840C4F75; Fri, 3 Apr 2020 04:38:44 +0900 (JST) From: Lad Prabhakar To: Bjorn Helgaas , Rob Herring , Mark Rutland , Geert Uytterhoeven , Magnus Damm , Kishon Vijay Abraham I , Lorenzo Pieralisi , Marek Vasut , Yoshihiro Shimoda , linux-pci@vger.kernel.org Subject: [PATCH v6 00/11] Add support for PCIe controller to work in endpoint mode on R-Car SoCs Date: Thu, 2 Apr 2020 20:38:28 +0100 Message-Id: <1585856319-4380-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200402_123859_062598_15590C1E X-CRM114-Status: GOOD ( 15.06 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.160.252.172 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Chris Paterson , Heiko Stuebner , Arnd Bergmann , Jingoo Han , Catalin Marinas , Shawn Lin , Frank Rowand , linux-kernel@vger.kernel.org, Lad Prabhakar , linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, Tom Joseph , Simon Horman , Lad Prabhakar , Greg Kroah-Hartman , Andrew Murray , Gustavo Pimentel , Will Deacon , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org This patch series adds support for PCIe controller on rcar to work in endpoint mode, this also extends the epf framework to handle base region for mapping PCI address locally. Note: The cadence/rockchip/designware endpoint drivers are build tested only. root@salvator-x:~# ./pcitest.sh BAR tests BAR0: OKAY BAR1: NOT OKAY BAR2: OKAY BAR3: NOT OKAY BAR4: OKAY BAR5: NOT OKAY Interrupt tests SET IRQ TYPE TO LEGACY: OKAY LEGACY IRQ: OKAY SET IRQ TYPE TO MSI: OKAY MSI1: OKAY MSI2: OKAY MSI3: OKAY MSI4: OKAY MSI5: OKAY MSI6: OKAY MSI7: OKAY MSI8: OKAY MSI9: OKAY MSI10: OKAY MSI11: OKAY MSI12: OKAY MSI13: OKAY MSI14: OKAY MSI15: OKAY MSI16: OKAY MSI17: NOT OKAY MSI18: NOT OKAY MSI19: NOT OKAY MSI20: NOT OKAY MSI21: NOT OKAY MSI22: NOT OKAY MSI23: NOT OKAY MSI24: NOT OKAY MSI25: NOT OKAY MSI26: NOT OKAY MSI27: NOT OKAY MSI28: NOT OKAY MSI29: NOT OKAY MSI30: NOT OKAY MSI31: NOT OKAY MSI32: NOT OKAY Read Tests SET IRQ TYPE TO MSI: OKAY READ ( 1 bytes): OKAY READ ( 1024 bytes): OKAY READ ( 1025 bytes): OKAY READ (1024000 bytes): OKAY READ (1024001 bytes): OKAY Write Tests WRITE ( 1 bytes): OKAY WRITE ( 1024 bytes): OKAY WRITE ( 1025 bytes): OKAY WRITE (1024000 bytes): OKAY WRITE (1024001 bytes): OKAY Copy Tests COPY ( 1 bytes): OKAY COPY ( 1024 bytes): OKAY COPY ( 1025 bytes): OKAY COPY (1024000 bytes): OKAY COPY (1024001 bytes): OKAY Changes for v6: 1] Rebased patches on endpoint branch of https://git.kernel.org/pub/ scm/linux/kernel/git/lpieralisi/pci.git/ 2] Fixed review comments from Shimoda-san a] Made sure defconfig changes were in seprate patch b] Created rcar_pcie_host/rcar_pcie_ep structures c] Added pci-id for R8A774C0 d] Added entry in MAINTAINERS for dt-binding e] Dropped unnecessary braces 3] Added support for msi. Changes for v5: 1] Rebased patches on next branch of https://git.kernel.org/pub/scm/ linux/kernel/git/helgaas/pci.git 2] Fixed review comments reported by Kishon while fetching the matching window in function pci_epc_get_matching_window() 3] Fixed review comments reported by Bjorn a] Split patch up first patch so that its easier to review and incremental b] Fixed typos 4] Included Reviewed tag from Rob for the dt-binding patch 5] Fixed issue reported by Nathan for assigning variable to itself Changes for v4: 1] Fixed dtb_check error reported by Rob 2] Fixed review comments reported by Kishon a] Dropped pci_epc_find_best_fit_window() b] Fixed initializing mem ptr in __pci_epc_mem_init() c] Dropped map_size from pci_epc_mem_window structure Changes for v3: 1] Fixed review comments from Bjorn and Kishon. 3] Converted to DT schema Changes for v2: 1] Fixed review comments from Biju for dt-bindings to include an example for a tested platform. 2] Fixed review comments from Kishon to extend the features of outbound regions in epf framework. 3] Added support to parse outbound-ranges in OF. Lad Prabhakar (11): PCI: rcar: Rename pcie-rcar.c to pcie-rcar-host.c arm64: defconfig: enable CONFIG_PCIE_RCAR_HOST PCI: drop PCIE_RCAR config option PCI: rcar: Move shareable code to a common file PCI: rcar: Fix calculating mask for PCIEPAMR register PCI: endpoint: Add support to handle multiple base for mapping outbound memory dt-bindings: PCI: rcar: Add bindings for R-Car PCIe endpoint controller PCI: rcar: Add support for rcar PCIe controller in endpoint mode PCI: Add Renesas R8A774C0 device ID misc: pci_endpoint_test: Add Device ID for RZ/G2E PCIe controller MAINTAINERS: Add file patterns for rcar PCI device tree bindings .../devicetree/bindings/pci/rcar-pci-ep.yaml | 76 ++ MAINTAINERS | 1 + arch/arm64/configs/defconfig | 2 +- drivers/misc/pci_endpoint_test.c | 2 + drivers/pci/controller/Kconfig | 15 +- drivers/pci/controller/Makefile | 3 +- .../pci/controller/cadence/pcie-cadence-ep.c | 3 +- .../pci/controller/dwc/pcie-designware-ep.c | 16 +- drivers/pci/controller/pcie-rcar-ep.c | 556 ++++++++ drivers/pci/controller/pcie-rcar-host.c | 1065 +++++++++++++++ drivers/pci/controller/pcie-rcar.c | 1206 +---------------- drivers/pci/controller/pcie-rcar.h | 140 ++ drivers/pci/controller/pcie-rockchip-ep.c | 2 +- drivers/pci/endpoint/pci-epc-mem.c | 195 ++- include/linux/pci-epc.h | 39 +- include/linux/pci_ids.h | 1 + 16 files changed, 2068 insertions(+), 1254 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/rcar-pci-ep.yaml create mode 100644 drivers/pci/controller/pcie-rcar-ep.c create mode 100644 drivers/pci/controller/pcie-rcar-host.c create mode 100644 drivers/pci/controller/pcie-rcar.h