]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
mediatek: fix 2.5G PHY LED polarity for MT7987 21200/head
authorChukun Pan <amadeus@jmu.edu.cn>
Fri, 5 Dec 2025 12:16:02 +0000 (20:16 +0800)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 9 Jan 2026 12:59:54 +0000 (12:59 +0000)
The patch that adds MT7987 support to the mtk-2p5ge
driver does the following:

case MTK_2P5GPHY_ID_MT7987:
phy_clear_bits_mmd MTK_PHY_LED_ON_POLARITY
case MTK_2P5GPHY_ID_MT7988:
phy_set_bits_mmd.. MTK_PHY_LED_ON_POLARITY

phy_set_bits_mmd... MTK_PHY_LED_ON_POLARITY | xxx

This clearly resulted in the LED polarity of the 2.5G PHY
on the MT7987 being reversed. Remove redundant MMD operations
to fix the 2.5G PHY LED error on Bananapi BPi-R4 Lite.

Fixes: d62fc50f ("mediatek: import patches from SDK to support MT7987 Ethernet")
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
target/linux/mediatek/patches-6.12/752-net-phy-mediatek-i2p5g-add-support-for-mt7987.patch

index de720a3571249d17b0f47d8afd8979e99b151f32..eea7f6e79ac7713c96e76ffa89d123083fbcce24 100644 (file)
  {
        struct mtk_i2p5ge_phy_priv *priv = phydev->priv;
        void __iomem *mcu_csr_base, *pmb_addr;
-@@ -135,7 +449,20 @@ static int mt798x_2p5ge_phy_config_init(
+@@ -135,15 +449,27 @@ static int mt798x_2p5ge_phy_config_init(
        if (phydev->interface != PHY_INTERFACE_MODE_INTERNAL)
                return -ENODEV;
  
        if (ret < 0)
                return ret;
  
-@@ -293,6 +620,7 @@ static int mt798x_2p5ge_phy_probe(struct
+       /* Setup LED */
+       phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL,
+-                       MTK_PHY_LED_ON_POLARITY | MTK_PHY_LED_ON_LINK10 |
+-                       MTK_PHY_LED_ON_LINK100 | MTK_PHY_LED_ON_LINK1000 |
+-                       MTK_PHY_LED_ON_LINK2500);
++                       MTK_PHY_LED_ON_LINK10 | MTK_PHY_LED_ON_LINK100 |
++                       MTK_PHY_LED_ON_LINK1000 | MTK_PHY_LED_ON_LINK2500);
+       phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED1_ON_CTRL,
+                        MTK_PHY_LED_ON_FDX | MTK_PHY_LED_ON_HDX);
+@@ -293,6 +619,7 @@ static int mt798x_2p5ge_phy_probe(struct
                return -ENOMEM;
  
        switch (phydev->drv->phy_id) {
        case MTK_2P5GPHY_ID_MT7988:
                /* The original hardware only sets MDIO_DEVS_PMAPMD */
                phydev->c45_ids.mmds_present |= MDIO_DEVS_PCS |
-@@ -312,6 +640,20 @@ static int mt798x_2p5ge_phy_probe(struct
+@@ -312,6 +639,20 @@ static int mt798x_2p5ge_phy_probe(struct
  
  static struct phy_driver mtk_2p5gephy_driver[] = {
        {