Skip to contentSkip to conversation

pci: enable designware pci and phy on spacemit k1 SoC

PATCH Applied Eric Chung 3 participants 9 messages Sep 13 – Sep 29

Subsystems (3)
lore
Share & tools
lore

Eric Chung

author
#0 lore raw

v2 cover pci: enable designware pci and phy on spacemit k1 SoC

---
Changes in v2:
- dts: Rebase on upstream DTS. So drop the changes in overlay DTS.
- pci: Find the phy by index instead.
- maintainer: Add the driver in the Spacemit MAINTAINER entry.
- Link to v1: https://patch.msgid.link/[email protected]

To: [email protected]
To: [email protected]
Cc: Tom Rini <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: David Lechner <[email protected]>
Cc: Julien Stephan <[email protected]>
Cc: Johan Jonker <[email protected]>
Cc: Siu Ming Tong <[email protected]>
Cc: "Lucien.Jheng" <[email protected]>
Cc: Eric Chung <[email protected]>
Cc: Huan Zhou <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Pranav Sanwal <[email protected]>
Cc: Raymond Mao <[email protected]>
Cc: Yixun Lan <[email protected]>

---
Eric Chung (4):
phy: spacemit: add K1 PCIe/USB3 combo PHY driver
pci: spacemit: add DesignWare PCIe host controller driver
configs: k1: enable PCIe and NVMe support
MAINTAINER: add K1 PCIe driver to Spacemit entry

 board/spacemit/k1/MAINTAINERS      |   1 +
 configs/spacemit_k1_defconfig      |  10 +
 drivers/pci/Kconfig                |   7 +
 drivers/pci/Makefile               |   1 +
 drivers/pci/pcie_dw_spacemit.c     | 391 +++++++++++++++++++++++++++++
 drivers/pci/pcie_dw_spacemit.h     |  78 ++++++
 drivers/phy/Kconfig                |   1 +
 drivers/phy/Makefile               |   1 +
 drivers/phy/spacemit/Kconfig       |  11 +
 drivers/phy/spacemit/Makefile      |   1 +
 drivers/phy/spacemit/phy-k1-pcie.c | 492 +++++++++++++++++++++++++++++++++++++
 11 files changed, 994 insertions(+)

---
base-commit: b739fb09a011558396287e077108d2e5379069c1
change-id: 20260705-pci-38358b570d03

Best regards,

Signature · 1 line
Eric Chung <[email protected]>
author
#1 lore raw

PATCH v2 1/4 phy: spacemit: add K1 PCIe/USB3 combo PHY driver

Add PHY driver for Spacemit K1 SoC supporting:
- Combo PHY (PCIe/USB3) with auto-calibration of RX/TX termination
- PCIe-only PHY (2 lanes) using combo PHY calibration values

The combo PHY calibrates at probe time, and the result is shared globally so PCIe-only PHYs can apply the same termination settings.

---
 drivers/phy/Kconfig                |   1 +
 drivers/phy/Makefile               |   1 +
 drivers/phy/spacemit/Kconfig       |  11 +
 drivers/phy/spacemit/Makefile      |   1 +
 drivers/phy/spacemit/phy-k1-pcie.c | 492 +++++++++++++++++++++++++++++++++++++
 5 files changed, 506 insertions(+)
drivers/phy/Kconfig +1 -0
index 6262380a60a0..6c5816e67a78 100644
@@ -369,6 +369,7 @@ source "drivers/phy/ti/Kconfig"
 source "drivers/phy/qcom/Kconfig"
 source "drivers/phy/renesas/Kconfig"
 source "drivers/phy/starfive/Kconfig"
+source "drivers/phy/spacemit/Kconfig"
 
 config PHY_COMMON_PROPS
 	bool "Common PHY properties support"
drivers/phy/Makefile +1 -0
index 19cf95759e57..3256e8bad8d6 100644
@@ -51,3 +51,4 @@ obj-y += ti/
 obj-y += qcom/
 obj-y += renesas/
 obj-y += starfive/
+obj-y += spacemit/
drivers/phy/spacemit/Kconfig new file +11 -0
new file mode 100644
index 000000000000..3c47601c1fd4
@@ -0,0 +1,11 @@
+config PHY_SPACEMIT_K1_PCIE
+	bool "Spacemit K1 PCIe PHY driver"
+	depends on PHY
+	help
+	  Support for the Spacemit K1 SoC PCIe and Combo (PCIe/USB3) PHYs.
+
+	  This driver handles both the combo PHY used for port A (which
+	  calibrates RX/TX termination values) and the PCIe-only PHYs for
+	  ports B and C.  The combo PHY must be enabled even if port A
+	  is not used for PCIe, because it provides calibration values
+	  required by the other ports.
drivers/phy/spacemit/Makefile new file +1 -0
new file mode 100644
index 000000000000..3496c099cdf3
@@ -0,0 +1 @@
+obj-$(CONFIG_PHY_SPACEMIT_K1_PCIE) += phy-k1-pcie.o
drivers/phy/spacemit/phy-k1-pcie.c new file +492 -0

492 lines not on this page · raw message

Signature · 1 line
2.51.0
author
#2 lore raw

PATCH v2 2/4 pci: spacemit: add DesignWare PCIe host controller driver

In reply to Eric Chung

Add PCIe host controller driver for Spacemit K1 SoC using the Synopsys DesignWare PCIe core. Supports up to 3 ports.

---
v2:
- Locate the phy by index instead.

---
 drivers/pci/Kconfig            |   7 +
 drivers/pci/Makefile           |   1 +
 drivers/pci/pcie_dw_spacemit.c | 391 +++++++++++++++++++++++++++++++++++++++++
 drivers/pci/pcie_dw_spacemit.h |  78 ++++++++
 4 files changed, 477 insertions(+)
drivers/pci/Kconfig +7 -0
index 42edc73bcdaa..86fafc5a3c73 100644
@@ -498,4 +498,11 @@ config PCIE_DW_IMX
 	  Say Y here if you want to enable DW PCIe controller support on
 	  iMX SoCs.
 
+config PCIE_DW_SPACEMIT
+	bool "Enable Spacemit K1 PCIe"
+	select PCIE_DW_COMMON
+	help
+	  Say Y here if you want to enable PCIe controller support on
+	  K1 SoC.
+
 endif
drivers/pci/Makefile +1 -0
index 3873f357a45f..f839ea1d396f 100644
@@ -60,3 +60,4 @@ obj-$(CONFIG_PCIE_PLDA_COMMON) += pcie_plda_common.o
 obj-$(CONFIG_PCIE_STARFIVE_JH7110) += pcie_starfive_jh7110.o
 obj-$(CONFIG_PCIE_DW_AMD) += pcie_dw_amd.o
 obj-$(CONFIG_PCIE_DW_IMX) += pcie_dw_imx.o
+obj-$(CONFIG_PCIE_DW_SPACEMIT) += pcie_dw_spacemit.o
drivers/pci/pcie_dw_spacemit.c new file +391 -0

391 lines not on this page · raw message

drivers/pci/pcie_dw_spacemit.h new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.51.0
maintainer
#3 lore raw

Re: [PATCH v2 2/4] pci: spacemit: add DesignWare PCIe host controller driver

Hi Neil,

Quoted 9 lines · Eric Chung

Add PCIe host controller driver for Spacemit K1 SoC using the Synopsys DesignWare PCIe core. Supports up to 3 ports.

---
v2:
- Locate the phy by index instead.

Quoted 7 lines
---
 drivers/pci/Kconfig            |   7 +
 drivers/pci/Makefile           |   1 +
 drivers/pci/pcie_dw_spacemit.c | 391 +++++++++++++++++++++++++++++++++++++++++
 drivers/pci/pcie_dw_spacemit.h |  78 ++++++++
 4 files changed, 477 insertions(+)

Would you like to merge this patch via pci tree? otherwise, I could take all of this series via spacemit custodian tree, let me know which way you'd prefer?

Thanks

Signature · 1 line
Yixun Lan (dlan)
#4 lore raw

Re: [PATCH v2 2/4] pci: spacemit: add DesignWare PCIe host controller driver

Hi,

Quoted 20 lines · Yixun Lan

Hi Neil,

Quoted 9 lines · Eric Chung

Add PCIe host controller driver for Spacemit K1 SoC using the Synopsys DesignWare PCIe core. Supports up to 3 ports.

---
v2:
- Locate the phy by index instead.

Quoted 7 lines
---
  drivers/pci/Kconfig            |   7 +
  drivers/pci/Makefile           |   1 +
  drivers/pci/pcie_dw_spacemit.c | 391 +++++++++++++++++++++++++++++++++++++++++
  drivers/pci/pcie_dw_spacemit.h |  78 ++++++++
  4 files changed, 477 insertions(+)
Quoted 2 lines

Would you like to merge this patch via pci tree? otherwise, I could take all of this series via spacemit custodian tree, let me know which way you'd prefer?

Feel free to pick it via your tree!

Thanks,
Neil

Quoted 3 lines

Thanks

author
#5 lore raw

PATCH v2 3/4 configs: k1: enable PCIe and NVMe support

In reply to Eric Chung

Enable PCIe and NVMe support on K1 based boards.

---
 configs/spacemit_k1_defconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)
configs/spacemit_k1_defconfig +10 -0
index 5f9923c7f470..9c15d96eae20 100644
@@ -105,6 +105,16 @@ CONFIG_CMD_MMC=y
 CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_MEMINFO_MAP=y
 CONFIG_EFI_PARTITION=y
+CONFIG_PCI=y
+CONFIG_CMD_PCI=y
+CONFIG_NVME=y
+CONFIG_NVME_PCI=y
+CONFIG_CMD_NVME=y
+CONFIG_PCIE_DW_SPACEMIT=y
+CONFIG_PHY=y
+CONFIG_PHY_SPACEMIT_K1_PCIE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_EXT4=y
 CONFIG_SPL_SPI=y
 CONFIG_SPL_DM_SPI=y
 CONFIG_SPL_DM_SPI_FLASH=y
Signature · 1 line
2.51.0
author
#6 lore raw

PATCH v2 4/4 MAINTAINER: add K1 PCIe driver to Spacemit entry

In reply to Eric Chung

Add drivers/pci/pcie_dw_spacemit.c to the list of files maintained for the Spacemit K1 board.

---
 board/spacemit/k1/MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
board/spacemit/k1/MAINTAINERS +1 -0
index e12288a206e0..c1d6b8f3a1c0 100644
@@ -10,6 +10,7 @@ F:	doc/board/spacemit/
 F:	drivers/gpio/spacemit_gpio.c
 F:	drivers/i2c/k1_i2c.c
 F:	drivers/mmc/spacemit_sdhci.c
+F:	drivers/pci/pcie_dw_spacemit.c
 F:	drivers/pinctrl/spacemit/
 F:	drivers/power/pmic/pmic_spacemit_p1.c
 F:	drivers/power/regulator/spacemit_p1_regulator.c
Signature · 1 line
2.51.0
maintainer Reviewed-by Tested-by on the v2 series
#7 lore raw
In reply to Eric Chung
Quoted 43 lines · Eric Chung

---
Changes in v2:
- dts: Rebase on upstream DTS. So drop the changes in overlay DTS.
- pci: Find the phy by index instead.
- maintainer: Add the driver in the Spacemit MAINTAINER entry.
- Link to v1: https://patch.msgid.link/[email protected]

To: [email protected]
To: [email protected]
Cc: Tom Rini <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: David Lechner <[email protected]>
Cc: Julien Stephan <[email protected]>
Cc: Johan Jonker <[email protected]>
Cc: Siu Ming Tong <[email protected]>
Cc: "Lucien.Jheng" <[email protected]>
Cc: Eric Chung <[email protected]>
Cc: Huan Zhou <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Pranav Sanwal <[email protected]>
Cc: Raymond Mao <[email protected]>
Cc: Yixun Lan <[email protected]>

---
Eric Chung (4):
phy: spacemit: add K1 PCIe/USB3 combo PHY driver
pci: spacemit: add DesignWare PCIe host controller driver
configs: k1: enable PCIe and NVMe support
MAINTAINER: add K1 PCIe driver to Spacemit entry

 board/spacemit/k1/MAINTAINERS      |   1 +
 configs/spacemit_k1_defconfig      |  10 +
 drivers/pci/Kconfig                |   7 +
 drivers/pci/Makefile               |   1 +
 drivers/pci/pcie_dw_spacemit.c     | 391 +++++++++++++++++++++++++++++
 drivers/pci/pcie_dw_spacemit.h     |  78 ++++++
 drivers/phy/Kconfig                |   1 +
 drivers/phy/Makefile               |   1 +
 drivers/phy/spacemit/Kconfig       |  11 +
 drivers/phy/spacemit/Makefile      |   1 +
 drivers/phy/spacemit/phy-k1-pcie.c | 492 +++++++++++++++++++++++++++++++++++++
 11 files changed, 994 insertions(+)
Quoted 1 line

---

For the series, tested on Bananapi-f3 board

Signature · 1 line
Yixun Lan (dlan)
maintainer Applied
#8 lore raw
In reply to Eric Chung