Skip to contentSkip to conversation

Move PHY out of pcie-kirin driver

RFC PATCH New Mauro Carvalho Chehab 1 participant 2 messages Jul 6, 2021

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover Move PHY out of pcie-kirin driver

During the review of the Kirin 970 PCIe patch series, it was pointed that the pcie-kirin driver has PHY logic mixed inside it:

https://lore.kernel.org/lkml/CAL_JsqK7_hAw4aacHyiqJWE6zSWiMez5695+deaCSHfeWuX-XA@mail.gmail.com/

Probably due to that, support for those devices weren't added upstream.

Before trying to re-send it again, let's split the existing PHY code for Kirin 960 (Hisi3660) from the driver.

Please notice that this change will alter the device tree, as a new PHY descriptor will be needed, and the PHY properties from the pcie nodes will need to switch.

This patch doesn't change the documentation yet, but it does change the DTS file. If this change is OK, I'll resend this patch together with the documentation changes.

Tested on a Hikey 960. After the patch, the PCI bridge is properly displayed:

	$ lspci
	00:00.0 PCI bridge: Huawei Technologies Co., Ltd. Device 3660 (rev 01)

Unfortunately, currently I can't test if the bridge is working as this bridge supports only non-SATA M.2 devices. I'm acquiring one for tests, but it will take a couple weeks to arrive.

Mauro Carvalho Chehab (1):
PCI: dwc: pcie-kirin: split PHY interface from the driver

 arch/arm64/boot/dts/hisilicon/hi3660.dtsi |  24 +-
 drivers/pci/controller/dwc/pcie-kirin.c   | 195 +++-------------
 drivers/phy/hisilicon/Kconfig             |  10 +
 drivers/phy/hisilicon/Makefile            |   1 +
 drivers/phy/hisilicon/phy-hi3660-pcie.c   | 261 ++++++++++++++++++++++
 5 files changed, 321 insertions(+), 170 deletions(-)
 create mode 100644 drivers/phy/hisilicon/phy-hi3660-pcie.c
Signature · 8 lines
2.31.1



-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
#1 lore raw

RFC PATCH 1/1 PCI: dwc: pcie-kirin: split PHY interface from the driver

The pcie-kirin PCIe driver contains internally a PHY interface for a Hikey 960. As we'll be adding support also for Hikey 970, we need to first split the PHY into a separate driver.

---
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi |  24 +-
 drivers/pci/controller/dwc/pcie-kirin.c   | 195 +++-------------
 drivers/phy/hisilicon/Kconfig             |  10 +
 drivers/phy/hisilicon/Makefile            |   1 +
 drivers/phy/hisilicon/phy-hi3660-pcie.c   | 261 ++++++++++++++++++++++
 5 files changed, 321 insertions(+), 170 deletions(-)
 create mode 100644 drivers/phy/hisilicon/phy-hi3660-pcie.c
arch/arm64/boot/dts/hisilicon/hi3660.dtsi +15 -9
index 53890e8052a7..3a589fa4ca81 100644
@@ -1001,17 +1001,28 @@ spi3: spi@ff3b3000 {
 			status = "disabled";
 		};
 
+		pcie_phy: pcie-phy@f3f2000 {
+			compatible = "hisilicon,hi960-pcie-phy";
+			reg = <0x0 0xf3f20000 0x0 0x40000>;
+			reg-names = "phy";
+			clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
+				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>;
+			clock-names = "pcie_phy_ref", "pcie_apb_phy";
+			reset-gpios = <&gpio11 1 0 >;
+			#phy-cells = <0>;
+		};
+
 		pcie@f4000000 {
 			compatible = "hisilicon,kirin960-pcie";
 			reg = <0x0 0xf4000000 0x0 0x1000>,
 			      <0x0 0xff3fe000 0x0 0x1000>,
-			      <0x0 0xf3f20000 0x0 0x40000>,
 			      <0x0 0xf5000000 0x0 0x2000>;
-			reg-names = "dbi", "apb", "phy", "config";
+			reg-names = "dbi", "apb", "config";
 			bus-range = <0x0  0x1>;
 			#address-cells = <3>;
 			#size-cells = <2>;
 			device_type = "pci";
+			phys = <&pcie_phy>;
 			ranges = <0x02000000 0x0 0x00000000
 				  0x0 0xf6000000
 				  0x0 0x02000000>;
@@ -1028,15 +1039,10 @@ &gic GIC_SPI 283 IRQ_TYPE_LEVEL_HIGH>,
 					 &gic GIC_SPI 284 IRQ_TYPE_LEVEL_HIGH>,
 					<0x0 0 0 4
 					 &gic GIC_SPI 285 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&crg_ctrl HI3660_PCIEPHY_REF>,
-				 <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
-				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_PHY>,
+			clocks = <&crg_ctrl HI3660_CLK_GATE_PCIEAUX>,
 				 <&crg_ctrl HI3660_PCLK_GATE_PCIE_SYS>,
 				 <&crg_ctrl HI3660_ACLK_GATE_PCIE>;
-			clock-names = "pcie_phy_ref", "pcie_aux",
-				      "pcie_apb_phy", "pcie_apb_sys",
-				      "pcie_aclk";
-			reset-gpios = <&gpio11 1 0 >;
+			clock-names = "pcie_aux", "pcie_apb_sys", "pcie_aclk";
 		};
 
 		/* UFS */
drivers/pci/controller/dwc/pcie-kirin.c +34 -161

304 lines not on this page · raw message

drivers/phy/hisilicon/Kconfig +10 -0
index 4d008cfc279c..c0725907e2cb 100644
@@ -23,6 +23,16 @@ config PHY_HI3660_USB
 
 	  To compile this driver as a module, choose M here.
 
+config PHY_HI3660_PCIE
+	tristate "hi3660 PCIe PHY support"
+	depends on (ARCH_HISI && ARM64) || COMPILE_TEST
+	select GENERIC_PHY
+	select MFD_SYSCON
+	help
+	  Enable this to support the HISILICON HI3660 PCIe PHY.
+
+	  To compile this driver as a module, choose M here.
+
 config PHY_HI3670_USB
 	tristate "hi3670 USB PHY support"
 	depends on (ARCH_HISI && ARM64) || COMPILE_TEST
drivers/phy/hisilicon/Makefile +1 -0
index 51729868145b..3c3d70dd7469 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_PHY_HI6220_USB)		+= phy-hi6220-usb.o
 obj-$(CONFIG_PHY_HI3660_USB)		+= phy-hi3660-usb3.o
+obj-$(CONFIG_PHY_HI3660_PCIE)		+= phy-hi3660-pcie.o
 obj-$(CONFIG_PHY_HI3670_USB)		+= phy-hi3670-usb3.o
 obj-$(CONFIG_PHY_HISTB_COMBPHY)		+= phy-histb-combphy.o
 obj-$(CONFIG_PHY_HISI_INNO_USB2)	+= phy-hisi-inno-usb2.o
drivers/phy/hisilicon/phy-hi3660-pcie.c new file +261 -0

261 lines not on this page · raw message

Signature · 7 lines
2.31.1


-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy