Skip to contentSkip to conversation

MT7621 PCIe PHY

PATCH In review Sergio Paracuellos 2 participants 5 messages Mar 14, 2019 – Mar 28, 2019

Subsystems (6)
lore
Share & tools
lore

Sergio Paracuellos

author maintainer
#0 lore raw

This series adds support for the PCIe PHY found in the Mediatek MT7621 SoC.

This is the first attempt to get feedback of what is missing in this driver to be promoted from staging.

There is also a 'mt7621-pci' driver which is the controller part which is still in staging and is a client of this phy.

Both drivers have been tested together in a gnubee1 board.

Thanks in advance for your time.

Best regards,
Sergio Paracuellos

Sergio Paracuellos (2):
phy: ralink: Add PHY driver for MT7621 PCIe PHY
dt-bindings: phy: Add binding for Mediatek MT7621 PCIe PHY

 .../bindings/phy/mediatek,mt7621-pci-phy.txt  |  54 +++
 drivers/phy/ralink/Kconfig                    |   7 +
 drivers/phy/ralink/Makefile                   |   1 +
 drivers/phy/ralink/phy-mt7621-pci.c           | 387 ++++++++++++++++++
 4 files changed, 449 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt
 create mode 100644 drivers/phy/ralink/phy-mt7621-pci.c
Signature · 1 line
2.19.1
author maintainer
#1 lore raw

PATCH 1/2 phy: ralink: Add PHY driver for MT7621 PCIe PHY

This patch adds a driver for the PCIe PHY of MT7621 SoC.

---
 drivers/phy/ralink/Kconfig          |   7 +
 drivers/phy/ralink/Makefile         |   1 +
 drivers/phy/ralink/phy-mt7621-pci.c | 387 ++++++++++++++++++++++++++++
 3 files changed, 395 insertions(+)
 create mode 100644 drivers/phy/ralink/phy-mt7621-pci.c
drivers/phy/ralink/Kconfig +7 -0
index 14fd219535ef..87943a10f210 100644
@@ -1,6 +1,13 @@
 #
 # PHY drivers for Ralink platforms.
 #
+config PHY_MT7621_PCI
+	tristate "MediaTek MT7621 PCI PHY Driver"
+	depends on RALINK && OF
+	select GENERIC_PHY
+	help
+	  Say 'Y' here to add support for MediaTek MT7621 PCI PHY driver,
+
 config PHY_RALINK_USB
 	tristate "Ralink USB PHY driver"
 	depends on RALINK || COMPILE_TEST
drivers/phy/ralink/Makefile +1 -0
index 5c9e326e8757..2052d5649863 100644
@@ -1 +1,2 @@
+obj-$(CONFIG_PHY_MT7621_PCI)	+= phy-mt7621-pci.o
 obj-$(CONFIG_PHY_RALINK_USB)	+= phy-ralink-usb.o
drivers/phy/ralink/phy-mt7621-pci.c new file +387 -0

387 lines not on this page · raw message

Signature · 1 line
2.19.1
author maintainer
#2 lore raw

PATCH 2/2 dt-bindings: phy: Add binding for Mediatek MT7621 PCIe PHY

In reply to Sergio Paracuellos

Add bindings to describe Mediatek MT7621 PCIe PHY.

---
 .../bindings/phy/mediatek,mt7621-pci-phy.txt  | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +54 -0
new file mode 100644
index 000000000000..8addedbe815e
@@ -0,0 +1,54 @@
+Mediatek Mt7621 PCIe PHY
+
+Required properties:
+- compatible: must be "mediatek,mt7621-pci-phy"
+- reg: base address and length of the PCIe PHY block
+- #address-cells: must be 1
+- #size-cells: must be 0
+
+Each PCIe PHY should be represented by a child node
+
+Required properties For the child node:
+- reg: the PHY ID
+0 - PCIe RC 0
+1 - PCIe RC 1
+- #phy-cells: must be 0
+
+Example:
+	pcie0_phy: pcie-phy@1e149000 {
+		compatible = "mediatek,mt7621-pci-phy";
+		reg = <0x1e149000 0x0700>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		pcie0_port: pcie-phy@0 {
+			reg = <0>;
+			#phy-cells = <0>;
+		};
+
+		pcie1_port: pcie-phy@1 {
+			reg = <1>;
+			#phy-cells = <0>;
+		};
+	};
+
+	pcie1_phy: pcie-phy@1e14a000 {
+		compatible = "mediatek,mt7621-pci-phy";
+		reg = <0x1e14a000 0x0700>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		pcie2_port: pcie-phy@0 {
+			reg = <0>;
+			#phy-cells = <0>;
+		};
+	};
+
+	/* users of the PCIe phy */
+
+	pcie: pcie@1e140000 {
+		...
+		...
+		phys = <&pcie0_port>, <&pcie1_port>, <&pcie2_port>;
+		phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2";
+	};
Signature · 1 line
2.19.1
maintainer
#3 lore raw

Re: [PATCH 2/2] dt-bindings: phy: Add binding for Mediatek MT7621 PCIe PHY

Quoted 1 line · Sergio Paracuellos

Add bindings to describe Mediatek MT7621 PCIe PHY.

Binding should come before the driver.

Quoted 35 lines
---
 .../bindings/phy/mediatek,mt7621-pci-phy.txt  | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +22 -0
new file mode 100644
index 000000000000..8addedbe815e
@@ -0,0 +1,54 @@
+Mediatek Mt7621 PCIe PHY
+
+Required properties:
+- compatible: must be "mediatek,mt7621-pci-phy"
+- reg: base address and length of the PCIe PHY block
+- #address-cells: must be 1
+- #size-cells: must be 0
+
+Each PCIe PHY should be represented by a child node
+
+Required properties For the child node:
+- reg: the PHY ID
+0 - PCIe RC 0
+1 - PCIe RC 1
+- #phy-cells: must be 0
+
+Example:
+	pcie0_phy: pcie-phy@1e149000 {
+		compatible = "mediatek,mt7621-pci-phy";
+		reg = <0x1e149000 0x0700>;
+		#address-cells = <1>;
+		#size-cells = <0>;

Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt line 32

Quoted 10 lines
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +10 -0
+
+		pcie0_port: pcie-phy@0 {
+			reg = <0>;
+			#phy-cells = <0>;
+		};
+
+		pcie1_port: pcie-phy@1 {
+			reg = <1>;
+			#phy-cells = <0>;
+		};

If each phy port doesn't have its own resources, then you don't need child nodes. Just set #phy-cells to 1.

Quoted 25 lines
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +22 -0
+	};
+
+	pcie1_phy: pcie-phy@1e14a000 {
+		compatible = "mediatek,mt7621-pci-phy";
+		reg = <0x1e14a000 0x0700>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		pcie2_port: pcie-phy@0 {
+			reg = <0>;
+			#phy-cells = <0>;
+		};
+	};
+
+	/* users of the PCIe phy */
+
+	pcie: pcie@1e140000 {
+		...
+		...
+		phys = <&pcie0_port>, <&pcie1_port>, <&pcie2_port>;
+		phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2";
+	};
Signature · 1 line
2.19.1
author maintainer
#4 lore raw

Re: [PATCH 2/2] dt-bindings: phy: Add binding for Mediatek MT7621 PCIe PHY

Hi Rob,

Thanks for the review.

Quoted 5 lines · Rob Herring
Quoted 1 line · Sergio Paracuellos

Add bindings to describe Mediatek MT7621 PCIe PHY.

Binding should come before the driver.

Do you mean this should be PATCH 1 of the series?

Quoted 41 lines
Quoted 41 lines
---
 .../bindings/phy/mediatek,mt7621-pci-phy.txt  | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +27 -0
new file mode 100644
index 000000000000..8addedbe815e
@@ -0,0 +1,54 @@
+Mediatek Mt7621 PCIe PHY
+
+Required properties:
+- compatible: must be "mediatek,mt7621-pci-phy"
+- reg: base address and length of the PCIe PHY block
+- #address-cells: must be 1
+- #size-cells: must be 0
+
+Each PCIe PHY should be represented by a child node
+
+Required properties For the child node:
+- reg: the PHY ID
+0 - PCIe RC 0
+1 - PCIe RC 1
+- #phy-cells: must be 0
+
+Example:
+     pcie0_phy: pcie-phy@1e149000 {
+             compatible = "mediatek,mt7621-pci-phy";
+             reg = <0x1e149000 0x0700>;
+             #address-cells = <1>;
+             #size-cells = <0>;
+
+             pcie0_port: pcie-phy@0 {
+                     reg = <0>;
+                     #phy-cells = <0>;
+             };
Quoted 8 lines

Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt line 32

Quoted 5 lines
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +5 -0
+
+             pcie1_port: pcie-phy@1 {
+                     reg = <1>;
+                     #phy-cells = <0>;
+             };

If each phy port doesn't have its own resources, then you don't need child nodes. Just set #phy-cells to 1.

I see. I will change those two into:

pcie0_phy: pcie-phy@1e149000 {
     compatible = "mediatek,mt7621-pci-phy";
     reg = <0x1e149000 0x0700>;
     #phy-cells = <1>;
};
pcie1_phy: pcie-phy@1e14a000 {
     compatible = "mediatek,mt7621-pci-phy";
     reg = <0x1e14a000 0x0700>;
     #phy-cells = <0>;
};
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +14 -0
+     };
+
+     pcie1_phy: pcie-phy@1e14a000 {
+             compatible = "mediatek,mt7621-pci-phy";
+             reg = <0x1e14a000 0x0700>;
+             #address-cells = <1>;
+             #size-cells = <0>;
+
+             pcie2_port: pcie-phy@0 {
+                     reg = <0>;
+                     #phy-cells = <0>;
+             };
+     };
+
Quoted 8 lines

Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt line 54

Quoted 8 lines
Documentation/devicetree/bindings/phy/mediatek,mt7621-pci-phy.txt new file +8 -0
+     /* users of the PCIe phy */
+
+     pcie: pcie@1e140000 {
+             ...
+             ...
+             phys = <&pcie0_port>, <&pcie1_port>, <&pcie2_port>;
+             phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2";
+     };

I think changing the previous one as you suggested make clients to do now:

pcie: pcie@1e140000 {
      phys = <&pcie0_phy 0>, <&pcie0_phy 1>, <&pcie1_phy>;
      phy-names = "pcie-phy0", "pcie-phy1", "pcie-phy2";
};

Am I right?

I have to figure out how to change the driver to achieve this changes also to properly get the phy.

Thanks, I will make the changes in staging to be tested by Neil a send v2 PATCHEs for this with your suggested changes.

Best regards and thanks again for your time.

Sergio Paracuellos