Skip to contentSkip to conversation

ARM64: dts: meson-gxl: Enable Ethernet

PATCH Applied Neil Armstrong 2 participants 7 messages Nov 7, 2016 – Nov 14, 2016

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

cover ARM64: dts: meson-gxl: Enable Ethernet

The Amlogic Meson GXL SoCs have an internal RMII PHY that is muxed with the external RGMII pins.

The internal PHY is added in the GXL dtsi and support for each board is added in intermediate board family dtsi or final dts.

This patchset depends on ARM64 dts patch at [1]

Changes since v2 RFC at : [3]
- Change phy Kconfig/Makefile alphabetic order
- GXL dtsi cleanup
- Add P230 External PHY reset
- Add external PHY compatible ID string

Changes since original RFC patchset at : [2]
- Remove meson8b experimental phy switching
- Switch to mdio-mux-mmioreg with extennded size support
- Add internal phy support for S905x and p231
- Add external PHY support for p230

[1] http://lkml.kernel.org/r/1477932286-27482-1-git-send-email-narmstrong at baylibre.com
[2] http://lkml.kernel.org/r/1477060838-14164-1-git-send-email-narmstrong at baylibre.com
[3] http://lkml.kernel.org/r/1477932987-27871-1-git-send-email-narmstrong at baylibre.com

Neil Armstrong (3):
ARM64: dts: meson-gxl: Add ethernet nodes with internal PHY
ARM64: dts: meson-gxl-p23x: Enable ethernet
ARM64: dts: meson-gxl-s905x: Enable internal ethernet PHY

 .../boot/dts/amlogic/meson-gxl-s905d-p230.dts      | 25 +++++++++++++
 .../boot/dts/amlogic/meson-gxl-s905d-p231.dts      |  6 +++
 .../boot/dts/amlogic/meson-gxl-s905d-p23x.dtsi     |  4 ++
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x.dtsi   |  6 +++
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi         | 43 ++++++++++++++++++++++
 5 files changed, 84 insertions(+)
Signature · 1 line
2.7.0
#1 lore raw

PATCH 1/3 ARM64: dts: meson-gxl: Add ethernet nodes with internal PHY

Add Ethernet node with Internal PHY selection for the Amlogic GXL SoCs

---
 arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 43 ++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl.dtsi +43 -0
index d1bf381..3af54dc 100644
@@ -49,6 +49,22 @@
 	compatible = "amlogic,meson-gxl";
 };
 
+&ethmac {
+	reg = <0x0 0xc9410000 0x0 0x10000
+	       0x0 0xc8834540 0x0 0x4>;
+
+	clocks = <&clkc CLKID_ETH>,
+		 <&clkc CLKID_FCLK_DIV2>,
+		 <&clkc CLKID_MPLL2>;
+	clock-names = "stmmaceth", "clkin0", "clkin1";
+
+	mdio0: mdio {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "snps,dwmac-mdio";
+	};
+};
+
 &aobus {
 	pinctrl_aobus: pinctrl at 14 {
 		compatible = "amlogic,meson-gxl-aobus-pinctrl";
@@ -214,6 +230,33 @@
 			};
 		};
 	};
+
+	eth-phy-mux {
+		compatible = "mdio-mux-mmioreg", "mdio-mux";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0x0 0x55c 0x0 0x4>;
+		mux-mask = <0xffffffff>;
+		mdio-parent-bus = <&mdio0>;
+
+		internal_mdio: mdio at e40908ff {
+			reg = <0xe40908ff>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			internal_phy: ethernet-phy at 8 {
+				compatible = "ethernet-phy-id0181.4400", "ethernet-phy-ieee802.3-c22";
+				reg = <8>;
+				max-speed = <100>;
+			};
+		};
+
+		external_mdio: mdio at 2009087f {
+			reg = <0x2009087f>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+	};
 };
 
 &hiubus {
Signature · 1 line
2.7.0
#2 lore raw

PATCH 2/3 ARM64: dts: meson-gxl-p23x: Enable ethernet

In reply to Neil Armstrong

Enable Ethernet on the p23x board, pinctrl attribute is only added for the p230 board since the p231 only uses the Internal PHY.

---
 .../boot/dts/amlogic/meson-gxl-s905d-p230.dts      | 25 ++++++++++++++++++++++
 .../boot/dts/amlogic/meson-gxl-s905d-p231.dts      |  6 ++++++
 .../boot/dts/amlogic/meson-gxl-s905d-p23x.dtsi     |  4 ++++
 3 files changed, 35 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p230.dts +25 -0
index 3dfaa37..4d082a7 100644
@@ -49,3 +49,28 @@
 	compatible = "amlogic,p230", "amlogic,s905d", "amlogic,meson-gxl";
 	model = "Amlogic Meson GXL (S905D) P230 Development Board";
 };
+
+/* P230 has exclusive choice between internal or external PHY */
+&ethmac {
+	pinctrl-0 = <&eth_pins>;
+	pinctrl-names = "default";
+
+	/* Select external PHY by default */
+	phy-handle = <&external_phy>;
+
+	/* External PHY reset is shared with internal PHY Led signals */
+	snps,reset-gpio = <&gpio GPIOZ_14 0>;
+	snps,reset-delays-us = <0 10000 1000000>;
+	snps,reset-active-low;
+
+	/* External PHY is in RGMII */
+	phy-mode = "rgmii";
+};
+
+&external_mdio {
+	external_phy: ethernet-phy at 0 {
+		compatible = "ethernet-phy-id001c.c916", "ethernet-phy-ieee802.3-c22";
+		reg = <0>;
+		max-speed = <1000>;
+	};
+};
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p231.dts +6 -0
index ade8d29..1cc8d49 100644
@@ -49,3 +49,9 @@
 	compatible = "amlogic,p231", "amlogic,s905d", "amlogic,meson-gxl";
 	model = "Amlogic Meson GXL (S905D) P231 Development Board";
 };
+
+/* P231 has only internal PHY port */
+&ethmac {
+	phy-mode = "rmii";
+	phy-handle = <&internal_phy>;
+};
arch/arm64/boot/dts/amlogic/meson-gxl-s905d-p23x.dtsi +4 -0
index bbe46a2..622ffbe 100644
@@ -182,3 +182,7 @@
 	clocks = <&clkc CLKID_FCLK_DIV4>;
 	clock-names = "clkin0";
 };
+
+&ethmac {
+	status = "okay";
+};
Signature · 1 line
2.7.0
#3 lore raw

PATCH 3/3 ARM64: dts: meson-gxl-s905x: Enable internal ethernet PHY

In reply to Neil Armstrong
---
 arch/arm64/boot/dts/amlogic/meson-gxl-s905x.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxl-s905x.dtsi +6 -0
index 07f0e0b..08237ee 100644
@@ -46,3 +46,9 @@
 / {
 	compatible = "amlogic,s905x", "amlogic,meson-gxl";
 };
+
+/* S905X Only has access to its internal PHY */
+&ethmac {
+	phy-mode = "rmii";
+	phy-handle = <&internal_phy>;
+};
Signature · 1 line
2.7.0
#4 lore raw

PATCH 1/1 ARM64: configs: Activate Internal PHY for Meson GXL

In reply to Neil Armstrong
---
 arch/arm64/configs/defconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/configs/defconfig +3 -0
index dab2cb0..3890321 100644
@@ -183,7 +183,10 @@ CONFIG_SMC91X=y
 CONFIG_SMSC911X=y
 CONFIG_STMMAC_ETH=m
 CONFIG_REALTEK_PHY=m
+CONFIG_MESON_GXL_PHY=m
 CONFIG_MICREL_PHY=y
+CONFIG_MDIO_BUS_MUX=y
+CONFIG_MDIO_BUS_MUX_MMIOREG=y
 CONFIG_USB_PEGASUS=m
 CONFIG_USB_RTL8150=m
 CONFIG_USB_RTL8152=m
Signature · 1 line
1.9.1
maintainer Applied
#6 lore raw
In reply to Neil Armstrong
Quoted 5 lines · Neil Armstrong

The Amlogic Meson GXL SoCs have an internal RMII PHY that is muxed with the external RGMII pins.

The internal PHY is added in the GXL dtsi and support for each board is added in intermediate board family dtsi or final dts.

Tested external phy and internal phy (using p231 DT) on my p230 board.

Applied to v4.10/dt64

Kevin