1d82a9689SDylan Hung /* SPDX-License-Identifier: GPL-2.0+ */ 2d82a9689SDylan Hung /* 3d82a9689SDylan Hung * Copyright (C) ASPEED Technology Inc. 4d82a9689SDylan Hung */ 55c8f9400Sryan_chen void recov_phy_marvell(MAC_ENGINE *eng); 65c8f9400Sryan_chen void phy_marvell(MAC_ENGINE *eng); 75c8f9400Sryan_chen void recov_phy_marvell0(MAC_ENGINE *eng); 85c8f9400Sryan_chen void phy_marvell0(MAC_ENGINE *eng); 95c8f9400Sryan_chen void recov_phy_marvell1(MAC_ENGINE *eng); 105c8f9400Sryan_chen void phy_marvell1(MAC_ENGINE *eng); 115c8f9400Sryan_chen void recov_phy_marvell2(MAC_ENGINE *eng); 125c8f9400Sryan_chen void phy_marvell2(MAC_ENGINE *eng); 135c8f9400Sryan_chen void phy_marvell3(MAC_ENGINE *eng); 145c8f9400Sryan_chen void phy_broadcom(MAC_ENGINE *eng); 155c8f9400Sryan_chen void recov_phy_broadcom0(MAC_ENGINE *eng); 165c8f9400Sryan_chen void phy_broadcom0(MAC_ENGINE *eng); 175c8f9400Sryan_chen void phy_realtek(MAC_ENGINE *eng); 185c8f9400Sryan_chen void phy_realtek0(MAC_ENGINE *eng); 195c8f9400Sryan_chen void recov_phy_realtek1(MAC_ENGINE *eng); 205c8f9400Sryan_chen void phy_realtek1(MAC_ENGINE *eng); 215c8f9400Sryan_chen void recov_phy_realtek2(MAC_ENGINE *eng); 225c8f9400Sryan_chen void recov_phy_realtek3(MAC_ENGINE *eng); 235c8f9400Sryan_chen void phy_realtek3(MAC_ENGINE *eng); 245c8f9400Sryan_chen void phy_realtek4(MAC_ENGINE *eng); 255c8f9400Sryan_chen void phy_realtek2(MAC_ENGINE *eng); 265c8f9400Sryan_chen void recov_phy_realtek5(MAC_ENGINE *eng); 275c8f9400Sryan_chen void phy_realtek5(MAC_ENGINE *eng); 285c8f9400Sryan_chen void phy_realtek6(MAC_ENGINE *eng); 295c8f9400Sryan_chen void phy_smsc(MAC_ENGINE *eng); 305c8f9400Sryan_chen void phy_micrel(MAC_ENGINE *eng); 315c8f9400Sryan_chen void phy_micrel0(MAC_ENGINE *eng); 325c8f9400Sryan_chen void phy_micrel1(MAC_ENGINE *eng); 335c8f9400Sryan_chen void phy_micrel2(MAC_ENGINE *eng); 345c8f9400Sryan_chen void recov_phy_vitesse(MAC_ENGINE *eng); 355c8f9400Sryan_chen void phy_vitesse(MAC_ENGINE *eng); 365c8f9400Sryan_chen void recov_phy_atheros(MAC_ENGINE *eng); 375c8f9400Sryan_chen void phy_atheros(MAC_ENGINE *eng); 385c8f9400Sryan_chen void phy_default(MAC_ENGINE *eng); 395c8f9400Sryan_chen 405c8f9400Sryan_chen struct phy_desc { 41daba96f3SDylan Hung uint16_t id1; 425c8f9400Sryan_chen uint16_t id2; 43daba96f3SDylan Hung uint16_t id2_mask; 445c8f9400Sryan_chen uint8_t name[64]; 455c8f9400Sryan_chen PHY_ENGINE cfg; 465c8f9400Sryan_chen }; 475c8f9400Sryan_chen 48*ff6a54e2SDylan Hung #define PHY_LOOKUP_N 35 495c8f9400Sryan_chen static const struct phy_desc phy_lookup_tbl[PHY_LOOKUP_N] = { 50daba96f3SDylan Hung { .id1 = 0x001c, 51daba96f3SDylan Hung .id2 = 0xc916, 52daba96f3SDylan Hung .id2_mask = 0xffff, 535c8f9400Sryan_chen .name = "RTL8211F", 545c8f9400Sryan_chen .cfg.fp_set = phy_realtek5, 555c8f9400Sryan_chen .cfg.fp_clr = recov_phy_realtek5 }, 56daba96f3SDylan Hung { .id1 = 0x001c, 57e961bfafSDylan Hung .id2 = 0xc859, 58e961bfafSDylan Hung .id2_mask = 0xffff, 59e961bfafSDylan Hung .name = "RTL8211FD-VX", 60e961bfafSDylan Hung .cfg.fp_set = phy_realtek5, 61e961bfafSDylan Hung .cfg.fp_clr = recov_phy_realtek5 }, 62e961bfafSDylan Hung { .id1 = 0x001c, 63*ff6a54e2SDylan Hung .id2 = 0xc870, 64*ff6a54e2SDylan Hung .id2_mask = 0xfff0, 65*ff6a54e2SDylan Hung .name = "RTL8211F-VD", 66*ff6a54e2SDylan Hung .cfg.fp_set = phy_realtek5, 67*ff6a54e2SDylan Hung .cfg.fp_clr = recov_phy_realtek5 }, 68*ff6a54e2SDylan Hung { .id1 = 0x001c, 69daba96f3SDylan Hung .id2 = 0xc915, 70daba96f3SDylan Hung .id2_mask = 0xffff, 715c8f9400Sryan_chen .name = "RTL8211E", 725c8f9400Sryan_chen .cfg.fp_set = phy_realtek2, 735c8f9400Sryan_chen .cfg.fp_clr = recov_phy_realtek2 }, 74daba96f3SDylan Hung { .id1 = 0x001c, 75daba96f3SDylan Hung .id2 = 0xc914, 76daba96f3SDylan Hung .id2_mask = 0xffff, 775c8f9400Sryan_chen .name = "RTL8211D", 785c8f9400Sryan_chen .cfg.fp_set = phy_realtek1, 795c8f9400Sryan_chen .cfg.fp_clr = recov_phy_realtek1 }, 80daba96f3SDylan Hung { .id1 = 0x001c, 81daba96f3SDylan Hung .id2 = 0xc912, 82daba96f3SDylan Hung .id2_mask = 0xffff, 835c8f9400Sryan_chen .name = "RTL8211C", 845c8f9400Sryan_chen .cfg.fp_set = phy_realtek3, 855c8f9400Sryan_chen .cfg.fp_clr = recov_phy_realtek3 }, 86daba96f3SDylan Hung { .id1 = 0x001c, 87daba96f3SDylan Hung .id2 = 0xc930, 88daba96f3SDylan Hung .id2_mask = 0xffff, 895c8f9400Sryan_chen .name = "RTL8363S", 905c8f9400Sryan_chen .cfg.fp_set = phy_realtek6, 915c8f9400Sryan_chen .cfg.fp_clr = NULL }, 92daba96f3SDylan Hung { .id1 = 0x001c, 93daba96f3SDylan Hung .id2 = 0xc816, 94daba96f3SDylan Hung .id2_mask = 0xffff, 955c8f9400Sryan_chen .name = "RTL8201F", 965c8f9400Sryan_chen .cfg.fp_set = phy_realtek4, 975c8f9400Sryan_chen .cfg.fp_clr = NULL }, 98daba96f3SDylan Hung { .id1 = 0x001c, 99daba96f3SDylan Hung .id2 = 0xc815, 100daba96f3SDylan Hung .id2_mask = 0xfff0, 1015c8f9400Sryan_chen .name = "RTL8201E", 1025c8f9400Sryan_chen .cfg.fp_set = phy_realtek0, 1035c8f9400Sryan_chen .cfg.fp_clr = NULL }, 104daba96f3SDylan Hung { .id1 = 0x0000, 105daba96f3SDylan Hung .id2 = 0x8201, 106daba96f3SDylan Hung .id2_mask = PHYID3_Mask, 1075c8f9400Sryan_chen .name = "RTL8201N", 1085c8f9400Sryan_chen .cfg.fp_set = phy_realtek, 1095c8f9400Sryan_chen .cfg.fp_clr = NULL }, 110daba96f3SDylan Hung { .id1 = 0x0143, 111daba96f3SDylan Hung .id2 = 0xbcb2, 112daba96f3SDylan Hung .id2_mask = 0xfff0, 1135c8f9400Sryan_chen .name = "BCM5482", 1145c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1155c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 116daba96f3SDylan Hung { .id1 = 0x0143, 117daba96f3SDylan Hung .id2 = 0xbca0, 118daba96f3SDylan Hung .id2_mask = 0xfff0, 1195c8f9400Sryan_chen .name = "BCM5481", 1205c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1215c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 122daba96f3SDylan Hung { .id1 = 0x0362, 123daba96f3SDylan Hung .id2 = 0x5e6a, 124daba96f3SDylan Hung .id2_mask = 0xfff0, 1255c8f9400Sryan_chen .name = "BCM54612", 1265c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1275c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 128daba96f3SDylan Hung { .id1 = 0x0362, 129daba96f3SDylan Hung .id2 = 0x5d10, 130daba96f3SDylan Hung .id2_mask = 0xfff0, 1315c8f9400Sryan_chen .name = "BCM54616S", 1325c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1335c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 134daba96f3SDylan Hung { .id1 = 0x0020, 135daba96f3SDylan Hung .id2 = 0x60b0, 136daba96f3SDylan Hung .id2_mask = 0xfff0, 1375c8f9400Sryan_chen .name = "BCM5464SR", 1385c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1395c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 140daba96f3SDylan Hung { .id1 = 0x0020, 141daba96f3SDylan Hung .id2 = 0x60c1, 142daba96f3SDylan Hung .id2_mask = 0xfff0, 1435c8f9400Sryan_chen .name = "BCM5461S", 1445c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1455c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 146daba96f3SDylan Hung { .id1 = 0x600d, 147daba96f3SDylan Hung .id2 = 0x84a2, 148daba96f3SDylan Hung .id2_mask = 0xfff0, 1494c1e9a66SDylan Hung .name = "BCM5421x", 1505c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1515c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 152daba96f3SDylan Hung { .id1 = 0x0143, 153daba96f3SDylan Hung .id2 = 0xbd63, 154daba96f3SDylan Hung .id2_mask = 0xfff0, 1555c8f9400Sryan_chen .name = "BCM54610C", 1565c8f9400Sryan_chen .cfg.fp_set = phy_broadcom0, 1575c8f9400Sryan_chen .cfg.fp_clr = recov_phy_broadcom0 }, 158daba96f3SDylan Hung { .id1 = 0x0040, 159daba96f3SDylan Hung .id2 = 0x61e0, 160daba96f3SDylan Hung .id2_mask = PHYID3_Mask, 1615c8f9400Sryan_chen .name = "BCM5221", 1625c8f9400Sryan_chen .cfg.fp_set = phy_broadcom, 1635c8f9400Sryan_chen .cfg.fp_clr = NULL }, 164daba96f3SDylan Hung { .id1 = 0x0141, 165daba96f3SDylan Hung .id2 = 0x0e22, 166daba96f3SDylan Hung .id2_mask = 0xfff0, 1675c8f9400Sryan_chen .name = "88E3019", 1685c8f9400Sryan_chen .cfg.fp_set = phy_marvell3, 1695c8f9400Sryan_chen .cfg.fp_clr = NULL }, 170daba96f3SDylan Hung { .id1 = 0x0141, 171daba96f3SDylan Hung .id2 = 0x0dd0, 172daba96f3SDylan Hung .id2_mask = 0xfff0, 1735c8f9400Sryan_chen .name = "88E15 10/12/14/18", 1745c8f9400Sryan_chen .cfg.fp_set = phy_marvell2, 1755c8f9400Sryan_chen .cfg.fp_clr = recov_phy_marvell2 }, 176daba96f3SDylan Hung { .id1 = 0xff00, 177daba96f3SDylan Hung .id2 = 0x1761, 178daba96f3SDylan Hung .id2_mask = 0xffff, 1795c8f9400Sryan_chen .name = "88E6176(IntLoop)", 1805c8f9400Sryan_chen .cfg.fp_set = phy_marvell1, 1815c8f9400Sryan_chen .cfg.fp_clr = recov_phy_marvell1 }, 182daba96f3SDylan Hung { .id1 = 0xff00, 183daba96f3SDylan Hung .id2 = 0x1152, 184daba96f3SDylan Hung .id2_mask = 0xffff, 1855c8f9400Sryan_chen .name = "88E6320(IntLoop)", 1865c8f9400Sryan_chen .cfg.fp_set = phy_marvell1, 1875c8f9400Sryan_chen .cfg.fp_clr = recov_phy_marvell1 }, 188daba96f3SDylan Hung { .id1 = 0x0141, 189daba96f3SDylan Hung .id2 = 0x0e90, 190daba96f3SDylan Hung .id2_mask = 0xfff0, 1915c8f9400Sryan_chen .name = "88E1310", 1925c8f9400Sryan_chen .cfg.fp_set = phy_marvell0, 1935c8f9400Sryan_chen .cfg.fp_clr = recov_phy_marvell0 }, 194daba96f3SDylan Hung { .id1 = 0x0141, 195daba96f3SDylan Hung .id2 = 0x0cc0, 196daba96f3SDylan Hung .id2_mask = PHYID3_Mask, 1975c8f9400Sryan_chen .name = "88E1111", 1985c8f9400Sryan_chen .cfg.fp_set = phy_marvell, 1995c8f9400Sryan_chen .cfg.fp_clr = recov_phy_marvell }, 200daba96f3SDylan Hung { .id1 = 0x0022, 201daba96f3SDylan Hung .id2 = 0x1555, 202daba96f3SDylan Hung .id2_mask = 0xfff0, 2035c8f9400Sryan_chen .name = "KSZ8031/KSZ8051", 2045c8f9400Sryan_chen .cfg.fp_set = phy_micrel0, 2055c8f9400Sryan_chen .cfg.fp_clr = NULL }, 206daba96f3SDylan Hung { .id1 = 0x0022, 207daba96f3SDylan Hung .id2 = 0x1622, 208daba96f3SDylan Hung .id2_mask = 0xfff0, 2095c8f9400Sryan_chen .name = "KSZ9031", 2105c8f9400Sryan_chen .cfg.fp_set = phy_micrel1, 2115c8f9400Sryan_chen .cfg.fp_clr = NULL }, 212daba96f3SDylan Hung { .id1 = 0x0022, 213daba96f3SDylan Hung .id2 = 0x1562, 214daba96f3SDylan Hung .id2_mask = 0xfff0, 2155c8f9400Sryan_chen .name = "KSZ8081", 2165c8f9400Sryan_chen .cfg.fp_set = phy_micrel2, 2175c8f9400Sryan_chen .cfg.fp_clr = NULL }, 218daba96f3SDylan Hung { .id1 = 0x0022, 219daba96f3SDylan Hung .id2 = 0x1512, 220daba96f3SDylan Hung .id2_mask = 0xfff0, 2215c8f9400Sryan_chen .name = "KSZ8041", 2225c8f9400Sryan_chen .cfg.fp_set = phy_micrel, 2235c8f9400Sryan_chen .cfg.fp_clr = NULL }, 224daba96f3SDylan Hung { .id1 = 0x004d, 225daba96f3SDylan Hung .id2 = 0xd072, 226daba96f3SDylan Hung .id2_mask = 0xfff0, 2275c8f9400Sryan_chen .name = "AR8035", 2285c8f9400Sryan_chen .cfg.fp_set = phy_atheros, 2295c8f9400Sryan_chen .cfg.fp_clr = recov_phy_atheros }, 230daba96f3SDylan Hung { .id1 = 0x0007, 231daba96f3SDylan Hung .id2 = 0xc0c4, 232daba96f3SDylan Hung .id2_mask = PHYID3_Mask, 2335c8f9400Sryan_chen .name = "LAN8700", 2345c8f9400Sryan_chen .cfg.fp_set = phy_smsc, 2355c8f9400Sryan_chen .cfg.fp_clr = NULL }, 236daba96f3SDylan Hung { .id1 = 0x000f, 237daba96f3SDylan Hung .id2 = 0xc4b1, 238daba96f3SDylan Hung .id2_mask = 0xfff0, 2395c8f9400Sryan_chen .name = "VSC8211", 2405c8f9400Sryan_chen .cfg.fp_set = phy_vitesse, 2415c8f9400Sryan_chen .cfg.fp_clr = recov_phy_vitesse }, 242daba96f3SDylan Hung { .id1 = 0x0007, 243daba96f3SDylan Hung .id2 = 0x0421, 244daba96f3SDylan Hung .id2_mask = 0xfff0, 2455c8f9400Sryan_chen .name = "VSC8601", 2465c8f9400Sryan_chen .cfg.fp_set = phy_vitesse, 2475c8f9400Sryan_chen .cfg.fp_clr = recov_phy_vitesse }, 248daba96f3SDylan Hung { .id1 = 0x0007, 249daba96f3SDylan Hung .id2 = 0x0431, 250daba96f3SDylan Hung .id2_mask = 0xfff0, 2515c8f9400Sryan_chen .name = "VSC8641", 2525c8f9400Sryan_chen .cfg.fp_set = phy_vitesse, 2535c8f9400Sryan_chen .cfg.fp_clr = recov_phy_vitesse }, 254daba96f3SDylan Hung { .id1 = 0x0000, 255daba96f3SDylan Hung .id2 = 0x0000, 256daba96f3SDylan Hung .id2_mask = 0x0000, 2575c8f9400Sryan_chen .name = "default", 2585c8f9400Sryan_chen .cfg.fp_set = phy_default, 2595c8f9400Sryan_chen .cfg.fp_clr = NULL }, 2605c8f9400Sryan_chen };