Skip to contentSkip to conversation

PCI: cadence: Convert drivers to core library

PATCH Applied Tom Joseph 2 participants 4 messages Nov 11, 2019

Subsystems (3)
lore
Share & tools
lore

Tom Joseph

author
#0 lore raw

v4 cover PCI: cadence: Convert drivers to core library

This patch series intend to refactor the cadence pcie host and endpoint driver files as a library, such that this can be used by other platform drivers. A new directory 'cadence' is created to group all the cadence derivatives.

v4:
- Updated commit title for [PATCH 2/2] as adviced by Andrew

v3:
- Commit logs rephrased and corrected as suggested by Andrew and Kishon
- Created a new folder 'cadence', as suggested by Kishon.
- Removed few unwanted codes, as pointed out by review comments

Tom Joseph (2):
PCI: cadence: Refactor driver to use as a core library
PCI: cadence: Move all files to per-device cadence directory

 drivers/pci/controller/Kconfig                     |  29 +---
 drivers/pci/controller/Makefile                    |   4 +-
 drivers/pci/controller/cadence/Kconfig             |  45 ++++++
 drivers/pci/controller/cadence/Makefile            |   5 +
 .../pci/controller/{ => cadence}/pcie-cadence-ep.c |  96 +-----------
 .../controller/{ => cadence}/pcie-cadence-host.c   |  95 +----------
 drivers/pci/controller/cadence/pcie-cadence-plat.c | 174 +++++++++++++++++++++
 .../pci/controller/{ => cadence}/pcie-cadence.c    |   0
 .../pci/controller/{ => cadence}/pcie-cadence.h    |  77 +++++++++
 9 files changed, 315 insertions(+), 210 deletions(-)
 create mode 100644 drivers/pci/controller/cadence/Kconfig
 create mode 100644 drivers/pci/controller/cadence/Makefile
 rename drivers/pci/controller/{ => cadence}/pcie-cadence-ep.c (83%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence-host.c (76%)
 create mode 100644 drivers/pci/controller/cadence/pcie-cadence-plat.c
 rename drivers/pci/controller/{ => cadence}/pcie-cadence.c (100%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence.h (82%)
Signature · 1 line
2.2.2
author
#1 lore raw

PATCH v4 1/2 PCI: cadence: Refactor driver to use as a core library

Cadence PCIe host and endpoint IP may be embedded into a variety of SoCs/platforms. Let's extract the platform related APIs/Structures in the current driver to a separate file (pcie-cadence-plat.c), such that the common functionality can be used by future platforms.

---
Testing done using simulation environment

Changes in v4:None

---
 drivers/pci/controller/Kconfig             |  31 +++--
 drivers/pci/controller/Makefile            |   1 +
 drivers/pci/controller/pcie-cadence-ep.c   |  96 +---------------
 drivers/pci/controller/pcie-cadence-host.c |  95 ++--------------
 drivers/pci/controller/pcie-cadence-plat.c | 174 +++++++++++++++++++++++++++++
 drivers/pci/controller/pcie-cadence.h      |  77 +++++++++++++
 6 files changed, 287 insertions(+), 187 deletions(-)
 create mode 100644 drivers/pci/controller/pcie-cadence-plat.c
drivers/pci/controller/Kconfig +23 -8
index fe9f9f1..57d52f6 100644
@@ -28,23 +28,38 @@ config PCIE_CADENCE
 	bool
 
 config PCIE_CADENCE_HOST
-	bool "Cadence PCIe host controller"
+	bool
 	depends on OF
-	depends on PCI
 	select IRQ_DOMAIN
 	select PCIE_CADENCE
-	help
-	  Say Y here if you want to support the Cadence PCIe controller in host
-	  mode. This PCIe controller may be embedded into many different vendors
-	  SoCs.
 
 config PCIE_CADENCE_EP
-	bool "Cadence PCIe endpoint controller"
+	bool
 	depends on OF
 	depends on PCI_ENDPOINT
 	select PCIE_CADENCE
+
+config PCIE_CADENCE_PLAT
+	bool
+
+config PCIE_CADENCE_PLAT_HOST
+	bool "Cadence PCIe platform host controller"
+	depends on OF
+	select PCIE_CADENCE_HOST
+	select PCIE_CADENCE_PLAT
+	help
+	  Say Y here if you want to support the Cadence PCIe platform controller in
+	  host mode. This PCIe controller may be embedded into many different
+	  vendors SoCs.
+
+config PCIE_CADENCE_PLAT_EP
+	bool "Cadence PCIe platform endpoint controller"
+	depends on OF
+	depends on PCI_ENDPOINT
+	select PCIE_CADENCE_EP
+	select PCIE_CADENCE_PLAT
 	help
-	  Say Y here if you want to support the Cadence PCIe  controller in
+	  Say Y here if you want to support the Cadence PCIe  platform controller in
 	  endpoint mode. This PCIe controller may be embedded into many
 	  different vendors SoCs.
 
drivers/pci/controller/Makefile +1 -0
index d56a507..676a41e 100644
@@ -2,6 +2,7 @@
 obj-$(CONFIG_PCIE_CADENCE) += pcie-cadence.o
 obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host.o
 obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o
+obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o
 obj-$(CONFIG_PCI_FTPCI100) += pci-ftpci100.o
 obj-$(CONFIG_PCI_HYPERV) += pci-hyperv.o
 obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
drivers/pci/controller/pcie-cadence-ep.c +5 -91

125 lines not on this page · raw message

drivers/pci/controller/pcie-cadence-host.c +7 -88

144 lines not on this page · raw message

drivers/pci/controller/pcie-cadence-plat.c new file +174 -0

174 lines not on this page · raw message

drivers/pci/controller/pcie-cadence.h +77 -0

102 lines not on this page · raw message

Signature · 1 line
2.2.2
author
#2 lore raw

PATCH v4 2/2 PCI: cadence: Move all files to per-device cadence directory

In reply to Tom Joseph

Cadence core library files may be used by various platform drivers. Add a new directory "cadence" to group all the Cadence core library files and the platforms using Cadence core library.

---
Changes in v4: Updated commit title as adviced by Andrew Murray

---
 drivers/pci/controller/Kconfig                     | 44 +--------------------
 drivers/pci/controller/Makefile                    |  5 +--
 drivers/pci/controller/cadence/Kconfig             | 45 ++++++++++++++++++++++
 drivers/pci/controller/cadence/Makefile            |  5 +++
 .../pci/controller/{ => cadence}/pcie-cadence-ep.c |  0
 .../controller/{ => cadence}/pcie-cadence-host.c   |  0
 .../controller/{ => cadence}/pcie-cadence-plat.c   |  0
 .../pci/controller/{ => cadence}/pcie-cadence.c    |  0
 .../pci/controller/{ => cadence}/pcie-cadence.h    |  0
 9 files changed, 52 insertions(+), 47 deletions(-)
 create mode 100644 drivers/pci/controller/cadence/Kconfig
 create mode 100644 drivers/pci/controller/cadence/Makefile
 rename drivers/pci/controller/{ => cadence}/pcie-cadence-ep.c (100%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence-host.c (100%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence-plat.c (100%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence.c (100%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence.h (100%)
drivers/pci/controller/Kconfig +1 -43
index 57d52f6..2aab586 100644
@@ -22,49 +22,6 @@ config PCI_AARDVARK
 	 controller is part of the South Bridge of the Marvel Armada
 	 3700 SoC.
 
-menu "Cadence PCIe controllers support"
-
-config PCIE_CADENCE
-	bool
-
-config PCIE_CADENCE_HOST
-	bool
-	depends on OF
-	select IRQ_DOMAIN
-	select PCIE_CADENCE
-
-config PCIE_CADENCE_EP
-	bool
-	depends on OF
-	depends on PCI_ENDPOINT
-	select PCIE_CADENCE
-
-config PCIE_CADENCE_PLAT
-	bool
-
-config PCIE_CADENCE_PLAT_HOST
-	bool "Cadence PCIe platform host controller"
-	depends on OF
-	select PCIE_CADENCE_HOST
-	select PCIE_CADENCE_PLAT
-	help
-	  Say Y here if you want to support the Cadence PCIe platform controller in
-	  host mode. This PCIe controller may be embedded into many different
-	  vendors SoCs.
-
-config PCIE_CADENCE_PLAT_EP
-	bool "Cadence PCIe platform endpoint controller"
-	depends on OF
-	depends on PCI_ENDPOINT
-	select PCIE_CADENCE_EP
-	select PCIE_CADENCE_PLAT
-	help
-	  Say Y here if you want to support the Cadence PCIe  platform controller in
-	  endpoint mode. This PCIe controller may be embedded into many
-	  different vendors SoCs.
-
-endmenu
-
 config PCIE_XILINX_NWL
 	bool "NWL PCIe Core"
 	depends on ARCH_ZYNQMP || COMPILE_TEST
@@ -297,4 +254,5 @@ config VMD
 	  module will be called vmd.
 
 source "drivers/pci/controller/dwc/Kconfig"
+source "drivers/pci/controller/cadence/Kconfig"
 endmenu
drivers/pci/controller/Makefile +1 -4
index 676a41e..8a59829 100644
@@ -1,8 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_PCIE_CADENCE) += pcie-cadence.o
-obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host.o
-obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o
-obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o
+obj-$(CONFIG_PCIE_CADENCE) += cadence/
 obj-$(CONFIG_PCI_FTPCI100) += pci-ftpci100.o
 obj-$(CONFIG_PCI_HYPERV) += pci-hyperv.o
 obj-$(CONFIG_PCI_MVEBU) += pci-mvebu.o
drivers/pci/controller/cadence/Kconfig new file +45 -0

45 lines not on this page · raw message

drivers/pci/controller/cadence/Makefile new file +5 -0
new file mode 100644
index 0000000..232a3f2
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_PCIE_CADENCE) += pcie-cadence.o
+obj-$(CONFIG_PCIE_CADENCE_HOST) += pcie-cadence-host.o
+obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o
+obj-$(CONFIG_PCIE_CADENCE_PLAT) += pcie-cadence-plat.o
drivers/pci/controller/cadence/pcie-cadence-ep.c renamed from drivers/pci/controller/pcie-cadence-ep.c +0 -0
similarity index 100%
rename from drivers/pci/controller/pcie-cadence-ep.c
rename to drivers/pci/controller/cadence/pcie-cadence-ep.c
drivers/pci/controller/cadence/pcie-cadence-host.c renamed from drivers/pci/controller/pcie-cadence-host.c +0 -0
similarity index 100%
rename from drivers/pci/controller/pcie-cadence-host.c
rename to drivers/pci/controller/cadence/pcie-cadence-host.c
drivers/pci/controller/cadence/pcie-cadence-plat.c renamed from drivers/pci/controller/pcie-cadence-plat.c +0 -0
similarity index 100%
rename from drivers/pci/controller/pcie-cadence-plat.c
rename to drivers/pci/controller/cadence/pcie-cadence-plat.c
drivers/pci/controller/cadence/pcie-cadence.c renamed from drivers/pci/controller/pcie-cadence.c +0 -0
similarity index 100%
rename from drivers/pci/controller/pcie-cadence.c
rename to drivers/pci/controller/cadence/pcie-cadence.c
drivers/pci/controller/cadence/pcie-cadence.h renamed from drivers/pci/controller/pcie-cadence.h +0 -0
similarity index 100%
rename from drivers/pci/controller/pcie-cadence.h
rename to drivers/pci/controller/cadence/pcie-cadence.h
Signature · 1 line
2.2.2
#3 lore raw
In reply to Tom Joseph
Quoted 26 lines · Tom Joseph

This patch series intend to refactor the cadence pcie host and endpoint driver files as a library, such that this can be used by other platform drivers. A new directory 'cadence' is created to group all the cadence derivatives.

v4:
- Updated commit title for [PATCH 2/2] as adviced by Andrew

v3:
- Commit logs rephrased and corrected as suggested by Andrew and Kishon
- Created a new folder 'cadence', as suggested by Kishon.
- Removed few unwanted codes, as pointed out by review comments

Tom Joseph (2):
PCI: cadence: Refactor driver to use as a core library
PCI: cadence: Move all files to per-device cadence directory

 drivers/pci/controller/Kconfig                     |  29 +---
 drivers/pci/controller/Makefile                    |   4 +-
 drivers/pci/controller/cadence/Kconfig             |  45 ++++++
 drivers/pci/controller/cadence/Makefile            |   5 +
 .../pci/controller/{ => cadence}/pcie-cadence-ep.c |  96 +-----------
 .../controller/{ => cadence}/pcie-cadence-host.c   |  95 +----------
 drivers/pci/controller/cadence/pcie-cadence-plat.c | 174 +++++++++++++++++++++
 .../pci/controller/{ => cadence}/pcie-cadence.c    |   0
 .../pci/controller/{ => cadence}/pcie-cadence.h    |  77 +++++++++
Quoted 9 lines
 9 files changed, 315 insertions(+), 210 deletions(-)
 create mode 100644 drivers/pci/controller/cadence/Kconfig
 create mode 100644 drivers/pci/controller/cadence/Makefile
 rename drivers/pci/controller/{ => cadence}/pcie-cadence-ep.c (83%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence-host.c (76%)
 create mode 100644 drivers/pci/controller/cadence/pcie-cadence-plat.c
 rename drivers/pci/controller/{ => cadence}/pcie-cadence.c (100%)
 rename drivers/pci/controller/{ => cadence}/pcie-cadence.h (82%)

Applied to pci/cadence, thanks.

Lorenzo