mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 12:40:16 +04:00
45633073fe
At least the XikeStor SKT-2.5G-100M SFP module seems to internally use MDIO address 0 to access the PHY. This module allows accessing PHY registers using Rollball protocol on address 0x51, and also provides read-only C22 access on address 0x56. However, after disabling the PHYAD0 configuration bit, only 0xffff can be read via both methods (except for MMD device 30 which can still be accessed). Since having MDIO address 0 enabled shouldn't do any harm on SFP modules just leave the configuration bit alone in that case. Signed-off-by: Jan Hoffmann <jan@3e8.eu> Link: https://github.com/openwrt/openwrt/pull/23065 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
48 lines
1.8 KiB
Diff
48 lines
1.8 KiB
Diff
From: Daniel Golle <daniel@makrotopia.org>
|
|
Date: Thu, 30 Jan 2025 05:38:31 +0000
|
|
Subject: [PATCH] net: phy: realtek: disable MDIO broadcast
|
|
|
|
RealTek's PHYs by default also listen on MDIO address 0 which is defined
|
|
as broadcast address. This can lead to problems if there is an actual PHY
|
|
(such as MT7981 built-in PHY) present at this address, as accessing that
|
|
PHY may then confuse the RealTek PHY.
|
|
|
|
Disabled listening on the MDIO broadcast address to avoid such problems.
|
|
|
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
---
|
|
--- a/drivers/net/phy/realtek/realtek_main.c
|
|
+++ b/drivers/net/phy/realtek/realtek_main.c
|
|
@@ -173,6 +173,7 @@
|
|
#define RTL8221B_PHYCR1 0xa430
|
|
#define RTL8221B_PHYCR1_ALDPS_EN BIT(2)
|
|
#define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12)
|
|
+#define RTL8221B_PHYCR1_PHYAD_0_EN BIT(13)
|
|
|
|
#define RTL8366RB_POWER_SAVE 0x15
|
|
#define RTL8366RB_POWER_SAVE_ON BIT(12)
|
|
@@ -1351,14 +1352,21 @@ static int rtl822xb_write_mmd(struct phy
|
|
static int rtl822x_init_phycr1(struct phy_device *phydev, bool no_aldps)
|
|
{
|
|
struct rtl822x_priv *priv = phydev->priv;
|
|
+ u16 mask = RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN;
|
|
u16 val = 0;
|
|
|
|
+ /* The controller in some SFP modules uses MDIO address 0 to access the
|
|
+ * PHY. Leave the MDIO broadcast configuration bit alone for SFP
|
|
+ * modules, as it won't cause any issues there anyways.
|
|
+ */
|
|
+ if (!phydev->is_on_sfp_module)
|
|
+ mask |= RTL8221B_PHYCR1_PHYAD_0_EN;
|
|
+
|
|
if (priv->enable_aldps && !no_aldps)
|
|
val = RTL8221B_PHYCR1_ALDPS_EN | RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN;
|
|
|
|
return phy_modify_mmd_changed(phydev, MDIO_MMD_VEND2, RTL8221B_PHYCR1,
|
|
- RTL8221B_PHYCR1_ALDPS_EN |
|
|
- RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN, val);
|
|
+ mask, val);
|
|
}
|
|
|
|
static int rtl822x_set_serdes_option_mode(struct phy_device *phydev, bool gen1)
|