I am trying to add support for a new mt7986 board having two Maxlinear GPY211C phys connected to switch port 5 and the second gmac. The one attacted to the switch works fine. But I cannot figure out what is wrong with the gmac connection.
No matter what I do, I am unable to send or receive any packets via the gmac2 netdev (eth1). It does work with OEM firmware, so the hardware must be OK.
The relevant part of my dts looks like this:
ð {
status = "okay";
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
// FIXME: this fails to forward any traffic over mac@1
mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
// phy-mode = "sgmii";
phy-mode = "2500base-x"; // phy will automatically switch to sgmmii
phy-handle = <&phy6>;
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
};
};
&mdio {
// must reset before probing phy5 and phy6- using dummy as workaround
phy@0 {
compatible = "ethernet-phy-ieee802.3-c45";
reg = <0>;
reset-gpios = <&pio 6 GPIO_ACTIVE_LOW>;
reset-assert-us = <50000>;
reset-deassert-us = <20000>;
};
phy5: phy@5 {
compatible = "ethernet-phy-ieee802.3-c45";
reg = <5>;
};
phy6: phy@6 {
compatible = "ethernet-phy-ieee802.3-c45";
reg = <6>;
};
switch: switch@1f {
compatible = "mediatek,mt7531";
reg = <31>;
reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>;
interrupt-controller;
#interrupt-cells = <1>;
interrupt-parent = <&pio>;
interrupts = <66 IRQ_TYPE_LEVEL_HIGH>;
};
};
&switch {
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan2";
};
port@1 {
reg = <1>;
label = "lan3";
};
port@2 {
reg = <2>;
label = "lan4";
};
port@5 {
reg = <5>;
label = "lan1";
phy-mode = "2500base-x";
phy-handle = <&phy5>;
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
( NOTE: Ignore the phy@0 is a temporary hack. It ensures that phy@5 and phy@6 are powered up in time for probing. I don't know exactly what gpio 6 is connected to, but I don't think it can be the phy@5 reset line like the OEM firmware claimed. It's more likely enabling a power domain shared by both phys)
Everything looks very good on the surface. Looks like the phy is attached and muxing set up as expected:
root@(none):/# ifconfig eth1 up
[ 138.256433] mtk_soc_eth 15100000.ethernet eth1: PHY [mdio-bus:06] driver [Maxlinear Ethernet GPY211C] (irq=POLL)
[ 138.266626] mtk_soc_eth 15100000.ethernet eth1: configuring for phy/2500base-x link mode
[ 138.274705] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_gdm1_to_gmac1_esw isn't present on the SoC
[ 138.284856] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_gmac2_gmac0_to_gephy isn't present on the SoC
[ 138.295266] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_u3_gmac2_to_qphy isn't present on the SoC
[ 138.305328] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_gmac1_gmac2_to_sgmii_rgmii isn't present on the SoC
[ 138.316264] set_mux_gmac12_to_gephy_sgmii: mtk_soc_eth 15100000.ethernet: path gmac2_sgmii in set_mux_gmac12_to_gephy_sgmii updated = 1
ethtool is also fine. Without anything connected:
root@(none):/# ethtool eth1
Settings for eth1:
Supported ports: [ ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Half
Auto-negotiation: on
Port: Twisted Pair
PHYAD: 6
Transceiver: external
MDI-X: Unknown
Current message level: 0x000000ff (255)
drv probe link timer ifdown ifup rx_err tx_err
Link detected: no
Connecting to a 1gig device also looks good to me:
root@(none):/# [ 1123.207295] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_gdm1_to_gmac1_esw isn't present on the SoC
[ 1123.217465] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_gmac2_gmac0_to_gephy isn't present on the SoC
[ 1123.227875] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_u3_gmac2_to_qphy isn't present on the SoC
[ 1123.237938] mtk_eth_mux_setup: mtk_soc_eth 15100000.ethernet: mux mux_gmac1_gmac2_to_sgmii_rgmii isn't present on the SoC
[ 1123.248873] set_mux_gmac12_to_gephy_sgmii: mtk_soc_eth 15100000.ethernet: path gmac2_sgmii in set_mux_gmac12_to_gephy_sgmii updated = 1
[ 1123.261032] mtk_soc_eth 15100000.ethernet eth1: Link is Up - 1Gbps/Full - flow control rx/tx
[ 1123.269473] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
root@(none):/# ethtool eth1
Settings for eth1:
Supported ports: [ ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: slave
Port: Twisted Pair
PHYAD: 6
Transceiver: external
MDI-X: on (auto)
Current message level: 0x000000ff (255)
drv probe link timer ifdown ifup rx_err tx_err
Link detected: yes
But I still can't receive or transmit anything. No errors. Nothing. Just silence.
FWIW, connecting "lan1" (switch port 5) to the same 1gig device looks very similar, except that it works...
root@(none):/# [ 1217.769488] mt7530 mdio-bus:1f lan1: Link is Up - 1Gbps/Full - flow control rx/tx
[ 1217.776989] IPv6: ADDRCONF(NETDEV_CHANGE): lan1: link becomes ready
root@(none):/# ethtool lan1
Settings for lan1:
Supported ports: [ ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
2500baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: slave
Port: Twisted Pair
PHYAD: 5
Transceiver: external
MDI-X: on (auto)
Supports Wake-on: pg
Wake-on: d
Link detected: yes
I assume there's some important detail I'm missing here. But what?