]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: phy: enhance RTL8218B initialization
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Wed, 7 Jan 2026 07:02:40 +0000 (08:02 +0100)
committerStijn Tintel <stijn@linux-ipv6.be>
Mon, 12 Jan 2026 02:44:48 +0000 (04:44 +0200)
The RTL8214FC and the RTL8218B share the same register set and
need to be initialized quite similar. In the future the RTl8214FC
will get its own setup sequence. To keep the codebase small the
common parts (serdes & copper) will be covered by the existing
RTL8218B configuration.

Enhance the RTL8218B setup with this separate commit to ensure
that nothing breaks.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21435
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c

index b6d2aba00f30b4bc048b3d1ba63edb397f45c7bd..8ac3024439d38d2409604ea43139c5b28e9aa7c1 100644 (file)
@@ -904,9 +904,19 @@ static int rtl8218b_config_init(struct phy_device *phydev)
        phy_modify_paged(phydev, RTL821X_MAC_SDS_PAGE(0, 1), 0x14, 0, BIT(3));
        /* magic CMU setting for stable connectivity of first MAC serdes */
        phy_write_paged(phydev, 0x462, 0x15, 0x6e58);
+       /* magic setting for rate select 10G full */
+       phy_write_paged(phydev, 0x464, 0x15, 0x202a);
+       /* magic setting for variable gain amplifier */
+       phy_modify_paged(phydev, 0x464, 0x12, 0, 0x1f80);
+       /* magic setting for equalizer of second MAC serdes */
+       phy_write_paged(phydev, RTL821X_MAC_SDS_PAGE(1, 8), 0x12, 0x2020);
+       /* unknown magic for second MAC serdes */
+       phy_write_paged(phydev, RTL821X_MAC_SDS_PAGE(1, 9), 0x11, 0xc014);
        rtl8218b_cmu_reset(phydev, 0);
 
        for (int sds = 0; sds < 2; sds++) {
+               /* disable ring PLL for serdes 2+3 */
+               phy_modify_paged(phydev, RTL821X_MAC_SDS_PAGE(sds + 1, 8), 0x11, BIT(15), 0);
                /* force negative clock edge */
                phy_modify_paged(phydev, RTL821X_MAC_SDS_PAGE(sds, 0), 0x17, 0, BIT(14));
                rtl8218b_cmu_reset(phydev, 5 + sds);