Skip to contentSkip to conversation

arm64: dts: meson: g12a: add ethernet support

PATCH Applied Jerome Brunet 4 participants 17 messages May 20, 2019 – May 23, 2019

Subsystems (2)
lore
Share & tools
lore

Jerome Brunet

author reviewer
#0 lore raw

v2 cover arm64: dts: meson: g12a: add ethernet support

Add network support to the g12a SoC family

This is series is based on 5.2-rc1 and the patches I already sent last week. If this is not convient for you, please let me know, I'll rebase.

Also, you will need to get the clk tag "clk-meson-5.3-1-fixes" (to get the update MPLL50M id) from clk-meson [0].

Changes since v1: [1]
* rebased on v5.2-rc1
* s/eth_rmii_pins/eth_pins
* fix MPLL50M typo

[0]: git://github.com/BayLibre/clk-meson.git
[1]: https://lkml.kernel.org/r/[email protected]

Jerome Brunet (5):
arm64: dts: meson: g12a: add ethernet mac controller
arm64: dts: meson: g12a: add ethernet pinctrl definitions
arm64: dts: meson: g12a: add mdio multiplexer
arm64: dts: meson: u200: add internal network
arm64: dts: meson: sei510: add network support

 .../boot/dts/amlogic/meson-g12a-sei510.dts    |  7 ++
 .../boot/dts/amlogic/meson-g12a-u200.dts      |  7 ++
 arch/arm64/boot/dts/amlogic/meson-g12a.dtsi   | 90 +++++++++++++++++++
 3 files changed, 104 insertions(+)
Signature · 1 line
2.20.1
author reviewer
#1 lore raw

PATCH v2 1/5 arm64: dts: meson: g12a: add ethernet mac controller

Add the synopsys ethernet mac controller embedded in the g12a SoC family.

---
 arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +21 -0
index fd24fd29f4ed..1d16cd2107ea 100644
@@ -137,6 +137,27 @@
 		#size-cells = <2>;
 		ranges;
 
+		ethmac: ethernet@ff3f0000 {
+			compatible = "amlogic,meson-axg-dwmac",
+				     "snps,dwmac-3.70a",
+				     "snps,dwmac";
+			reg = <0x0 0xff3f0000 0x0 0x10000
+			       0x0 0xff634540 0x0 0x8>;
+			interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
+			interrupt-names = "macirq";
+			clocks = <&clkc CLKID_ETH>,
+				 <&clkc CLKID_FCLK_DIV2>,
+				 <&clkc CLKID_MPLL2>;
+			clock-names = "stmmaceth", "clkin0", "clkin1";
+			status = "disabled";
+
+			mdio0: mdio {
+				#address-cells = <1>;
+				#size-cells = <0>;
+				compatible = "snps,dwmac-mdio";
+			};
+		};
+
 		apb: bus@ff600000 {
 			compatible = "simple-bus";
 			reg = <0x0 0xff600000 0x0 0x200000>;
Signature · 1 line
2.20.1
author reviewer
#3 lore raw

PATCH v2 2/5 arm64: dts: meson: g12a: add ethernet pinctrl definitions

In reply to Jerome Brunet

Add the ethernet pinctrl settings for RMII, RGMII and internal phy leds

---
 arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 37 +++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +37 -0
index 1d16cd2107ea..def02ebf6501 100644
@@ -1109,6 +1109,43 @@
 						};
 					};
 
+					eth_leds_pins: eth-leds {
+						mux {
+							groups = "eth_link_led",
+								 "eth_act_led";
+							function = "eth";
+							bias-disable;
+						};
+					};
+
+					eth_pins: eth {
+						mux {
+							groups = "eth_mdio",
+								 "eth_mdc",
+								 "eth_rgmii_rx_clk",
+								 "eth_rx_dv",
+								 "eth_rxd0",
+								 "eth_rxd1",
+								 "eth_txen",
+								 "eth_txd0",
+								 "eth_txd1";
+							function = "eth";
+							bias-disable;
+						};
+					};
+
+					eth_rgmii_pins: eth-rgmii {
+						mux {
+							groups = "eth_rxd2_rgmii",
+								 "eth_rxd3_rgmii",
+								 "eth_rgmii_tx_clk",
+								 "eth_txd2_rgmii",
+								 "eth_txd3_rgmii";
+							function = "eth";
+							bias-disable;
+						};
+					};
+
 					tdm_c_din2_z_pins: tdm-c-din2-z {
 						mux {
 							groups = "tdm_c_din2_z";
Signature · 1 line
2.20.1
author reviewer
#5 lore raw

PATCH v2 3/5 arm64: dts: meson: g12a: add mdio multiplexer

In reply to Jerome Brunet

Add the g12a mdio multiplexer which allows to connect to either an external phy through the SoC pins or the internal 10/100 phy

---
 arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 32 +++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +32 -0
index def02ebf6501..90da7cc81681 100644
@@ -1698,6 +1698,38 @@
 				assigned-clock-rates = <100000000>;
 				#phy-cells = <1>;
 			};
+
+			eth_phy: mdio-multiplexer@4c000 {
+				compatible = "amlogic,g12a-mdio-mux";
+				reg = <0x0 0x4c000 0x0 0xa4>;
+				clocks = <&clkc CLKID_ETH_PHY>,
+					 <&xtal>,
+					 <&clkc CLKID_MPLL_50M>;
+				clock-names = "pclk", "clkin0", "clkin1";
+				mdio-parent-bus = <&mdio0>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				ext_mdio: mdio@0 {
+					reg = <0>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+				};
+
+				int_mdio: mdio@1 {
+					reg = <1>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					internal_ephy: ethernet_phy@8 {
+						compatible = "ethernet-phy-id0180.3301",
+							     "ethernet-phy-ieee802.3-c22";
+						interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+						reg = <8>;
+						max-speed = <100>;
+					};
+				};
+			};
 		};
 
 		aobus: bus@ff800000 {
Signature · 1 line
2.20.1
reviewer Acked-by on v2 3/5
#6 lore raw

Re: [PATCH v2 3/5] arm64: dts: meson: g12a: add mdio multiplexer

Hi Jerome,

Quoted 5 lines · Jerome Brunet

Add the g12a mdio multiplexer which allows to connect to either an external phy through the SoC pins or the internal 10/100 phy

Quoted 28 lines
---
 arch/arm64/boot/dts/amlogic/meson-g12a.dtsi | 32 +++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +16 -0
index def02ebf6501..90da7cc81681 100644
@@ -1698,6 +1698,38 @@
                                assigned-clock-rates = <100000000>;
                                #phy-cells = <1>;
                        };
+
+                       eth_phy: mdio-multiplexer@4c000 {
+                               compatible = "amlogic,g12a-mdio-mux";
+                               reg = <0x0 0x4c000 0x0 0xa4>;
+                               clocks = <&clkc CLKID_ETH_PHY>,
+                                        <&xtal>,
+                                        <&clkc CLKID_MPLL_50M>;
+                               clock-names = "pclk", "clkin0", "clkin1";
+                               mdio-parent-bus = <&mdio0>;
+                               #address-cells = <1>;
+                               #size-cells = <0>;
+
+                               ext_mdio: mdio@0 {
+                                       reg = <0>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;

arch/arm64/boot/dts/amlogic/meson-g12a.dtsi line 1726

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +10 -0
+                               };
+
+                               int_mdio: mdio@1 {
+                                       reg = <1>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       internal_ephy: ethernet_phy@8 {
+                                               compatible = "ethernet-phy-id0180.3301",
+                                                            "ethernet-phy-ieee802.3-c22";

Based on your comment on v1 of this patch [0] the Ethernet PHY ID is defined by this "mdio-multiplexer" (write arbitrary value to a register then that's the PHY ID which will show up on the bus) I'm fine with explicitly listing the ID which the PHY driver binds to because I don't know a better way.

+Cc Andrew, Florian and Heiner because I think they should be aware of such cases (it seems like a special case to me).

Martin

[0] https://patchwork.kernel.org/patch/10939255/

#7 lore raw

Re: [PATCH v2 3/5] arm64: dts: meson: g12a: add mdio multiplexer

Quoted 8 lines

arch/arm64/boot/dts/amlogic/meson-g12a.dtsi line 1726

Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +8 -0
+                               int_mdio: mdio@1 {
+                                       reg = <1>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       internal_ephy: ethernet_phy@8 {
+                                               compatible = "ethernet-phy-id0180.3301",
+                                                            "ethernet-phy-ieee802.3-c22";
Quoted 5 lines

Based on your comment on v1 of this patch [0] the Ethernet PHY ID is defined by this "mdio-multiplexer" (write arbitrary value to a register then that's the PHY ID which will show up on the bus) I'm fine with explicitly listing the ID which the PHY driver binds to because I don't know a better way.

Does reading the ID registers give the correct ID, once you have poked registers in the mdio-multiplexer? If so, you don't need this compatible string.

If the read is giving the wrong ID, then yes, you do want this. But then please add a comment in the DT blob. This is very unusual, so should have some explanation why it is needed.

Thanks
Andrew

author reviewer
#8 lore raw

Re: [PATCH v2 3/5] arm64: dts: meson: g12a: add mdio multiplexer

Quoted 13 lines · Andrew Lunn
Quoted 13 lines

arch/arm64/boot/dts/amlogic/meson-g12a.dtsi line 1726

Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +8 -0
+                               int_mdio: mdio@1 {
+                                       reg = <1>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       internal_ephy: ethernet_phy@8 {
+                                               compatible = "ethernet-phy-id0180.3301",
+                                                            "ethernet-phy-ieee802.3-c22";

Based on your comment on v1 of this patch [0] the Ethernet PHY ID is defined by this "mdio-multiplexer" (write arbitrary value to a register then that's the PHY ID which will show up on the bus) I'm fine with explicitly listing the ID which the PHY driver binds to because I don't know a better way.

...

Quoted 4 lines

Does reading the ID registers give the correct ID, once you have poked registers in the mdio-multiplexer? If so, you don't need this compatible string.

Hi Andrew,

In 5.1 the mdio-mux set a wrong simply because I got it wrong. I pushed a fix for that, and maybe it has already hit mainline.

As I pointed to Martin on v1, this situation just shows that this setting is weaker than the usual phy setup.

I do understand why we don't want to put the PHY id in DT. If the PHY fitted on the board changes, we want to pick it up. This particular phy is embedded in SoC, we know it won't change for this SoC, whatever the mdio-mux sets.

So yes it should (soon) work as usual, setting this id is not strictly necessary but it nicely reflect that this particular phy is integrated in the SoC and we know which driver to use.

So, if this is ok with you, I'd prefer to keep this particular id around.

Quoted 4 lines

If the read is giving the wrong ID, then yes, you do want this. But then please add a comment in the DT blob. This is very unusual, so should have some explanation why it is needed.

Sure, can add a comment. I suggest to do it in follow-up. At least it keeps things aligned between the gxl, which has been like this for quite a while now, and g12a.

Quoted 3 lines

Thanks
Andrew

maintainer
#9 lore raw

Re: [PATCH v2 3/5] arm64: dts: meson: g12a: add mdio multiplexer

Quoted 34 lines · Jerome Brunet
Quoted 13 lines · Andrew Lunn
Quoted 13 lines

arch/arm64/boot/dts/amlogic/meson-g12a.dtsi line 1726

Quoted 8 lines
arch/arm64/boot/dts/amlogic/meson-g12a.dtsi +8 -0
+                               int_mdio: mdio@1 {
+                                       reg = <1>;
+                                       #address-cells = <1>;
+                                       #size-cells = <0>;
+
+                                       internal_ephy: ethernet_phy@8 {
+                                               compatible = "ethernet-phy-id0180.3301",
+                                                            "ethernet-phy-ieee802.3-c22";

Based on your comment on v1 of this patch [0] the Ethernet PHY ID is defined by this "mdio-multiplexer" (write arbitrary value to a register then that's the PHY ID which will show up on the bus) I'm fine with explicitly listing the ID which the PHY driver binds to because I don't know a better way.

...

Quoted 4 lines

Does reading the ID registers give the correct ID, once you have poked registers in the mdio-multiplexer? If so, you don't need this compatible string.

Hi Andrew,

In 5.1 the mdio-mux set a wrong simply because I got it wrong. I pushed a fix for that, and maybe it has already hit mainline.

As I pointed to Martin on v1, this situation just shows that this setting is weaker than the usual phy setup.

I do understand why we don't want to put the PHY id in DT. If the PHY fitted on the board changes, we want to pick it up. This particular phy is embedded in SoC, we know it won't change for this SoC, whatever the mdio-mux sets.

Quoted 5 lines

So yes it should (soon) work as usual, setting this id is not strictly necessary but it nicely reflect that this particular phy is integrated in the SoC and we know which driver to use.

So, if this is ok with you, I'd prefer to keep this particular id around.

Seems OK to me, so I'm queuing this for v5.3 because we really need network support. It can be removed later if it's really insisted on.

Quoted 8 lines
Quoted 4 lines

If the read is giving the wrong ID, then yes, you do want this. But then please add a comment in the DT blob. This is very unusual, so should have some explanation why it is needed.

Sure, can add a comment. I suggest to do it in follow-up. At least it keeps things aligned between the gxl, which has been like this for quite a while now, and g12a.

Follow-up is good for me,

Kevin

author reviewer
#10 lore raw

PATCH v2 4/5 arm64: dts: meson: u200: add internal network

In reply to Jerome Brunet

The u200 is the main mother board for the S905D2. It can provide both the internal and external network. However, by default the resistance required for the external RGMII bus are not fitted, so enable the internal PHY.

---
 arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a-u200.dts +7 -0
index e02534ab7673..8551fbd4a488 100644
@@ -15,6 +15,7 @@
 
 	aliases {
 		serial0 = &uart_AO;
+		ethernet0 = &ethmac;
 	};
 
 	chosen {
@@ -150,6 +151,12 @@
 	};
 };
 
+&ethmac {
+	status = "okay";
+	phy-handle = <&internal_ephy>;
+	phy-mode = "rmii";
+};
+
 &hdmi_tx {
 	status = "okay";
 	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
Signature · 1 line
2.20.1
reviewer Acked-by on v2 4/5
#11 lore raw

Re: [PATCH v2 4/5] arm64: dts: meson: u200: add internal network

Quoted 7 lines · Jerome Brunet

The u200 is the main mother board for the S905D2. It can provide both the internal and external network. However, by default the resistance required for the external RGMII bus are not fitted, so enable the internal PHY.

I don't have this board but it looks sane so:

author reviewer
#12 lore raw

PATCH v2 5/5 arm64: dts: meson: sei510: add network support

In reply to Jerome Brunet

Enable the network interface of the SEI510 which use the internal PHY.

---
 arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts +7 -0
index 484b93ef11d8..be1d9ed6d521 100644
@@ -29,6 +29,7 @@
 
 	aliases {
 		serial0 = &uart_AO;
+		ethernet0 = &ethmac;
 	};
 
 	chosen {
@@ -149,6 +150,12 @@
 	};
 };
 
+&ethmac {
+	status = "okay";
+	phy-handle = <&internal_ephy>;
+	phy-mode = "rmii";
+};
+
 &hdmi_tx {
 	status = "okay";
 	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
Signature · 1 line
2.20.1
maintainer
#14 lore raw
In reply to Jerome Brunet
Quoted 4 lines · Jerome Brunet

Add network support to the g12a SoC family

This is series is based on 5.2-rc1 and the patches I already sent last week. If this is not convient for you, please let me know, I'll rebase.

Could you apply this on top of the "consistently order nodes" patches that are already in my v5.3/dt64 branch?

More specifically, if you rebase this onto this commit[1], I'll be able to easily replace the v1 of this series that's already in v5.3/dt64.

Kevin

[1] 5b9533f6de2a arm64: dts: meson: u200: consistently order nodes

Quoted 25 lines

Also, you will need to get the clk tag "clk-meson-5.3-1-fixes" (to get the update MPLL50M id) from clk-meson [0].

Changes since v1: [1]
* rebased on v5.2-rc1
* s/eth_rmii_pins/eth_pins
* fix MPLL50M typo

[0]: git://github.com/BayLibre/clk-meson.git
[1]: https://lkml.kernel.org/r/[email protected]

Jerome Brunet (5):
arm64: dts: meson: g12a: add ethernet mac controller
arm64: dts: meson: g12a: add ethernet pinctrl definitions
arm64: dts: meson: g12a: add mdio multiplexer
arm64: dts: meson: u200: add internal network
arm64: dts: meson: sei510: add network support

 .../boot/dts/amlogic/meson-g12a-sei510.dts    |  7 ++
 .../boot/dts/amlogic/meson-g12a-u200.dts      |  7 ++
 arch/arm64/boot/dts/amlogic/meson-g12a.dtsi   | 90 +++++++++++++++++++
 3 files changed, 104 insertions(+)
Signature · 1 line
2.20.1
maintainer
#15 lore raw
Quoted 9 lines · Kevin Hilman
Quoted 4 lines · Jerome Brunet

Add network support to the g12a SoC family

This is series is based on 5.2-rc1 and the patches I already sent last week. If this is not convient for you, please let me know, I'll rebase.

Could you apply this on top of the "consistently order nodes" patches that are already in my v5.3/dt64 branch?

Nevermind, I mis-read the above and thought it was on v5.2-rc1, but now see that it's on -rc1 + all your other series, so it's all good.

Kevin

maintainer Applied
#16 lore raw
In reply to Jerome Brunet
Quoted 4 lines · Jerome Brunet

Add network support to the g12a SoC family

This is series is based on 5.2-rc1 and the patches I already sent last week. If this is not convient for you, please let me know, I'll rebase.

Queued for v5.3.

Quoted 2 lines

Also, you will need to get the clk tag "clk-meson-5.3-1-fixes" (to get the update MPLL50M id) from clk-meson [0].

I merged this tag in to v5.3/dt64 before applying this series. Thanks for explaining the dependencies.

Kevin