Skip to contentSkip to conversation

phy: mediatek: Add PCIe PHY driver

PATCH Applied Jianjun Wang 4 participants 7 messages Jun 17, 2022 – Jul 5, 2022

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

v10 cover phy: mediatek: Add PCIe PHY driver

These series patches add support for PCIe PHY driver on MediaTek chipsets.

Changes in v10:
1. Sort the order in Kconfig and Makefile.

Changes in v9:
1. Check if the return value is -ENOMEM when reading efuse data fails.

Changes in v8:
1. Use "device_property_present()" to increase human readability;
2. Use "GPL" as recommended in commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity").

Changes in v7:
1. Add bitfield.h header to fix the build error on non-arm64 platforms.

Changes in v6:
1. Remove unnecessary header files;
2. Use FILELD_PREP in bitfield.h to set value.

Changes in v5:
1. Fix typo in kerneldoc: "eFues" => "eFuse".

Changes in v4:
1. Fix no return when calling dev_err_probe.

Changes in v3:
1. Add introductions for structure members;
2. Add SoC dependent data;
3. Dynamically allocate efuse data;
4. Check return value if it's an -EPROBE_DEFER.

Changes in v2:
1. Add specific compatible name;
2. Read NVMEM data at probe time;
3. Fix typos.

Jianjun Wang (2):
dt-bindings: phy: mediatek: Add YAML schema for PCIe PHY
phy: mediatek: Add PCIe PHY driver

 .../bindings/phy/mediatek,pcie-phy.yaml       |  75 +++++
 drivers/phy/mediatek/Kconfig                  |  11 +
 drivers/phy/mediatek/Makefile                 |   1 +
 drivers/phy/mediatek/phy-mtk-pcie.c           | 267 ++++++++++++++++++
 4 files changed, 354 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/mediatek,pcie-phy.yaml
 create mode 100644 drivers/phy/mediatek/phy-mtk-pcie.c
Signature · 1 line
2.18.0
#1 lore raw

PATCH v10 1/2 dt-bindings: phy: mediatek: Add YAML schema for PCIe PHY

Add YAML schema documentation for PCIe PHY on MediaTek chipsets.

---
 .../bindings/phy/mediatek,pcie-phy.yaml       | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/mediatek,pcie-phy.yaml
Documentation/devicetree/bindings/phy/mediatek,pcie-phy.yaml new file +75 -0
new file mode 100644
index 000000000000..422750cc4121
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/mediatek,pcie-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek PCIe PHY
+
+maintainers:
+  - Jianjun Wang <[email protected]>
+
+description: |
+  The PCIe PHY supports physical layer functionality for PCIe Gen3 port.
+
+properties:
+  compatible:
+    const: mediatek,mt8195-pcie-phy
+
+  reg:
+    maxItems: 1
+
+  reg-names:
+    items:
+      - const: sif
+
+  "#phy-cells":
+    const: 0
+
+  nvmem-cells:
+    maxItems: 7
+    description:
+      Phandles to nvmem cell that contains the efuse data, if unspecified,
+      default value is used.
+
+  nvmem-cell-names:
+    items:
+      - const: glb_intr
+      - const: tx_ln0_pmos
+      - const: tx_ln0_nmos
+      - const: rx_ln0
+      - const: tx_ln1_pmos
+      - const: tx_ln1_nmos
+      - const: rx_ln1
+
+  power-domains:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    phy@11e80000 {
+        compatible = "mediatek,mt8195-pcie-phy";
+        #phy-cells = <0>;
+        reg = <0x11e80000 0x10000>;
+        reg-names = "sif";
+        nvmem-cells = <&pciephy_glb_intr>,
+                      <&pciephy_tx_ln0_pmos>,
+                      <&pciephy_tx_ln0_nmos>,
+                      <&pciephy_rx_ln0>,
+                      <&pciephy_tx_ln1_pmos>,
+                      <&pciephy_tx_ln1_nmos>,
+                      <&pciephy_rx_ln1>;
+        nvmem-cell-names = "glb_intr", "tx_ln0_pmos",
+                           "tx_ln0_nmos", "rx_ln0",
+                           "tx_ln1_pmos", "tx_ln1_nmos",
+                           "rx_ln1";
+        power-domains = <&spm 2>;
+    };
Signature · 1 line
2.18.0
#2 lore raw

PATCH v10 2/2 phy: mediatek: Add PCIe PHY driver

In reply to Jianjun Wang

Add PCIe GEN3 PHY driver support on MediaTek chipsets.

---
 drivers/phy/mediatek/Kconfig        |  11 ++
 drivers/phy/mediatek/Makefile       |   1 +
 drivers/phy/mediatek/phy-mtk-pcie.c | 267 ++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100644 drivers/phy/mediatek/phy-mtk-pcie.c
drivers/phy/mediatek/Kconfig +11 -0
index 55f8e6c048ab..dfb18b490d07 100644
@@ -2,6 +2,17 @@
 #
 # Phy drivers for Mediatek devices
 #
+config PHY_MTK_PCIE
+	tristate "MediaTek PCIe-PHY Driver"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	depends on OF
+	select GENERIC_PHY
+	help
+	  Say 'Y' here to add support for MediaTek PCIe PHY driver.
+	  This driver create the basic PHY instance and provides initialize
+	  callback for PCIe GEN3 port, it supports software efuse
+	  initialization.
+
 config PHY_MTK_TPHY
 	tristate "MediaTek T-PHY Driver"
 	depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/phy/mediatek/Makefile +1 -0
index ace660fbed3a..445b23728a61 100644
@@ -3,6 +3,7 @@
 # Makefile for the phy drivers.
 #
 
+obj-$(CONFIG_PHY_MTK_PCIE)		+= phy-mtk-pcie.o
 obj-$(CONFIG_PHY_MTK_TPHY)		+= phy-mtk-tphy.o
 obj-$(CONFIG_PHY_MTK_UFS)		+= phy-mtk-ufs.o
 obj-$(CONFIG_PHY_MTK_XSPHY)		+= phy-mtk-xsphy.o
drivers/phy/mediatek/phy-mtk-pcie.c new file +267 -0

267 lines not on this page · raw message

Signature · 1 line
2.18.0
maintainer Reviewed-by on v10 2/2
#4 lore raw
In reply to Jianjun Wang
Quoted 11 lines · Jianjun Wang

Add PCIe GEN3 PHY driver support on MediaTek chipsets.

---
 drivers/phy/mediatek/Kconfig        |  11 ++
 drivers/phy/mediatek/Makefile       |   1 +
 drivers/phy/mediatek/phy-mtk-pcie.c | 267
++++++++++++++++++++++++++++
 3 files changed, 279 insertions(+)
 create mode 100644 drivers/phy/mediatek/phy-mtk-pcie.c

Thanks

#5 lore raw
In reply to Jianjun Wang

Hello Maintainers,

Gentle ping for this patch series, if there is anything I can do to get these patches merged, please let me know.

Thanks.

Quoted 54 lines · Jianjun Wang

These series patches add support for PCIe PHY driver on MediaTek chipsets.

Changes in v10:
1. Sort the order in Kconfig and Makefile.

Changes in v9:
1. Check if the return value is -ENOMEM when reading efuse data fails.

Changes in v8:
1. Use "device_property_present()" to increase human readability;
2. Use "GPL" as recommended in commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity").

Changes in v7:
1. Add bitfield.h header to fix the build error on non-arm64 platforms.

Changes in v6:
1. Remove unnecessary header files;
2. Use FILELD_PREP in bitfield.h to set value.

Changes in v5:
1. Fix typo in kerneldoc: "eFues" => "eFuse".

Changes in v4:
1. Fix no return when calling dev_err_probe.

Changes in v3:
1. Add introductions for structure members;
2. Add SoC dependent data;
3. Dynamically allocate efuse data;
4. Check return value if it's an -EPROBE_DEFER.

Changes in v2:
1. Add specific compatible name;
2. Read NVMEM data at probe time;
3. Fix typos.

Jianjun Wang (2):
dt-bindings: phy: mediatek: Add YAML schema for PCIe PHY
phy: mediatek: Add PCIe PHY driver

 .../bindings/phy/mediatek,pcie-phy.yaml       |  75 +++++
 drivers/phy/mediatek/Kconfig                  |  11 +
 drivers/phy/mediatek/Makefile                 |   1 +
 drivers/phy/mediatek/phy-mtk-pcie.c           | 267
++++++++++++++++++
 4 files changed, 354 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/phy/mediatek,pcie-phy.yaml
 create mode 100644 drivers/phy/mediatek/phy-mtk-pcie.c
maintainer Applied
#6 lore raw
In reply to Jianjun Wang
Quoted 1 line · Jianjun Wang

These series patches add support for PCIe PHY driver on MediaTek chipsets.

Applied, thanks

Signature · 1 line
~Vinod