Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support
@ 2026-11-30  5:24 Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 1/9] dt-bindings: phy: allwinner,sun60i-a733-combophy: Add binding Alastair D'Silva
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Add Devicetree bindings, drivers, SoC nodes, and board enablement for
the Allwinner A733 (sun60i) Cadence Combo PHY 1 and DesignWare PCIe
Root Complex controller.

Tested on Orange Pi 4 Pro with a Micron NVMe SSD (1344:5410) on cold
boot and warm boot (after U-Boot pci enum):
- PCIe Gen3 x1 (8.0 GT/s) link up
- 9 MSI-X queues and Root Port PME/AER on legacy INTx
- Uncached direct read (476 MB/s) and write with SHA-256 verification
- Root filesystem booted from /dev/nvme0n1p1

Radxa Cubie A7A, A7S, and A7Z board nodes match their published
schematics and compile cleanly; they are not yet hardware-tested.

Patches 5-9 depend on:
- "[PATCH v6 0/5] arm64: dts: allwinner: add A733 and Radxa Cubie A7 support"
  https://lore.kernel.org/r/20261126-a733-cubie-a7s-dt-v6-0@gmail.com
- "[PATCH v2 0/2] arm64: dts: allwinner: Add Xunlong OrangePi 4 Pro support"
  https://lore.kernel.org/r/20261127065343.1449675-1-alastair@d-silva.org
- "[PATCH v2] arm64: dts: allwinner: sun60i-a733: Add PCK-600 power domain controller"
  https://lore.kernel.org/r/20261130005242.3366676-1-alastair@d-silva.org

Changes since v1:
- Rebase onto linux-next (next-20261127) and update renamed DesignWare
  PCIe DBI register macros.
- Drop unused phy.h include from allwinner,sun60i-a733-combophy.yaml.
- Depend on standalone PCK-600 power domain controller patch.
- Enable PCIe on Orange Pi 4 Pro, Radxa Cubie A7A, A7S, and A7Z.
- Drop deprecated Assisted-by tags.
- Add base-commit and prerequisite-patch-id metadata.

Alastair D'Silva (9):
  dt-bindings: phy: allwinner,sun60i-a733-combophy: Add binding
  phy: allwinner: Add Allwinner A733 Cadence Combo PHY driver
  dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding
  PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver
  arm64: dts: allwinner: sun60i-a733: Add PCIe and Combo PHY nodes
  arm64: dts: allwinner: orangepi-4-pro: Enable PCIe
  arm64: dts: allwinner: cubie-a7a: Enable PCIe
  arm64: dts: allwinner: cubie-a7s: Enable PCIe
  arm64: dts: allwinner: cubie-a7z: Enable PCIe

 .../devicetree/bindings/mfd/syscon.yaml       |   1 +
 .../pci/allwinner,sun60i-a733-pcie.yaml       | 187 +++++++
 .../phy/allwinner,sun60i-a733-combophy.yaml   |  84 +++
 MAINTAINERS                                   |  16 +
 .../dts/allwinner/sun60i-a733-cubie-a7a.dts   |  21 +
 .../dts/allwinner/sun60i-a733-cubie-a7s.dts   |  21 +
 .../dts/allwinner/sun60i-a733-cubie-a7z.dts   |  21 +
 .../allwinner/sun60i-a733-orangepi-4-pro.dts  |  26 +
 .../arm64/boot/dts/allwinner/sun60i-a733.dtsi |  76 +++
 drivers/pci/controller/dwc/Kconfig            |  15 +
 drivers/pci/controller/dwc/Makefile           |   1 +
 drivers/pci/controller/dwc/pcie-sunxi.c       | 505 ++++++++++++++++++
 drivers/phy/allwinner/Kconfig                 |  13 +
 drivers/phy/allwinner/Makefile                |   1 +
 drivers/phy/allwinner/phy-sun60i-combophy.c   | 372 +++++++++++++
 15 files changed, 1360 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/allwinner,sun60i-a733-pcie.yaml
 create mode 100644 Documentation/devicetree/bindings/phy/allwinner,sun60i-a733-combophy.yaml
 create mode 100644 drivers/pci/controller/dwc/pcie-sunxi.c
 create mode 100644 drivers/phy/allwinner/phy-sun60i-combophy.c


base-commit: e5aad2bdbbee783611d32599f89cea3f12f9593d
prerequisite-patch-id: 19691099774bd3dc41f56585c03ddefb7bdc6f9c
prerequisite-patch-id: cdfb39a40db2a16f92458a1b49ad6192e8aa69d6
prerequisite-patch-id: a3e883da50bf03e8f522444def66fec7f996ffbe
prerequisite-patch-id: c6889699a6dc13c336ce4cf4659e21b551e9a9fc
prerequisite-patch-id: b5871e4b44b9b1eb7304601cf984a646bbdbbb86
prerequisite-patch-id: c598480f753e36b7f6230129b864c559b9f185d5
prerequisite-patch-id: f86b468a896a40f132adfcba885700327dff1bc5
prerequisite-patch-id: a733e6bbf6de77dd9f260e65912894fd4d97aa78
prerequisite-patch-id: 090c5ff78d4e2150804aa8d294581cd338b1e971
prerequisite-patch-id: af0aebcae7c38d58354925119c412178b5821b5e
prerequisite-patch-id: beb8a098ba14724e316ff243bdf8e00e729243c1
prerequisite-patch-id: 63342c5ec38e8eb9e55c8c74d3c5a81a630d5f69
prerequisite-patch-id: 1dc8d70f80674c98b2b15d09556dd27f643b20da
prerequisite-patch-id: 4555860586ef50f27bf787a23f6ba693e9c3b0d6
prerequisite-patch-id: 0279f281cd59cf54bceee39b0fa4d0b6a7b87c48
prerequisite-patch-id: 14424bd8324b6cae2b8c4d6840df0db626d1385f
prerequisite-patch-id: 7b42728bc8271e5dfd57fffec47a7f5745eff357
prerequisite-patch-id: 74f5c7d066477024a374a789b3180e841398fb07
prerequisite-patch-id: 309a5a3ca5b216915907263dea7024263abf1d1c
prerequisite-patch-id: b27be6461a0725baf9c6accc3815859e4e485f17
prerequisite-patch-id: b302709123a938272f5ddc8f88e269c0ef3e7cf3
-- 
2.53.0



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/9] dt-bindings: phy: allwinner,sun60i-a733-combophy: Add binding
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 2/9] phy: allwinner: Add Allwinner A733 Cadence Combo PHY driver Alastair D'Silva
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Add Devicetree binding for the Allwinner A733 (sun60i) Cadence Combo PHY
and register the SerDes subsystem syscon compatible in syscon.yaml.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../devicetree/bindings/mfd/syscon.yaml       |  1 +
 .../phy/allwinner,sun60i-a733-combophy.yaml   | 84 +++++++++++++++++++
 2 files changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/allwinner,sun60i-a733-combophy.yaml

diff --git a/Documentation/devicetree/bindings/mfd/syscon.yaml b/Documentation/devicetree/bindings/mfd/syscon.yaml
index 23141dd450bc..172bbba857a2 100644
--- a/Documentation/devicetree/bindings/mfd/syscon.yaml
+++ b/Documentation/devicetree/bindings/mfd/syscon.yaml
@@ -31,6 +31,7 @@ properties:
               - allwinner,sun8i-h3-system-controller
               - allwinner,sun8i-v3s-system-controller
               - allwinner,sun50i-a64-system-controller
+              - allwinner,sun60i-a733-serdes-syscon
               - altr,l3regs
               - altr,sdr-ctl
               - ambarella,cv75-sec-scratchpad
diff --git a/Documentation/devicetree/bindings/phy/allwinner,sun60i-a733-combophy.yaml b/Documentation/devicetree/bindings/phy/allwinner,sun60i-a733-combophy.yaml
new file mode 100644
index 000000000000..5e6727acb832
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/allwinner,sun60i-a733-combophy.yaml
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/allwinner,sun60i-a733-combophy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A733 (sun60i) Cadence Combo PHY
+
+maintainers:
+  - Alastair D'Silva <alastair@d-silva.org>
+  - Chen-Yu Tsai <wens@kernel.org>
+  - Jernej Skrabec <jernej.skrabec@gmail.com>
+
+description: |
+  The Allwinner A733 (sun60i) SoC integrates a Cadence Combo PHY within its
+  SerDes subsystem, supporting PCIe Gen3 (up to 8.0 GT/s).
+
+properties:
+  compatible:
+    const: allwinner,sun60i-a733-combophy1
+
+  reg:
+    maxItems: 1
+    description: Cadence Combo PHY PMA/PCS analog registers
+
+  allwinner,serdes-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the Allwinner A733 SerDes subsystem syscon
+
+  clocks:
+    items:
+      - description: SerDes PHY clock (100 MHz)
+      - description: SerDes AHB bus clock
+      - description: SerDes MBUS clock
+      - description: Reference oscillator / DCXO clock
+
+  clock-names:
+    items:
+      - const: serdes
+      - const: ahb
+      - const: mbus
+      - const: ref
+
+  resets:
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+  phy-supply:
+    description: 1.8V SerDes PHY power supply
+
+  "#phy-cells":
+    const: 1
+    description: PHY type (e.g. PHY_TYPE_PCIE from dt-bindings/phy/phy.h)
+
+required:
+  - compatible
+  - reg
+  - allwinner,serdes-syscon
+  - clocks
+  - clock-names
+  - resets
+  - power-domains
+  - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sun6i-rtc.h>
+    #include <dt-bindings/power/allwinner,sun60i-a733-pck-600.h>
+
+    phy@6ca0000 {
+        compatible = "allwinner,sun60i-a733-combophy1";
+        reg = <0x06ca0000 0x20000>;
+        clocks = <&ccu 226>, <&ccu 68>, <&ccu 81>, <&rtc CLK_HOSC_SERDES1>;
+        clock-names = "serdes", "ahb", "mbus", "ref";
+        resets = <&ccu 92>;
+        power-domains = <&pck600 PD_PCIE>;
+        phy-supply = <&reg_serdes1v8>;
+        allwinner,serdes-syscon = <&serdes>;
+        #phy-cells = <1>;
+    };
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/9] phy: allwinner: Add Allwinner A733 Cadence Combo PHY driver
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 1/9] dt-bindings: phy: allwinner,sun60i-a733-combophy: Add binding Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 3/9] dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding Alastair D'Silva
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Add a generic PHY driver for the Allwinner A733 (sun60i) Cadence Combo
PHY in PCIe Gen3 mode.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 MAINTAINERS                                 |   8 +
 drivers/phy/allwinner/Kconfig               |  13 +
 drivers/phy/allwinner/Makefile              |   1 +
 drivers/phy/allwinner/phy-sun60i-combophy.c | 372 ++++++++++++++++++++
 4 files changed, 394 insertions(+)
 create mode 100644 drivers/phy/allwinner/phy-sun60i-combophy.c

diff --git a/MAINTAINERS b/MAINTAINERS
index f2670f0547b2..30736248fd3f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -955,6 +955,14 @@ T:	git git://linuxtv.org/media.git
 F:	Documentation/devicetree/bindings/media/allwinner,sun6i-a31-mipi-csi2.yaml
 F:	drivers/media/platform/sunxi/sun6i-mipi-csi2/
 
+ALLWINNER A733 COMBO PHY DRIVER
+M:	Alastair D'Silva <alastair@d-silva.org>
+L:	linux-phy@lists.infradead.org
+L:	linux-sunxi@lists.linux.dev
+S:	Maintained
+F:	Documentation/devicetree/bindings/phy/allwinner,sun60i-a733-combophy.yaml
+F:	drivers/phy/allwinner/phy-sun60i-combophy.c
+
 ALLWINNER CPUFREQ DRIVER
 M:	Yangtao Li <tiny.windzz@gmail.com>
 L:	linux-pm@vger.kernel.org
diff --git a/drivers/phy/allwinner/Kconfig b/drivers/phy/allwinner/Kconfig
index fb584518b2d0..911d40d1e558 100644
--- a/drivers/phy/allwinner/Kconfig
+++ b/drivers/phy/allwinner/Kconfig
@@ -57,3 +57,16 @@ config PHY_SUN50I_USB3
 	  part of Allwinner H6 SoC.
 
 	  This driver controls each individual USB 2+3 host PHY combo.
+
+config PHY_SUN60I_COMBOPHY
+	tristate "Allwinner A733 (sun60i) Cadence Combo PHY driver"
+	depends on ARCH_SUNXI || COMPILE_TEST
+	depends on HAS_IOMEM && OF
+	depends on RESET_CONTROLLER
+	select GENERIC_PHY
+	select MFD_SYSCON
+	help
+	  Enable this to support the Cadence Combo PHY in the SerDes
+	  subsystem of Allwinner A733 (sun60i) SoCs. The driver
+	  configures clocks, resets, and analog tuning parameters
+	  for PCIe Gen3 operation.
diff --git a/drivers/phy/allwinner/Makefile b/drivers/phy/allwinner/Makefile
index bd74901a1255..483e9053bb5f 100644
--- a/drivers/phy/allwinner/Makefile
+++ b/drivers/phy/allwinner/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_PHY_SUN4I_USB)		+= phy-sun4i-usb.o
 obj-$(CONFIG_PHY_SUN6I_MIPI_DPHY)	+= phy-sun6i-mipi-dphy.o
 obj-$(CONFIG_PHY_SUN9I_USB)		+= phy-sun9i-usb.o
 obj-$(CONFIG_PHY_SUN50I_USB3)		+= phy-sun50i-usb3.o
+obj-$(CONFIG_PHY_SUN60I_COMBOPHY)	+= phy-sun60i-combophy.o
diff --git a/drivers/phy/allwinner/phy-sun60i-combophy.c b/drivers/phy/allwinner/phy-sun60i-combophy.c
new file mode 100644
index 000000000000..44fdb3d43849
--- /dev/null
+++ b/drivers/phy/allwinner/phy-sun60i-combophy.c
@@ -0,0 +1,372 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Allwinner A733 (sun60i) Cadence Combo PHY driver
+ *
+ * Copyright (c) 2026 Alastair D'Silva <alastair@d-silva.org>
+ */
+
+#include <linux/array_size.h>
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/phy/phy.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include <dt-bindings/phy/phy.h>
+
+/* SerDes subsystem syscon register offsets */
+#define SERDES_PCIE_BGR_REG		0x0004
+#define SERDES_PCIE_BGR_DEASSERT	(BIT(18) | BIT(17) | BIT(16) | \
+					 BIT(1) | BIT(0))
+#define SERDES_CTRL0_REG		0x0010
+#define SERDES_CTRL0_PCIE_EN		BIT(0)
+#define SERDES_PCIE_APP_SUB_CTRL_REG	0x0020
+#define SERDES_PCIE_APP_CLK_EN		BIT(0)
+#define SERDES_CTRL1_REG		0x00f0
+#define SERDES_CTRL1_PCIE_MODE		(BIT(29) | BIT(10))
+#define SERDES_AXI2TO1_TH_REG		0x0300
+#define SERDES_AXI2TO1_TH_DEFAULT	0x00ff00ff
+#define SERDES_COMB1_PIPE_REG		0x6c44
+#define SERDES_COMB1_PIPE_PCIE_SEL	BIT(0)
+
+/* Combo PHY 1 top register offsets (within SerDes syscon) */
+#define COMBOPHY_TOP_OFFSET		0x2000
+#define COMBOPHY_LINK_RST_REG		(COMBOPHY_TOP_OFFSET + 0x0000)
+#define COMBOPHY_LINK_RST_N		BIT(0)
+#define COMBOPHY_CLK_CTRL_REG		(COMBOPHY_TOP_OFFSET + 0x0004)
+#define COMBOPHY_CLK_REF_EN		(BIT(28) | BIT(24) | BIT(20) | BIT(0))
+#define COMBOPHY_LANE0_RST_REG		(COMBOPHY_TOP_OFFSET + 0x0100)
+#define COMBOPHY_LANE0_PCIE_RST_N	BIT(0)
+#define COMBOPHY_PLL_STATUS_REG		(COMBOPHY_TOP_OFFSET + 0x0900)
+#define COMBOPHY_PLL_LOCK_BIT		BIT(0)
+
+/* Combo PHY 1 PMA/PCS analog register offsets (relative to phy_base) */
+#define COMBOPHY_ANALOG_TX_CTRL0	0x0098
+#define COMBOPHY_ANALOG_TX_CTRL1	0x00a0
+#define COMBOPHY_ANALOG_TX_CTRL2	0x00a8
+#define COMBOPHY_ANALOG_TX_CTRL3	0x00d8
+#define COMBOPHY_ANALOG_TX_IDLE_MODE	0x0002
+#define COMBOPHY_ANALOG_TX_POST_PLL	0x0270
+#define COMBOPHY_ANALOG_TX_EN_BIT	BIT(4)
+#define COMBOPHY_ANALOG_EXT_OFFSET	0x18000
+#define COMBOPHY_ANALOG_EXT_EN		BIT(0)
+
+#define COMBOPHY_SERDES_CLK_RATE	100000000UL
+#define COMBOPHY_PLL_LOCK_TIMEOUT_US	50000
+
+enum sun60i_combophy_clk_id {
+	CLK_ID_SERDES,
+	CLK_ID_AHB,
+	CLK_ID_MBUS,
+	CLK_ID_REF,
+	NUM_COMBOPHY_CLKS,
+};
+
+struct sun60i_combophy {
+	struct device *dev;
+	struct regmap *serdes;
+	void __iomem *phy_base;
+	struct clk_bulk_data clks[NUM_COMBOPHY_CLKS];
+	struct reset_control *rst;
+	struct phy *phy;
+};
+
+struct phy_reg_val {
+	u32 off;
+	u16 val;
+};
+
+/*
+ * Allwinner A733 (sun60i) Cadence Combo PHY PCIe Gen3 (8.0 GT/s)
+ * calibration sequence derived from the Allwinner BSP. The A733 User
+ * Manual does not document the internal Cadence PMA registers.
+ * Grouped by Cadence PMA functional block.
+ */
+static const struct phy_reg_val cphy_analog_regs[] = {
+	/* CMN bias, reference oscillator, and charge pump */
+	{ 0x00044, 0x001a },
+	{ 0x00054, 0x0034 }, { 0x00058, 0x00da },
+	{ 0x00064, 0x0034 }, { 0x00068, 0x00da },
+	{ 0x000c8, 0x0082 }, { 0x000ca, 0x0082 },
+	{ 0x000e8, 0x001a },
+
+	/* CMN PLL0/PLL1 dividers, VCO calibration, and loop filter */
+	{ 0x00208, 0x0020 }, { 0x0020a, 0x0007 },
+	{ 0x00218, 0x0020 }, { 0x0021a, 0x0007 },
+	{ 0x00228, 0x030c }, { 0x0022a, 0x0007 },
+	{ 0x00248, 0x0007 }, { 0x0024a, 0x0003 },
+	{ 0x0024c, 0x000f }, { 0x00250, 0x0132 },
+
+	/* PMA lane PCS/clock-tree and TX/RX isolation */
+	{ 0x08180, 0x0208 }, { 0x08184, 0x009c },
+	{ 0x10088, 0x001a }, { 0x1008a, 0x0082 },
+	{ 0x10098, 0x001a }, { 0x1009a, 0x0082 },
+	{ 0x08246, 0x0a28 },
+	{ 0x00128, 0x0004 }, { 0x00148, 0x0004 }, { 0x001a8, 0x0004 },
+	{ 0x00348, 0x0509 }, { 0x00368, 0x0509 }, { 0x00388, 0x0509 },
+	{ 0x0034a, 0x0f00 }, { 0x0036a, 0x0f00 }, { 0x0038a, 0x0f00 },
+	{ 0x0034c, 0x0f08 }, { 0x0036c, 0x0f08 }, { 0x0038c, 0x0f08 },
+
+	/* PMA Gen1/Gen2/Gen3 CDR, SSM, and PI tuning */
+	{ 0x00120, 0x0180 }, { 0x00140, 0x0133 }, { 0x001a0, 0x0133 },
+	{ 0x00122, 0x9d8a }, { 0x00142, 0xb13b }, { 0x001a2, 0xb13b },
+	{ 0x00124, 0x0002 }, { 0x00144, 0x0002 }, { 0x001a4, 0x0002 },
+	{ 0x00126, 0x0102 }, { 0x00146, 0x00ce }, { 0x001a6, 0x00ce },
+	{ 0x00340, 0x0022 }, { 0x00360, 0x0022 }, { 0x00380, 0x0022 },
+	{ 0x00130, 0x0001 }, { 0x00150, 0x0001 }, { 0x001b0, 0x0001 },
+	{ 0x00132, 0x045f }, { 0x00152, 0x02f0 }, { 0x001b2, 0x0399 },
+	{ 0x00134, 0x006b }, { 0x00154, 0x0068 }, { 0x001b4, 0x0068 },
+	{ 0x00136, 0x0004 }, { 0x00156, 0x0004 }, { 0x001b6, 0x0004 },
+	{ 0x00108, 0x0104 }, { 0x00188, 0x0104 },
+	{ 0x0010a, 0x0005 }, { 0x0018a, 0x0005 },
+	{ 0x0010c, 0x0337 }, { 0x0018c, 0x0337 },
+	{ 0x00110, 0x3dbe }, { 0x00190, 0x3dbe },
+	{ 0x00104, 0x0003 }, { 0x00184, 0x0003 },
+	{ 0x00138, 0x0014 }, { 0x001b8, 0x0014 },
+	{ 0x0013c, 0x0192 }, { 0x001bc, 0x0192 },
+	{ 0x0013e, 0x0006 }, { 0x001be, 0x0006 },
+
+	/* TX/RX datapath and PMA mode */
+	{ 0x103c0, 0x0000 },
+	{ 0x102e2, 0x0019 }, { 0x102e4, 0x0019 },
+	{ 0x103fe, 0x0001 },
+};
+
+static int sun60i_combophy_init(struct phy *phy)
+{
+	struct sun60i_combophy *combophy = phy_get_drvdata(phy);
+	int ret;
+
+	ret = pm_runtime_resume_and_get(combophy->dev);
+	if (ret < 0)
+		return ret;
+
+	ret = clk_set_rate(combophy->clks[CLK_ID_SERDES].clk,
+			   COMBOPHY_SERDES_CLK_RATE);
+	if (ret)
+		goto err_pm;
+
+	ret = clk_bulk_prepare_enable(NUM_COMBOPHY_CLKS, combophy->clks);
+	if (ret)
+		goto err_pm;
+
+	ret = reset_control_deassert(combophy->rst);
+	if (ret)
+		goto err_clks;
+
+	/* Route SerDes subsystem and PIPE interface to PCIe */
+	regmap_update_bits(combophy->serdes, SERDES_PCIE_BGR_REG,
+			   SERDES_PCIE_BGR_DEASSERT, SERDES_PCIE_BGR_DEASSERT);
+	regmap_update_bits(combophy->serdes, SERDES_CTRL0_REG,
+			   SERDES_CTRL0_PCIE_EN, SERDES_CTRL0_PCIE_EN);
+	regmap_update_bits(combophy->serdes, SERDES_PCIE_APP_SUB_CTRL_REG,
+			   SERDES_PCIE_APP_CLK_EN, SERDES_PCIE_APP_CLK_EN);
+	regmap_update_bits(combophy->serdes, SERDES_CTRL1_REG,
+			   SERDES_CTRL1_PCIE_MODE, SERDES_CTRL1_PCIE_MODE);
+	regmap_write(combophy->serdes, SERDES_COMB1_PIPE_REG,
+		     SERDES_COMB1_PIPE_PCIE_SEL);
+	regmap_write(combophy->serdes, SERDES_AXI2TO1_TH_REG,
+		     SERDES_AXI2TO1_TH_DEFAULT);
+
+	return 0;
+
+err_clks:
+	clk_bulk_disable_unprepare(NUM_COMBOPHY_CLKS, combophy->clks);
+err_pm:
+	pm_runtime_put_sync(combophy->dev);
+
+	return ret;
+}
+
+static int sun60i_combophy_exit(struct phy *phy)
+{
+	struct sun60i_combophy *combophy = phy_get_drvdata(phy);
+
+	regmap_clear_bits(combophy->serdes, SERDES_COMB1_PIPE_REG,
+			  SERDES_COMB1_PIPE_PCIE_SEL);
+	regmap_clear_bits(combophy->serdes, SERDES_CTRL1_REG,
+			  SERDES_CTRL1_PCIE_MODE);
+	regmap_clear_bits(combophy->serdes, SERDES_PCIE_APP_SUB_CTRL_REG,
+			  SERDES_PCIE_APP_CLK_EN);
+	regmap_clear_bits(combophy->serdes, SERDES_CTRL0_REG,
+			  SERDES_CTRL0_PCIE_EN);
+	regmap_clear_bits(combophy->serdes, SERDES_PCIE_BGR_REG,
+			  SERDES_PCIE_BGR_DEASSERT);
+	reset_control_assert(combophy->rst);
+	clk_bulk_disable_unprepare(NUM_COMBOPHY_CLKS, combophy->clks);
+	pm_runtime_put_sync(combophy->dev);
+
+	return 0;
+}
+
+static int sun60i_combophy_power_on(struct phy *phy)
+{
+	struct sun60i_combophy *combophy = phy_get_drvdata(phy);
+	u32 val;
+	int i, ret;
+
+	/* Hold link and lane 0 in reset while programming analog registers */
+	regmap_write(combophy->serdes, COMBOPHY_LANE0_RST_REG, 0);
+	regmap_write(combophy->serdes, COMBOPHY_LINK_RST_REG, 0);
+
+	regmap_write(combophy->serdes, COMBOPHY_CLK_CTRL_REG,
+		     COMBOPHY_CLK_REF_EN);
+
+	for (i = 0; i < ARRAY_SIZE(cphy_analog_regs); i++)
+		writew(cphy_analog_regs[i].val,
+		       combophy->phy_base + cphy_analog_regs[i].off);
+
+	writel((readl(combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL0) & ~0x3) |
+	       COMBOPHY_ANALOG_TX_IDLE_MODE,
+	       combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL0);
+	writel((readl(combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL2) & ~0x3) |
+	       COMBOPHY_ANALOG_TX_IDLE_MODE,
+	       combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL2);
+	writel((readl(combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL3) & ~0x3) |
+	       COMBOPHY_ANALOG_TX_IDLE_MODE,
+	       combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL3);
+
+	/* Deassert link and lane 0 reset in PCIe mode */
+	regmap_write(combophy->serdes, COMBOPHY_LINK_RST_REG,
+		     COMBOPHY_LINK_RST_N);
+	regmap_write(combophy->serdes, COMBOPHY_LANE0_RST_REG,
+		     COMBOPHY_LANE0_PCIE_RST_N);
+
+	ret = regmap_read_poll_timeout(combophy->serdes,
+				       COMBOPHY_PLL_STATUS_REG, val,
+				       val & COMBOPHY_PLL_LOCK_BIT, 100,
+				       COMBOPHY_PLL_LOCK_TIMEOUT_US);
+	if (ret) {
+		dev_err(combophy->dev,
+			"Combo PHY PLL lock timeout (status=0x%08x)\n", val);
+		regmap_write(combophy->serdes, COMBOPHY_LANE0_RST_REG, 0);
+		regmap_write(combophy->serdes, COMBOPHY_LINK_RST_REG, 0);
+		regmap_write(combophy->serdes, COMBOPHY_CLK_CTRL_REG, 0);
+		return ret;
+	}
+
+	/* Enable TX after PLL lock */
+	writew(COMBOPHY_ANALOG_TX_POST_PLL,
+	       combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL1);
+	writew(readw(combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL0) |
+	       COMBOPHY_ANALOG_TX_EN_BIT,
+	       combophy->phy_base + COMBOPHY_ANALOG_TX_CTRL0);
+	writew(COMBOPHY_ANALOG_EXT_EN,
+	       combophy->phy_base + COMBOPHY_ANALOG_EXT_OFFSET);
+	regmap_write(combophy->serdes, COMBOPHY_CLK_CTRL_REG,
+		     COMBOPHY_CLK_REF_EN);
+
+	return 0;
+}
+
+static int sun60i_combophy_power_off(struct phy *phy)
+{
+	struct sun60i_combophy *combophy = phy_get_drvdata(phy);
+
+	regmap_write(combophy->serdes, COMBOPHY_LANE0_RST_REG, 0);
+	regmap_write(combophy->serdes, COMBOPHY_LINK_RST_REG, 0);
+	regmap_write(combophy->serdes, COMBOPHY_CLK_CTRL_REG, 0);
+
+	return 0;
+}
+
+static const struct phy_ops sun60i_combophy_ops = {
+	.init		= sun60i_combophy_init,
+	.exit		= sun60i_combophy_exit,
+	.power_on	= sun60i_combophy_power_on,
+	.power_off	= sun60i_combophy_power_off,
+	.owner		= THIS_MODULE,
+};
+
+static struct phy *sun60i_combophy_xlate(struct device *dev,
+					 const struct of_phandle_args *args)
+{
+	struct sun60i_combophy *combophy = dev_get_drvdata(dev);
+
+	if (args->args_count != 1)
+		return ERR_PTR(-EINVAL);
+
+	if (args->args[0] != PHY_TYPE_PCIE) {
+		dev_err(dev, "Unsupported PHY type %u\n", args->args[0]);
+		return ERR_PTR(-EINVAL);
+	}
+
+	return combophy->phy;
+}
+
+static int sun60i_combophy_probe(struct platform_device *pdev)
+{
+	struct sun60i_combophy *combophy;
+	struct device *dev = &pdev->dev;
+	struct phy_provider *provider;
+	int ret;
+
+	combophy = devm_kzalloc(dev, sizeof(*combophy), GFP_KERNEL);
+	if (!combophy)
+		return -ENOMEM;
+
+	combophy->dev = dev;
+	dev_set_drvdata(dev, combophy);
+
+	combophy->serdes = syscon_regmap_lookup_by_phandle(dev->of_node,
+							   "allwinner,serdes-syscon");
+	if (IS_ERR(combophy->serdes))
+		return dev_err_probe(dev, PTR_ERR(combophy->serdes),
+				     "failed to get serdes syscon\n");
+
+	combophy->phy_base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(combophy->phy_base))
+		return PTR_ERR(combophy->phy_base);
+
+	combophy->clks[CLK_ID_SERDES].id = "serdes";
+	combophy->clks[CLK_ID_AHB].id = "ahb";
+	combophy->clks[CLK_ID_MBUS].id = "mbus";
+	combophy->clks[CLK_ID_REF].id = "ref";
+
+	ret = devm_clk_bulk_get(dev, NUM_COMBOPHY_CLKS, combophy->clks);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get clocks\n");
+
+	combophy->rst = devm_reset_control_get_shared(dev, NULL);
+	if (IS_ERR(combophy->rst))
+		return dev_err_probe(dev, PTR_ERR(combophy->rst),
+				     "failed to get reset control\n");
+
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return ret;
+
+	combophy->phy = devm_phy_create(dev, NULL, &sun60i_combophy_ops);
+	if (IS_ERR(combophy->phy))
+		return dev_err_probe(dev, PTR_ERR(combophy->phy),
+				     "failed to create phy\n");
+
+	phy_set_drvdata(combophy->phy, combophy);
+
+	provider = devm_of_phy_provider_register(dev, sun60i_combophy_xlate);
+	return PTR_ERR_OR_ZERO(provider);
+}
+
+static const struct of_device_id sun60i_combophy_of_match[] = {
+	{ .compatible = "allwinner,sun60i-a733-combophy1" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sun60i_combophy_of_match);
+
+static struct platform_driver sun60i_combophy_driver = {
+	.probe	= sun60i_combophy_probe,
+	.driver	= {
+		.name		= "sun60i-combophy",
+		.of_match_table	= sun60i_combophy_of_match,
+	},
+};
+module_platform_driver(sun60i_combophy_driver);
+
+MODULE_DESCRIPTION("Allwinner A733 (sun60i) Cadence Combo PHY driver");
+MODULE_LICENSE("GPL");
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/9] dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 1/9] dt-bindings: phy: allwinner,sun60i-a733-combophy: Add binding Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 2/9] phy: allwinner: Add Allwinner A733 Cadence Combo PHY driver Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30 20:18   ` Bjorn Helgaas
  2026-11-30  5:24 ` [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver Alastair D'Silva
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Add Devicetree binding for the Allwinner A733 (sun60i) DesignWare PCIe
Root Complex controller.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../pci/allwinner,sun60i-a733-pcie.yaml       | 187 ++++++++++++++++++
 1 file changed, 187 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/allwinner,sun60i-a733-pcie.yaml

diff --git a/Documentation/devicetree/bindings/pci/allwinner,sun60i-a733-pcie.yaml b/Documentation/devicetree/bindings/pci/allwinner,sun60i-a733-pcie.yaml
new file mode 100644
index 000000000000..71ff657d15c5
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/allwinner,sun60i-a733-pcie.yaml
@@ -0,0 +1,187 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/allwinner,sun60i-a733-pcie.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner A733 (sun60i) DesignWare PCIe Root Complex controller
+
+maintainers:
+  - Alastair D'Silva <alastair@d-silva.org>
+  - Chen-Yu Tsai <wens@kernel.org>
+  - Jernej Skrabec <jernej.skrabec@gmail.com>
+
+description: |
+  The Allwinner A733 (sun60i) PCIe Root Complex controller is based on the
+  Synopsys DesignWare PCIe IP and inherits all common properties defined in
+  snps,dw-pcie.yaml.
+
+allOf:
+  - $ref: /schemas/pci/snps,dw-pcie.yaml#
+
+properties:
+  compatible:
+    const: allwinner,sun60i-a733-pcie
+
+  reg:
+    items:
+      - description: Data Bus Interface (DBI) registers
+      - description: iATU registers
+      - description: Allwinner application registers
+      - description: PCIe configuration space
+
+  reg-names:
+    items:
+      - const: dbi
+      - const: atu
+      - const: app
+      - const: config
+
+  clocks:
+    items:
+      - description: PCIe auxiliary clock
+      - description: PCIe AXI slave clock
+      - description: PCIe ITS/master AXI bridge clock
+
+  clock-names:
+    items:
+      - const: aux
+      - const: slv
+      - const: mstr
+
+  resets:
+    items:
+      - description: PCIe controller reset
+      - description: PCIe power-up reset
+      - description: PCIe ITS/master AXI bridge reset
+
+  reset-names:
+    items:
+      - const: core
+      - const: pwr
+      - const: mstr
+
+  interrupts:
+    minItems: 1
+    items:
+      - description: Application / SII legacy interrupt
+      - description: MSI interrupt (when msi-map is not used)
+
+  interrupt-names:
+    minItems: 1
+    items:
+      - const: app
+      - const: msi
+
+  allwinner,serdes-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: Phandle to the Allwinner A733 SerDes subsystem syscon
+
+  phys:
+    maxItems: 1
+
+  phy-names:
+    const: pcie0
+
+  power-domains:
+    maxItems: 1
+
+  vpcie3v3-supply:
+    description: 3.3V PCIe slot or M.2 power supply
+
+  ranges:
+    minItems: 2
+    maxItems: 3
+
+  dma-ranges:
+    maxItems: 1
+
+  legacy-interrupt-controller:
+    description: Interrupt controller node for handling legacy PCI INTx interrupts.
+    type: object
+    additionalProperties: false
+    properties:
+      "#address-cells":
+        const: 0
+
+      "#interrupt-cells":
+        const: 1
+
+      interrupt-controller: true
+
+    required:
+      - "#address-cells"
+      - "#interrupt-cells"
+      - interrupt-controller
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - interrupts
+  - interrupt-names
+  - phys
+  - phy-names
+  - power-domains
+  - ranges
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/phy/phy.h>
+    #include <dt-bindings/power/allwinner,sun60i-a733-pck-600.h>
+
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        pcie@6000000 {
+            compatible = "allwinner,sun60i-a733-pcie";
+            reg = <0x0 0x06000000 0x0 0x00010000>,
+                  <0x0 0x06300000 0x0 0x00100000>,
+                  <0x0 0x06400000 0x0 0x00080000>,
+                  <0x0 0x20000000 0x0 0x01000000>;
+            reg-names = "dbi", "atu", "app", "config";
+            #address-cells = <3>;
+            #size-cells = <2>;
+            bus-range = <0x00 0xff>;
+            device_type = "pci";
+            ranges = <0x81000000 0x0 0x21000000 0x0 0x21000000 0x0 0x00010000>,
+                     <0x82000000 0x0 0x22000000 0x0 0x22000000 0x0 0x06000000>;
+            dma-ranges = <0x03000000 0x0 0x40000000 0x0 0x40000000 0x3 0xc0000000>;
+            clocks = <&ccu 224>, <&ccu 225>, <&ccu 49>;
+            clock-names = "aux", "slv", "mstr";
+            resets = <&ccu 91>, <&ccu 90>, <&ccu 0>;
+            reset-names = "core", "pwr", "mstr";
+            interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH 0>,
+                         <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH 0>;
+            interrupt-names = "app", "msi";
+            #interrupt-cells = <1>;
+            interrupt-map-mask = <0 0 0 7>;
+            interrupt-map = <0 0 0 1 &pcie_intc 0>,
+                            <0 0 0 2 &pcie_intc 1>,
+                            <0 0 0 3 &pcie_intc 2>,
+                            <0 0 0 4 &pcie_intc 3>;
+            max-link-speed = <3>;
+            num-lanes = <1>;
+            phys = <&combophy1 PHY_TYPE_PCIE>;
+            phy-names = "pcie0";
+            power-domains = <&pck600 PD_PCIE>;
+            allwinner,serdes-syscon = <&serdes>;
+            reset-gpios = <&pio 3 22 GPIO_ACTIVE_LOW>;
+            vpcie3v3-supply = <&reg_vcc_3v3>;
+
+            pcie_intc: legacy-interrupt-controller {
+                interrupt-controller;
+                #address-cells = <0>;
+                #interrupt-cells = <1>;
+            };
+        };
+    };
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
                   ` (2 preceding siblings ...)
  2026-11-30  5:24 ` [PATCH v2 3/9] dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30 20:12   ` Bjorn Helgaas
  2026-11-30  5:24 ` [PATCH v2 5/9] arm64: dts: allwinner: sun60i-a733: Add PCIe and Combo PHY nodes Alastair D'Silva
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Add a DesignWare PCIe Root Complex glue driver for Allwinner A733
(sun60i) SoCs using dw_pcie_host_init().

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 MAINTAINERS                             |   8 +
 drivers/pci/controller/dwc/Kconfig      |  15 +
 drivers/pci/controller/dwc/Makefile     |   1 +
 drivers/pci/controller/dwc/pcie-sunxi.c | 505 ++++++++++++++++++++++++
 4 files changed, 529 insertions(+)
 create mode 100644 drivers/pci/controller/dwc/pcie-sunxi.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 30736248fd3f..8df90948dfb2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -963,6 +963,14 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/phy/allwinner,sun60i-a733-combophy.yaml
 F:	drivers/phy/allwinner/phy-sun60i-combophy.c
 
+ALLWINNER A733 PCIE DRIVER
+M:	Alastair D'Silva <alastair@d-silva.org>
+L:	linux-pci@vger.kernel.org
+L:	linux-sunxi@lists.linux.dev
+S:	Maintained
+F:	Documentation/devicetree/bindings/pci/allwinner,sun60i-a733-pcie.yaml
+F:	drivers/pci/controller/dwc/pcie-sunxi.c
+
 ALLWINNER CPUFREQ DRIVER
 M:	Yangtao Li <tiny.windzz@gmail.com>
 L:	linux-pm@vger.kernel.org
diff --git a/drivers/pci/controller/dwc/Kconfig b/drivers/pci/controller/dwc/Kconfig
index 0a0d56fcf0ac..2c6246793e23 100644
--- a/drivers/pci/controller/dwc/Kconfig
+++ b/drivers/pci/controller/dwc/Kconfig
@@ -487,6 +487,21 @@ config PCIE_STM32_EP
 	  This driver can also be built as a module. If so, the module
 	  will be called pcie-stm32-ep.
 
+config PCIE_SUNXI
+	tristate "Allwinner A733 (sun60i) PCIe host controller"
+	depends on ARCH_SUNXI || COMPILE_TEST
+	depends on HAS_IOMEM && OF
+	depends on RESET_CONTROLLER
+	depends on PCI_MSI
+	select GENERIC_PHY
+	select MFD_SYSCON
+	select PCIE_DW_HOST
+	help
+	  Enable support for the Synopsys DesignWare PCIe Root Complex
+	  controller found on Allwinner A733 (sun60i) SoCs. It uses
+	  the generic DesignWare host core and handles Allwinner
+	  clocks, resets, PHY, and legacy INTx interrupts.
+
 config PCI_DRA7XX
 	tristate
 
diff --git a/drivers/pci/controller/dwc/Makefile b/drivers/pci/controller/dwc/Makefile
index d4f88cfc6229..a534eed5a324 100644
--- a/drivers/pci/controller/dwc/Makefile
+++ b/drivers/pci/controller/dwc/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_PCIE_RCAR_GEN4) += pcie-rcar-gen4.o
 obj-$(CONFIG_PCIE_SPACEMIT_K1) += pcie-spacemit-k1.o
 obj-$(CONFIG_PCIE_STM32_HOST) += pcie-stm32.o
 obj-$(CONFIG_PCIE_STM32_EP) += pcie-stm32-ep.o
+obj-$(CONFIG_PCIE_SUNXI) += pcie-sunxi.o
 obj-$(CONFIG_PCIE_ULTRARISC) += pcie-ultrarisc.o
 
 # The following drivers are for devices that use the generic ACPI
diff --git a/drivers/pci/controller/dwc/pcie-sunxi.c b/drivers/pci/controller/dwc/pcie-sunxi.c
new file mode 100644
index 000000000000..6b4befa2d124
--- /dev/null
+++ b/drivers/pci/controller/dwc/pcie-sunxi.c
@@ -0,0 +1,505 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Allwinner A733 (sun60i) DesignWare PCIe host controller driver
+ *
+ * Copyright (c) 2026 Alastair D'Silva <alastair@d-silva.org>
+ */
+
+#include <linux/bitops.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/pci.h>
+#include <linux/phy/phy.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
+#include <linux/reset.h>
+#include <linux/spinlock.h>
+
+#include "../../pci.h"
+#include "pcie-designware.h"
+
+/* SerDes subsystem syscon register for PCIe ITS target address */
+#define SERDES_PCIE_ITS_TAGT_ADDR_REG	0x0220
+/* Upper 16 bits of GICv3 ITS GITS_TRANSLATER at 0x03450000 */
+#define SERDES_PCIE_ITS_TAGT_DEFAULT	0x00000345
+
+/* Allwinner PCIe application register offsets (relative to app_base) */
+#define PCIE_APP_CLK_CTRL		0x0800
+#define PCIE_APP_CLK_AUX_EN		BIT(4)
+#define PCIE_APP_CLK_MSTR_AXI_EN	BIT(5)
+#define PCIE_APP_CLK_SLV_AXI_EN		BIT(6)
+#define PCIE_APP_CLK_DBI_EN		BIT(7)
+#define PCIE_APP_CLK_CORE_EN		BIT(8)
+#define PCIE_APP_CLK_PIPE_EN		BIT(9)
+#define PCIE_APP_CLK_REF_EN		BIT(13)
+#define PCIE_APP_CLK_BUS_EN		BIT(21)
+#define PCIE_APP_CLK_SYS_EN		BIT(23)
+#define PCIE_APP_CLK_CTRL_DEFAULT	(PCIE_APP_CLK_SYS_EN | \
+					 PCIE_APP_CLK_BUS_EN | \
+					 PCIE_APP_CLK_REF_EN | \
+					 PCIE_APP_CLK_PIPE_EN | \
+					 PCIE_APP_CLK_CORE_EN | \
+					 PCIE_APP_CLK_DBI_EN | \
+					 PCIE_APP_CLK_SLV_AXI_EN | \
+					 PCIE_APP_CLK_MSTR_AXI_EN | \
+					 PCIE_APP_CLK_AUX_EN)
+
+#define PCIE_LTSSM_CTRL			0x0c00
+#define PCIE_DEVICE_TYPE_RC		BIT(6)
+#define PCIE_LINK_TRAINING		BIT(0)
+#define SII_INT_MASK0			0x0e00
+#define INTX_RX_ASSERT_SHIFT		5
+#define INTX_RX_ASSERT_MASK		GENMASK(8, 5)
+#define INTX_RX_ASSERT(x)		BIT((x) + INTX_RX_ASSERT_SHIFT)
+#define SII_INT_STAS0			0x0e08
+#define PCIE_LINK_STAT			0x0e0c
+#define SMLH_LINK_UP			BIT(0)
+#define RDLH_LINK_UP			BIT(1)
+
+/* Synopsys DWC port logic bit in PCIE_TIMER_CTRL_MAX_FUNC_NUM (0x718) */
+#define PCIE_AXI_CTO_RESP_EN		BIT(19)
+
+#define PCIE_SLV_CLK_RATE		400000000UL
+
+enum sunxi_pcie_clk_id {
+	CLK_ID_AUX,
+	CLK_ID_SLV,
+	CLK_ID_MSTR,
+	NUM_SUNXI_PCIE_CLKS,
+};
+
+enum sunxi_pcie_rst_id {
+	RST_ID_CORE,
+	RST_ID_PWR,
+	RST_ID_MSTR,
+	NUM_SUNXI_PCIE_RSTS,
+};
+
+struct sunxi_pcie {
+	struct dw_pcie pci;
+	void __iomem *app_base;
+	struct regmap *serdes;
+	struct phy *phy;
+	struct clk_bulk_data clks[NUM_SUNXI_PCIE_CLKS];
+	struct reset_control_bulk_data rsts[NUM_SUNXI_PCIE_RSTS];
+	struct gpio_desc *rst_gpio;
+	struct regulator *vpcie3v3;
+	struct irq_domain *intx_irq_domain;
+	raw_spinlock_t intx_lock;
+	int app_irq;
+};
+
+#define to_sunxi_pcie(x)	dev_get_drvdata((x)->dev)
+
+static void sunxi_pcie_intx_irq_mask(struct irq_data *d)
+{
+	struct sunxi_pcie *sunxi = irq_data_get_irq_chip_data(d);
+	irq_hw_number_t hwirq = irqd_to_hwirq(d);
+	unsigned long flags;
+	u32 val;
+
+	raw_spin_lock_irqsave(&sunxi->intx_lock, flags);
+	val = readl(sunxi->app_base + SII_INT_MASK0);
+	val &= ~INTX_RX_ASSERT(hwirq);
+	writel(val, sunxi->app_base + SII_INT_MASK0);
+	raw_spin_unlock_irqrestore(&sunxi->intx_lock, flags);
+}
+
+static void sunxi_pcie_intx_irq_unmask(struct irq_data *d)
+{
+	struct sunxi_pcie *sunxi = irq_data_get_irq_chip_data(d);
+	irq_hw_number_t hwirq = irqd_to_hwirq(d);
+	unsigned long flags;
+	u32 val;
+
+	raw_spin_lock_irqsave(&sunxi->intx_lock, flags);
+	val = readl(sunxi->app_base + SII_INT_MASK0);
+	val |= INTX_RX_ASSERT(hwirq);
+	writel(val, sunxi->app_base + SII_INT_MASK0);
+	raw_spin_unlock_irqrestore(&sunxi->intx_lock, flags);
+}
+
+static const struct irq_chip sunxi_pcie_intx_chip = {
+	.name		= "sunxi-pcie-intx",
+	.irq_mask	= sunxi_pcie_intx_irq_mask,
+	.irq_unmask	= sunxi_pcie_intx_irq_unmask,
+};
+
+static int sunxi_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
+			       irq_hw_number_t hwirq)
+{
+	irq_set_chip_and_handler(irq, &sunxi_pcie_intx_chip, handle_level_irq);
+	irq_set_chip_data(irq, domain->host_data);
+
+	return 0;
+}
+
+static const struct irq_domain_ops sunxi_pcie_intx_domain_ops = {
+	.map = sunxi_pcie_intx_map,
+};
+
+static void sunxi_pcie_app_irq_handler(struct irq_desc *desc)
+{
+	struct sunxi_pcie *sunxi = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
+	unsigned long status, bit;
+	u32 mask, stas;
+
+	chained_irq_enter(chip, desc);
+
+	mask = readl(sunxi->app_base + SII_INT_MASK0);
+	stas = readl(sunxi->app_base + SII_INT_STAS0);
+	status = (mask & stas) & INTX_RX_ASSERT_MASK;
+
+	bit = INTX_RX_ASSERT_SHIFT;
+	for_each_set_bit_from(bit, &status,
+			      PCI_NUM_INTX + INTX_RX_ASSERT_SHIFT) {
+		writel(BIT(bit), sunxi->app_base + SII_INT_STAS0);
+		generic_handle_domain_irq(sunxi->intx_irq_domain,
+					  bit - INTX_RX_ASSERT_SHIFT);
+	}
+
+	chained_irq_exit(chip, desc);
+}
+
+static int sunxi_pcie_init_intx_irq(struct sunxi_pcie *sunxi)
+{
+	struct device *dev = sunxi->pci.dev;
+	struct platform_device *pdev = to_platform_device(dev);
+	struct device_node *intc;
+	int irq;
+
+	intc = of_get_child_by_name(dev->of_node,
+				    "legacy-interrupt-controller");
+	if (!intc)
+		return 0;
+
+	irq = platform_get_irq_byname(pdev, "app");
+	if (irq < 0) {
+		of_node_put(intc);
+		return irq;
+	}
+
+	writel(0, sunxi->app_base + SII_INT_MASK0);
+	writel(~0U, sunxi->app_base + SII_INT_STAS0);
+
+	sunxi->intx_irq_domain =
+		irq_domain_create_linear(of_fwnode_handle(intc), PCI_NUM_INTX,
+					 &sunxi_pcie_intx_domain_ops, sunxi);
+	of_node_put(intc);
+	if (!sunxi->intx_irq_domain)
+		return -ENOMEM;
+
+	irq_set_chained_handler_and_data(irq, sunxi_pcie_app_irq_handler,
+					 sunxi);
+	sunxi->app_irq = irq;
+
+	return 0;
+}
+
+static void sunxi_pcie_deinit_intx_irq(struct sunxi_pcie *sunxi)
+{
+	int i;
+
+	if (sunxi->app_irq > 0) {
+		unsigned long flags;
+
+		raw_spin_lock_irqsave(&sunxi->intx_lock, flags);
+		writel(0, sunxi->app_base + SII_INT_MASK0);
+		raw_spin_unlock_irqrestore(&sunxi->intx_lock, flags);
+		irq_set_chained_handler_and_data(sunxi->app_irq, NULL, NULL);
+		synchronize_irq(sunxi->app_irq);
+		sunxi->app_irq = 0;
+	}
+
+	if (sunxi->intx_irq_domain) {
+		for (i = 0; i < PCI_NUM_INTX; i++)
+			irq_dispose_mapping(irq_find_mapping(sunxi->intx_irq_domain,
+							     i));
+		irq_domain_remove(sunxi->intx_irq_domain);
+		sunxi->intx_irq_domain = NULL;
+	}
+}
+
+static int sunxi_pcie_host_init(struct dw_pcie_rp *pp)
+{
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct sunxi_pcie *sunxi = to_sunxi_pcie(pci);
+	u32 val;
+
+	if (sunxi->serdes)
+		regmap_write(sunxi->serdes, SERDES_PCIE_ITS_TAGT_ADDR_REG,
+			     SERDES_PCIE_ITS_TAGT_DEFAULT);
+
+	/* Configure Root Complex mode */
+	val = readl(sunxi->app_base + PCIE_LTSSM_CTRL);
+	val |= PCIE_DEVICE_TYPE_RC;
+	writel(val, sunxi->app_base + PCIE_LTSSM_CTRL);
+
+	/* Enable AXI completion timeout response and clear coherency regs */
+	dw_pcie_dbi_ro_wr_en(pci);
+	val = dw_pcie_readl_dbi(pci, TIMER_CTRL_MAX_FUNC_NUM);
+	val |= PCIE_AXI_CTO_RESP_EN;
+	dw_pcie_writel_dbi(pci, TIMER_CTRL_MAX_FUNC_NUM, val);
+	dw_pcie_writel_dbi(pci, COHERENCY_CTRL1, 0);
+	dw_pcie_writel_dbi(pci, COHERENCY_CTRL3, 0);
+	dw_pcie_dbi_ro_wr_dis(pci);
+
+	return 0;
+}
+
+static const struct dw_pcie_host_ops sunxi_pcie_host_ops = {
+	.init	= sunxi_pcie_host_init,
+};
+
+static bool sunxi_pcie_link_up(struct dw_pcie *pci)
+{
+	struct sunxi_pcie *sunxi = to_sunxi_pcie(pci);
+	u32 val;
+
+	val = readl(sunxi->app_base + PCIE_LINK_STAT);
+
+	return (val & (SMLH_LINK_UP | RDLH_LINK_UP)) ==
+	       (SMLH_LINK_UP | RDLH_LINK_UP);
+}
+
+static int sunxi_pcie_start_link(struct dw_pcie *pci)
+{
+	struct sunxi_pcie *sunxi = to_sunxi_pcie(pci);
+	u32 val;
+
+	if (sunxi->rst_gpio) {
+		/* Ensure T_PERST-CLK (>= 100 us) after REFCLK is stable */
+		usleep_range(100, 200);
+		gpiod_set_value_cansleep(sunxi->rst_gpio, 0);
+		msleep(PCIE_RESET_CONFIG_WAIT_MS);
+	}
+
+	val = readl(sunxi->app_base + PCIE_LTSSM_CTRL);
+	val |= PCIE_DEVICE_TYPE_RC | PCIE_LINK_TRAINING;
+	writel(val, sunxi->app_base + PCIE_LTSSM_CTRL);
+
+	return 0;
+}
+
+static void sunxi_pcie_stop_link(struct dw_pcie *pci)
+{
+	struct sunxi_pcie *sunxi = to_sunxi_pcie(pci);
+	u32 val;
+
+	val = readl(sunxi->app_base + PCIE_LTSSM_CTRL);
+	val &= ~PCIE_LINK_TRAINING;
+	writel(val, sunxi->app_base + PCIE_LTSSM_CTRL);
+
+	if (sunxi->rst_gpio)
+		gpiod_set_value_cansleep(sunxi->rst_gpio, 1);
+}
+
+static const struct dw_pcie_ops sunxi_dw_pcie_ops = {
+	.link_up	= sunxi_pcie_link_up,
+	.start_link	= sunxi_pcie_start_link,
+	.stop_link	= sunxi_pcie_stop_link,
+};
+
+static int sunxi_pcie_get_resources(struct platform_device *pdev,
+				    struct sunxi_pcie *sunxi)
+{
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	sunxi->app_base = devm_platform_ioremap_resource_byname(pdev, "app");
+	if (IS_ERR(sunxi->app_base))
+		return dev_err_probe(dev, PTR_ERR(sunxi->app_base),
+				     "failed to map app registers\n");
+
+	if (of_property_present(dev->of_node, "allwinner,serdes-syscon")) {
+		sunxi->serdes = syscon_regmap_lookup_by_phandle(dev->of_node,
+								"allwinner,serdes-syscon");
+		if (IS_ERR(sunxi->serdes))
+			return dev_err_probe(dev, PTR_ERR(sunxi->serdes),
+					     "failed to get serdes syscon\n");
+	}
+
+	sunxi->clks[CLK_ID_AUX].id = "aux";
+	sunxi->clks[CLK_ID_SLV].id = "slv";
+	sunxi->clks[CLK_ID_MSTR].id = "mstr";
+	ret = devm_clk_bulk_get(dev, NUM_SUNXI_PCIE_CLKS, sunxi->clks);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get clocks\n");
+
+	sunxi->rsts[RST_ID_CORE].id = "core";
+	sunxi->rsts[RST_ID_PWR].id = "pwr";
+	sunxi->rsts[RST_ID_MSTR].id = "mstr";
+	ret = devm_reset_control_bulk_get_exclusive(dev, NUM_SUNXI_PCIE_RSTS,
+						    sunxi->rsts);
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get resets\n");
+
+	sunxi->phy = devm_phy_get(dev, "pcie0");
+	if (IS_ERR(sunxi->phy))
+		return dev_err_probe(dev, PTR_ERR(sunxi->phy),
+				     "failed to get phy\n");
+
+	sunxi->rst_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(sunxi->rst_gpio))
+		return dev_err_probe(dev, PTR_ERR(sunxi->rst_gpio),
+				     "failed to get reset gpio\n");
+
+	sunxi->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3");
+	if (IS_ERR(sunxi->vpcie3v3)) {
+		if (PTR_ERR(sunxi->vpcie3v3) == -ENODEV)
+			sunxi->vpcie3v3 = NULL;
+		else
+			return dev_err_probe(dev, PTR_ERR(sunxi->vpcie3v3),
+					     "failed to get vpcie3v3\n");
+	}
+
+	return 0;
+}
+
+static int sunxi_pcie_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct sunxi_pcie *sunxi;
+	int ret;
+
+	sunxi = devm_kzalloc(dev, sizeof(*sunxi), GFP_KERNEL);
+	if (!sunxi)
+		return -ENOMEM;
+
+	sunxi->pci.dev = dev;
+	sunxi->pci.ops = &sunxi_dw_pcie_ops;
+	sunxi->pci.pp.ops = &sunxi_pcie_host_ops;
+	raw_spin_lock_init(&sunxi->intx_lock);
+	platform_set_drvdata(pdev, sunxi);
+
+	ret = sunxi_pcie_get_resources(pdev, sunxi);
+	if (ret)
+		return ret;
+
+	ret = devm_pm_runtime_enable(dev);
+	if (ret)
+		return ret;
+
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret < 0)
+		return ret;
+
+	if (sunxi->vpcie3v3) {
+		ret = regulator_enable(sunxi->vpcie3v3);
+		if (ret)
+			goto err_pm;
+	}
+
+	/* Ensure T_PVPERL (100 ms) from power/PERST# assertion before release */
+	if (sunxi->vpcie3v3 || sunxi->rst_gpio)
+		msleep(PCIE_T_PVPERL_MS);
+
+	ret = clk_set_rate(sunxi->clks[CLK_ID_SLV].clk, PCIE_SLV_CLK_RATE);
+	if (ret)
+		goto err_reg;
+
+	ret = clk_bulk_prepare_enable(NUM_SUNXI_PCIE_CLKS, sunxi->clks);
+	if (ret)
+		goto err_reg;
+
+	ret = reset_control_bulk_assert(NUM_SUNXI_PCIE_RSTS, sunxi->rsts);
+	if (ret)
+		goto err_clks;
+
+	usleep_range(10, 20);
+
+	ret = reset_control_bulk_deassert(NUM_SUNXI_PCIE_RSTS, sunxi->rsts);
+	if (ret)
+		goto err_clks;
+
+	ret = phy_init(sunxi->phy);
+	if (ret)
+		goto err_rsts;
+
+	ret = phy_power_on(sunxi->phy);
+	if (ret)
+		goto err_phy_exit;
+
+	/* Enable core, AXI, DBI, and AUX clock gates */
+	writel(PCIE_APP_CLK_CTRL_DEFAULT, sunxi->app_base + PCIE_APP_CLK_CTRL);
+
+	/* Ensure any bootloader-trained link is stopped before RC init */
+	sunxi_pcie_stop_link(&sunxi->pci);
+
+	ret = sunxi_pcie_init_intx_irq(sunxi);
+	if (ret)
+		goto err_phy_off;
+
+	ret = dw_pcie_host_init(&sunxi->pci.pp);
+	if (ret)
+		goto err_intx;
+
+	return 0;
+
+err_intx:
+	sunxi_pcie_deinit_intx_irq(sunxi);
+	if (sunxi->rst_gpio)
+		gpiod_set_value_cansleep(sunxi->rst_gpio, 1);
+err_phy_off:
+	phy_power_off(sunxi->phy);
+err_phy_exit:
+	phy_exit(sunxi->phy);
+err_rsts:
+	reset_control_bulk_assert(NUM_SUNXI_PCIE_RSTS, sunxi->rsts);
+err_clks:
+	clk_bulk_disable_unprepare(NUM_SUNXI_PCIE_CLKS, sunxi->clks);
+err_reg:
+	if (sunxi->vpcie3v3)
+		regulator_disable(sunxi->vpcie3v3);
+err_pm:
+	pm_runtime_put_sync(dev);
+	return ret;
+}
+
+static void sunxi_pcie_remove(struct platform_device *pdev)
+{
+	struct sunxi_pcie *sunxi = platform_get_drvdata(pdev);
+
+	dw_pcie_host_deinit(&sunxi->pci.pp);
+	sunxi_pcie_deinit_intx_irq(sunxi);
+	if (sunxi->rst_gpio)
+		gpiod_set_value_cansleep(sunxi->rst_gpio, 1);
+	phy_power_off(sunxi->phy);
+	phy_exit(sunxi->phy);
+	reset_control_bulk_assert(NUM_SUNXI_PCIE_RSTS, sunxi->rsts);
+	clk_bulk_disable_unprepare(NUM_SUNXI_PCIE_CLKS, sunxi->clks);
+	if (sunxi->vpcie3v3)
+		regulator_disable(sunxi->vpcie3v3);
+	pm_runtime_put_sync(&pdev->dev);
+}
+
+static const struct of_device_id sunxi_pcie_of_match[] = {
+	{ .compatible = "allwinner,sun60i-a733-pcie" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sunxi_pcie_of_match);
+
+static struct platform_driver sunxi_pcie_driver = {
+	.probe	= sunxi_pcie_probe,
+	.remove	= sunxi_pcie_remove,
+	.driver	= {
+		.name		= "sunxi-pcie",
+		.of_match_table	= sunxi_pcie_of_match,
+	},
+};
+module_platform_driver(sunxi_pcie_driver);
+
+MODULE_DESCRIPTION("Allwinner A733 (sun60i) DesignWare PCIe host controller driver");
+MODULE_LICENSE("GPL");
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/9] arm64: dts: allwinner: sun60i-a733: Add PCIe and Combo PHY nodes
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
                   ` (3 preceding siblings ...)
  2026-11-30  5:24 ` [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 6/9] arm64: dts: allwinner: orangepi-4-pro: Enable PCIe Alastair D'Silva
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Add SerDes syscon, Cadence Combo PHY 1, and DesignWare PCIe Root Complex
nodes to sun60i-a733.dtsi.

Place pcie@6000000 at the root node because soc@0 uses 1-cell addresses
and a 1 GB ranges window, whereas pcie@6000000 requires 64-bit
dma-ranges. Use the DWC integrated MSI receiver (msi IRQ) while GICv3
ITS remains disabled.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../arm64/boot/dts/allwinner/sun60i-a733.dtsi | 76 +++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi b/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
index fe62d0e0b013..e3e6e40f4aa9 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
@@ -4,6 +4,8 @@
 #include <dt-bindings/clock/allwinner,sun60i-a733-r-ccu.h>
 #include <dt-bindings/clock/sun6i-rtc.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+#include <dt-bindings/power/allwinner,sun60i-a733-pck-600.h>
 #include <dt-bindings/reset/allwinner,sun60i-a733-ccu.h>
 #include <dt-bindings/reset/allwinner,sun60i-a733-r-ccu.h>
 
@@ -546,6 +548,30 @@ mmc2: mmc@4022000 {
 			status = "disabled";
 		};
 
+		serdes: syscon@6c00000 {
+			compatible = "allwinner,sun60i-a733-serdes-syscon",
+				     "syscon";
+			reg = <0x06c00000 0x8000>;
+		};
+
+		combophy1: phy@6ca0000 {
+			compatible = "allwinner,sun60i-a733-combophy1";
+			reg = <0x06ca0000 0x20000>;
+			clocks = <&ccu CLK_SERDES_PHY>,
+				 <&ccu CLK_AHB_SERDES>,
+				 <&ccu CLK_MBUS_SERDES>,
+				 <&rtc CLK_HOSC_SERDES1>;
+			clock-names = "serdes", "ahb", "mbus", "ref";
+			assigned-clocks = <&ccu CLK_SERDES_PHY>;
+			assigned-clock-parents = <&ccu CLK_PLL_PERIPH0_600M>;
+			assigned-clock-rates = <100000000>;
+			resets = <&ccu RST_BUS_SERDES>;
+			power-domains = <&pck600 PD_PCIE>;
+			#phy-cells = <1>;
+			allwinner,serdes-syscon = <&serdes>;
+			status = "disabled";
+		};
+
 		r_ccu: clock-controller@7010000 {
 			compatible = "allwinner,sun60i-a733-r-ccu";
 			reg = <0x07010000 0x250>;
@@ -675,4 +701,54 @@ rtc: rtc@7090000 {
 			#clock-cells = <1>;
 		};
 	};
+
+	pcie: pcie@6000000 {
+		compatible = "allwinner,sun60i-a733-pcie";
+		reg = <0x0 0x06000000 0x0 0x00010000>,
+		      <0x0 0x06300000 0x0 0x00100000>,
+		      <0x0 0x06400000 0x0 0x00080000>,
+		      <0x0 0x20000000 0x0 0x01000000>;
+		reg-names = "dbi", "atu", "app", "config";
+		#address-cells = <3>;
+		#size-cells = <2>;
+		bus-range = <0x00 0xff>;
+		device_type = "pci";
+		ranges = <0x81000000 0x0 0x21000000 0x0 0x21000000 0x0 0x00010000>,
+			 <0x82000000 0x0 0x22000000 0x0 0x22000000 0x0 0x06000000>;
+		dma-ranges = <0x03000000 0x0 0x40000000 0x0 0x40000000 0x3 0xc0000000>;
+		clocks = <&ccu CLK_PCIE_AUX>,
+			 <&ccu CLK_PCIE_AXI_SLV>,
+			 <&ccu CLK_BUS_ITS_PCIE0_ACLK>;
+		clock-names = "aux", "slv", "mstr";
+		assigned-clocks = <&ccu CLK_PCIE_AXI_SLV>;
+		assigned-clock-parents = <&ccu CLK_PLL_PERIPH0_400M>;
+		assigned-clock-rates = <400000000>;
+		resets = <&ccu RST_BUS_PCIE>,
+			 <&ccu RST_BUS_PCIE_PWRUP>,
+			 <&ccu RST_BUS_ITS_PCIE0>;
+		reset-names = "core", "pwr", "mstr";
+		interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH 0>;
+		interrupt-names = "app", "msi";
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map = <0 0 0 1 &pcie_intc 0>,
+				<0 0 0 2 &pcie_intc 1>,
+				<0 0 0 3 &pcie_intc 2>,
+				<0 0 0 4 &pcie_intc 3>;
+		max-link-speed = <3>;
+		num-lanes = <1>;
+		linux,pci-domain = <0>;
+		phys = <&combophy1 PHY_TYPE_PCIE>;
+		phy-names = "pcie0";
+		power-domains = <&pck600 PD_PCIE>;
+		allwinner,serdes-syscon = <&serdes>;
+		status = "disabled";
+
+		pcie_intc: legacy-interrupt-controller {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+		};
+	};
 };
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 6/9] arm64: dts: allwinner: orangepi-4-pro: Enable PCIe
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
                   ` (4 preceding siblings ...)
  2026-11-30  5:24 ` [PATCH v2 5/9] arm64: dts: allwinner: sun60i-a733: Add PCIe and Combo PHY nodes Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 7/9] arm64: dts: allwinner: cubie-a7a: " Alastair D'Silva
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Enable the Cadence Combo PHY and PCIe Root Complex for the M.2 Key-M
slot on the Xunlong OrangePi 4 Pro.

Add the CLDO5 1.8V PHY supply and PL3-controlled 3.3V slot regulator,
with PERST# on PD22.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../allwinner/sun60i-a733-orangepi-4-pro.dts  | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
index 68ad09bb5d3b..57cd8a1bf46d 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
@@ -21,6 +21,20 @@ aliases {
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	reg_vcc3v3_pcie: regulator-vcc3v3-pcie {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3-pcie";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&r_pio 0 3 GPIO_ACTIVE_HIGH>; /* PL3 */
+		enable-active-high;
+	};
+};
+
+&combophy1 {
+	phy-supply = <&reg_cldo5>;
+	status = "okay";
 };
 
 &hosc {
@@ -35,6 +49,12 @@ &mmc0 {
 	status = "okay";
 };
 
+&pcie {
+	reset-gpios = <&pio 3 22 GPIO_ACTIVE_LOW>; /* PD22 */
+	vpcie3v3-supply = <&reg_vcc3v3_pcie>;
+	status = "okay";
+};
+
 &r_i2c0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&r_i2c0_pl_pins>;
@@ -50,6 +70,12 @@ axp318w: pmic@36 {
 		#interrupt-cells = <1>;
 
 		regulators {
+			reg_cldo5: cldo5 {
+				regulator-name = "vcc18-pcie-combo";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+			};
+
 			reg_dcdc2: dcdc2 {
 				regulator-name = "vdd-cpu";
 				regulator-min-microvolt = <500000>;
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 7/9] arm64: dts: allwinner: cubie-a7a: Enable PCIe
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
                   ` (5 preceding siblings ...)
  2026-11-30  5:24 ` [PATCH v2 6/9] arm64: dts: allwinner: orangepi-4-pro: Enable PCIe Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 8/9] arm64: dts: allwinner: cubie-a7s: " Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 9/9] arm64: dts: allwinner: cubie-a7z: " Alastair D'Silva
  8 siblings, 0 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Enable the Cadence Combo PHY and PCIe Root Complex for the 16-pin FPC
PCIe connector on the Radxa Cubie A7A.

Use CLDO5 for the 1.8V PHY supply, PE11 for PCIe power enable, and PE13
for PERST# per the v1.10 schematic.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../dts/allwinner/sun60i-a733-cubie-a7a.dts   | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts
index 9017cadf6c6a..a82f89c14fd1 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7a.dts
@@ -69,6 +69,21 @@ reg_vcc5v: regulator-5v {
 		regulator-max-microvolt = <5000000>;
 		regulator-always-on;
 	};
+
+	reg_vcc3v3_pcie: regulator-vcc3v3-pcie {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3-pcie";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&pio 4 11 GPIO_ACTIVE_HIGH>; /* PE11 */
+		enable-active-high;
+		vin-supply = <&reg_vcc5v>;
+	};
+};
+
+&combophy1 {
+	phy-supply = <&reg_cldo5>;
+	status = "okay";
 };
 
 &cpu0 {
@@ -132,6 +147,12 @@ &hosc {
 	clock-frequency = <26000000>;
 };
 
+&pcie {
+	reset-gpios = <&pio 4 13 GPIO_ACTIVE_LOW>; /* PE13 */
+	vpcie3v3-supply = <&reg_vcc3v3_pcie>;
+	status = "okay";
+};
+
 &pio {
 	vcc-pb-supply = <&reg_swout2>;	// via VCC-IO
 	vcc-pc-supply = <&reg_cldo5>;
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 8/9] arm64: dts: allwinner: cubie-a7s: Enable PCIe
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
                   ` (6 preceding siblings ...)
  2026-11-30  5:24 ` [PATCH v2 7/9] arm64: dts: allwinner: cubie-a7a: " Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  2026-11-30  5:24 ` [PATCH v2 9/9] arm64: dts: allwinner: cubie-a7z: " Alastair D'Silva
  8 siblings, 0 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Enable the Cadence Combo PHY and PCIe Root Complex for the 16-pin FPC
PCIe connector on the Radxa Cubie A7S.

Use CLDO5 for the 1.8V PHY supply, PD20 for PCIe power enable, and PD22
for PERST# per the v1.10 schematic.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../dts/allwinner/sun60i-a733-cubie-a7s.dts   | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7s.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7s.dts
index 98a878a2d739..de69fcc2709a 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7s.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7s.dts
@@ -59,6 +59,16 @@ reg_ps: regulator-ps-output {
 		vin-supply = <&reg_vcc5v0_sys>;
 	};
 
+	reg_vcc3v3_pcie: regulator-vcc3v3-pcie {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3-pcie";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
+		enable-active-high;
+		vin-supply = <&reg_vcc5v0_sys>;
+	};
+
 	reg_vcc5v0_sys: regulator-vcc5v0-sys {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc5v0-sys";
@@ -68,6 +78,11 @@ reg_vcc5v0_sys: regulator-vcc5v0-sys {
 	};
 };
 
+&combophy1 {
+	phy-supply = <&reg_cldo5>;
+	status = "okay";
+};
+
 &cpu0 {
 	cpu-supply = <&reg_dcdc5>;
 };
@@ -129,6 +144,12 @@ &mmc0 {
 	status = "okay";
 };
 
+&pcie {
+	reset-gpios = <&pio 3 22 GPIO_ACTIVE_LOW>; /* PD22 */
+	vpcie3v3-supply = <&reg_vcc3v3_pcie>;
+	status = "okay";
+};
+
 &pio {
 	vcc-pb-supply = <&reg_swout2>;	/* via VCC-IO */
 	vcc-pc-supply = <&reg_cldo5>;
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 9/9] arm64: dts: allwinner: cubie-a7z: Enable PCIe
  2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
                   ` (7 preceding siblings ...)
  2026-11-30  5:24 ` [PATCH v2 8/9] arm64: dts: allwinner: cubie-a7s: " Alastair D'Silva
@ 2026-11-30  5:24 ` Alastair D'Silva
  8 siblings, 0 replies; 12+ messages in thread
From: Alastair D'Silva @ 2026-11-30  5:24 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones
  Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel, Alastair D'Silva

Enable the Cadence Combo PHY and PCIe Root Complex for the 16-pin FPC
PCIe connector on the Radxa Cubie A7Z.

Use CLDO5 for the 1.8V PHY supply, PD20 for PCIe power enable, and PD22
for PERST# per the v1.10, v1.11, and v2.00 schematics.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../dts/allwinner/sun60i-a733-cubie-a7z.dts   | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts
index 049e6b67c23a..48c09a00d126 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-cubie-a7z.dts
@@ -60,6 +60,16 @@ reg_ps: regulator-ps-output {
 		vin-supply = <&reg_vcc5v0>;
 	};
 
+	reg_vcc3v3_pcie: regulator-vcc3v3-pcie {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3-pcie";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		gpio = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */
+		enable-active-high;
+		vin-supply = <&reg_vcc5v0>;
+	};
+
 	/* Board wide 5 V supply from the USB-C connector. */
 	reg_vcc5v0: regulator-vcc5v0 {
 		compatible = "regulator-fixed";
@@ -70,6 +80,11 @@ reg_vcc5v0: regulator-vcc5v0 {
 	};
 };
 
+&combophy1 {
+	phy-supply = <&reg_cldo5>;
+	status = "okay";
+};
+
 &cpu0 {
 	cpu-supply = <&reg_dcdc5>;
 };
@@ -117,6 +132,12 @@ &mmc0 {
 	status = "okay";
 };
 
+&pcie {
+	reset-gpios = <&pio 3 22 GPIO_ACTIVE_LOW>; /* PD22 */
+	vpcie3v3-supply = <&reg_vcc3v3_pcie>;
+	status = "okay";
+};
+
 &pio {
 	/* VCC-IO */
 	vcc-pb-supply = <&reg_swout2>;
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver
  2026-11-30  5:24 ` [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver Alastair D'Silva
@ 2026-11-30 20:12   ` Bjorn Helgaas
  0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2026-11-30 20:12 UTC (permalink / raw)
  To: Alastair D'Silva
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones, Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel

On Mon, Nov 30, 2026 at 04:24:45PM +1100, Alastair D'Silva wrote:
> Add a DesignWare PCIe Root Complex glue driver for Allwinner A733
> (sun60i) SoCs using dw_pcie_host_init().

> +++ b/drivers/pci/controller/dwc/Kconfig
> @@ -487,6 +487,21 @@ config PCIE_STM32_EP
>  	  This driver can also be built as a module. If so, the module
>  	  will be called pcie-stm32-ep.
>  
> +config PCIE_SUNXI
> +	tristate "Allwinner A733 (sun60i) PCIe host controller"

Reorder this so the Kconfig menu stays sorted by vendor.

> +#define SII_INT_MASK0			0x0e00
> +#define INTX_RX_ASSERT_SHIFT		5

Remove *_SHIFT definitions and use FIELD_GET() etc.  See other drivers
for examples.

> +#define INTX_RX_ASSERT_MASK		GENMASK(8, 5)
> +#define INTX_RX_ASSERT(x)		BIT((x) + INTX_RX_ASSERT_SHIFT)

> +static int sunxi_pcie_start_link(struct dw_pcie *pci)
> +{
> +	struct sunxi_pcie *sunxi = to_sunxi_pcie(pci);
> +	u32 val;
> +
> +	if (sunxi->rst_gpio) {
> +		/* Ensure T_PERST-CLK (>= 100 us) after REFCLK is stable */
> +		usleep_range(100, 200);

Use #define from drivers/pci/pci.h for the sleep.  Add one if needed.

> +static int sunxi_pcie_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct sunxi_pcie *sunxi;
> +	int ret;
> +
> +	sunxi = devm_kzalloc(dev, sizeof(*sunxi), GFP_KERNEL);
> +	if (!sunxi)
> +		return -ENOMEM;
> +
> +	sunxi->pci.dev = dev;
> +	sunxi->pci.ops = &sunxi_dw_pcie_ops;
> +	sunxi->pci.pp.ops = &sunxi_pcie_host_ops;
> +	raw_spin_lock_init(&sunxi->intx_lock);
> +	platform_set_drvdata(pdev, sunxi);
> +
> +	ret = sunxi_pcie_get_resources(pdev, sunxi);
> +	if (ret)
> +		return ret;
> +
> +	ret = devm_pm_runtime_enable(dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret < 0)
> +		return ret;
> +
> +	if (sunxi->vpcie3v3) {
> +		ret = regulator_enable(sunxi->vpcie3v3);
> +		if (ret)
> +			goto err_pm;
> +	}
> +
> +	/* Ensure T_PVPERL (100 ms) from power/PERST# assertion before release */
> +	if (sunxi->vpcie3v3 || sunxi->rst_gpio)
> +		msleep(PCIE_T_PVPERL_MS);
> +
> +	ret = clk_set_rate(sunxi->clks[CLK_ID_SLV].clk, PCIE_SLV_CLK_RATE);
> +	if (ret)
> +		goto err_reg;
> +
> +	ret = clk_bulk_prepare_enable(NUM_SUNXI_PCIE_CLKS, sunxi->clks);
> +	if (ret)
> +		goto err_reg;
> +
> +	ret = reset_control_bulk_assert(NUM_SUNXI_PCIE_RSTS, sunxi->rsts);
> +	if (ret)
> +		goto err_clks;
> +
> +	usleep_range(10, 20);

Reference for this?


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/9] dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding
  2026-11-30  5:24 ` [PATCH v2 3/9] dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding Alastair D'Silva
@ 2026-11-30 20:18   ` Bjorn Helgaas
  0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2026-11-30 20:18 UTC (permalink / raw)
  To: Alastair D'Silva
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Vinod Koul, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Lee Jones, Philipp Zabel, Liam Girdwood, Mark Brown, Enzo Adriano,
	devicetree, linux-pci, linux-phy, linux-sunxi, linux-arm-kernel,
	mfd, linux-kernel

On Mon, Nov 30, 2026 at 04:24:44PM +1100, Alastair D'Silva wrote:
> Add Devicetree binding for the Allwinner A733 (sun60i) DesignWare PCIe
> Root Complex controller.

Please structure in a way that allows multiple Root Ports per
controller.  Even if no current devices will have multiple RPs, future
ones might, and it's helpful to use a similar structure across
drivers.  See
https://lore.kernel.org/linux-pci/20250625221653.GA1590146@bhelgaas/
for examples.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-30 20:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30  5:24 [PATCH v2 0/9] Add Allwinner A733 (sun60i) PCIe and Combo PHY support Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 1/9] dt-bindings: phy: allwinner,sun60i-a733-combophy: Add binding Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 2/9] phy: allwinner: Add Allwinner A733 Cadence Combo PHY driver Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 3/9] dt-bindings: PCI: allwinner,sun60i-a733-pcie: Add binding Alastair D'Silva
2026-11-30 20:18   ` Bjorn Helgaas
2026-11-30  5:24 ` [PATCH v2 4/9] PCI: sunxi: Add Allwinner A733 DesignWare PCIe host controller driver Alastair D'Silva
2026-11-30 20:12   ` Bjorn Helgaas
2026-11-30  5:24 ` [PATCH v2 5/9] arm64: dts: allwinner: sun60i-a733: Add PCIe and Combo PHY nodes Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 6/9] arm64: dts: allwinner: orangepi-4-pro: Enable PCIe Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 7/9] arm64: dts: allwinner: cubie-a7a: " Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 8/9] arm64: dts: allwinner: cubie-a7s: " Alastair D'Silva
2026-11-30  5:24 ` [PATCH v2 9/9] arm64: dts: allwinner: cubie-a7z: " Alastair D'Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox