From patchwork Thu Jul 27 10:39:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 12691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1015574vqo; Thu, 27 Jul 2023 04:04:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlG7Gt8l9iVNk/Y4uEaAkY3Uoh2/SJK+57V+s4pSN7SKoaPtApun7brYZde1faZvv0JyNuQp X-Received: by 2002:a17:903:11d1:b0:1b7:c166:f197 with SMTP id q17-20020a17090311d100b001b7c166f197mr4777716plh.29.1690455892685; Thu, 27 Jul 2023 04:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690455892; cv=none; d=google.com; s=arc-20160816; b=iX7X2CFaCAnA1aC+/VbID4aXuKfunSJ++FEhhcBKpFntOmuoGMefy3LFwHcWEszTsA egPvyGRwEjYY8qvk+1u/9Rf+LY7NxyvFTS5oC8KgLS9mELjFAAboA5w1iZjqSER4H91c TRtWGpyI39vwZW/NiDxOEI/mIlP8/7ykgdVW7EzrQxjopYo5n7HXHO7YfwDvXebrXmlL eJ05v0jaKvIyDx7+U9zxvjsA19NSOHwp30MhKYVWxzbqvrqolZh8q6yVFh4IxfIhuy6Q n++PFjboJcrhv7+9N1dzuELpv4HEuaCsbT7Jb/TVqU9LEddPo57nq9KZLChHRtN4esCA pITw== 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=72ijlNl29iT0VR/yBSslXJrHMC6ngQlzo7EbMBIbux8=; fh=mYNwWIT0I+BTQpMor0NWfIt/1vO9zgcMdxlytwlX0A4=; b=Dv+eaf/1ljlLH9vFKHrKwpVlbBQh4UAOJH84ysgCb6Ip+Z9nKG4Hdppx/rHD27CAOq xS0i/0s7wVI4XXI+lSKiXsE9PgU70qXQ9YwIPfv9q9sjmriXANyfUu6wOuq7XnfLpgW8 lc1c5FocehueczfLF7KorrwJYtd2ekix5Y4NC11IK9g20Pe7ru0y4SE2b7IPZJZil+OI eNkgMfuYcXuX6vdP4EbQXfGGlB0GWSsmw31VccEf2Eo7pHHI/v0eofbvG/9vvrQpogeb ACH60Y4L5d82pqqZR49+Zs/edL+FBFbY9ZwCgHalp2GoXVLqZbTUwR8RtenTljN0Bw1L mgtg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r12-20020a170903410c00b001b02bd00c67si1073296pld.324.2023.07.27.04.04.38; Thu, 27 Jul 2023 04:04:52 -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 S233464AbjG0KkQ (ORCPT + 99 others); Thu, 27 Jul 2023 06:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232480AbjG0KkK (ORCPT ); Thu, 27 Jul 2023 06:40:10 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD8726AB; Thu, 27 Jul 2023 03:40:08 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id CFC2680E2; Thu, 27 Jul 2023 18:39:58 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 27 Jul 2023 18:39:58 +0800 Received: from localhost.localdomain (113.72.147.196) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 27 Jul 2023 18:39:57 +0800 From: Minda Chen To: =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Daire McNamara , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , Emil Renner Berthing CC: , , , Philipp Zabel , "Mason Huo" , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v2 0/4] Refactoring Microchip PCIe driver and add StarFive PCIe Date: Thu, 27 Jul 2023 18:39:45 +0800 Message-ID: <20230727103949.26149-1-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [113.72.147.196] 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,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772571477972978428 X-GMAIL-MSGID: 1772571477972978428 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 - 2) Then, add Starfive codes. (patch3 - 4) This patchset is base on v6.5-rc1 patch1 is move PLDA XpressRICH PCIe host common properties dt-binding docs from microchip,pcie-host.yaml patch2 is extracting the PLDA common codes from microchip Polarfire PCIe codes. The change list in the commit message. patch3 is add StarFive JH7110 PCIe dt-binding doc. patch4 is add StarFive JH7110 Soc PCIe codes. I have noticed that Daire have changed microchip's codes. https://patchwork.kernel.org/project/linux-pci/cover/20230630154859.2049521-1-daire.mcnamara@microchip.com/ I have changed patch2 base on their commits. StarFive PCIe driver still can work. But their codes is under reviewed and maybe changing. Do not base on their changes first. I will base on their commit to change patch2 as soon as their commits are accepted. previous version: v1:https://patchwork.kernel.org/project/linux-pci/cover/20230719102057.22329-1-minda.chen@starfivetech.com/ change: v2: patch1: - squash dt-bindings patches to patch1 - add 'required' list. - plda doc rename to plda,xpressrich-axi-common.yaml patch2: - squash the microchip modification patch to patch 2. patch3: - remove the plda common required property. patch4: - 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 (4): dt-bindings: PCI: Add PLDA XpressRICH PCIe host common properties PCI: plda: Get common codes from Microchip PolarFire host dt-bindings: PCI: Add StarFive JH7110 PCIe controller PCI: starfive: Add JH7110 PCIe controller .../bindings/pci/microchip,pcie-host.yaml | 49 +- .../pci/plda,xpressrich3-axi-common.yaml | 69 ++ .../bindings/pci/starfive,jh7110-pcie.yaml | 133 ++++ MAINTAINERS | 19 +- drivers/pci/controller/Kconfig | 9 +- drivers/pci/controller/Makefile | 2 +- drivers/pci/controller/plda/Kconfig | 31 + drivers/pci/controller/plda/Makefile | 4 + .../{ => plda}/pcie-microchip-host.c | 594 ++-------------- drivers/pci/controller/plda/pcie-plda-host.c | 665 ++++++++++++++++++ drivers/pci/controller/plda/pcie-plda.h | 242 +++++++ drivers/pci/controller/plda/pcie-starfive.c | 438 ++++++++++++ 12 files changed, 1645 insertions(+), 610 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 (50%) 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: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5