Skip to contentSkip to conversation

Add PCIe phy driver for some Mediatek SoCs

PATCH In review Ryder Lee 2 participants 5 messages Apr 23, 2017 – May 2, 2017

Subsystems (3)
lore
Share & tools
lore

Ryder Lee

author
#0 lore raw

cover Add PCIe phy driver for some Mediatek SoCs

Hi,

This patch series add PCIe phy driver and related dt-binding file for Mediatek mt7623 SoCs families.

Thanks.

Ryder Lee (2):
phy: add PCIe phy driver for mt7623 SoCs families
dt-bindings: phy: Add documentation for Mediatek PCIe PHY

 .../devicetree/bindings/phy/phy-mt7623-pcie.txt    |  67 +++++
 drivers/phy/Kconfig                                |   9 +
 drivers/phy/Makefile                               |   1 +
 drivers/phy/phy-mt7623-pcie.c                      | 290 +++++++++++++++++++++
 4 files changed, 367 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt
 create mode 100644 drivers/phy/phy-mt7623-pcie.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/2 phy: add PCIe phy driver for mt7623 SoCs families

support PCIe phy of mt7623 SoCs families

---
 drivers/phy/Kconfig           |   9 ++
 drivers/phy/Makefile          |   1 +
 drivers/phy/phy-mt7623-pcie.c | 290 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 300 insertions(+)
 create mode 100644 drivers/phy/phy-mt7623-pcie.c
drivers/phy/Kconfig +9 -0
index dc5277a..00ab313 100644
@@ -518,4 +518,13 @@ config PHY_NSP_USB3
 	help
 	  Enable this to support the Broadcom Northstar plus USB3 PHY.
 	  If unsure, say N.
+
+config PHY_MT7623_PCIE
+	tristate "Mediatek PCIe PHY driver for MT7623 SoC families"
+	depends on ARCH_MEDIATEK && OF
+	select GENERIC_PHY
+	select MFD_SYSCON
+	help
+	  Say 'Y' here to add support for Mediatek PCIe PHY driver which
+	  can be found on the MT7623 SoC families.
 endmenu
drivers/phy/Makefile +1 -0
index e7b0feb..95032d6 100644
@@ -63,3 +63,4 @@ obj-$(CONFIG_ARCH_TEGRA) += tegra/
 obj-$(CONFIG_PHY_NS2_PCIE)		+= phy-bcm-ns2-pcie.o
 obj-$(CONFIG_PHY_MESON8B_USB2)		+= phy-meson8b-usb2.o
 obj-$(CONFIG_PHY_NSP_USB3)		+= phy-bcm-nsp-usb3.o
+obj-$(CONFIG_PHY_MT7623_PCIE)		+= phy-mt7623-pcie.o
drivers/phy/phy-mt7623-pcie.c new file +290 -0

290 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#2 lore raw

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

In reply to Ryder Lee

Add documentation for PCIe PHY available in MT7623 series SoCs.

---
 .../devicetree/bindings/phy/phy-mt7623-pcie.txt    | 67 ++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +67 -0
new file mode 100644
index 0000000..27a9253
@@ -0,0 +1,67 @@
+Mediatek MT7623 PCIe PHY
+-----------------------
+
+Required properties:
+ - compatible: Should contain "mediatek,mt7623-pcie-phy"
+ - #phy-cells: must be 0
+ - clocks: Must contain an entry in clock-names.
+	See ../clocks/clock-bindings.txt for details.
+ - clock-names: Must be "refclk"
+ - resets: Must contain an entry in reset-names.
+	See ../reset/reset.txt for details.
+ - reset-names: Must be "phy"
+
+Optional properties:
+ - phy-switch: The PHY on PCIe port2 is shared with USB u3phy2. If you
+	want to enable port2, you should contain it.
+
+Example:
+
+	pcie0_phy: pciephy at 1a149000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a149000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+		status = "disabled";
+	};
+
+	pcie1_phy: pciephy at 1a14a000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a14a000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+		status = "disabled";
+	};
+
+	pcie2_phy: pciephy at 1a244000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a244000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+
+		phy-switch = <&hifsys>;
+		status = "disabled";
+	};
+
+Specifying phy control of devices
+---------------------------------
+
+Device nodes should specify the configuration required in their "phys"
+property, containing a phandle to the phy node and phy-names.
+
+Example:
+
+#include <dt-bindings/phy/phy.h>
+
+pcie: pcie at 1a140000 {
+	...
+	pcie at 1,0 {
+		...
+		phys = <&pcie0_phy>;
+		phy-names = "pcie-phy0";
+	}
+	...
+};
Signature · 1 line
1.9.1
maintainer
#3 lore raw

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

Quoted 20 lines · Ryder Lee

Add documentation for PCIe PHY available in MT7623 series SoCs.

---
 .../devicetree/bindings/phy/phy-mt7623-pcie.txt    | 67 ++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +6 -0
new file mode 100644
index 0000000..27a9253
@@ -0,0 +1,67 @@
+Mediatek MT7623 PCIe PHY
+-----------------------
+
+Required properties:
+ - compatible: Should contain "mediatek,mt7623-pcie-phy"
+ - #phy-cells: must be 0

Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +10 -0
+ - clocks: Must contain an entry in clock-names.
+	See ../clocks/clock-bindings.txt for details.
+ - clock-names: Must be "refclk"
+ - resets: Must contain an entry in reset-names.
+	See ../reset/reset.txt for details.
+ - reset-names: Must be "phy"
+
+Optional properties:
+ - phy-switch: The PHY on PCIe port2 is shared with USB u3phy2. If you
+	want to enable port2, you should contain it.

Need to state what the value is (i.e. a phandle to ?). Also needs a vendor prefix.

Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +4 -0
+
+Example:
+
+	pcie0_phy: pciephy at 1a149000 {

pcie-phy at ...

Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt line 26

Quoted 6 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +6 -0
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a149000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+		status = "disabled";

Don't show status in examples.

Quoted 44 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +41 -0
+	};
+
+	pcie1_phy: pciephy at 1a14a000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a14a000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+		status = "disabled";
+	};
+
+	pcie2_phy: pciephy at 1a244000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a244000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+
+		phy-switch = <&hifsys>;
+		status = "disabled";
+	};
+
+Specifying phy control of devices
+---------------------------------
+
+Device nodes should specify the configuration required in their "phys"
+property, containing a phandle to the phy node and phy-names.
+
+Example:
+
+#include <dt-bindings/phy/phy.h>
+
+pcie: pcie at 1a140000 {
+	...
+	pcie at 1,0 {
+		...
+		phys = <&pcie0_phy>;
+		phy-names = "pcie-phy0";
+	}
+	...
+};
Signature · 1 line
1.9.1
author
#4 lore raw

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

Quoted 26 lines · Rob Herring
Quoted 25 lines · Ryder Lee

Add documentation for PCIe PHY available in MT7623 series SoCs.

---
 .../devicetree/bindings/phy/phy-mt7623-pcie.txt    | 67 ++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +11 -0
new file mode 100644
index 0000000..27a9253
@@ -0,0 +1,67 @@
+Mediatek MT7623 PCIe PHY
+-----------------------
+
+Required properties:
+ - compatible: Should contain "mediatek,mt7623-pcie-phy"
+ - #phy-cells: must be 0
+ - clocks: Must contain an entry in clock-names.
+	See ../clocks/clock-bindings.txt for details.
+ - clock-names: Must be "refclk"
+ - resets: Must contain an entry in reset-names.
+	See ../reset/reset.txt for details.
Quoted 8 lines

Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt line 16

Quoted 5 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +5 -0
+ - reset-names: Must be "phy"
+
+Optional properties:
+ - phy-switch: The PHY on PCIe port2 is shared with USB u3phy2. If you
+	want to enable port2, you should contain it.

Need to state what the value is (i.e. a phandle to ?). Also needs a vendor prefix.

I will correct it.

Quoted 6 lines

Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +4 -0
+
+Example:
+
+	pcie0_phy: pciephy at 1a149000 {

pcie-phy at ...

Okay.

Quoted 8 lines

Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt line 26

Quoted 6 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +6 -0
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a149000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+		status = "disabled";

Don't show status in examples.

I will drop it all.

Quoted 33 lines
Quoted 33 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +33 -0
+	};
+
+	pcie1_phy: pciephy at 1a14a000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a14a000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+		status = "disabled";
+	};
+
+	pcie2_phy: pciephy at 1a244000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a244000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+
+		phy-switch = <&hifsys>;
+		status = "disabled";
+	};
+
+Specifying phy control of devices
+---------------------------------
+
+Device nodes should specify the configuration required in their "phys"
+property, containing a phandle to the phy node and phy-names.
+
+Example:
+
+#include <dt-bindings/phy/phy.h>
+
+pcie: pcie at 1a140000 {
Quoted 8 lines

Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt line 67

Quoted 8 lines
Documentation/devicetree/bindings/phy/phy-mt7623-pcie.txt new file +8 -0
+	...
+	pcie at 1,0 {
+		...
+		phys = <&pcie0_phy>;
+		phy-names = "pcie-phy0";
+	}
+	...
+};

Thanks for your reviews.

Quoted 3 lines
Quoted 3 lines
Signature · 1 line
1.9.1