Hi Does somebody try to use 2-nd gmac to wan directly? Gmac1 -> port 5 -> PHY port 4. I think this mode is better for routers.
I made tests with vlan aware bridge (bridging aux/p5 and gmac) some time ago for r2 and r64.
See second ethernet lane here
https://wiki.fw-web.de/doku.php?id=en:bpi-r2:network:start#permanent
I made it through dts for kernel 5.10.
ð {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
mac-address = [fe dc ba 98 76 54];
reg = <0>;
phy-mode = "trgmii";
fixed-link {
speed = <1000>;
full-duplex;
pause;
};
};
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
mac-address = [01 23 45 67 89 ab];
reg = <1>;
phy-mode = "rgmii";
phy-handle = <&phy0>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
/* Internal phy */
phy0: eth-phy@0 {
reg = <0>;
};
mt7530: switch@1 {
compatible = "mediatek,mt7530";
reg = <1>;
/* reset-gpios = <&pio 33 0>; */
core-supply = <&mt6323_vpa_reg>;
io-supply = <&mt6323_vemc3v3_reg>;
mediatek,mcm;
resets = <ðsys MT2701_ETHSYS_MCM_RST> ; /* 2>; */
reset-names = "mcm";
ports {
#address-cells = <1>;
#size-cells = <0>;
/*
port@0 {
reg = <0>;
label = "wan";
};
*/
port@1 {
reg = <1>;
label = "lan0";
};
port@2 {
reg = <2>;
label = "lan1";
};
port@3 {
reg = <3>;
label = "lan2";
};
port@4 {
reg = <4>;
label = "lan3";
};
cpu_port0: port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac0>;
phy-mode = "trgmii";
fixed-link {
speed = <1000>;
full-duplex;
pause;
};
};
};
};
};
};
Itâs working for port0 as wan.
Ok, did not know it is possible this wayâŚdoes it work with full speed?
I donât test speed yet. But Iâm looking for an opportunity test it by available resources.
this seems not working on r64
+++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts
@@ -136,6 +136,7 @@ gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "rgmii";
+ phy-handle = <&phy0>;
fixed-link {
speed = <1000>;
@@ -148,6 +149,11 @@ mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
+ /* Internal phy */
+ phy0: eth-phy@0 {
+ reg = <0>;
+ };
+
switch@0 {
compatible = "mediatek,mt7531";
reg = <0>;
@@ -157,10 +163,10 @@ ports {
#address-cells = <1>;
#size-cells = <0>;
- port@0 {
+ /*port@0 {
reg = <0>;
label = "wan";
- };
+ };*/
results in probe error of mtk_soc_eth driver
mtk_soc_eth: probe of 1b100000.ethernet failed with error -16
but i see you have address 1 for switch on mdio bus, how did you get this address (imho this have not to be 1 and 0 is broadcast)?
I tried to modify configuration from example 2 of https://github.com/frank-w/BPI-R2-4.14/blob/5.10-main/Documentation/devicetree/bindings/net/dsa/mt7530.txt . And with phy0: eth-phy@0 { reg = <4>; and mt7530: switch@0 { reg = <0>; all worked, using port 4 as eth1. Changing phy reg = <0> disabled mt7530 init. I thought it was reg conflict (phy makes switch0) and tried to change reg of switch to 1. Also, mt7530 require mediatek,mcm flag and mcm reset for external phy. I donât know to mt7531 needs it.
- the original r64 dts works (wan with reg=0 over eth0)
- why changing reg to 4 for internal phy as 4 is another port (lan3)
i donât think it is related to mcm, problem is more that internal phy maps to phy-id 0 (broadcast) and switch tooâŚimho mt7531 on r64 does not have real phy-idâŚtried to read out via mii-tool but got warning with stacktrace
WARNING: CPU: 0 PID: 1961 at drivers/net/phy/swphy.c:127 swphy_read_reg
I donât know how it works on r2 because I donât understand what reg means on mdio bus. As i mind mdio is setup interface for switch only. And those settings will not work on mt6531. This switch have considerably different init procedure in /drivers/net/dsa/mt7530.c
mdio is bus system comparable to i2c where multiple devices can be attached with different adresses (phy-ids).
the top reg (below switch compatible) is normally the phy-id on mdio-but, where 0 is broadcast. in my example above 2 nodes have broadcast-adress so it is invalid (which device is meant when get a response to broadcast). Ports having their own reg-property which are handled by switch driver.
yes init is different, but the reg-property handling (top by mdio-probe, ports by switch-driver/dsa-core) should be same/similar
Now I absolutely do not understand why it works âŚ
And I donât have a mt7530 manual