Skip to contentSkip to conversation

arm64: dts: mt8195: Add Ethernet controller

PATCH Superseded Biao Huang 2 participants 4 messages Oct 19, 2022 – Oct 20, 2022

Subsystems (2)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Biao Huang

author
#0 lore raw

v2 cover arm64: dts: mt8195: Add Ethernet controller

Changes in v2:
1. modify pinctrl node used by ethernet to match rules in pinctrl-mt8195.yaml, as comments from Krzysztof.
2. remove "mac-address" property in ethernet node as comments from Krzysztof.

Changes in v1:
add dts node for MT8195 Ethernet controller

Biao Huang (1):
arm64: dts: mt8195: Add Ethernet controller

 arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 88 ++++++++++++++++++++
 arch/arm64/boot/dts/mediatek/mt8195.dtsi     | 86 +++++++++++++++++++
 2 files changed, 174 insertions(+)
Signature · 1 line
2.18.0
author
#1 lore raw

PATCH v2 1/1 arm64: dts: mt8195: Add Ethernet controller

Add Ethernet controller node for mt8195.

---
 arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 88 ++++++++++++++++++++
 arch/arm64/boot/dts/mediatek/mt8195.dtsi     | 86 +++++++++++++++++++
 2 files changed, 174 insertions(+)
arch/arm64/boot/dts/mediatek/mt8195-demo.dts +88 -0
index 4fbd99eb496a..0e8496d837ef 100644
@@ -258,6 +258,72 @@ &mt6359_vsram_others_ldo_reg {
 };
 
 &pio {
+	eth_default_pins: eth-default-pins {
+		pins-txd {
+			pinmux = <PINMUX_GPIO77__FUNC_GBE_TXD3>,
+				 <PINMUX_GPIO78__FUNC_GBE_TXD2>,
+				 <PINMUX_GPIO79__FUNC_GBE_TXD1>,
+				 <PINMUX_GPIO80__FUNC_GBE_TXD0>;
+			drive-strength = <MTK_DRIVE_8mA>;
+		};
+		pins-cc {
+			pinmux = <PINMUX_GPIO85__FUNC_GBE_TXC>,
+				 <PINMUX_GPIO88__FUNC_GBE_TXEN>,
+				 <PINMUX_GPIO87__FUNC_GBE_RXDV>,
+				 <PINMUX_GPIO86__FUNC_GBE_RXC>;
+			drive-strength = <MTK_DRIVE_8mA>;
+		};
+		pins-rxd {
+			pinmux = <PINMUX_GPIO81__FUNC_GBE_RXD3>,
+				 <PINMUX_GPIO82__FUNC_GBE_RXD2>,
+				 <PINMUX_GPIO83__FUNC_GBE_RXD1>,
+				 <PINMUX_GPIO84__FUNC_GBE_RXD0>;
+		};
+		pins-mdio {
+			pinmux = <PINMUX_GPIO89__FUNC_GBE_MDC>,
+				 <PINMUX_GPIO90__FUNC_GBE_MDIO>;
+			input-enable;
+		};
+		pins-power {
+			pinmux = <PINMUX_GPIO91__FUNC_GPIO91>,
+				 <PINMUX_GPIO92__FUNC_GPIO92>;
+			output-high;
+		};
+	};
+
+	eth_sleep_pins: eth-sleep-pins {
+		pins-txd {
+			pinmux = <PINMUX_GPIO77__FUNC_GPIO77>,
+				 <PINMUX_GPIO78__FUNC_GPIO78>,
+				 <PINMUX_GPIO79__FUNC_GPIO79>,
+				 <PINMUX_GPIO80__FUNC_GPIO80>;
+		};
+		pins-cc {
+			pinmux = <PINMUX_GPIO85__FUNC_GPIO85>,
+				 <PINMUX_GPIO88__FUNC_GPIO88>,
+				 <PINMUX_GPIO87__FUNC_GPIO87>,
+				 <PINMUX_GPIO86__FUNC_GPIO86>;
+		};
+		pins-rxd {
+			pinmux = <PINMUX_GPIO81__FUNC_GPIO81>,
+				 <PINMUX_GPIO82__FUNC_GPIO82>,
+				 <PINMUX_GPIO83__FUNC_GPIO83>,
+				 <PINMUX_GPIO84__FUNC_GPIO84>;
+		};
+		pins-mdio {
+			pinmux = <PINMUX_GPIO89__FUNC_GPIO89>,
+				 <PINMUX_GPIO90__FUNC_GPIO90>;
+			input-disable;
+			bias-disable;
+		};
+		pins-power {
+			pinmux = <PINMUX_GPIO91__FUNC_GPIO91>,
+				 <PINMUX_GPIO92__FUNC_GPIO92>;
+			input-disable;
+			bias-disable;
+		};
+	};
+
 	gpio_keys_pins: gpio-keys-pins {
 		pins {
 			pinmux = <PINMUX_GPIO106__FUNC_GPIO106>;
@@ -434,6 +500,28 @@ &xhci0 {
 	status = "okay";
 };
 
+&eth {
+	phy-mode ="rgmii-rxid";
+	phy-handle = <&ethernet_phy0>;
+	snps,reset-gpio = <&pio 93 GPIO_ACTIVE_HIGH>;
+	snps,reset-delays-us = <0 10000 10000>;
+	mediatek,tx-delay-ps = <2030>;
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&eth_default_pins>;
+	pinctrl-1 = <&eth_sleep_pins>;
+	status = "okay";
+
+	mdio {
+		compatible = "snps,dwmac-mdio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		ethernet_phy0: ethernet-phy@1 {
+			compatible = "ethernet-phy-id001c.c916";
+			reg = <0x1>;
+		};
+	};
+};
+
 &xhci1 {
 	vusb33-supply = <&mt6359_vusb_ldo_reg>;
 	status = "okay";
arch/arm64/boot/dts/mediatek/mt8195.dtsi +86 -0

92 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Il 19/10/22 11:15, Biao Huang ha scritto:

Quoted 8 lines

Add Ethernet controller node for mt8195.

---
  arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 88 ++++++++++++++++++++
  arch/arm64/boot/dts/mediatek/mt8195.dtsi     | 86 +++++++++++++++++++
  2 files changed, 174 insertions(+)

..snip..

arch/arm64/boot/dts/mediatek/mt8195.dtsi spis1: spi@1101e000 { · line 1045

Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
index 905d1a90b406..7f7d9f8e72ee 100644
@@ -1042,6 +1042,92 @@ spis1: spi@1101e000 {
  			status = "disabled";
  		};
 
+		stmmac_axi_setup: stmmac-axi-config {

Didn't you get a warning during dtb build for these ones? And if you did, why have you ignored it? :-)

Quoted 5 lines
arch/arm64/boot/dts/mediatek/mt8195.dtsi +5 -0
+			snps,wr_osr_lmt = <0x7>;
+			snps,rd_osr_lmt = <0x7>;
+			snps,blen = <0 0 0 0 16 8 4>;
+		};
+

..snip..

Quoted 23 lines
arch/arm64/boot/dts/mediatek/mt8195.dtsi +23 -0
+
+		eth: ethernet@11021000 {
+			compatible = "mediatek,mt8195-gmac", "snps,dwmac-5.10a";
+			reg = <0 0x11021000 0 0x4000>;
+			interrupts = <GIC_SPI 716 IRQ_TYPE_LEVEL_HIGH 0>;
+			interrupt-names = "macirq";
+			clock-names = "axi",
+				      "apb",
+				      "mac_cg",
+				      "mac_main",
+				      "ptp_ref",
+				      "rmii_internal";
+			clocks = <&pericfg_ao CLK_PERI_AO_ETHERNET>,
+				 <&pericfg_ao CLK_PERI_AO_ETHERNET_BUS>,
+				 <&pericfg_ao CLK_PERI_AO_ETHERNET_MAC>,
+				 <&topckgen CLK_TOP_SNPS_ETH_250M>,
+				 <&topckgen CLK_TOP_SNPS_ETH_62P4M_PTP>,
+				 <&topckgen CLK_TOP_SNPS_ETH_50M_RMII>;
+			assigned-clocks = <&topckgen CLK_TOP_SNPS_ETH_250M>,
+					  <&topckgen CLK_TOP_SNPS_ETH_62P4M_PTP>,
+					  <&topckgen CLK_TOP_SNPS_ETH_50M_RMII>;
+			assigned-clock-parents = <&topckgen CLK_TOP_ETHPLL_D2>,
+						 <&topckgen CLK_TOP_ETHPLL_D8>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi spis1: spi@1101e000 { · line 1128

Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt8195.dtsi +10 -0
+						 <&topckgen CLK_TOP_ETHPLL_D10>;
+			power-domains = <&spm MT8195_POWER_DOMAIN_ETHER>;
+			mediatek,pericfg = <&infracfg_ao>;
+			snps,axi-config = <&stmmac_axi_setup>;
+			snps,mtl-rx-config = <&mtl_rx_setup>;
+			snps,mtl-tx-config = <&mtl_tx_setup>;
+			snps,txpbl = <16>;
+			snps,rxpbl = <16>;
+			snps,clk-csr = <0>;
+			status = "disabled";

Please move stmmac-axi-config, rx-queues-config, tx-queues-config here as a subnode or in the root node, respecting address/size cells being zero.
Of course adding that here means also specifying {address,size}-cells = <0> in this ethernet node.

Regards,
Angelo

author
#3 lore raw

Dear Angelo,
Thanks for your comments!

Quoted 23 lines · AngeloGioacchino Del Regno

Il 19/10/22 11:15, Biao Huang ha scritto:

Quoted 10 lines

Add Ethernet controller node for mt8195.

---
  arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 88
++++++++++++++++++++
  arch/arm64/boot/dts/mediatek/mt8195.dtsi     | 86
+++++++++++++++++++
  2 files changed, 174 insertions(+)

..snip..

Quoted 9 lines
arch/arm64/boot/dts/mediatek/mt8195.dtsi +0 -0
index 905d1a90b406..7f7d9f8e72ee 100644
@@ -1042,6 +1042,92 @@ spis1: spi@1101e000 {
  			status = "disabled";
  		};
 
Quoted 4 lines

arch/arm64/boot/dts/mediatek/mt8195.dtsi spis1: spi@1101e000 { · line 1045

Quoted 1 line
arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+		stmmac_axi_setup: stmmac-axi-config {

Didn't you get a warning during dtb build for these ones? And if you did, why have you ignored it? :-)

I checked some dts, they keep stmmac-axi-config outside ethernet node, so I keep the similar way with them, maybe that's old style.

Quoted 53 lines
Quoted 6 lines
arch/arm64/boot/dts/mediatek/mt8195.dtsi +5 -0
+			snps,wr_osr_lmt = <0x7>;
+			snps,rd_osr_lmt = <0x7>;
+			snps,blen = <0 0 0 0 16 8 4>;
+		};
+

..snip..

Quoted 44 lines
arch/arm64/boot/dts/mediatek/mt8195.dtsi +3 -0
+
+		eth: ethernet@11021000 {
+			compatible = "mediatek,mt8195-gmac",

"snps,dwmac-5.10a";

arch/arm64/boot/dts/mediatek/mt8195.dtsi +2 -0
+			reg = <0 0x11021000 0 0x4000>;
+			interrupts = <GIC_SPI 716 IRQ_TYPE_LEVEL_HIGH

0>;

arch/arm64/boot/dts/mediatek/mt8195.dtsi +9 -0
+			interrupt-names = "macirq";
+			clock-names = "axi",
+				      "apb",
+				      "mac_cg",
+				      "mac_main",
+				      "ptp_ref",
+				      "rmii_internal";
+			clocks = <&pericfg_ao CLK_PERI_AO_ETHERNET>,
+				 <&pericfg_ao

CLK_PERI_AO_ETHERNET_BUS>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+				 <&pericfg_ao

CLK_PERI_AO_ETHERNET_MAC>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi +2 -0
+				 <&topckgen CLK_TOP_SNPS_ETH_250M>,
+				 <&topckgen

CLK_TOP_SNPS_ETH_62P4M_PTP>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi +2 -0
+				 <&topckgen CLK_TOP_SNPS_ETH_50M_RMII>;
+			assigned-clocks = <&topckgen

CLK_TOP_SNPS_ETH_250M>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+					  <&topckgen

CLK_TOP_SNPS_ETH_62P4M_PTP>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+					  <&topckgen

CLK_TOP_SNPS_ETH_50M_RMII>;

arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+			assigned-clock-parents = <&topckgen

CLK_TOP_ETHPLL_D2>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+						 <&topckgen

CLK_TOP_ETHPLL_D8>,

arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+						 <&topckgen

CLK_TOP_ETHPLL_D10>;

arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+			power-domains = <&spm

MT8195_POWER_DOMAIN_ETHER>;

arch/arm64/boot/dts/mediatek/mt8195.dtsi +7 -0
+			mediatek,pericfg = <&infracfg_ao>;
+			snps,axi-config = <&stmmac_axi_setup>;
+			snps,mtl-rx-config = <&mtl_rx_setup>;
+			snps,mtl-tx-config = <&mtl_tx_setup>;
+			snps,txpbl = <16>;
+			snps,rxpbl = <16>;
+			snps,clk-csr = <0>;
Quoted 8 lines

arch/arm64/boot/dts/mediatek/mt8195.dtsi spis1: spi@1101e000 { · line 1128

Quoted 1 line
arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 -0
+			status = "disabled";

Please move stmmac-axi-config, rx-queues-config, tx-queues-config here as a subnode
or in the root node, respecting address/size cells being zero. Of course adding that here means also specifying {address,size}-cells = <0> in this
ethernet node.

OK, I'll move them to ethernet node, and add address/size-cells in thernet node.

Quoted 3 lines

Regards,
Angelo

Best Regards!
Biao