1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright (C) ASPEED Technology Inc. 4 */ 5 void recov_phy_marvell(MAC_ENGINE *eng); 6 void phy_marvell(MAC_ENGINE *eng); 7 void recov_phy_marvell0(MAC_ENGINE *eng); 8 void phy_marvell0(MAC_ENGINE *eng); 9 void recov_phy_marvell1(MAC_ENGINE *eng); 10 void phy_marvell1(MAC_ENGINE *eng); 11 void recov_phy_marvell2(MAC_ENGINE *eng); 12 void phy_marvell2(MAC_ENGINE *eng); 13 void phy_marvell3(MAC_ENGINE *eng); 14 void phy_broadcom(MAC_ENGINE *eng); 15 void recov_phy_broadcom0(MAC_ENGINE *eng); 16 void phy_broadcom0(MAC_ENGINE *eng); 17 void phy_realtek(MAC_ENGINE *eng); 18 void phy_realtek0(MAC_ENGINE *eng); 19 void recov_phy_realtek1(MAC_ENGINE *eng); 20 void phy_realtek1(MAC_ENGINE *eng); 21 void recov_phy_realtek2(MAC_ENGINE *eng); 22 void recov_phy_realtek3(MAC_ENGINE *eng); 23 void phy_realtek3(MAC_ENGINE *eng); 24 void phy_realtek4(MAC_ENGINE *eng); 25 void phy_realtek2(MAC_ENGINE *eng); 26 void recov_phy_realtek5(MAC_ENGINE *eng); 27 void phy_realtek5(MAC_ENGINE *eng); 28 void phy_realtek6(MAC_ENGINE *eng); 29 void phy_smsc(MAC_ENGINE *eng); 30 void phy_micrel(MAC_ENGINE *eng); 31 void phy_micrel0(MAC_ENGINE *eng); 32 void phy_micrel1(MAC_ENGINE *eng); 33 void phy_micrel2(MAC_ENGINE *eng); 34 void recov_phy_vitesse(MAC_ENGINE *eng); 35 void phy_vitesse(MAC_ENGINE *eng); 36 void recov_phy_atheros(MAC_ENGINE *eng); 37 void phy_atheros(MAC_ENGINE *eng); 38 void phy_default(MAC_ENGINE *eng); 39 40 struct phy_desc { 41 uint16_t id1; 42 uint16_t id2; 43 uint16_t id2_mask; 44 uint8_t name[64]; 45 PHY_ENGINE cfg; 46 }; 47 48 #define PHY_LOOKUP_N 35 49 static const struct phy_desc phy_lookup_tbl[PHY_LOOKUP_N] = { 50 { .id1 = 0x001c, 51 .id2 = 0xc916, 52 .id2_mask = 0xffff, 53 .name = "RTL8211F", 54 .cfg.fp_set = phy_realtek5, 55 .cfg.fp_clr = recov_phy_realtek5 }, 56 { .id1 = 0x001c, 57 .id2 = 0xc859, 58 .id2_mask = 0xffff, 59 .name = "RTL8211FD-VX", 60 .cfg.fp_set = phy_realtek5, 61 .cfg.fp_clr = recov_phy_realtek5 }, 62 { .id1 = 0x001c, 63 .id2 = 0xc870, 64 .id2_mask = 0xfff0, 65 .name = "RTL8211F-VD", 66 .cfg.fp_set = phy_realtek5, 67 .cfg.fp_clr = recov_phy_realtek5 }, 68 { .id1 = 0x001c, 69 .id2 = 0xc915, 70 .id2_mask = 0xffff, 71 .name = "RTL8211E", 72 .cfg.fp_set = phy_realtek2, 73 .cfg.fp_clr = recov_phy_realtek2 }, 74 { .id1 = 0x001c, 75 .id2 = 0xc914, 76 .id2_mask = 0xffff, 77 .name = "RTL8211D", 78 .cfg.fp_set = phy_realtek1, 79 .cfg.fp_clr = recov_phy_realtek1 }, 80 { .id1 = 0x001c, 81 .id2 = 0xc912, 82 .id2_mask = 0xffff, 83 .name = "RTL8211C", 84 .cfg.fp_set = phy_realtek3, 85 .cfg.fp_clr = recov_phy_realtek3 }, 86 { .id1 = 0x001c, 87 .id2 = 0xc930, 88 .id2_mask = 0xffff, 89 .name = "RTL8363S", 90 .cfg.fp_set = phy_realtek6, 91 .cfg.fp_clr = NULL }, 92 { .id1 = 0x001c, 93 .id2 = 0xc816, 94 .id2_mask = 0xffff, 95 .name = "RTL8201F", 96 .cfg.fp_set = phy_realtek4, 97 .cfg.fp_clr = NULL }, 98 { .id1 = 0x001c, 99 .id2 = 0xc815, 100 .id2_mask = 0xfff0, 101 .name = "RTL8201E", 102 .cfg.fp_set = phy_realtek0, 103 .cfg.fp_clr = NULL }, 104 { .id1 = 0x0000, 105 .id2 = 0x8201, 106 .id2_mask = PHYID3_Mask, 107 .name = "RTL8201N", 108 .cfg.fp_set = phy_realtek, 109 .cfg.fp_clr = NULL }, 110 { .id1 = 0x0143, 111 .id2 = 0xbcb2, 112 .id2_mask = 0xfff0, 113 .name = "BCM5482", 114 .cfg.fp_set = phy_broadcom0, 115 .cfg.fp_clr = recov_phy_broadcom0 }, 116 { .id1 = 0x0143, 117 .id2 = 0xbca0, 118 .id2_mask = 0xfff0, 119 .name = "BCM5481", 120 .cfg.fp_set = phy_broadcom0, 121 .cfg.fp_clr = recov_phy_broadcom0 }, 122 { .id1 = 0x0362, 123 .id2 = 0x5e6a, 124 .id2_mask = 0xfff0, 125 .name = "BCM54612", 126 .cfg.fp_set = phy_broadcom0, 127 .cfg.fp_clr = recov_phy_broadcom0 }, 128 { .id1 = 0x0362, 129 .id2 = 0x5d10, 130 .id2_mask = 0xfff0, 131 .name = "BCM54616S", 132 .cfg.fp_set = phy_broadcom0, 133 .cfg.fp_clr = recov_phy_broadcom0 }, 134 { .id1 = 0x0020, 135 .id2 = 0x60b0, 136 .id2_mask = 0xfff0, 137 .name = "BCM5464SR", 138 .cfg.fp_set = phy_broadcom0, 139 .cfg.fp_clr = recov_phy_broadcom0 }, 140 { .id1 = 0x0020, 141 .id2 = 0x60c1, 142 .id2_mask = 0xfff0, 143 .name = "BCM5461S", 144 .cfg.fp_set = phy_broadcom0, 145 .cfg.fp_clr = recov_phy_broadcom0 }, 146 { .id1 = 0x600d, 147 .id2 = 0x84a2, 148 .id2_mask = 0xfff0, 149 .name = "BCM5421x", 150 .cfg.fp_set = phy_broadcom0, 151 .cfg.fp_clr = recov_phy_broadcom0 }, 152 { .id1 = 0x0143, 153 .id2 = 0xbd63, 154 .id2_mask = 0xfff0, 155 .name = "BCM54610C", 156 .cfg.fp_set = phy_broadcom0, 157 .cfg.fp_clr = recov_phy_broadcom0 }, 158 { .id1 = 0x0040, 159 .id2 = 0x61e0, 160 .id2_mask = PHYID3_Mask, 161 .name = "BCM5221", 162 .cfg.fp_set = phy_broadcom, 163 .cfg.fp_clr = NULL }, 164 { .id1 = 0x0141, 165 .id2 = 0x0e22, 166 .id2_mask = 0xfff0, 167 .name = "88E3019", 168 .cfg.fp_set = phy_marvell3, 169 .cfg.fp_clr = NULL }, 170 { .id1 = 0x0141, 171 .id2 = 0x0dd0, 172 .id2_mask = 0xfff0, 173 .name = "88E15 10/12/14/18", 174 .cfg.fp_set = phy_marvell2, 175 .cfg.fp_clr = recov_phy_marvell2 }, 176 { .id1 = 0xff00, 177 .id2 = 0x1761, 178 .id2_mask = 0xffff, 179 .name = "88E6176(IntLoop)", 180 .cfg.fp_set = phy_marvell1, 181 .cfg.fp_clr = recov_phy_marvell1 }, 182 { .id1 = 0xff00, 183 .id2 = 0x1152, 184 .id2_mask = 0xffff, 185 .name = "88E6320(IntLoop)", 186 .cfg.fp_set = phy_marvell1, 187 .cfg.fp_clr = recov_phy_marvell1 }, 188 { .id1 = 0x0141, 189 .id2 = 0x0e90, 190 .id2_mask = 0xfff0, 191 .name = "88E1310", 192 .cfg.fp_set = phy_marvell0, 193 .cfg.fp_clr = recov_phy_marvell0 }, 194 { .id1 = 0x0141, 195 .id2 = 0x0cc0, 196 .id2_mask = PHYID3_Mask, 197 .name = "88E1111", 198 .cfg.fp_set = phy_marvell, 199 .cfg.fp_clr = recov_phy_marvell }, 200 { .id1 = 0x0022, 201 .id2 = 0x1555, 202 .id2_mask = 0xfff0, 203 .name = "KSZ8031/KSZ8051", 204 .cfg.fp_set = phy_micrel0, 205 .cfg.fp_clr = NULL }, 206 { .id1 = 0x0022, 207 .id2 = 0x1622, 208 .id2_mask = 0xfff0, 209 .name = "KSZ9031", 210 .cfg.fp_set = phy_micrel1, 211 .cfg.fp_clr = NULL }, 212 { .id1 = 0x0022, 213 .id2 = 0x1562, 214 .id2_mask = 0xfff0, 215 .name = "KSZ8081", 216 .cfg.fp_set = phy_micrel2, 217 .cfg.fp_clr = NULL }, 218 { .id1 = 0x0022, 219 .id2 = 0x1512, 220 .id2_mask = 0xfff0, 221 .name = "KSZ8041", 222 .cfg.fp_set = phy_micrel, 223 .cfg.fp_clr = NULL }, 224 { .id1 = 0x004d, 225 .id2 = 0xd072, 226 .id2_mask = 0xfff0, 227 .name = "AR8035", 228 .cfg.fp_set = phy_atheros, 229 .cfg.fp_clr = recov_phy_atheros }, 230 { .id1 = 0x0007, 231 .id2 = 0xc0c4, 232 .id2_mask = PHYID3_Mask, 233 .name = "LAN8700", 234 .cfg.fp_set = phy_smsc, 235 .cfg.fp_clr = NULL }, 236 { .id1 = 0x000f, 237 .id2 = 0xc4b1, 238 .id2_mask = 0xfff0, 239 .name = "VSC8211", 240 .cfg.fp_set = phy_vitesse, 241 .cfg.fp_clr = recov_phy_vitesse }, 242 { .id1 = 0x0007, 243 .id2 = 0x0421, 244 .id2_mask = 0xfff0, 245 .name = "VSC8601", 246 .cfg.fp_set = phy_vitesse, 247 .cfg.fp_clr = recov_phy_vitesse }, 248 { .id1 = 0x0007, 249 .id2 = 0x0431, 250 .id2_mask = 0xfff0, 251 .name = "VSC8641", 252 .cfg.fp_set = phy_vitesse, 253 .cfg.fp_clr = recov_phy_vitesse }, 254 { .id1 = 0x0000, 255 .id2 = 0x0000, 256 .id2_mask = 0x0000, 257 .name = "default", 258 .cfg.fp_set = phy_default, 259 .cfg.fp_clr = NULL }, 260 };