Skip to contentSkip to conversation

drivers: pci: refactor pcie_sifive to use pcie_dw_common

RFC PATCH New Green Wan 1 participant 4 messages Mar 30, 2021

Subsystems (3)
lore
Share & tools
lore

Green Wan

author
#0 lore raw

cover drivers: pci: refactor pcie_sifive to use pcie_dw_common

pcie_dw_common.c is recently posted for designware-based PCIe drivers.

https://lists.denx.de/pipermail/u-boot/2021-March/445536.html

Use this patch set to refactor SiFive PCIe driver to use common code in pcie_dw_common.c.

Several changes are listed:

- Move common iomem base address into 'struct pcie_dw'
- remove unnecessary/unused functions after code merge
- rename perstn-gpios to reset-gpios
- rename pcie_sifive.c to pcie_dw_sifive.c

Green Wan (3):
arch: riscv: dts: change perstn-gpios to reset-gpios of FU740
drivers: pci: refactor SiFive pcie to use designware common code
drivers: pci: rename pcie_sifive to pcie_dw_pcie

 arch/riscv/dts/fu740-c000.dtsi     |   2 +-
 configs/sifive_unmatched_defconfig |   1 +
 drivers/pci/Kconfig                |   1 +
 drivers/pci/Makefile               |   2 +-
 drivers/pci/pcie_dw_sifive.c       | 508 ++++++++++++++++++
 drivers/pci/pcie_sifive.c          | 797 -----------------------------
 drivers/pci/pcie_sifive.h          | 374 --------------
 7 files changed, 512 insertions(+), 1173 deletions(-)
 create mode 100644 drivers/pci/pcie_dw_sifive.c
 delete mode 100644 drivers/pci/pcie_sifive.c
 delete mode 100644 drivers/pci/pcie_sifive.h
Signature · 1 line
2.31.0
author
#1 lore raw

RFC PATCH 1/3 arch: riscv: dts: change perstn-gpios to reset-gpios of FU740

To use more common gpio name for PCIE reset in DT, change the 'perstn-gpios' to 'reset-gpios'. The name is also aligned with designware based uboot driver and Linux driver.

---
 arch/riscv/dts/fu740-c000.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/dts/fu740-c000.dtsi +1 -1
index 0325e51e39..9e876a4fe3 100644
@@ -317,7 +317,7 @@
 					<0x0 0x0 0x0 0x3 &plic0 59>,
 					<0x0 0x0 0x0 0x4 &plic0 60>;
 			pwren-gpios = <&gpio 5 0>;
-			perstn-gpios = <&gpio 8 0>;
+			reset-gpios = <&gpio 8 0>;
 			clocks = <&prci PRCI_CLK_PCIEAUX>;
 			clock-names = "pcieaux";
 			resets = <&prci PRCI_RST_PCIE_POWER_UP_N>;
Signature · 1 line
2.31.0
author
#2 lore raw

RFC PATCH 2/3 drivers: pci: refactor SiFive pcie to use designware common code

In reply to Green Wan

Refactor pcie_sifive.c to use pcie_dw_common.c.

- Add DW_COMMON to defconfig and Kconfig
- Move common iomem base address into 'struct pcie_dw'
- Remove unnecessary/unused functions after code merge
- Rename 'perstn-gpios' to 'reset-gpios'
- Remove drivers/pci/pcie_sifive.h

---
 configs/sifive_unmatched_defconfig |   1 +
 drivers/pci/Kconfig                |   1 +
 drivers/pci/pcie_sifive.c          | 735 +++++++++--------------------
 drivers/pci/pcie_sifive.h          | 374 ---------------
 4 files changed, 225 insertions(+), 886 deletions(-)
 delete mode 100644 drivers/pci/pcie_sifive.h
configs/sifive_unmatched_defconfig +1 -0
index c5ca0be0bf..7769e366dc 100644
@@ -51,3 +51,4 @@ CONFIG_CLK_SIFIVE_PRCI=y
 CONFIG_DM_PWM=y
 CONFIG_PWM_SIFIVE=y
 CONFIG_CMD_PWM=y
+CONFIG_PCIE_DW_COMMON=y
drivers/pci/Kconfig +1 -0
index 842240ba42..fd24cef45f 100644
@@ -102,6 +102,7 @@ config PCIE_SIFIVE_FU740
 	depends on CLK_SIFIVE_PRCI
 	depends on RESET_SIFIVE
 	depends on SIFIVE_GPIO
+	select PCIE_DW_COMMON
 	help
 	  Say Y here if you want to enable PCIe controller support on
 	  FU740.
drivers/pci/pcie_sifive.c +223 -512

931 lines not on this page · raw message

drivers/pci/pcie_sifive.h deleted +0 -374

374 lines not on this page · raw message

Signature · 1 line
2.31.0
author
#3 lore raw

RFC PATCH 3/3 drivers: pci: rename pcie_sifive to pcie_dw_pcie

In reply to Green Wan

Rename pcie_sifive.c driver to pcie_dw_pcie.c.

---
 drivers/pci/Makefile                            | 2 +-
 drivers/pci/{pcie_sifive.c => pcie_dw_sifive.c} | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/pci/{pcie_sifive.c => pcie_dw_sifive.c} (100%)
drivers/pci/Makefile +1 -1
index 0fde9d7bb8..a657c5f45e 100644
@@ -52,4 +52,4 @@ obj-$(CONFIG_PCIE_ROCKCHIP) += pcie_rockchip.o
 obj-$(CONFIG_PCIE_DW_ROCKCHIP) += pcie_dw_rockchip.o
 obj-$(CONFIG_PCI_BRCMSTB) += pcie_brcmstb.o
 obj-$(CONFIG_PCI_OCTEONTX) += pci_octeontx.o
-obj-$(CONFIG_PCIE_SIFIVE_FU740) += pcie_sifive.o
+obj-$(CONFIG_PCIE_SIFIVE_FU740) += pcie_dw_sifive.o
drivers/pci/pcie_dw_sifive.c renamed from drivers/pci/pcie_sifive.c +0 -0
similarity index 100%
rename from drivers/pci/pcie_sifive.c
rename to drivers/pci/pcie_dw_sifive.c
Signature · 1 line
2.31.0