[BPI-R3(mt7986a)] + 2.5G yt8821 phy, when link up 2.5G, ping OK, link up others speed(10/100/1000M), ping fail

Hi

Issue description:

Based on BPI-R3 evb,

When yt8821 2.5G phy serdes is configed to “force 2500Base-x“ mode,

Only link up speed 2.5G ping ok, other link up speed(10/10/1000M) ping fail

Detail below:

  1. Device config in

BPI-Router-Linux-6.10-rc/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts

gmac0: mac@0 {

	compatible = "mediatek,eth-mac";

	reg = <0>;

	phy-mode = "2500base-x";


	fixed-link {

		speed = <2500>;

		full-duplex;

		pause;

	};

};

gmac1: mac@1 {

	compatible = "mediatek,eth-mac";

	reg = <1>;

	**phy-mode = "2500base-x";**

	//phy-mode = "sgmii";

	**phy-handle = <&phy7>;**

	//sfp = <&sfp1>;

	//managed = "in-band-status";

};

mdio: mdio-bus {
	#address-cells = <1>;
	#size-cells = <0>;
};

};

&mdio {

switch: switch@31 {

	compatible = "mediatek,mt7531";

	reg = <31>;

	interrupt-controller;

	#interrupt-cells = <1>;

	interrupts-extended = <&pio 66 IRQ_TYPE_LEVEL_HIGH>;

	reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>;

};

phy7: ethernet-phy@7 {

	compatible = "ethernet-phy-id4f51.ea19";

	**phy-mode = "2500base-x";**

	//phy-mode = "sgmii";

	reg = <0x7>;

	full-duplex;

	pause;

};

};

  1. topology like bpi-r3-mini(2.5G phy is en881h)

Mt7986a gmac1<2.5G serdes>yt8821 phy

  1. test env snapshot below

Could anyone give me some advice and how to debug the issue?

Appreciate your help!

The devicetree is similar to the R3mini with the en8811h, so that’s all ok.

If you have the phy operating at fixed 2500base-x, you will need to:

static int yt8821_get_rate_matching(struct phy_device *phydev, phy_interface_t iface)
{
    return RATE_MATCH_PAUSE;
}

Add the function pointer in the driver table of the phy.

AND set:

phydev->rate_matching = RATE_MATCH_PAUSE;

Somewhere in probe() / config_init() or read_status() of your phy driver.

OR

If you want serdes switching between 2500base-x and sgmii, then have a look at the rtl8221b code of the 6.10+ kernel, we added that there.

https://patchwork.kernel.org/project/netdevbpf/list/?series=842685&state=%2A&archive=both

See commits 1/6 and 2/6

Don’t place the PCB on that antistatic bag, it might create a short circuit

I’m just curious, why don’t you use an SFP-to-SMA or SFP-to-SFP connection for the YT8821 board?

媒體