Totally forgot those unfinished fragments ... save them for posterity before dropping the build environment ...
Minimum RLT839x 10G SerDes initialization sequence to get QSGMII PHY link up and running and compensate for missing U-Boot.
... somehwere early in the PCS driver ...
if (sds != 8 && sds !=9 && sds != 12 && sds != 13)
return;
rtpcs_sds_write(ctrl, sds, 0x0a, 0x1c, 0x002a);
rtpcs_sds_write(ctrl, sds, 0x0a, 0x1d, 0x0000);
rtpcs_sds_write(ctrl, sds, 0x0a, 0x1e, 0xa052); /* changes to 0x0002 */
rtpcs_sds_write(ctrl, sds, 0x0a, 0x1f, 0x9a00); /* changes to 0xbe00 */
rtpcs_sds_write(ctrl, sds, 0x0b, 0x00, 0x00f5);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x01, 0xc480);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x05, 0x3340);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x08, 0x803f);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x0c, 0x2bff);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x0d, 0x2bff);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x11, 0x0000);
if (even) {
rtpcs_sds_write(ctrl, sds, 0x0a, 0x11, 0xf04a);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x04, 0x39ff);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x06, 0x40a2);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x0e, 0x4e10); /* changes to 0x0a10 */
} else {
rtpcs_sds_write(ctrl, sds, 0x0a, 0x11, 0xfdab);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x04, 0x93fa);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x06, 0x4280);
rtpcs_sds_write(ctrl, sds, 0x0b, 0x0e, 0x4c50); /* changes to 0x0a10 */
}
/* Needs this function from RTK afterwards */
rtl839x_serdes_reset(sds);
Minimum RTL8214FC initialization sequence to get network connectivity and to compensate for missing U-Boot. Should work on RTL838x too.
static int rtl8214fc_config_init(struct phy_device *phydev)
{
static int regs[] = {16, 19, 20, 21};
if (phydev->mdio.addr % 8)
return 0;
...
for (port = 0; port < 4; port++)
patchphy = get_package_phy(phydev, port);
phy_write(phydev, 0x1e, 0x8);
/* setup basic fiber control in base phy and default to copper */
phy_write_paged(phydev, 0x266, regs[port], 0x0f95};
phy_write(phydev, 0x1e, 0x0);
phy_write(patchphy, 0x1e, 0x3);
/* set fiber SerDes RX to negative edge */
phy_modify_paged(patchphy, 0x8, 0x17, BIT(14), 0);
/* auto negotiation disable link on */
phy_modify_paged(patchphy, 0x8, 0x14, 0, BIT(2));
/* disable fiber 100MBit */
phy_modify_paged(patchphy, 0x8, 0x17, BIT(5), 0);
phy_write(patchphy, 0x1e, 0x0);
/* Disable EEE. 0xa5d/0x10 is the same as MDIO_MMD_AN / MDIO_AN_EEE_ADV */
phy_write_paged(patchphy, 0xa5d, 0x10, 0x0000);
}
/* similar hardware, reuse for MAC SerDes init */
rtl8218b_config_init(phydev);
...