diff --git a/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch b/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch index b7ace232905..c371bd5ff8d 100644 --- a/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch +++ b/target/linux/generic/pending-6.18/742-net-phy-realtek-add-5G-and-10G-PHY-support.patch @@ -64,7 +64,7 @@ Signed-off-by: Balázs Triszka #include #include -@@ -217,10 +219,27 @@ +@@ -217,10 +219,33 @@ #define RTL_8221B_VM_CG 0x001cc84a #define RTL_8251B 0x001cc862 #define RTL_8261C 0x001cc890 @@ -80,8 +80,14 @@ Signed-off-by: Balázs Triszka +#define RTL826X_VEND1_SERDES_GLOBAL_CFG_HSO_INV BIT(7) + +#define RTL826X_VEND1_PKG_MODEL 0x103 ++#define RTL826X_VEND1_PKG_MODEL_8251 0x8251 ++#define RTL826X_VEND1_PKG_MODEL_8254 0x8254 ++#define RTL826X_VEND1_PKG_MODEL_8261 0x8261 +#define RTL826X_VEND1_VERSION_ID 0x104 +#define RTL826X_VEND1_VERSION_ID_VARIANT GENMASK(2, 0) ++/* MODEL_CHAR_1ST/2ND encode "BE" (B=0x2, E=0x5) in bits 15:6 */ ++#define RTL826X_VEND1_VERSION_ID_MODEL GENMASK(15, 6) ++#define RTL826X_VEND1_VERSION_ID_MODEL_BE 0x1140 + +#define RTL826X_VND2_INER 0xA424 +#define RTL826X_VND2_INER_LINK_STATUS BIT(4) @@ -92,7 +98,7 @@ Signed-off-by: Balázs Triszka MODULE_DESCRIPTION("Realtek PHY driver"); MODULE_AUTHOR("Johnson Leung"); MODULE_LICENSE("GPL"); -@@ -2151,6 +2170,125 @@ static int rtl8251b_c45_match_phy_device +@@ -2151,6 +2176,125 @@ static int rtl8251b_c45_match_phy_device return rtlgen_is_c45_match(phydev, RTL_8251B, true); } @@ -111,7 +117,7 @@ Signed-off-by: Balázs Triszka + if (data < 0) + return 0; + -+ if (data != 0x8251) ++ if (data != RTL826X_VEND1_PKG_MODEL_8251) + return 0; + + return 1; @@ -132,7 +138,7 @@ Signed-off-by: Balázs Triszka + if (data < 0) + return 0; + -+ if (data != 0x8254) ++ if (data != RTL826X_VEND1_PKG_MODEL_8254) + return 0; + + return 1; @@ -153,14 +159,14 @@ Signed-off-by: Balázs Triszka + if (data < 0) + return 0; + -+ if (data == 0x8251) ++ if (data != RTL826X_VEND1_PKG_MODEL_8261) + return 0; + + data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_VERSION_ID); + if (data < 0) + return 0; + -+ if ((data & 0xFFC0) != 0x1140) ++ if ((data & RTL826X_VEND1_VERSION_ID_MODEL) != RTL826X_VEND1_VERSION_ID_MODEL_BE) + return 0; + + return 1; @@ -181,14 +187,14 @@ Signed-off-by: Balázs Triszka + if (data < 0) + return 0; + -+ if (data == 0x8251) ++ if (data != RTL826X_VEND1_PKG_MODEL_8261) + return 0; + + data = phy_read_mmd(phydev, MDIO_MMD_VEND1, RTL826X_VEND1_VERSION_ID); + if (data < 0) + return 0; + -+ if ((data & 0xFFC0) == 0x1140) ++ if ((data & RTL826X_VEND1_VERSION_ID_MODEL) == RTL826X_VEND1_VERSION_ID_MODEL_BE) + return 0; + + return 1; @@ -209,7 +215,7 @@ Signed-off-by: Balázs Triszka + if (data < 0) + return 0; + -+ if (data == 0x8254) ++ if (data == RTL826X_VEND1_PKG_MODEL_8254) + return 0; + + return 1; @@ -218,7 +224,7 @@ Signed-off-by: Balázs Triszka static int rtlgen_resume(struct phy_device *phydev) { int ret = genphy_resume(phydev); -@@ -2372,6 +2510,482 @@ static int rtlgen_sfp_config_aneg(struct +@@ -2372,6 +2516,485 @@ static int rtlgen_sfp_config_aneg(struct return 0; } @@ -252,9 +258,12 @@ Signed-off-by: Balázs Triszka + if (!priv->enable_pma_low_power) + phydev_warn(phydev, "PMA low-power suspend disabled\n"); + -+ /* Disable EEE due to link stability issues */ ++ /* Disable EEE due to link stability issues (incl. multi-G / rate-adapt) */ + phy_disable_eee_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Full_BIT); + phy_disable_eee_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Full_BIT); ++ phy_disable_eee_mode(phydev, ETHTOOL_LINK_MODE_2500baseT_Full_BIT); ++ phy_disable_eee_mode(phydev, ETHTOOL_LINK_MODE_5000baseT_Full_BIT); ++ phy_disable_eee_mode(phydev, ETHTOOL_LINK_MODE_10000baseT_Full_BIT); + + ret = rtl826x_patch_db_init(phydev); + if (ret < 0) @@ -318,7 +327,7 @@ Signed-off-by: Balázs Triszka + if (ret < 0) + return ret; + -+ /* toggle reset */ ++ /* Soft-reset (MMD30.0x145); after release wait datasheet t7 SMI-ready */ + ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, 0x145, BIT(0)); + if (ret < 0) + return ret; @@ -334,7 +343,7 @@ Signed-off-by: Balázs Triszka + return ret; + } + -+ msleep(30); ++ msleep(150); + + ret = rtlgen_phy_patch(phydev); + if (ret) { @@ -701,7 +710,7 @@ Signed-off-by: Balázs Triszka static struct phy_driver realtek_drvs[] = { { PHY_ID_MATCH_EXACT(0x00008201), -@@ -2686,6 +3300,108 @@ static struct phy_driver realtek_drvs[] +@@ -2686,6 +3309,108 @@ static struct phy_driver realtek_drvs[] .resume = genphy_resume, .read_mmd = genphy_read_mmd_unsupported, .write_mmd = genphy_write_mmd_unsupported, diff --git a/target/linux/generic/pending-6.18/743-net-phy-realtek-reset-RTL8261N-USXGMII-SerDes-on-lin.patch b/target/linux/generic/pending-6.18/743-net-phy-realtek-reset-RTL8261N-USXGMII-SerDes-on-lin.patch index 379da970e4c..341087749d5 100644 --- a/target/linux/generic/pending-6.18/743-net-phy-realtek-reset-RTL8261N-USXGMII-SerDes-on-lin.patch +++ b/target/linux/generic/pending-6.18/743-net-phy-realtek-reset-RTL8261N-USXGMII-SerDes-on-lin.patch @@ -65,9 +65,9 @@ Signed-off-by: Daniel Golle +#define RTL826X_SDS_MAX_RESETS 20 + #define RTL826X_VEND1_PKG_MODEL 0x103 - #define RTL826X_VEND1_VERSION_ID 0x104 - #define RTL826X_VEND1_VERSION_ID_VARIANT GENMASK(2, 0) -@@ -2524,6 +2535,70 @@ static int rtl826x_patch_db_init(struct + #define RTL826X_VEND1_PKG_MODEL_8251 0x8251 + #define RTL826X_VEND1_PKG_MODEL_8254 0x8254 +@@ -2530,6 +2541,70 @@ static int rtl826x_patch_db_init(struct return rtl8264b_phy_patch_db_init(phydev); } @@ -138,7 +138,7 @@ Signed-off-by: Daniel Golle static int rtl826x_probe(struct phy_device *phydev) { struct device *dev = &phydev->mdio.dev; -@@ -2535,8 +2610,14 @@ static int rtl826x_probe(struct phy_devi +@@ -2541,8 +2616,14 @@ static int rtl826x_probe(struct phy_devi return -ENOMEM; priv->enable_pma_low_power = device_property_read_bool(dev, "realtek,enable-pma-low-power"); @@ -153,7 +153,7 @@ Signed-off-by: Daniel Golle if (!priv->enable_pma_low_power) phydev_warn(phydev, "PMA low-power suspend disabled\n"); -@@ -3337,6 +3418,7 @@ static struct phy_driver realtek_drvs[] +@@ -3346,6 +3427,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8261BE 10Gbps PHY", .config_init = rtl826x_config_init, @@ -161,7 +161,7 @@ Signed-off-by: Daniel Golle .probe = rtl826x_probe, .get_features = rtl826x_get_features, .suspend = rtl826x_suspend, -@@ -3354,6 +3436,7 @@ static struct phy_driver realtek_drvs[] +@@ -3363,6 +3445,7 @@ static struct phy_driver realtek_drvs[] }, { .name = "RTL8261N 10Gbps PHY", .config_init = rtl826x_config_init, diff --git a/target/linux/realtek/patches-6.18/024-02-v7.1-net-phy-realtek-add-RTL8224-pair-order-support.patch b/target/linux/realtek/patches-6.18/024-02-v7.1-net-phy-realtek-add-RTL8224-pair-order-support.patch index b60ab431cfe..2c070be9fb3 100644 --- a/target/linux/realtek/patches-6.18/024-02-v7.1-net-phy-realtek-add-RTL8224-pair-order-support.patch +++ b/target/linux/realtek/patches-6.18/024-02-v7.1-net-phy-realtek-add-RTL8224-pair-order-support.patch @@ -54,7 +54,7 @@ Signed-off-by: Jakub Kicinski #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -2059,6 +2062,66 @@ static int rtl8224_cable_test_get_status +@@ -2065,6 +2068,66 @@ static int rtl8224_cable_test_get_status return rtl8224_cable_test_report(phydev, finished); } @@ -121,7 +121,7 @@ Signed-off-by: Jakub Kicinski static bool rtlgen_supports_2_5gbps(struct phy_device *phydev) { int val; -@@ -3333,6 +3396,8 @@ static struct phy_driver realtek_drvs[] +@@ -3342,6 +3405,8 @@ static struct phy_driver realtek_drvs[] PHY_ID_MATCH_EXACT(0x001ccad0), .name = "RTL8224 2.5Gbps PHY", .flags = PHY_POLL_CABLE_TEST, diff --git a/target/linux/realtek/patches-6.18/024-04-v7.1-net-phy-realtek-add-RTL8224-polarity-support.patch b/target/linux/realtek/patches-6.18/024-04-v7.1-net-phy-realtek-add-RTL8224-polarity-support.patch index e095c4c6e95..968a33efc57 100644 --- a/target/linux/realtek/patches-6.18/024-04-v7.1-net-phy-realtek-add-RTL8224-polarity-support.patch +++ b/target/linux/realtek/patches-6.18/024-04-v7.1-net-phy-realtek-add-RTL8224-polarity-support.patch @@ -32,7 +32,7 @@ Signed-off-by: Jakub Kicinski #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -2110,9 +2111,40 @@ static int rtl8224_mdi_config_order(stru +@@ -2116,9 +2117,40 @@ static int rtl8224_mdi_config_order(stru order ? BIT(port_offset) : 0); } diff --git a/target/linux/realtek/patches-6.18/030-v7.2-net-phy-realtek-support-MDI-swapping-for-RTL8226-CG.patch b/target/linux/realtek/patches-6.18/030-v7.2-net-phy-realtek-support-MDI-swapping-for-RTL8226-CG.patch index 436283111be..f1fb7faa296 100644 --- a/target/linux/realtek/patches-6.18/030-v7.2-net-phy-realtek-support-MDI-swapping-for-RTL8226-CG.patch +++ b/target/linux/realtek/patches-6.18/030-v7.2-net-phy-realtek-support-MDI-swapping-for-RTL8226-CG.patch @@ -60,7 +60,7 @@ Signed-off-by: Jakub Kicinski #define RTL8366RB_POWER_SAVE 0x15 #define RTL8366RB_POWER_SAVE_ON BIT(12) -@@ -1415,6 +1430,144 @@ static int rtl822x_init_phycr1(struct ph +@@ -1421,6 +1436,144 @@ static int rtl822x_init_phycr1(struct ph mask, val); } @@ -205,7 +205,7 @@ Signed-off-by: Jakub Kicinski static int rtl822x_set_serdes_option_mode(struct phy_device *phydev, bool gen1) { bool has_2500, has_sgmii; -@@ -3312,6 +3465,7 @@ static struct phy_driver realtek_drvs[] +@@ -3321,6 +3474,7 @@ static struct phy_driver realtek_drvs[] .soft_reset = rtl822x_c45_soft_reset, .get_features = rtl822x_c45_get_features, .config_aneg = rtl822x_c45_config_aneg, diff --git a/target/linux/realtek/patches-6.18/743-net-realtek-serdes-configuration.patch b/target/linux/realtek/patches-6.18/743-net-realtek-serdes-configuration.patch index 0badb36486a..98e89e14637 100644 --- a/target/linux/realtek/patches-6.18/743-net-realtek-serdes-configuration.patch +++ b/target/linux/realtek/patches-6.18/743-net-realtek-serdes-configuration.patch @@ -42,7 +42,7 @@ #define RTL8221B_PHYCR1 0xa430 #define RTL8221B_PHYCR1_ALDPS_EN BIT(2) #define RTL8221B_PHYCR1_ALDPS_XTAL_OFF_EN BIT(12) -@@ -2239,6 +2274,147 @@ exit: +@@ -2245,6 +2280,147 @@ exit: return ret; } @@ -190,7 +190,7 @@ static int rtl8224_mdi_config_order(struct phy_device *phydev) { struct device_node *np = phydev->mdio.dev.of_node; -@@ -2293,6 +2469,10 @@ static int rtl8224_config_init(struct ph +@@ -2299,6 +2475,10 @@ static int rtl8224_config_init(struct ph { int ret;