Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp59397rdb; Thu, 7 Sep 2023 13:34:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHlOzPFVYfPthvr7sc9wOml6FR/KkbUp8a4jDK9Umjsywa3uMVkEkOtlmIEClojNAsY+W3o X-Received: by 2002:a05:6a00:2d97:b0:68e:371a:c652 with SMTP id fb23-20020a056a002d9700b0068e371ac652mr485831pfb.13.1694118856793; Thu, 07 Sep 2023 13:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694118856; cv=none; d=google.com; s=arc-20160816; b=EEVF9EvJSO239lr4moD63LfoIksfFIASUcqloqsfD3XCvk2d8E3ZOHUOmj5WvADQM2 3cvSzy40Zo/FiKAS3O84y9o7YJgPNGpIjxzP/GdYr7S8NvExywaW9C75a4nayb2HRp06 +oheMxf+5rBJkaeGXZG9Birh2kJlCpbCyKLpTmImTo61TYVdg8c066CQ8ri7r6RY6A6j pemVYO9u4K2jv4qkmqzfbNYbHjk5zjXRHz9+IzcYcXUSJk7ZfbdDQTv5VzT8GwMr1Whm iCSKB3NL4UPBX1YDeqiNG+pWeM7aTP6v2/Y588xo2ZqoRFrAJk6lHl4fhM8s0o9VkJcR H/5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=lKNttDC8kKnJWECBAyhQbpNuBo4AiiyjLFIRmqsUOv0=; fh=y8d0C5dLtGb8zs8KQUIJy2R9+5DBPV29N8a8eZxYvuU=; b=TyEdw2w0tqLkMWYiVeJCoK6gNmnI58WKK71CbqPFSjYbt9T1g2GLntPjuBjwP/Fp4E LPoiMRCY4O8d9xkuDtN1ylCer5S/IUIyGXFdqIl/OMmDmYasNg28KzPj0qc6GKh08DhL rqdtD5TxCI1E/ShxeqBdL4lLon63r/5zzKKE5MFkjFOBUbyZjHwfAP7JN1IZb4fQ90m2 cLm4yIZ/41TVmCxBY6jh7rXOugMH9ZlKRsc9CDz/hlrjFRpl4rMBK9sM/7RLghWlEXJ4 L6VqIY4foOZguEkVByUZGgvF8Rqc7Svff5KM0sZzfylgJvwWU86e8lLi1MuAGYK1bpEM 2DrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020aa79aed000000b0068be0825745si212480pfp.303.2023.09.07.13.34.02; Thu, 07 Sep 2023 13:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbjIGSaq (ORCPT + 99 others); Thu, 7 Sep 2023 14:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241633AbjIGSam (ORCPT ); Thu, 7 Sep 2023 14:30:42 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 957D51BD3; Thu, 7 Sep 2023 11:30:10 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 4639B24E1DE; Thu, 7 Sep 2023 17:11:01 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 7 Sep 2023 17:11:01 +0800 Received: from ubuntu.localdomain (113.72.144.73) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 7 Sep 2023 17:11:00 +0800 From: Minda Chen To: Daire McNamara , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Emil Renner Berthing CC: , , , , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v5 0/11] Refactoring Microchip PCIe driver and add StarFive PCIe Date: Thu, 7 Sep 2023 17:10:47 +0800 Message-ID: <20230907091058.125630-1-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [113.72.144.73] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset final purpose is add PCIe driver for StarFive JH7110 SoC. JH7110 using PLDA XpressRICH PCIe IP. Microchip PolarFire Using the same IP and have commit their codes, which are mixed with PLDA controller codes and Microchip platform codes. For re-use the PLDA controller codes, I request refactoring microchip codes, move PLDA common codes to PLDA files. Desigware and Cadence is good example for refactoring codes. So first step is extract the PLDA common codes from microchip, and refactoring the microchip codes.(patch1 - 8) Then, add Starfive codes. (patch9 - 11) This patchset is base on v6.5 The patch is base on Daire microchip commit,(accepted, not merge in mainline now) https://patchwork.kernel.org/project/linux-pci/cover/20230728131401.1615724-1-daire.mcnamara@microchip.com/ patch11 dts patch base on stg clk patchset and syscon patch(these will be merged in 6.6-rcx). https://patchwork.kernel.org/project/linux-riscv/cover/20230713113902.56519-1-xingyu.wu@starfivetech.com/ https://patchwork.kernel.org/project/linux-riscv/patch/20230717023040.78860-7-xingyu.wu@starfivetech.com/ patch1 is move PLDA XpressRICH PCIe host common properties dt-binding docs from microchip,pcie-host.yaml patch2 is move PolarFire codes to PLDA directory. patch3 is move PLDA IP register macros to plda-pcie.h patch4 is rename data structure setup and IRQ functions in microchip codes. patch5 is move the patch4 functions to common file pcie-plda-host.c patch6 is Add PLDA event interrupt codes and IRQ domain ops. patch7 is rename IRQ init function in microchip codes, prepare to move the common file pcie-plda-host.c, patch8 is move IRQ init functions and other functions to pcie-plda-host.c patch9 is add StarFive JH7110 PCIe dt-binding doc. patch10 is add StarFive JH7110 Soc PCIe codes. patch11 is Starfive dts config previous version: v1:https://patchwork.kernel.org/project/linux-pci/cover/20230719102057.22329-1-minda.chen@starfivetech.com/ v2:https://patchwork.kernel.org/project/linux-pci/cover/20230727103949.26149-1-minda.chen@starfivetech.com/ v3:https://patchwork.kernel.org/project/linux-pci/cover/20230814082016.104181-1-minda.chen@starfivetech.com/ v4:https://patchwork.kernel.org/project/linux-pci/cover/20230825090129.65721-1-minda.chen@starfivetech.com/ change: v5: patch 6 -8: - Some variables names changed (evt->event). - plda_handle_event() using a unify callback function to get events num. - Add plda_event_ops data structure. patch 10: plda_event_ops changed which is related to patch 6- 8 changed. v4: patch 3: Copy the interrupt events macros to pcie-plda-host.c patch 7 - 8: get_events() change in patch 7. Patch 8 is just move the codes. other change: All the functions in commit message add (). v3: patch 2- 8: - splite refactoring patches to multiple patch. - rename plda_pcie to plda_pcie_rp. Maybe other vendor will upstream PLDA ep codes. patch 9: - Remove the redundant reference. - move the offset value to codes in starfive,stg-syscon - change reset-gpio to prest-gpio. patch10: - Add 100ms delay after preset for PCIe 6.0 spec. - stg-syscon related modification. patch11: - Add dts configure. v2: patch1: - squash dt-bindings patches to patch1 - add 'required' list. - plda doc rename to plda,xpressrich-axi-common.yaml patch2 - 8: - squash the microchip modification patch. patch9: - remove the plda common required property. patch10: - Sync the hide rc bar ops with config read function. - Revert the T_PVPERL to 100ms and add comments for the source. - Replace the link check function by the standard link ops. - Convert to new pm ops marcos. - Some formats modification. - pcie-plda-host modification merge to patch4. other: - remove the pcie-plda-plat.c - remove the starfive dts patch first. for it depends on stg clock and syscon setting. Minda Chen (11): dt-bindings: PCI: Add PLDA XpressRICH PCIe host common properties PCI: microchip: Move pcie-microchip-host.c to plda directory PCI: microchip: Move PLDA IP register macros to pcie-plda.h PCI: microchip: Rename data structure and functions PCI: plda: Move the common functions to pcie-plda-host.c PCI: plda: Add event interrupt codes and IRQ domain ops PCI: microchip: Rename IRQ init function PCI: microchip: Move IRQ init functions to pcie-plda-host.c dt-bindings: PCI: Add StarFive JH7110 PCIe controller PCI: starfive: Add JH7110 PCIe controller riscv: dts: starfive: add PCIe dts configuration for JH7110 .../bindings/pci/microchip,pcie-host.yaml | 55 +- .../pci/plda,xpressrich3-axi-common.yaml | 75 ++ .../bindings/pci/starfive,jh7110-pcie.yaml | 120 ++++ MAINTAINERS | 17 +- .../jh7110-starfive-visionfive-2.dtsi | 64 ++ arch/riscv/boot/dts/starfive/jh7110.dtsi | 86 +++ drivers/pci/controller/Kconfig | 9 +- drivers/pci/controller/Makefile | 2 +- drivers/pci/controller/plda/Kconfig | 30 + drivers/pci/controller/plda/Makefile | 4 + .../{ => plda}/pcie-microchip-host.c | 605 ++-------------- drivers/pci/controller/plda/pcie-plda-host.c | 656 ++++++++++++++++++ drivers/pci/controller/plda/pcie-plda.h | 239 +++++++ drivers/pci/controller/plda/pcie-starfive.c | 460 ++++++++++++ 14 files changed, 1817 insertions(+), 605 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/plda,xpressrich3-axi-common.yaml create mode 100644 Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml create mode 100644 drivers/pci/controller/plda/Kconfig create mode 100644 drivers/pci/controller/plda/Makefile rename drivers/pci/controller/{ => plda}/pcie-microchip-host.c (54%) create mode 100644 drivers/pci/controller/plda/pcie-plda-host.c create mode 100644 drivers/pci/controller/plda/pcie-plda.h create mode 100644 drivers/pci/controller/plda/pcie-starfive.c base-commit: 2dde18cd1d8fac735875f2e4987f11817cc0bc2c -- 2.17.1