Hi,
I’m playing with Kernel 6.10 from frank-w for few days. I notice something interesting in 6.9 and 6.10 regarding the ethernet switch ports when I’m using default DTS/DTSO/DTSI I’m getting this:
root@EasyOS:~# ip a l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <BROADCAST,MULTICAST> mtu 1504 qdisc noop state DOWN group default qlen 1000
link/ether d2:bd:79:c9:31:b0 brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 12:f8:45:33:0a:cd brd ff:ff:ff:ff:ff:ff
5: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether e6:5d:54:94:db:fd brd ff:ff:ff:ff:ff:ff
6: wan@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 92:95:f8:52:e4:4d brd ff:ff:ff:ff:ff:ff
7: lan1@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 12:69:34:45:bc:2f brd ff:ff:ff:ff:ff:ff
8: lan2@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 26:7e:07:90:db:bf brd ff:ff:ff:ff:ff:ff
9: lan3@eth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether e6:ae:d6:2a:ef:f1 brd ff:ff:ff:ff:ff:ff
Looking into the DTS mt7988a-bananapi-bpi-r4.dts
:
&gsw_port0 {
label = "wan";
};
and mt7988a.dtsi
:
switch: switch@15020000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "mediatek,mt7988-switch";
reg = <0 0x15020000 0 0x8000>;
interrupt-controller;
#interrupt-cells = <1>;
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 209 IRQ_TYPE_LEVEL_HIGH>;
resets = <ðwarp MT7988_ETHWARP_RST_SWITCH>;
ports {
#address-cells = <1>;
#size-cells = <0>;
gsw_port0: port@0 {
reg = <0>;
label = "lan0";
phy-mode = "internal";
phy-handle = <&gsw_phy0>;
};
gsw_port1: port@1 {
reg = <1>;
label = "lan1";
phy-mode = "internal";
phy-handle = <&gsw_phy1>;
};
gsw_port2: port@2 {
reg = <2>;
label = "lan2";
phy-mode = "internal";
phy-handle = <&gsw_phy2>;
};
gsw_port3: port@3 {
reg = <3>;
label = "lan3";
phy-mode = "internal";
phy-handle = <&gsw_phy3>;
};
port@6 {
reg = <6>;
ethernet = <&gmac0>;
phy-mode = "internal";
fixed-link {
speed = <10000>;
full-duplex;
pause;
};
};
};
Question 1: For me doesn’t make sense switch port 0 to be “wan”. There is any particular reason why is labeled “wan” this first port of the BPI-R4 switch?
My proposal:
--- mt7988a-bananapi-bpi-r4.dts.orig 2024-07-28 12:47:22.800049510 +0200
+++ mt7988a-bananapi-bpi-r4.dts.easyos 2024-07-28 14:10:35.919969285 +0200
@@ -117,7 +117,7 @@
};
&gsw_port0 {
- label = "wan";
+ label = "swlan0";
};
&gsw_phy0_led0 {
@@ -130,6 +130,10 @@
pinctrl-0 = <&gbe1_led0_pins>;
};
+&gsw_port1 {
+ label = "swlan1";
+};
+
&gsw_phy1_led0 {
status = "okay";
color = <LED_COLOR_ID_GREEN>;
@@ -140,6 +144,10 @@
pinctrl-0 = <&gbe2_led0_pins>;
};
+&gsw_port2 {
+ label = "swlan2";
+};
+
&gsw_phy2_led0 {
status = "okay";
color = <LED_COLOR_ID_GREEN>;
@@ -150,6 +158,10 @@
pinctrl-0 = <&gbe3_led0_pins>;
};
+&gsw_port3 {
+ label = "swlan3";
+};
+
&gsw_phy3_led0 {
status = "okay";
color = <LED_COLOR_ID_GREEN>;
In this way I can see a better difference between normal ethernet ports and switch ports.
Second issue I have with the 2 SFPs ports: the SFP on left edge is named eth2 and second one is named eth1 in Linux.
I tried to play with gmac
entries in mt7988a.dtsi
, I was able to shut/unshut the left port, but the traffic is still coming on eth2:
..
xfi_tphy0: phy@11f20000 {
compatible = "mediatek,mt7988-xfi-tphy";
reg = <0 0x11f20000 0 0x10000>;
resets = <&watchdog MT7988_TOPRGU_XFI_PEXTP0_GRST>;
clocks = <&xfi_pll CLK_XFIPLL_PLL_EN>, <&topckgen CLK_TOP_XFI_PHY_0_XTAL_SEL>;
clock-names = "xfipll", "topxtal";
mediatek,usxgmii-performance-errata;
#phy-cells = <0>;
};
xfi_tphy1: phy@11f30000 {
compatible = "mediatek,mt7988-xfi-tphy";
reg = <0 0x11f30000 0 0x10000>;
resets = <&watchdog MT7988_TOPRGU_XFI_PEXTP1_GRST>;
clocks = <&xfi_pll CLK_XFIPLL_PLL_EN>, <&topckgen CLK_TOP_XFI_PHY_1_XTAL_SEL>;
clock-names = "xfipll", "topxtal";
#phy-cells = <0>;
};
...
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
status = "disabled";
pcs-handle = <&sgmiipcs1>, <&usxgmiisys1>;
phys = <&xfi_tphy1>;
};
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
status = "disabled";
pcs-handle = <&sgmiipcs0>, <&usxgmiisys0>;
phys = <&xfi_tphy0>;
};
..
and in mt7988a-bananapi-bpi-r4.dts
:
..
/* SFP1 cage (WAN) */
sfp1: sfp1 {
compatible = "sff,sfp";
i2c-bus = <&i2c_sfp1>;
los-gpios = <&pio 54 GPIO_ACTIVE_HIGH>;
mod-def0-gpios = <&pio 82 GPIO_ACTIVE_LOW>;
tx-disable-gpios = <&pio 70 GPIO_ACTIVE_HIGH>;
tx-fault-gpios = <&pio 69 GPIO_ACTIVE_HIGH>;
rate-select0-gpios = <&pio 21 GPIO_ACTIVE_LOW>;
maximum-power-milliwatt = <3000>;
};
/* SFP2 cage (LAN) */
sfp2: sfp2 {
compatible = "sff,sfp";
i2c-bus = <&i2c_sfp2>;
los-gpios = <&pio 2 GPIO_ACTIVE_HIGH>;
mod-def0-gpios = <&pio 83 GPIO_ACTIVE_LOW>;
tx-disable-gpios = <&pio 0 GPIO_ACTIVE_HIGH>;
tx-fault-gpios = <&pio 1 GPIO_ACTIVE_HIGH>;
rate-select0-gpios = <&pio 3 GPIO_ACTIVE_LOW>;
maximum-power-milliwatt = <3000>;
};
..
&gmac1 {
sfp = <&sfp2>;
managed = "in-band-status";
phy-mode = "usxgmii";
status = "okay";
};
&gmac2 {
sfp = <&sfp1>;
managed = "in-band-status";
phy-mode = "usxgmii";
status = "okay";
};
I tried to switch gmac1: mac@1
to pcs-handle = <&sgmiipcs0>, <&usxgmiisys0>;
+ phys = <&xfi_tphy0>;
and gmac1: mac@2
to pcs-handle = <&sgmiipcs1>, <&usxgmiisys1>;
+ phys = <&xfi_tphy1>;
without success.
I manage only to switch SFPs GPIO ports and it worked to shut/noshut eth1 as left SFP port.
So my second question is why the ports are reversed? There is a way to make them in order in kernel?