Skip to contentSkip to conversation

phy: airoha: add support for AN7583 PCIe PHY driver

PATCH Superseded Christian Marangi 3 participants 5 messages Oct 16 – Nov 1

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover phy: airoha: add support for AN7583 PCIe PHY driver

This small series introduce support for Airoha AN7583 Gen3 PCIe PHY.

It's not possible to reuse the EN7581 code as the register changed between the 2 SoC and also the setup method changed (different calibration logic)

Putting the PHY in a dedicated directory is also needed for other series current pending that will add USB PHY support.

Also a dedicated schema is added as the register names is entirely different compared to EN7581.

Changes v4:
- Add REGMAP_MMIO to kconfig
- Better handle exit
- Add additional info on QPHY usage

Changes v3:
- Improve example for Documentation patch
- Deinit G3 PHY on QPHY error

Changes v2:
- Drop move patch (handled in different series)
- Rework to regmap implementation
- Rename files to more specific name
- Add .exit logic
- Drop QPHY in favor of external PHY handling
- Update schema with new requirement and improve example

Christian Marangi (2):
dt-bindings: phy: airoha: Document support for AN7583 Gen3 PCIe PHY
phy: airoha: add support for AN7583 Gen3 PCIe PHY driver

 .../phy/airoha,an7583-pcie-gen3-phy.yaml      |  65 ++
 MAINTAINERS                                   |   8 +
 drivers/phy/Kconfig                           |   1 +
 drivers/phy/Makefile                          |   3 +-
 drivers/phy/airoha/Kconfig                    |  14 +
 drivers/phy/airoha/Makefile                   |   2 +
 drivers/phy/airoha/phy-an7583-pcie-regs.h     | 377 ++++++++
 drivers/phy/airoha/phy-an7583-pcie.c          | 823 ++++++++++++++++++
 8 files changed, 1292 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7583-pcie-gen3-phy.yaml
 create mode 100644 drivers/phy/airoha/Kconfig
 create mode 100644 drivers/phy/airoha/Makefile
 create mode 100644 drivers/phy/airoha/phy-an7583-pcie-regs.h
 create mode 100644 drivers/phy/airoha/phy-an7583-pcie.c
Signature · 1 line
2.55.0
#1 lore raw

PATCH v4 1/2 dt-bindings: phy: airoha: Document support for AN7583 Gen3 PCIe PHY

Document support for AN7583 PCIe PHY used to make the Gen3 PCIe port work. Add the required register to configure the PCIe PHY and provide an example for it.

The PHY link to another PHY (the QPHY as described in the YAML) to correctly handle Gen2 speed and mode. It's mandatory to have this PHY configured for correct functionality of PCIe. The QPHY is a unified PHY that both handle USB and PCIe PHY.

It's also mondatory that the QPHY setup is done in the PCIe PHY setup and calibration phase or calibration might fail.

---
 .../phy/airoha,an7583-pcie-gen3-phy.yaml      | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7583-pcie-gen3-phy.yaml
Documentation/devicetree/bindings/phy/airoha,an7583-pcie-gen3-phy.yaml new file +65 -0
new file mode 100644
index 000000000000..a8ec5ac781cc
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/airoha,an7583-pcie-gen3-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Airoha AN7583 PCI-Express PHY
+
+maintainers:
+  - Christian Marangi <[email protected]>
+
+description:
+  The PCIe PHY supports physical layer functionality for PCIe Gen2/Gen3 port.
+
+properties:
+  compatible:
+    const: airoha,an7583-pcie-gen3-phy
+
+  reg:
+    items:
+      - description: PCIE G3 analog base address
+      - description: PCIE G3 PMA base address
+      - description: PCIE detection time base address
+      - description: PCIE Rx AEQ base address
+
+  reg-names:
+    items:
+      - const: g3-ana
+      - const: g3-pma
+      - const: xr-dtime
+      - const: rx-aeq
+
+  phys:
+    items:
+      - description: phandle to QPHY phy for Gen2 support
+
+  "#phy-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - phys
+  - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/phy/phy.h>
+
+    phy@1fc7f000 {
+        compatible = "airoha,an7583-pcie-gen3-phy";
+        reg = <0x1fc7f000 0x1000>,
+              <0x1fc7e000 0x1000>,
+              <0x1fc30044 0x4>,
+              <0x1fc35030 0x4>;
+        reg-names = "g3-ana", "g3-pma",
+                    "xr-dtime", "rx-aeq";
+
+        phys = <&pcie1_phy PHY_TYPE_PCIE>;
+
+        #phy-cells = <0>;
+    };
Signature · 1 line
2.55.0
maintainer Reviewed-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] dt-bindings: phy: airoha: Document support for AN7583 Gen3 PCIe PHY

Quoted 9 lines · Christian Marangi

Document support for AN7583 PCIe PHY used to make the Gen3 PCIe port work. Add the required register to configure the PCIe PHY and provide an example for it.

The PHY link to another PHY (the QPHY as described in the YAML) to correctly handle Gen2 speed and mode. It's mandatory to have this PHY configured for correct functionality of PCIe. The QPHY is a unified PHY that both handle USB and PCIe PHY.

Quoted 9 lines

It's also mondatory that the QPHY setup is done in the PCIe PHY setup and calibration phase or calibration might fail.

---
 .../phy/airoha,an7583-pcie-gen3-phy.yaml      | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/airoha,an7583-pcie-gen3-phy.yaml
#3 lore raw

PATCH v4 2/2 phy: airoha: add support for AN7583 Gen3 PCIe PHY driver

In reply to Christian Marangi

Add support for AN7583 PCIe PHY driver. This is required to make the Gen3 PCIe port present on the Airoha AN7583 SoC correctly work.

A different setup is needed compared to Airoha EN7581 where the calibration process and the register map greatly changed.

---
 MAINTAINERS                               |   8 +
 drivers/phy/Kconfig                       |   1 +
 drivers/phy/Makefile                      |   3 +-
 drivers/phy/airoha/Kconfig                |  14 +
 drivers/phy/airoha/Makefile               |   2 +
 drivers/phy/airoha/phy-an7583-pcie-regs.h | 377 ++++++++++
 drivers/phy/airoha/phy-an7583-pcie.c      | 823 ++++++++++++++++++++++
 7 files changed, 1227 insertions(+), 1 deletion(-)
 create mode 100644 drivers/phy/airoha/Kconfig
 create mode 100644 drivers/phy/airoha/Makefile
 create mode 100644 drivers/phy/airoha/phy-an7583-pcie-regs.h
 create mode 100644 drivers/phy/airoha/phy-an7583-pcie.c
MAINTAINERS +8 -0
index 0570815ee980..19b7b6981d02 100644
@@ -767,6 +767,14 @@ F:	Documentation/devicetree/bindings/phy/airoha,en7581-pcie-phy.yaml
 F:	drivers/phy/phy-airoha-pcie-regs.h
 F:	drivers/phy/phy-airoha-pcie.c
 
+AIROHA AN7583 PCIE PHY DRIVER
+M:	Christian Marangi <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+S:	Maintained
+F:	Documentation/devicetree/bindings/phy/airoha,an7583-pcie-gen3-phy.yaml
+F:	drivers/phy/airoha/phy-an7583-pcie-regs.h
+F:	drivers/phy/airoha/phy-an7583-pcie.c
+
 AIROHA SPI SNFI DRIVER
 M:	Lorenzo Bianconi <[email protected]>
 M:	Ray Liu <[email protected]>
drivers/phy/Kconfig +1 -0
index 105fbe408aa2..1ba034400d59 100644
@@ -168,6 +168,7 @@ config PHY_XGENE
 	help
 	  This option enables support for APM X-Gene SoC multi-purpose PHY.
 
+source "drivers/phy/airoha/Kconfig"
 source "drivers/phy/allwinner/Kconfig"
 source "drivers/phy/amlogic/Kconfig"
 source "drivers/phy/apple/Kconfig"
drivers/phy/Makefile +2 -1
index c6dd02003bbe..bd773406331e 100644
@@ -20,7 +20,8 @@ obj-$(CONFIG_PHY_PISTACHIO_USB)		+= phy-pistachio-usb.o
 obj-$(CONFIG_PHY_SNPS_EUSB2)		+= phy-snps-eusb2.o
 obj-$(CONFIG_PHY_XGENE)			+= phy-xgene.o
 
-obj-$(CONFIG_GENERIC_PHY)		+= allwinner/	\
+obj-$(CONFIG_GENERIC_PHY)		+= airoha/	\
+					   allwinner/	\
 					   amlogic/	\
 					   apple/	\
 					   aspeed/	\
drivers/phy/airoha/Kconfig new file +14 -0
new file mode 100644
index 000000000000..b61019d96899
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Phy drivers for Airoha platforms
+#
+config PHY_AIROHA_AN7583_PCIE
+	tristate "Airoha AN7583 PCIe-PHY Driver"
+	depends on ARCH_AIROHA || COMPILE_TEST
+	depends on OF
+	select GENERIC_PHY
+	select REGMAP_MMIO
+	help
+	  Say Y here to add support for Airoha AN7583 PCIe PHY driver.
+	  This driver create the basic PHY instance and provides initialize
+	  callback for PCIe GEN3 port.
drivers/phy/airoha/Makefile new file +2 -0
new file mode 100644
index 000000000000..ca0fe9cffc96
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_PHY_AIROHA_AN7583_PCIE)	+= phy-an7583-pcie.o
drivers/phy/airoha/phy-an7583-pcie-regs.h new file +377 -0

377 lines not on this page · raw message

drivers/phy/airoha/phy-an7583-pcie.c new file +823 -0

823 lines not on this page · raw message

Signature · 1 line
2.55.0
reviewer Reviewed-by on v4 2/2
#4 lore raw

Re: [PATCH v4 2/2] phy: airoha: add support for AN7583 Gen3 PCIe PHY driver

Quoted 7 lines · Christian Marangi

Add support for AN7583 PCIe PHY driver. This is required to make the Gen3 PCIe port present on the Airoha AN7583 SoC correctly work.

A different setup is needed compared to Airoha EN7581 where the calibration process and the register map greatly changed.

- Mani