WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / phy / realtek.c
blob99ecd6c4c15a0c0c2a45b9de02954aabd8094fe5
1 // SPDX-License-Identifier: GPL-2.0+
2 /* drivers/net/phy/realtek.c
4 * Driver for Realtek PHYs
6 * Author: Johnson Leung <r58129@freescale.com>
8 * Copyright (c) 2004 Freescale Semiconductor, Inc.
9 */
10 #include <linux/bitops.h>
11 #include <linux/phy.h>
12 #include <linux/module.h>
13 #include <linux/delay.h>
15 #define RTL821x_PHYSR 0x11
16 #define RTL821x_PHYSR_DUPLEX BIT(13)
17 #define RTL821x_PHYSR_SPEED GENMASK(15, 14)
19 #define RTL821x_INER 0x12
20 #define RTL8211B_INER_INIT 0x6400
21 #define RTL8211E_INER_LINK_STATUS BIT(10)
22 #define RTL8211F_INER_LINK_STATUS BIT(4)
24 #define RTL821x_INSR 0x13
26 #define RTL821x_EXT_PAGE_SELECT 0x1e
27 #define RTL821x_PAGE_SELECT 0x1f
29 #define RTL8211F_PHYCR1 0x18
30 #define RTL8211F_INSR 0x1d
32 #define RTL8211F_TX_DELAY BIT(8)
33 #define RTL8211F_RX_DELAY BIT(3)
35 #define RTL8211F_ALDPS_PLL_OFF BIT(1)
36 #define RTL8211F_ALDPS_ENABLE BIT(2)
37 #define RTL8211F_ALDPS_XTAL_OFF BIT(12)
39 #define RTL8211E_CTRL_DELAY BIT(13)
40 #define RTL8211E_TX_DELAY BIT(12)
41 #define RTL8211E_RX_DELAY BIT(11)
43 #define RTL8201F_ISR 0x1e
44 #define RTL8201F_ISR_ANERR BIT(15)
45 #define RTL8201F_ISR_DUPLEX BIT(13)
46 #define RTL8201F_ISR_LINK BIT(11)
47 #define RTL8201F_ISR_MASK (RTL8201F_ISR_ANERR | \
48 RTL8201F_ISR_DUPLEX | \
49 RTL8201F_ISR_LINK)
50 #define RTL8201F_IER 0x13
52 #define RTL8366RB_POWER_SAVE 0x15
53 #define RTL8366RB_POWER_SAVE_ON BIT(12)
55 #define RTL_SUPPORTS_5000FULL BIT(14)
56 #define RTL_SUPPORTS_2500FULL BIT(13)
57 #define RTL_SUPPORTS_10000FULL BIT(0)
58 #define RTL_ADV_2500FULL BIT(7)
59 #define RTL_LPADV_10000FULL BIT(11)
60 #define RTL_LPADV_5000FULL BIT(6)
61 #define RTL_LPADV_2500FULL BIT(5)
63 #define RTLGEN_SPEED_MASK 0x0630
65 #define RTL_GENERIC_PHYID 0x001cc800
67 MODULE_DESCRIPTION("Realtek PHY driver");
68 MODULE_AUTHOR("Johnson Leung");
69 MODULE_LICENSE("GPL");
71 static int rtl821x_read_page(struct phy_device *phydev)
73 return __phy_read(phydev, RTL821x_PAGE_SELECT);
76 static int rtl821x_write_page(struct phy_device *phydev, int page)
78 return __phy_write(phydev, RTL821x_PAGE_SELECT, page);
81 static int rtl8201_ack_interrupt(struct phy_device *phydev)
83 int err;
85 err = phy_read(phydev, RTL8201F_ISR);
87 return (err < 0) ? err : 0;
90 static int rtl821x_ack_interrupt(struct phy_device *phydev)
92 int err;
94 err = phy_read(phydev, RTL821x_INSR);
96 return (err < 0) ? err : 0;
99 static int rtl8211f_ack_interrupt(struct phy_device *phydev)
101 int err;
103 err = phy_read_paged(phydev, 0xa43, RTL8211F_INSR);
105 return (err < 0) ? err : 0;
108 static int rtl8201_config_intr(struct phy_device *phydev)
110 u16 val;
111 int err;
113 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
114 err = rtl8201_ack_interrupt(phydev);
115 if (err)
116 return err;
118 val = BIT(13) | BIT(12) | BIT(11);
119 err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
120 } else {
121 val = 0;
122 err = phy_write_paged(phydev, 0x7, RTL8201F_IER, val);
123 if (err)
124 return err;
126 err = rtl8201_ack_interrupt(phydev);
129 return err;
132 static int rtl8211b_config_intr(struct phy_device *phydev)
134 int err;
136 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
137 err = rtl821x_ack_interrupt(phydev);
138 if (err)
139 return err;
141 err = phy_write(phydev, RTL821x_INER,
142 RTL8211B_INER_INIT);
143 } else {
144 err = phy_write(phydev, RTL821x_INER, 0);
145 if (err)
146 return err;
148 err = rtl821x_ack_interrupt(phydev);
151 return err;
154 static int rtl8211e_config_intr(struct phy_device *phydev)
156 int err;
158 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
159 err = rtl821x_ack_interrupt(phydev);
160 if (err)
161 return err;
163 err = phy_write(phydev, RTL821x_INER,
164 RTL8211E_INER_LINK_STATUS);
165 } else {
166 err = phy_write(phydev, RTL821x_INER, 0);
167 if (err)
168 return err;
170 err = rtl821x_ack_interrupt(phydev);
173 return err;
176 static int rtl8211f_config_intr(struct phy_device *phydev)
178 u16 val;
179 int err;
181 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
182 err = rtl8211f_ack_interrupt(phydev);
183 if (err)
184 return err;
186 val = RTL8211F_INER_LINK_STATUS;
187 err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
188 } else {
189 val = 0;
190 err = phy_write_paged(phydev, 0xa42, RTL821x_INER, val);
191 if (err)
192 return err;
194 err = rtl8211f_ack_interrupt(phydev);
197 return err;
200 static irqreturn_t rtl8201_handle_interrupt(struct phy_device *phydev)
202 int irq_status;
204 irq_status = phy_read(phydev, RTL8201F_ISR);
205 if (irq_status < 0) {
206 phy_error(phydev);
207 return IRQ_NONE;
210 if (!(irq_status & RTL8201F_ISR_MASK))
211 return IRQ_NONE;
213 phy_trigger_machine(phydev);
215 return IRQ_HANDLED;
218 static irqreturn_t rtl821x_handle_interrupt(struct phy_device *phydev)
220 int irq_status, irq_enabled;
222 irq_status = phy_read(phydev, RTL821x_INSR);
223 if (irq_status < 0) {
224 phy_error(phydev);
225 return IRQ_NONE;
228 irq_enabled = phy_read(phydev, RTL821x_INER);
229 if (irq_enabled < 0) {
230 phy_error(phydev);
231 return IRQ_NONE;
234 if (!(irq_status & irq_enabled))
235 return IRQ_NONE;
237 phy_trigger_machine(phydev);
239 return IRQ_HANDLED;
242 static irqreturn_t rtl8211f_handle_interrupt(struct phy_device *phydev)
244 int irq_status;
246 irq_status = phy_read_paged(phydev, 0xa43, RTL8211F_INSR);
247 if (irq_status < 0) {
248 phy_error(phydev);
249 return IRQ_NONE;
252 if (!(irq_status & RTL8211F_INER_LINK_STATUS))
253 return IRQ_NONE;
255 phy_trigger_machine(phydev);
257 return IRQ_HANDLED;
260 static int rtl8211_config_aneg(struct phy_device *phydev)
262 int ret;
264 ret = genphy_config_aneg(phydev);
265 if (ret < 0)
266 return ret;
268 /* Quirk was copied from vendor driver. Unfortunately it includes no
269 * description of the magic numbers.
271 if (phydev->speed == SPEED_100 && phydev->autoneg == AUTONEG_DISABLE) {
272 phy_write(phydev, 0x17, 0x2138);
273 phy_write(phydev, 0x0e, 0x0260);
274 } else {
275 phy_write(phydev, 0x17, 0x2108);
276 phy_write(phydev, 0x0e, 0x0000);
279 return 0;
282 static int rtl8211c_config_init(struct phy_device *phydev)
284 /* RTL8211C has an issue when operating in Gigabit slave mode */
285 return phy_set_bits(phydev, MII_CTRL1000,
286 CTL1000_ENABLE_MASTER | CTL1000_AS_MASTER);
289 static int rtl8211f_config_init(struct phy_device *phydev)
291 struct device *dev = &phydev->mdio.dev;
292 u16 val_txdly, val_rxdly;
293 u16 val;
294 int ret;
296 val = RTL8211F_ALDPS_ENABLE | RTL8211F_ALDPS_PLL_OFF | RTL8211F_ALDPS_XTAL_OFF;
297 phy_modify_paged_changed(phydev, 0xa43, RTL8211F_PHYCR1, val, val);
299 switch (phydev->interface) {
300 case PHY_INTERFACE_MODE_RGMII:
301 val_txdly = 0;
302 val_rxdly = 0;
303 break;
305 case PHY_INTERFACE_MODE_RGMII_RXID:
306 val_txdly = 0;
307 val_rxdly = RTL8211F_RX_DELAY;
308 break;
310 case PHY_INTERFACE_MODE_RGMII_TXID:
311 val_txdly = RTL8211F_TX_DELAY;
312 val_rxdly = 0;
313 break;
315 case PHY_INTERFACE_MODE_RGMII_ID:
316 val_txdly = RTL8211F_TX_DELAY;
317 val_rxdly = RTL8211F_RX_DELAY;
318 break;
320 default: /* the rest of the modes imply leaving delay as is. */
321 return 0;
324 ret = phy_modify_paged_changed(phydev, 0xd08, 0x11, RTL8211F_TX_DELAY,
325 val_txdly);
326 if (ret < 0) {
327 dev_err(dev, "Failed to update the TX delay register\n");
328 return ret;
329 } else if (ret) {
330 dev_dbg(dev,
331 "%s 2ns TX delay (and changing the value from pin-strapping RXD1 or the bootloader)\n",
332 val_txdly ? "Enabling" : "Disabling");
333 } else {
334 dev_dbg(dev,
335 "2ns TX delay was already %s (by pin-strapping RXD1 or bootloader configuration)\n",
336 val_txdly ? "enabled" : "disabled");
339 ret = phy_modify_paged_changed(phydev, 0xd08, 0x15, RTL8211F_RX_DELAY,
340 val_rxdly);
341 if (ret < 0) {
342 dev_err(dev, "Failed to update the RX delay register\n");
343 return ret;
344 } else if (ret) {
345 dev_dbg(dev,
346 "%s 2ns RX delay (and changing the value from pin-strapping RXD0 or the bootloader)\n",
347 val_rxdly ? "Enabling" : "Disabling");
348 } else {
349 dev_dbg(dev,
350 "2ns RX delay was already %s (by pin-strapping RXD0 or bootloader configuration)\n",
351 val_rxdly ? "enabled" : "disabled");
354 return 0;
357 static int rtl8211e_config_init(struct phy_device *phydev)
359 int ret = 0, oldpage;
360 u16 val;
362 /* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */
363 switch (phydev->interface) {
364 case PHY_INTERFACE_MODE_RGMII:
365 val = RTL8211E_CTRL_DELAY | 0;
366 break;
367 case PHY_INTERFACE_MODE_RGMII_ID:
368 val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY;
369 break;
370 case PHY_INTERFACE_MODE_RGMII_RXID:
371 val = RTL8211E_CTRL_DELAY | RTL8211E_RX_DELAY;
372 break;
373 case PHY_INTERFACE_MODE_RGMII_TXID:
374 val = RTL8211E_CTRL_DELAY | RTL8211E_TX_DELAY;
375 break;
376 default: /* the rest of the modes imply leaving delays as is. */
377 return 0;
380 /* According to a sample driver there is a 0x1c config register on the
381 * 0xa4 extension page (0x7) layout. It can be used to disable/enable
382 * the RX/TX delays otherwise controlled by RXDLY/TXDLY pins.
383 * The configuration register definition:
384 * 14 = reserved
385 * 13 = Force Tx RX Delay controlled by bit12 bit11,
386 * 12 = RX Delay, 11 = TX Delay
387 * 10:0 = Test && debug settings reserved by realtek
389 oldpage = phy_select_page(phydev, 0x7);
390 if (oldpage < 0)
391 goto err_restore_page;
393 ret = __phy_write(phydev, RTL821x_EXT_PAGE_SELECT, 0xa4);
394 if (ret)
395 goto err_restore_page;
397 ret = __phy_modify(phydev, 0x1c, RTL8211E_CTRL_DELAY
398 | RTL8211E_TX_DELAY | RTL8211E_RX_DELAY,
399 val);
401 err_restore_page:
402 return phy_restore_page(phydev, oldpage, ret);
405 static int rtl8211b_suspend(struct phy_device *phydev)
407 phy_write(phydev, MII_MMD_DATA, BIT(9));
409 return genphy_suspend(phydev);
412 static int rtl8211b_resume(struct phy_device *phydev)
414 phy_write(phydev, MII_MMD_DATA, 0);
416 return genphy_resume(phydev);
419 static int rtl8366rb_config_init(struct phy_device *phydev)
421 int ret;
423 ret = phy_set_bits(phydev, RTL8366RB_POWER_SAVE,
424 RTL8366RB_POWER_SAVE_ON);
425 if (ret) {
426 dev_err(&phydev->mdio.dev,
427 "error enabling power management\n");
430 return ret;
433 /* get actual speed to cover the downshift case */
434 static int rtlgen_get_speed(struct phy_device *phydev)
436 int val;
438 if (!phydev->link)
439 return 0;
441 val = phy_read_paged(phydev, 0xa43, 0x12);
442 if (val < 0)
443 return val;
445 switch (val & RTLGEN_SPEED_MASK) {
446 case 0x0000:
447 phydev->speed = SPEED_10;
448 break;
449 case 0x0010:
450 phydev->speed = SPEED_100;
451 break;
452 case 0x0020:
453 phydev->speed = SPEED_1000;
454 break;
455 case 0x0200:
456 phydev->speed = SPEED_10000;
457 break;
458 case 0x0210:
459 phydev->speed = SPEED_2500;
460 break;
461 case 0x0220:
462 phydev->speed = SPEED_5000;
463 break;
464 default:
465 break;
468 return 0;
471 static int rtlgen_read_status(struct phy_device *phydev)
473 int ret;
475 ret = genphy_read_status(phydev);
476 if (ret < 0)
477 return ret;
479 return rtlgen_get_speed(phydev);
482 static int rtlgen_read_mmd(struct phy_device *phydev, int devnum, u16 regnum)
484 int ret;
486 if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE) {
487 rtl821x_write_page(phydev, 0xa5c);
488 ret = __phy_read(phydev, 0x12);
489 rtl821x_write_page(phydev, 0);
490 } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) {
491 rtl821x_write_page(phydev, 0xa5d);
492 ret = __phy_read(phydev, 0x10);
493 rtl821x_write_page(phydev, 0);
494 } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE) {
495 rtl821x_write_page(phydev, 0xa5d);
496 ret = __phy_read(phydev, 0x11);
497 rtl821x_write_page(phydev, 0);
498 } else {
499 ret = -EOPNOTSUPP;
502 return ret;
505 static int rtlgen_write_mmd(struct phy_device *phydev, int devnum, u16 regnum,
506 u16 val)
508 int ret;
510 if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV) {
511 rtl821x_write_page(phydev, 0xa5d);
512 ret = __phy_write(phydev, 0x10, val);
513 rtl821x_write_page(phydev, 0);
514 } else {
515 ret = -EOPNOTSUPP;
518 return ret;
521 static int rtl822x_read_mmd(struct phy_device *phydev, int devnum, u16 regnum)
523 int ret = rtlgen_read_mmd(phydev, devnum, regnum);
525 if (ret != -EOPNOTSUPP)
526 return ret;
528 if (devnum == MDIO_MMD_PCS && regnum == MDIO_PCS_EEE_ABLE2) {
529 rtl821x_write_page(phydev, 0xa6e);
530 ret = __phy_read(phydev, 0x16);
531 rtl821x_write_page(phydev, 0);
532 } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) {
533 rtl821x_write_page(phydev, 0xa6d);
534 ret = __phy_read(phydev, 0x12);
535 rtl821x_write_page(phydev, 0);
536 } else if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_LPABLE2) {
537 rtl821x_write_page(phydev, 0xa6d);
538 ret = __phy_read(phydev, 0x10);
539 rtl821x_write_page(phydev, 0);
542 return ret;
545 static int rtl822x_write_mmd(struct phy_device *phydev, int devnum, u16 regnum,
546 u16 val)
548 int ret = rtlgen_write_mmd(phydev, devnum, regnum, val);
550 if (ret != -EOPNOTSUPP)
551 return ret;
553 if (devnum == MDIO_MMD_AN && regnum == MDIO_AN_EEE_ADV2) {
554 rtl821x_write_page(phydev, 0xa6d);
555 ret = __phy_write(phydev, 0x12, val);
556 rtl821x_write_page(phydev, 0);
559 return ret;
562 static int rtl822x_get_features(struct phy_device *phydev)
564 int val;
566 val = phy_read_paged(phydev, 0xa61, 0x13);
567 if (val < 0)
568 return val;
570 linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
571 phydev->supported, val & RTL_SUPPORTS_2500FULL);
572 linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
573 phydev->supported, val & RTL_SUPPORTS_5000FULL);
574 linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
575 phydev->supported, val & RTL_SUPPORTS_10000FULL);
577 return genphy_read_abilities(phydev);
580 static int rtl822x_config_aneg(struct phy_device *phydev)
582 int ret = 0;
584 if (phydev->autoneg == AUTONEG_ENABLE) {
585 u16 adv2500 = 0;
587 if (linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
588 phydev->advertising))
589 adv2500 = RTL_ADV_2500FULL;
591 ret = phy_modify_paged_changed(phydev, 0xa5d, 0x12,
592 RTL_ADV_2500FULL, adv2500);
593 if (ret < 0)
594 return ret;
597 return __genphy_config_aneg(phydev, ret);
600 static int rtl822x_read_status(struct phy_device *phydev)
602 int ret;
604 if (phydev->autoneg == AUTONEG_ENABLE) {
605 int lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
607 if (lpadv < 0)
608 return lpadv;
610 linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
611 phydev->lp_advertising, lpadv & RTL_LPADV_10000FULL);
612 linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
613 phydev->lp_advertising, lpadv & RTL_LPADV_5000FULL);
614 linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
615 phydev->lp_advertising, lpadv & RTL_LPADV_2500FULL);
618 ret = genphy_read_status(phydev);
619 if (ret < 0)
620 return ret;
622 return rtlgen_get_speed(phydev);
625 static bool rtlgen_supports_2_5gbps(struct phy_device *phydev)
627 int val;
629 phy_write(phydev, RTL821x_PAGE_SELECT, 0xa61);
630 val = phy_read(phydev, 0x13);
631 phy_write(phydev, RTL821x_PAGE_SELECT, 0);
633 return val >= 0 && val & RTL_SUPPORTS_2500FULL;
636 static int rtlgen_match_phy_device(struct phy_device *phydev)
638 return phydev->phy_id == RTL_GENERIC_PHYID &&
639 !rtlgen_supports_2_5gbps(phydev);
642 static int rtl8226_match_phy_device(struct phy_device *phydev)
644 return phydev->phy_id == RTL_GENERIC_PHYID &&
645 rtlgen_supports_2_5gbps(phydev);
648 static int rtlgen_resume(struct phy_device *phydev)
650 int ret = genphy_resume(phydev);
652 /* Internal PHY's from RTL8168h up may not be instantly ready */
653 msleep(20);
655 return ret;
658 static struct phy_driver realtek_drvs[] = {
660 PHY_ID_MATCH_EXACT(0x00008201),
661 .name = "RTL8201CP Ethernet",
662 .read_page = rtl821x_read_page,
663 .write_page = rtl821x_write_page,
664 }, {
665 PHY_ID_MATCH_EXACT(0x001cc816),
666 .name = "RTL8201F Fast Ethernet",
667 .config_intr = &rtl8201_config_intr,
668 .handle_interrupt = rtl8201_handle_interrupt,
669 .suspend = genphy_suspend,
670 .resume = genphy_resume,
671 .read_page = rtl821x_read_page,
672 .write_page = rtl821x_write_page,
673 }, {
674 PHY_ID_MATCH_MODEL(0x001cc880),
675 .name = "RTL8208 Fast Ethernet",
676 .read_mmd = genphy_read_mmd_unsupported,
677 .write_mmd = genphy_write_mmd_unsupported,
678 .suspend = genphy_suspend,
679 .resume = genphy_resume,
680 .read_page = rtl821x_read_page,
681 .write_page = rtl821x_write_page,
682 }, {
683 PHY_ID_MATCH_EXACT(0x001cc910),
684 .name = "RTL8211 Gigabit Ethernet",
685 .config_aneg = rtl8211_config_aneg,
686 .read_mmd = &genphy_read_mmd_unsupported,
687 .write_mmd = &genphy_write_mmd_unsupported,
688 .read_page = rtl821x_read_page,
689 .write_page = rtl821x_write_page,
690 }, {
691 PHY_ID_MATCH_EXACT(0x001cc912),
692 .name = "RTL8211B Gigabit Ethernet",
693 .config_intr = &rtl8211b_config_intr,
694 .handle_interrupt = rtl821x_handle_interrupt,
695 .read_mmd = &genphy_read_mmd_unsupported,
696 .write_mmd = &genphy_write_mmd_unsupported,
697 .suspend = rtl8211b_suspend,
698 .resume = rtl8211b_resume,
699 .read_page = rtl821x_read_page,
700 .write_page = rtl821x_write_page,
701 }, {
702 PHY_ID_MATCH_EXACT(0x001cc913),
703 .name = "RTL8211C Gigabit Ethernet",
704 .config_init = rtl8211c_config_init,
705 .read_mmd = &genphy_read_mmd_unsupported,
706 .write_mmd = &genphy_write_mmd_unsupported,
707 .read_page = rtl821x_read_page,
708 .write_page = rtl821x_write_page,
709 }, {
710 PHY_ID_MATCH_EXACT(0x001cc914),
711 .name = "RTL8211DN Gigabit Ethernet",
712 .config_intr = rtl8211e_config_intr,
713 .handle_interrupt = rtl821x_handle_interrupt,
714 .suspend = genphy_suspend,
715 .resume = genphy_resume,
716 .read_page = rtl821x_read_page,
717 .write_page = rtl821x_write_page,
718 }, {
719 PHY_ID_MATCH_EXACT(0x001cc915),
720 .name = "RTL8211E Gigabit Ethernet",
721 .config_init = &rtl8211e_config_init,
722 .config_intr = &rtl8211e_config_intr,
723 .handle_interrupt = rtl821x_handle_interrupt,
724 .suspend = genphy_suspend,
725 .resume = genphy_resume,
726 .read_page = rtl821x_read_page,
727 .write_page = rtl821x_write_page,
728 }, {
729 PHY_ID_MATCH_EXACT(0x001cc916),
730 .name = "RTL8211F Gigabit Ethernet",
731 .config_init = &rtl8211f_config_init,
732 .read_status = rtlgen_read_status,
733 .config_intr = &rtl8211f_config_intr,
734 .handle_interrupt = rtl8211f_handle_interrupt,
735 .suspend = genphy_suspend,
736 .resume = genphy_resume,
737 .read_page = rtl821x_read_page,
738 .write_page = rtl821x_write_page,
739 }, {
740 .name = "Generic FE-GE Realtek PHY",
741 .match_phy_device = rtlgen_match_phy_device,
742 .read_status = rtlgen_read_status,
743 .suspend = genphy_suspend,
744 .resume = rtlgen_resume,
745 .read_page = rtl821x_read_page,
746 .write_page = rtl821x_write_page,
747 .read_mmd = rtlgen_read_mmd,
748 .write_mmd = rtlgen_write_mmd,
749 }, {
750 .name = "RTL8226 2.5Gbps PHY",
751 .match_phy_device = rtl8226_match_phy_device,
752 .get_features = rtl822x_get_features,
753 .config_aneg = rtl822x_config_aneg,
754 .read_status = rtl822x_read_status,
755 .suspend = genphy_suspend,
756 .resume = rtlgen_resume,
757 .read_page = rtl821x_read_page,
758 .write_page = rtl821x_write_page,
759 .read_mmd = rtl822x_read_mmd,
760 .write_mmd = rtl822x_write_mmd,
761 }, {
762 PHY_ID_MATCH_EXACT(0x001cc840),
763 .name = "RTL8226B_RTL8221B 2.5Gbps PHY",
764 .get_features = rtl822x_get_features,
765 .config_aneg = rtl822x_config_aneg,
766 .read_status = rtl822x_read_status,
767 .suspend = genphy_suspend,
768 .resume = rtlgen_resume,
769 .read_page = rtl821x_read_page,
770 .write_page = rtl821x_write_page,
771 .read_mmd = rtl822x_read_mmd,
772 .write_mmd = rtl822x_write_mmd,
773 }, {
774 PHY_ID_MATCH_EXACT(0x001cc838),
775 .name = "RTL8226-CG 2.5Gbps PHY",
776 .get_features = rtl822x_get_features,
777 .config_aneg = rtl822x_config_aneg,
778 .read_status = rtl822x_read_status,
779 .suspend = genphy_suspend,
780 .resume = rtlgen_resume,
781 .read_page = rtl821x_read_page,
782 .write_page = rtl821x_write_page,
783 }, {
784 PHY_ID_MATCH_EXACT(0x001cc848),
785 .name = "RTL8226B-CG_RTL8221B-CG 2.5Gbps PHY",
786 .get_features = rtl822x_get_features,
787 .config_aneg = rtl822x_config_aneg,
788 .read_status = rtl822x_read_status,
789 .suspend = genphy_suspend,
790 .resume = rtlgen_resume,
791 .read_page = rtl821x_read_page,
792 .write_page = rtl821x_write_page,
793 }, {
794 PHY_ID_MATCH_EXACT(0x001cc849),
795 .name = "RTL8221B-VB-CG 2.5Gbps PHY",
796 .get_features = rtl822x_get_features,
797 .config_aneg = rtl822x_config_aneg,
798 .read_status = rtl822x_read_status,
799 .suspend = genphy_suspend,
800 .resume = rtlgen_resume,
801 .read_page = rtl821x_read_page,
802 .write_page = rtl821x_write_page,
803 }, {
804 PHY_ID_MATCH_EXACT(0x001cc84a),
805 .name = "RTL8221B-VM-CG 2.5Gbps PHY",
806 .get_features = rtl822x_get_features,
807 .config_aneg = rtl822x_config_aneg,
808 .read_status = rtl822x_read_status,
809 .suspend = genphy_suspend,
810 .resume = rtlgen_resume,
811 .read_page = rtl821x_read_page,
812 .write_page = rtl821x_write_page,
813 }, {
814 PHY_ID_MATCH_EXACT(0x001cc961),
815 .name = "RTL8366RB Gigabit Ethernet",
816 .config_init = &rtl8366rb_config_init,
817 /* These interrupts are handled by the irq controller
818 * embedded inside the RTL8366RB, they get unmasked when the
819 * irq is requested and ACKed by reading the status register,
820 * which is done by the irqchip code.
822 .config_intr = genphy_no_config_intr,
823 .handle_interrupt = genphy_handle_interrupt_no_ack,
824 .suspend = genphy_suspend,
825 .resume = genphy_resume,
829 module_phy_driver(realtek_drvs);
831 static const struct mdio_device_id __maybe_unused realtek_tbl[] = {
832 { PHY_ID_MATCH_VENDOR(0x001cc800) },
836 MODULE_DEVICE_TABLE(mdio, realtek_tbl);