mbox series

[v16,00/22] Refactoring Microchip PCIe driver and add StarFive PCIe

Message ID 20240328091835.14797-1-minda.chen@starfivetech.com (mailing list archive)
Headers show
Series Refactoring Microchip PCIe driver and add StarFive PCIe | expand

Message

Minda Chen March 28, 2024, 9:18 a.m. UTC
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.

----------------------------------------------------------
The refactoring patches total number is 16,(patch 1-16)
which do NOT contain changing logic of codes.

These patches just contain three type basic operations.
(rename, modify codes to support starfive platform, and moving to common file)
If these patched are all be reviewed. They can be accepted first.

Refactoring patches can be devided to different groups
1. (patch 1- 3 is the prepare work of refactoring)
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

2. (patch4 - 6 is processing and re-use PCIe host instance)
patch4 is add bridge_addr field to PCIe host instance.
patch5 is rename data structure in microchip codes.
patch6 is moving two data structures to head file

3. (patch 7 - 9 are for re-use two PCIe setup function)
patch7 is rename two setup functions in microchip codes, prepare to move
to common file.
patch8 is change the arguments of plda_pcie_setup_iomems()
patch9 is move the two setup functions to common file pcie-plda-host.c

4.(patch 10 - 16 are for re-use interupt processing codes)
patch10 is rename the IRQ related functions, prepare to move to
pcie-plda-host.c
patch 11 - 15 is modify the interrupt event codes, preparing for support starfive
and microchip two platforms.
patch16 is move IRQ related functions to pcie-plda-host.c

------------------------------------------------------------
The remainder patches (patch 17 -22) are not refactoring patch.
They are for adding StarFive codes and dont modify the microchip's
codes.

patch17 is Add event bitmap for mask unused/unimpementes interrupts
patch18 is Add host init/deinit functions.
patch19 is add StarFive JH7110 PCIe dt-binding doc.
patch20 is Add a PCIe delay time macro
patch21 is add StarFive JH7110 Soc PCIe driver code.
qurik).
patch22 is Starfive dts config

This patchset is base on v6.9-rc1

previous version:
v10:https://patchwork.kernel.org/project/linux-pci/cover/20231031115430.113586-1-minda.chen@starfivetech.com/
v11:https://patchwork.kernel.org/project/linux-pci/cover/20231115114912.71448-1-minda.chen@starfivetech.com/
v12:https://patchwork.kernel.org/project/linux-pci/cover/20231206105839.25805-1-minda.chen@starfivetech.com/
v13:https://patchwork.kernel.org/project/linux-pci/cover/20231214072839.2367-1-minda.chen@starfivetech.com/
v14:https://patchwork.kernel.org/project/linux-pci/cover/20240129005854.3554-1-minda.chen@starfivetech.com/
v15:https://patchwork.kernel.org/project/linux-pci/cover/20240227103522.80915-1-minda.chen@starfivetech.com/

change:
  v16: 
    modify the patch 3 - 9 commit message. (follow Lorrenzo's review comments)
    Update the MAINTAINER in correct patch.
    Add more comments in Starfive pcie driver to explain the pcie setting.(patch 21)
    Remove v15 patch 22. We will get the delay time errdata or find a correct fix method.

  v15: 
     resend: rebase on v6.8-rc6
     Add new patch 22.(A workaround to JH7110 PCIe quirk).

  v14:
   resend: correct some commit messages. base on v6.8-rc1
   Add a new patch 17. Add interrupt eventmap to mask non-implemented or unused interrupt.
   patch3: rename the PLDA interrupts macro name.
   patch9: remove the redundant head file.
   patch10,11: modify the commit message suggested by Lorrenzo.
   patch12: modify the commit message.
   patch14, 15: PLDA codes will handle DMA interrupts. Modify the commit message. 
   patch18 remove plda default events. This is implemented by vendor.
   patch21 Add plda_event instance stf_pcie_event.

  v13:
   patch14: 1. Add plda_get_event() function. This can be compare with mc_get_event() easily and 
		track the codes changes in case in the future..
            2. The host event_ops is directly set to plda host port.
	    3. Setting default host event_ops instead of checking event ops.
   patch15:1. Add PLDA event irq_chip instead of event_domain_ops, The
		event_domain_ops can be re-used.
            2. The host event irq_chip is directly set to plda host port.
	    3. Add PLDA event irqchip ops codes.
            4. Remove Conor's review tag due to whole patch have been changed.
   patch16: Also move the new added PLDA event codes.
   patch18: Add plda host init and deinit function only.

  v12:
   patch18: modify the commit message and add starfive review tag.
   Add PCIE_RESET_CONFIG_DEVICE_WAIT_MS to patch 19.
   patch21: Add disable runtime pm function in starfive_pcie_remove()
            Add "depens on ARCH_STARFIVE || COMPILE_TEST" in Starfive PCie Kconfig

  v11:
     check and modify some commit messages again.
     All the codes are the same with v10.   

  v10:
   All the commit message set to fit in 75 columns.
   All the codes fit in less than 80 colunms.
   patch 14: 
	Commit message changes suggested by Conor.
   patch 21:
        Add 100 ms delay macro to pci.h
	generic phy pointer related codes moving to pcie-starfive.c
	This patch Change pcie-starfive only, bus_ops move to patch 16.
	Some Codes changes suggested by Bjorn.


Kevin Xie (1):
  PCI: Add PCIE_RESET_CONFIG_DEVICE_WAIT_MS waiting time value

Minda Chen (21):
  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: Add bridge_addr field to struct mc_pcie
  PCI: microchip: Rename two PCIe data structures
  PCI: microchip: Move PCIe host data structures to plda-pcie.h
  PCI: microchip: Rename two setup functions
  PCI: microchip: Change the argument of plda_pcie_setup_iomems()
  PCI: microchip: Move setup functions to pcie-plda-host.c
  PCI: microchip: Rename interrupt related functions
  PCI: microchip: Add num_events field to struct plda_pcie_rp
  PCI: microchip: Add request_event_irq() callback function
  PCI: microchip: Add INTx and MSI event num to struct plda_event
  PCI: microchip: Add get_events() callback and add PLDA get_event()
  PCI: microchip: Add event irqchip field to host port and add PLDA
    irqchip
  PCI: microchip: Move IRQ functions to pcie-plda-host.c
  PCI: plda: Add event bitmap field to struct plda_pcie_rp
  PCI: plda: Add host init/deinit and map bus functions
  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                                   |  19 +-
 .../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          | 615 ++---------------
 drivers/pci/controller/plda/pcie-plda-host.c  | 651 ++++++++++++++++++
 drivers/pci/controller/plda/pcie-plda.h       | 273 ++++++++
 drivers/pci/controller/plda/pcie-starfive.c   | 488 +++++++++++++
 drivers/pci/pci.h                             |  16 +
 15 files changed, 1891 insertions(+), 616 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: 4cece764965020c22cff7665b18a012006359095

Comments

Minda Chen April 30, 2024, 12:53 a.m. UTC | #1
> 
> 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.
> 
> ----------------------------------------------------------
> The refactoring patches total number is 16,(patch 1-16) which do NOT contain
> changing logic of codes.
> 
> These patches just contain three type basic operations.
> (rename, modify codes to support starfive platform, and moving to common file)
> If these patched are all be reviewed. They can be accepted first.
> 
Hi Lorenzo Krzysztof ,Bjorn and other PCIe maintainer
   Do you have any comment to patch 1-16? Hope patch 1-16(refactoring patches) ready
to merged first.
Krzysztof WilczyƄski May 17, 2024, 11:16 a.m. UTC | #2
Hello,

> 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.

Applied to controller/microchip, thank you!

[01/21] dt-bindings: PCI: Add PLDA XpressRICH PCIe host common properties
        https://git.kernel.org/pci/pci/c/0ce827c82eea
[02/21] dt-bindings: PCI: Add StarFive JH7110 PCIe controller
        https://git.kernel.org/pci/pci/c/91b4524c9135
[03/21] PCI: Add PCIE_RESET_CONFIG_DEVICE_WAIT_MS waiting time value
        https://git.kernel.org/pci/pci/c/4b83a1379e8c
[04/21] PCI: microchip: Move pcie-microchip-host.c to PLDA directory
        https://git.kernel.org/pci/pci/c/ced442bf0124
[05/21] PCI: microchip: Move PLDA IP register macros to pcie-plda.h
        https://git.kernel.org/pci/pci/c/571f57cc281c
[06/21] PCI: microchip: Add bridge_addr field to struct mc_pcie
        https://git.kernel.org/pci/pci/c/73c9dcd35dd8
[07/21] PCI: microchip: Rename two PCIe data structures
        https://git.kernel.org/pci/pci/c/e92d66e0aa1e
[08/08] PCI: microchip: Move PCIe host data structures to plda-pcie.h
        https://git.kernel.org/pci/pci/c/79c0d7d53a51
[09/21] PCI: microchip: Rename two setup functions
        https://git.kernel.org/pci/pci/c/082bda75f7b0
[10/21] PCI: microchip: Change the argument of plda_pcie_setup_iomems()
        https://git.kernel.org/pci/pci/c/9251a0b72188
[11/21] PCI: microchip: Move setup functions to pcie-plda-host.c
        https://git.kernel.org/pci/pci/c/047cc7da3a25
[12/21] PCI: microchip: Rename interrupt related functions
        https://git.kernel.org/pci/pci/c/ddac0618211f
[13/21] PCI: microchip: Add num_events field to struct plda_pcie_rp
        https://git.kernel.org/pci/pci/c/cb90f7f6145b
[14/21] PCI: microchip: Add request_event_irq() callback function
        https://git.kernel.org/pci/pci/c/0ffbe1c70551
[15/21] PCI: microchip: Add INTx and MSI event num to struct plda_event
        https://git.kernel.org/pci/pci/c/9932c5d45e5a
[16/21] PCI: microchip: Add get_events() callback and add PLDA get_event()
        https://git.kernel.org/pci/pci/c/170407afbcc4
[17/21] PCI: microchip: Add event irqchip field to host port and add PLDA irqchip
        https://git.kernel.org/pci/pci/c/5e33af45dbcb
[18/21] PCI: microchip: Move IRQ functions to pcie-plda-host.c
        https://git.kernel.org/pci/pci/c/4e47aaf7afed
[19/21] PCI: plda: Add event bitmap field to struct plda_pcie_rp
        https://git.kernel.org/pci/pci/c/008d2bc41e3c
[20/21] PCI: plda: Add host init/deinit and map bus functions
        https://git.kernel.org/pci/pci/c/d86b148a401c
[21/21] PCI: starfive: Add JH7110 PCIe controller
        https://git.kernel.org/pci/pci/c/e6e7b974e425

	Krzysztof
Alexey Lukyanchuk June 22, 2024, 9:14 a.m. UTC | #3
Hello Minda Chen.

I applied your PCIE series patches to v6.10-rc3 and v6.9.0, works like
a charm - thank you!

So Tested-by: Alexey Lukyanchuk to all series.

Hovewere i had to fix some minor issues, you can view the results here:

https://github.com/skif-web/linux-starfive-vs2-mainline/tree/strafive-visionfive2-pcie-2

Hope it helps.

Hopefully to see this series being eventually applied soon.
Alexey Lukyanchuk June 22, 2024, 10:11 a.m. UTC | #4
SOZ, I forgot to add email to tag, sorry
Tested-by: Alexey Lukyanchuk <skifwebdevelop@gmail.com>

On Sat, 22 Jun 2024 12:14:03 +0300
Alexey Lukyanchuk <skifwebdevelop@gmail.com> wrote:

> Hello Minda Chen.
> 
> I applied your PCIE series patches to v6.10-rc3 and v6.9.0, works like
> a charm - thank you!
> 
> So Tested-by: Alexey Lukyanchuk to all series.
> 
> Hovewere i had to fix some minor issues, you can view the results
> here:
> 
> https://github.com/skif-web/linux-starfive-vs2-mainline/tree/strafive-visionfive2-pcie-2
> 
> Hope it helps.
> 
> Hopefully to see this series being eventually applied soon.