diff mbox series

[4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2

Message ID 20230120205318.519493-5-arinc.unal@arinc9.com (mailing list archive)
State New, archived
Headers show
Series arm: dts: mt7623: relocate gmacs, mt7530 switch, and mux phy | expand

Commit Message

Arınç ÜNAL Jan. 20, 2023, 8:53 p.m. UTC
Mux the MT7530 switch's phy0 to gmac5 which is wired to the SoC's gmac1.
This achieves 2 Gbps total bandwidth to the CPU using the second RGMII.

Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Frank Wunderlich Jan. 25, 2023, 4:41 p.m. UTC | #1
Am 20. Januar 2023 21:53:17 MEZ schrieb "Arınç ÜNAL" <arinc.unal@arinc9.com>:

> 		switch@1f {
> 			compatible = "mediatek,mt7530";
> 			reg = <0x1f>;
>@@ -199,11 +208,6 @@ ports {
> 				#address-cells = <1>;
> 				#size-cells = <0>;
> 
>-				port@0 {
>-					reg = <0>;
>-					label = "wan";
>-				};
>-

This will break existing userspace setups using wan as interface name.

> 				port@1 {
> 					reg = <1>;
> 					label = "lan0";


regards Frank
Arınç ÜNAL Jan. 25, 2023, 4:54 p.m. UTC | #2
On 25.01.2023 19:41, Frank Wunderlich wrote:
> Am 20. Januar 2023 21:53:17 MEZ schrieb "Arınç ÜNAL" <arinc.unal@arinc9.com>:
> 
>> 		switch@1f {
>> 			compatible = "mediatek,mt7530";
>> 			reg = <0x1f>;
>> @@ -199,11 +208,6 @@ ports {
>> 				#address-cells = <1>;
>> 				#size-cells = <0>;
>>
>> -				port@0 {
>> -					reg = <0>;
>> -					label = "wan";
>> -				};
>> -
> 
> This will break existing userspace setups using wan as interface name.

Yup. The OS being used will have to either rename the interface or adapt 
to the new name, eth1.

Arınç
Matthias Brugger Jan. 31, 2023, 11:55 a.m. UTC | #3
On 25/01/2023 17:54, Arınç ÜNAL wrote:
> On 25.01.2023 19:41, Frank Wunderlich wrote:
>> Am 20. Januar 2023 21:53:17 MEZ schrieb "Arınç ÜNAL" <arinc.unal@arinc9.com>:
>>
>>>         switch@1f {
>>>             compatible = "mediatek,mt7530";
>>>             reg = <0x1f>;
>>> @@ -199,11 +208,6 @@ ports {
>>>                 #address-cells = <1>;
>>>                 #size-cells = <0>;
>>>
>>> -                port@0 {
>>> -                    reg = <0>;
>>> -                    label = "wan";
>>> -                };
>>> -
>>
>> This will break existing userspace setups using wan as interface name.
> 
> Yup. The OS being used will have to either rename the interface or adapt to the 
> new name, eth1.
> 

In that case please explain in the commit message why this is needed. We are 
trying really hard to not break userspace by a device-tree update.

Regards,
Matthias
Frank Wunderlich Jan. 31, 2023, 4:39 p.m. UTC | #4
Hi
> Gesendet: Dienstag, 31. Januar 2023 um 12:55 Uhr
> Von: "Matthias Brugger" <matthias.bgg@gmail.com>
> An: "Arınç ÜNAL" <arinc.unal@arinc9.com>, frank-w@public-files.de, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>
> Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
> Betreff: Re: [PATCH 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
>
> 
> 
> On 25/01/2023 17:54, Arınç ÜNAL wrote:
> > On 25.01.2023 19:41, Frank Wunderlich wrote:
> >> Am 20. Januar 2023 21:53:17 MEZ schrieb "Arınç ÜNAL" <arinc.unal@arinc9.com>:
> >>
> >>>         switch@1f {
> >>>             compatible = "mediatek,mt7530";
> >>>             reg = <0x1f>;
> >>> @@ -199,11 +208,6 @@ ports {
> >>>                 #address-cells = <1>;
> >>>                 #size-cells = <0>;
> >>>
> >>> -                port@0 {
> >>> -                    reg = <0>;
> >>> -                    label = "wan";
> >>> -                };
> >>> -
> >>
> >> This will break existing userspace setups using wan as interface name.
> > 
> > Yup. The OS being used will have to either rename the interface or adapt to the 
> > new name, eth1.
> > 
> 
> In that case please explain in the commit message why this is needed. We are 
> trying really hard to not break userspace by a device-tree update.

I understand the reason why Arınç wants to change it:

currently all ports including wan-port are routed via dsa over gmac0 (trgmii), Arınç enables the second gmac and port5 of switch to route wan-traffic over the other gmac. But unfortunately there is no mainline-way to rename the gmac1 interface (eth1) to wan...this would be a way to not break the userspace.

i had an older patch for mtk_eth_soc [1] which do it at driver level for mediatek ethernet driver, but afair a generic way to (re)name interfaces in dts (vendor independ) was requested as the right way.

regards Frank

[1] https://github.com/frank-w/BPI-Router-Linux/commit/5088c9c81e90014622a950fca38cfb29e0421155
Arınç ÜNAL Feb. 1, 2023, 5:49 p.m. UTC | #5
On 31.01.2023 19:39, Frank Wunderlich wrote:
> Hi
>> Gesendet: Dienstag, 31. Januar 2023 um 12:55 Uhr
>> Von: "Matthias Brugger" <matthias.bgg@gmail.com>
>> An: "Arınç ÜNAL" <arinc.unal@arinc9.com>, frank-w@public-files.de, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>
>> Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, erkin.bozoglu@xeront.com, "Sean Wang" <sean.wang@mediatek.com>, "DENG Qingfang" <dqfext@gmail.com>
>> Betreff: Re: [PATCH 4/5] arm: dts: mt7623: mux phy0 on Bananapi BPI-R2
>>
>>
>>
>> On 25/01/2023 17:54, Arınç ÜNAL wrote:
>>> On 25.01.2023 19:41, Frank Wunderlich wrote:
>>>> Am 20. Januar 2023 21:53:17 MEZ schrieb "Arınç ÜNAL" <arinc.unal@arinc9.com>:
>>>>
>>>>>          switch@1f {
>>>>>              compatible = "mediatek,mt7530";
>>>>>              reg = <0x1f>;
>>>>> @@ -199,11 +208,6 @@ ports {
>>>>>                  #address-cells = <1>;
>>>>>                  #size-cells = <0>;
>>>>>
>>>>> -                port@0 {
>>>>> -                    reg = <0>;
>>>>> -                    label = "wan";
>>>>> -                };
>>>>> -
>>>>
>>>> This will break existing userspace setups using wan as interface name.
>>>
>>> Yup. The OS being used will have to either rename the interface or adapt to the
>>> new name, eth1.
>>>
>>
>> In that case please explain in the commit message why this is needed. We are
>> trying really hard to not break userspace by a device-tree update.
> 
> I understand the reason why Arınç wants to change it:
> 
> currently all ports including wan-port are routed via dsa over gmac0 (trgmii), Arınç enables the second gmac and port5 of switch to route wan-traffic over the other gmac. But unfortunately there is no mainline-way to rename the gmac1 interface (eth1) to wan...this would be a way to not break the userspace.
> 
> i had an older patch for mtk_eth_soc [1] which do it at driver level for mediatek ethernet driver, but afair a generic way to (re)name interfaces in dts (vendor independ) was requested as the right way.
> 
> regards Frank
> 
> [1] https://github.com/frank-w/BPI-Router-Linux/commit/5088c9c81e90014622a950fca38cfb29e0421155

I tried this [0] before. It's not going to happen on mainline, and 
that's fine. I'll just clearly mention on the patch log that the 
interface name will change with this patch.

[0] 
https://lore.kernel.org/netdev/20220404114000.3549-1-arinc.unal@arinc9.com/t/#u

Arınç
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
index 94174cb2b7e1..28051136c4e2 100644
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
@@ -184,10 +184,19 @@  fixed-link {
 		};
 	};
 
+	gmac1: mac@1 {
+		status = "okay";
+		phy-handle = <&ethphy0>;
+	};
+
 	mdio: mdio-bus {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
+		ethphy0: ethernet-phy@0 {
+			reg = <0>;
+		};
+
 		switch@1f {
 			compatible = "mediatek,mt7530";
 			reg = <0x1f>;
@@ -199,11 +208,6 @@  ports {
 				#address-cells = <1>;
 				#size-cells = <0>;
 
-				port@0 {
-					reg = <0>;
-					label = "wan";
-				};
-
 				port@1 {
 					reg = <1>;
 					label = "lan0";