Skip to contentSkip to conversation

Add PCIe phy driver for some Mediatek SoCs

PATCH New Ryder Lee 1 participant 3 messages May 25, 2017

Subsystems (3)

v3 of 5 New Latest is v5 →

lore
Share & tools
lore

Ryder Lee

author
#0 lore raw

v3 cover Add PCIe phy driver for some Mediatek SoCs

Hi,

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

The PICe host driver has been applied to pci/host-mediatek for v4.13.

Changes since v3:
- rename both the driver and the binding document to make it more generic so that we could reuse the driver if needed in the future.
- correct some anotations.

Changes since v2:
- rebase to v4.12-rc1

Changes since v1:
- revise binding document:
drop 'status' properties.
add a description to 'phy-switch' property and add vendor prefix.

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

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

PATCH v3 1/2 phy: add PCIe PHY driver for Mediatek SoCs

This patch adds a generic PCIe PHY driver for Mediatek SoCs.

---
 drivers/phy/Kconfig             |   8 ++
 drivers/phy/Makefile            |   1 +
 drivers/phy/phy-mediatek-pcie.c | 290 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 299 insertions(+)
 create mode 100644 drivers/phy/phy-mediatek-pcie.c
drivers/phy/Kconfig +8 -0
index afaf7b6..220f12f 100644
@@ -241,6 +241,14 @@ config PHY_MT65XX_USB3
 	  Say 'Y' here to add support for Mediatek USB3.0 PHY driver,
 	  it supports multiple usb2.0 and usb3.0 ports.
 
+config PHY_MEDIATEK_PCIE
+	tristate "Mediatek PCIe PHY driver"
+	depends on ARCH_MEDIATEK && OF
+	select GENERIC_PHY
+	select MFD_SYSCON
+	help
+	  Say 'Y' here to add support for generic Mediatek PCIe PHY driver.
+
 config PHY_HI6220_USB
 	tristate "hi6220 USB PHY support"
 	depends on (ARCH_HISI && ARM64) || COMPILE_TEST
drivers/phy/Makefile +1 -0
index f8047b4..b337ae9 100644
@@ -28,6 +28,7 @@ obj-$(CONFIG_PHY_EXYNOS5250_SATA)	+= phy-exynos5250-sata.o
 obj-$(CONFIG_PHY_HIX5HD2_SATA)		+= phy-hix5hd2-sata.o
 obj-$(CONFIG_PHY_HI6220_USB)		+= phy-hi6220-usb.o
 obj-$(CONFIG_PHY_MT65XX_USB3)		+= phy-mt65xx-usb3.o
+obj-$(CONFIG_PHY_MEDIATEK_PCIE)		+= phy-mediatek-pcie.o
 obj-$(CONFIG_PHY_SUN4I_USB)		+= phy-sun4i-usb.o
 obj-$(CONFIG_PHY_SUN9I_USB)		+= phy-sun9i-usb.o
 obj-$(CONFIG_PHY_SAMSUNG_USB2)		+= phy-exynos-usb2.o
drivers/phy/phy-mediatek-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 v3 2/2 dt-bindings: phy: Add documentation for Mediatek PCIe PHY

In reply to Ryder Lee

Add dt-binding information for Mediatek PCIe PHY

---
 .../devicetree/bindings/phy/phy-mediatek-pcie.txt  | 64 ++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/phy-mediatek-pcie.txt
Documentation/devicetree/bindings/phy/phy-mediatek-pcie.txt new file +64 -0
new file mode 100644
index 0000000..a9cf0dd
@@ -0,0 +1,64 @@
+Mediatek PCIe PHY
+-----------------------
+
+Required properties:
+ - compatible: should be one of
+   "mediatek,mt7623-pcie-phy"
+   "mediatek,mt2701-pcie-phy"
+ - reg: Base address and length of the registers.
+ - clocks: Must contain an entry in clock-names.
+   See ../clocks/clock-bindings.txt for details.
+ - clock-names: Must be "pciephya_ref"
+ - #phy-cells: Must be 0.
+
+Optional properties:
+ - mediatek,phy-switch: A phandle to the system controller, used to
+   enable the PCIe PHY function if needed.
+
+Example:
+
+	pcie0_phy: pcie-phy at 1a149000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a149000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+	};
+
+	pcie1_phy: pcie-phy at 1a14a000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a14a000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+	};
+
+	pcie2_phy: pcie-phy at 1a244000 {
+		compatible = "mediatek,mt7623-pcie-phy";
+		reg = <0 0x1a244000 0 0x1000>;
+		clocks = <&clk26m>;
+		clock-names = "pciephya_ref";
+		#phy-cells = <0>;
+
+		mediatek,phy-switch = <&hifsys>;
+	};
+
+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 0,0 {
+		...
+		phys = <&pcie0_phy>;
+		phy-names = "pcie-phy0";
+	}
+	...
+};
Signature · 1 line
1.9.1