1 // SPDX-License-Identifier: GPL-2.0+
2 /* Copyright (C) 2021 Maxlinear Corporation
3 * Copyright (C) 2020 Intel Corporation
5 * Drivers for Maxlinear Ethernet GPY
9 #include <linux/module.h>
10 #include <linux/bitfield.h>
11 #include <linux/hwmon.h>
12 #include <linux/phy.h>
13 #include <linux/polynomial.h>
14 #include <linux/netdevice.h>
17 #define PHY_ID_GPYx15B_MASK 0xFFFFFFFC
18 #define PHY_ID_GPY21xB_MASK 0xFFFFFFF9
19 #define PHY_ID_GPY2xx 0x67C9DC00
20 #define PHY_ID_GPY115B 0x67C9DF00
21 #define PHY_ID_GPY115C 0x67C9DF10
22 #define PHY_ID_GPY211B 0x67C9DE08
23 #define PHY_ID_GPY211C 0x67C9DE10
24 #define PHY_ID_GPY212B 0x67C9DE09
25 #define PHY_ID_GPY212C 0x67C9DE20
26 #define PHY_ID_GPY215B 0x67C9DF04
27 #define PHY_ID_GPY215C 0x67C9DF20
28 #define PHY_ID_GPY241B 0x67C9DE40
29 #define PHY_ID_GPY241BM 0x67C9DE80
30 #define PHY_ID_GPY245B 0x67C9DEC0
32 #define PHY_MIISTAT 0x18 /* MII state */
33 #define PHY_IMASK 0x19 /* interrupt mask */
34 #define PHY_ISTAT 0x1A /* interrupt status */
35 #define PHY_FWV 0x1E /* firmware version */
37 #define PHY_MIISTAT_SPD_MASK GENMASK(2, 0)
38 #define PHY_MIISTAT_DPX BIT(3)
39 #define PHY_MIISTAT_LS BIT(10)
41 #define PHY_MIISTAT_SPD_10 0
42 #define PHY_MIISTAT_SPD_100 1
43 #define PHY_MIISTAT_SPD_1000 2
44 #define PHY_MIISTAT_SPD_2500 4
46 #define PHY_IMASK_WOL BIT(15) /* Wake-on-LAN */
47 #define PHY_IMASK_ANC BIT(10) /* Auto-Neg complete */
48 #define PHY_IMASK_ADSC BIT(5) /* Link auto-downspeed detect */
49 #define PHY_IMASK_DXMC BIT(2) /* Duplex mode change */
50 #define PHY_IMASK_LSPC BIT(1) /* Link speed change */
51 #define PHY_IMASK_LSTC BIT(0) /* Link state change */
52 #define PHY_IMASK_MASK (PHY_IMASK_LSTC | \
58 #define PHY_FWV_REL_MASK BIT(15)
59 #define PHY_FWV_MAJOR_MASK GENMASK(11, 8)
60 #define PHY_FWV_MINOR_MASK GENMASK(7, 0)
63 #define VSPEC1_SGMII_CTRL 0x08
64 #define VSPEC1_SGMII_CTRL_ANEN BIT(12) /* Aneg enable */
65 #define VSPEC1_SGMII_CTRL_ANRS BIT(9) /* Restart Aneg */
66 #define VSPEC1_SGMII_ANEN_ANRS (VSPEC1_SGMII_CTRL_ANEN | \
67 VSPEC1_SGMII_CTRL_ANRS)
69 /* Temperature sensor */
70 #define VPSPEC1_TEMP_STA 0x0E
71 #define VPSPEC1_TEMP_STA_DATA GENMASK(9, 0)
74 #define VPSPEC2_WOL_CTL 0x0E06
75 #define VPSPEC2_WOL_AD01 0x0E08
76 #define VPSPEC2_WOL_AD23 0x0E09
77 #define VPSPEC2_WOL_AD45 0x0E0A
88 } ver_need_sgmii_reaneg[] = {
94 #if IS_ENABLED(CONFIG_HWMON)
95 /* The original translation formulae of the temperature (in degrees of Celsius)
98 * T = -2.5761e-11*(N^4) + 9.7332e-8*(N^3) + -1.9165e-4*(N^2) +
99 * 3.0762e-1*(N^1) + -5.2156e1
101 * where [-52.156, 137.961]C and N = [0, 1023].
103 * They must be accordingly altered to be suitable for the integer arithmetics.
104 * The technique is called 'factor redistribution', which just makes sure the
105 * multiplications and divisions are made so to have a result of the operations
106 * within the integer numbers limit. In addition we need to translate the
107 * formulae to accept millidegrees of Celsius. Here what it looks like after
110 * T = -25761e-12*(N^4) + 97332e-9*(N^3) + -191650e-6*(N^2) +
111 * 307620e-3*(N^1) + -52156
113 * where T = [-52156, 137961]mC and N = [0, 1023].
115 static const struct polynomial poly_N_to_temp = {
117 {4, -25761, 1000, 1},
119 {2, -191650, 1000, 1},
120 {1, 307620, 1000, 1},
125 static int gpy_hwmon_read(struct device *dev,
126 enum hwmon_sensor_types type,
127 u32 attr, int channel, long *value)
129 struct phy_device *phydev = dev_get_drvdata(dev);
132 ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VPSPEC1_TEMP_STA);
138 *value = polynomial_calc(&poly_N_to_temp,
139 FIELD_GET(VPSPEC1_TEMP_STA_DATA, ret));
144 static umode_t gpy_hwmon_is_visible(const void *data,
145 enum hwmon_sensor_types type,
146 u32 attr, int channel)
151 static const struct hwmon_channel_info *gpy_hwmon_info[] = {
152 HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
156 static const struct hwmon_ops gpy_hwmon_hwmon_ops = {
157 .is_visible = gpy_hwmon_is_visible,
158 .read = gpy_hwmon_read,
161 static const struct hwmon_chip_info gpy_hwmon_chip_info = {
162 .ops = &gpy_hwmon_hwmon_ops,
163 .info = gpy_hwmon_info,
166 static int gpy_hwmon_register(struct phy_device *phydev)
168 struct device *dev = &phydev->mdio.dev;
169 struct device *hwmon_dev;
172 hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev));
173 if (IS_ERR(hwmon_name))
174 return PTR_ERR(hwmon_name);
176 hwmon_dev = devm_hwmon_device_register_with_info(dev, hwmon_name,
178 &gpy_hwmon_chip_info,
181 return PTR_ERR_OR_ZERO(hwmon_dev);
184 static int gpy_hwmon_register(struct phy_device *phydev)
190 static int gpy_config_init(struct phy_device *phydev)
194 /* Mask all interrupts */
195 ret = phy_write(phydev, PHY_IMASK, 0);
199 /* Clear all pending interrupts */
200 ret = phy_read(phydev, PHY_ISTAT);
201 return ret < 0 ? ret : 0;
204 static int gpy_probe(struct phy_device *phydev)
206 struct device *dev = &phydev->mdio.dev;
207 struct gpy_priv *priv;
211 if (!phydev->is_c45) {
212 ret = phy_get_c45_ids(phydev);
217 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
222 fw_version = phy_read(phydev, PHY_FWV);
225 priv->fw_major = FIELD_GET(PHY_FWV_MAJOR_MASK, fw_version);
226 priv->fw_minor = FIELD_GET(PHY_FWV_MINOR_MASK, fw_version);
228 ret = gpy_hwmon_register(phydev);
232 /* Show GPY PHY FW version in dmesg */
233 phydev_info(phydev, "Firmware Version: %d.%d (0x%04X%s)\n",
234 priv->fw_major, priv->fw_minor, fw_version,
235 fw_version & PHY_FWV_REL_MASK ? "" : " test version");
240 static bool gpy_sgmii_need_reaneg(struct phy_device *phydev)
242 struct gpy_priv *priv = phydev->priv;
245 for (i = 0; i < ARRAY_SIZE(ver_need_sgmii_reaneg); i++) {
246 if (priv->fw_major != ver_need_sgmii_reaneg[i].major)
248 if (priv->fw_minor < ver_need_sgmii_reaneg[i].minor)
256 static bool gpy_2500basex_chk(struct phy_device *phydev)
260 ret = phy_read(phydev, PHY_MIISTAT);
262 phydev_err(phydev, "Error: MDIO register access failed: %d\n",
267 if (!(ret & PHY_MIISTAT_LS) ||
268 FIELD_GET(PHY_MIISTAT_SPD_MASK, ret) != PHY_MIISTAT_SPD_2500)
271 phydev->speed = SPEED_2500;
272 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
273 phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
274 VSPEC1_SGMII_CTRL_ANEN, 0);
278 static bool gpy_sgmii_aneg_en(struct phy_device *phydev)
282 ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL);
284 phydev_err(phydev, "Error: MMD register access failed: %d\n",
289 return (ret & VSPEC1_SGMII_CTRL_ANEN) ? true : false;
292 static int gpy_config_aneg(struct phy_device *phydev)
294 bool changed = false;
298 if (phydev->autoneg == AUTONEG_DISABLE) {
299 /* Configure half duplex with genphy_setup_forced,
300 * because genphy_c45_pma_setup_forced does not support.
302 return phydev->duplex != DUPLEX_FULL
303 ? genphy_setup_forced(phydev)
304 : genphy_c45_pma_setup_forced(phydev);
307 ret = genphy_c45_an_config_aneg(phydev);
313 adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising);
314 ret = phy_modify_changed(phydev, MII_CTRL1000,
315 ADVERTISE_1000FULL | ADVERTISE_1000HALF,
322 ret = genphy_c45_check_and_restart_aneg(phydev, changed);
326 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII ||
327 phydev->interface == PHY_INTERFACE_MODE_INTERNAL)
330 /* No need to trigger re-ANEG if link speed is 2.5G or SGMII ANEG is
333 if (!gpy_sgmii_need_reaneg(phydev) || gpy_2500basex_chk(phydev) ||
334 !gpy_sgmii_aneg_en(phydev))
337 /* There is a design constraint in GPY2xx device where SGMII AN is
338 * only triggered when there is change of speed. If, PHY link
339 * partner`s speed is still same even after PHY TPI is down and up
340 * again, SGMII AN is not triggered and hence no new in-band message
341 * from GPY to MAC side SGMII.
342 * This could cause an issue during power up, when PHY is up prior to
343 * MAC. At this condition, once MAC side SGMII is up, MAC side SGMII
344 * wouldn`t receive new in-band message from GPY with correct link
345 * status, speed and duplex info.
347 * 1) If PHY is already up and TPI link status is still down (such as
348 * hard reboot), TPI link status is polled for 4 seconds before
349 * retriggerring SGMII AN.
350 * 2) If PHY is already up and TPI link status is also up (such as soft
351 * reboot), polling of TPI link status is not needed and SGMII AN is
352 * immediately retriggered.
353 * 3) Other conditions such as PHY is down, speed change etc, skip
354 * retriggering SGMII AN. Note: in case of speed change, GPY FW will
358 if (phydev->state != PHY_UP)
361 ret = phy_read_poll_timeout(phydev, MII_BMSR, ret, ret & BMSR_LSTATUS,
362 20000, 4000000, false);
363 if (ret == -ETIMEDOUT)
368 /* Trigger SGMII AN. */
369 return phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
370 VSPEC1_SGMII_CTRL_ANRS, VSPEC1_SGMII_CTRL_ANRS);
373 static void gpy_update_interface(struct phy_device *phydev)
377 /* Interface mode is fixed for USXGMII and integrated PHY */
378 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII ||
379 phydev->interface == PHY_INTERFACE_MODE_INTERNAL)
382 /* Automatically switch SERDES interface between SGMII and 2500-BaseX
383 * according to speed. Disable ANEG in 2500-BaseX mode.
385 switch (phydev->speed) {
387 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
388 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
389 VSPEC1_SGMII_CTRL_ANEN, 0);
392 "Error: Disable of SGMII ANEG failed: %d\n",
398 phydev->interface = PHY_INTERFACE_MODE_SGMII;
399 if (gpy_sgmii_aneg_en(phydev))
401 /* Enable and restart SGMII ANEG for 10/100/1000Mbps link speed
402 * if ANEG is disabled (in 2500-BaseX mode).
404 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
405 VSPEC1_SGMII_ANEN_ANRS,
406 VSPEC1_SGMII_ANEN_ANRS);
409 "Error: Enable of SGMII ANEG failed: %d\n",
414 if (phydev->speed == SPEED_2500 || phydev->speed == SPEED_1000)
415 genphy_read_master_slave(phydev);
418 static int gpy_read_status(struct phy_device *phydev)
422 ret = genphy_update_link(phydev);
426 phydev->speed = SPEED_UNKNOWN;
427 phydev->duplex = DUPLEX_UNKNOWN;
429 phydev->asym_pause = 0;
431 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
432 ret = genphy_c45_read_lpa(phydev);
436 /* Read the link partner's 1G advertisement */
437 ret = phy_read(phydev, MII_STAT1000);
440 mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, ret);
441 } else if (phydev->autoneg == AUTONEG_DISABLE) {
442 linkmode_zero(phydev->lp_advertising);
445 ret = phy_read(phydev, PHY_MIISTAT);
449 phydev->link = (ret & PHY_MIISTAT_LS) ? 1 : 0;
450 phydev->duplex = (ret & PHY_MIISTAT_DPX) ? DUPLEX_FULL : DUPLEX_HALF;
451 switch (FIELD_GET(PHY_MIISTAT_SPD_MASK, ret)) {
452 case PHY_MIISTAT_SPD_10:
453 phydev->speed = SPEED_10;
455 case PHY_MIISTAT_SPD_100:
456 phydev->speed = SPEED_100;
458 case PHY_MIISTAT_SPD_1000:
459 phydev->speed = SPEED_1000;
461 case PHY_MIISTAT_SPD_2500:
462 phydev->speed = SPEED_2500;
467 gpy_update_interface(phydev);
472 static int gpy_config_intr(struct phy_device *phydev)
476 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
477 mask = PHY_IMASK_MASK;
479 return phy_write(phydev, PHY_IMASK, mask);
482 static irqreturn_t gpy_handle_interrupt(struct phy_device *phydev)
486 reg = phy_read(phydev, PHY_ISTAT);
492 if (!(reg & PHY_IMASK_MASK))
495 phy_trigger_machine(phydev);
500 static int gpy_set_wol(struct phy_device *phydev,
501 struct ethtool_wolinfo *wol)
503 struct net_device *attach_dev = phydev->attached_dev;
506 if (wol->wolopts & WAKE_MAGIC) {
507 /* MAC address - Byte0:Byte1:Byte2:Byte3:Byte4:Byte5
508 * VPSPEC2_WOL_AD45 = Byte0:Byte1
509 * VPSPEC2_WOL_AD23 = Byte2:Byte3
510 * VPSPEC2_WOL_AD01 = Byte4:Byte5
512 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
514 ((attach_dev->dev_addr[0] << 8) |
515 attach_dev->dev_addr[1]));
519 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
521 ((attach_dev->dev_addr[2] << 8) |
522 attach_dev->dev_addr[3]));
526 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
528 ((attach_dev->dev_addr[4] << 8) |
529 attach_dev->dev_addr[5]));
533 /* Enable the WOL interrupt */
534 ret = phy_write(phydev, PHY_IMASK, PHY_IMASK_WOL);
538 /* Enable magic packet matching */
539 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
545 /* Clear the interrupt status register.
546 * Only WoL is enabled so clear all.
548 ret = phy_read(phydev, PHY_ISTAT);
552 /* Disable magic packet matching */
553 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
560 if (wol->wolopts & WAKE_PHY) {
561 /* Enable the link state change interrupt */
562 ret = phy_set_bits(phydev, PHY_IMASK, PHY_IMASK_LSTC);
566 /* Clear the interrupt status register */
567 ret = phy_read(phydev, PHY_ISTAT);
571 if (ret & (PHY_IMASK_MASK & ~PHY_IMASK_LSTC))
572 phy_trigger_machine(phydev);
577 /* Disable the link state change interrupt */
578 return phy_clear_bits(phydev, PHY_IMASK, PHY_IMASK_LSTC);
581 static void gpy_get_wol(struct phy_device *phydev,
582 struct ethtool_wolinfo *wol)
586 wol->supported = WAKE_MAGIC | WAKE_PHY;
589 ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, VPSPEC2_WOL_CTL);
591 wol->wolopts |= WAKE_MAGIC;
593 ret = phy_read(phydev, PHY_IMASK);
594 if (ret & PHY_IMASK_LSTC)
595 wol->wolopts |= WAKE_PHY;
598 static int gpy_loopback(struct phy_device *phydev, bool enable)
602 ret = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
603 enable ? BMCR_LOOPBACK : 0);
605 /* It takes some time for PHY device to switch
606 * into/out-of loopback mode.
614 static int gpy115_loopback(struct phy_device *phydev, bool enable)
616 struct gpy_priv *priv = phydev->priv;
619 return gpy_loopback(phydev, enable);
621 if (priv->fw_minor > 0x76)
622 return gpy_loopback(phydev, 0);
624 return genphy_soft_reset(phydev);
627 static struct phy_driver gpy_drivers[] = {
629 PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx),
630 .name = "Maxlinear Ethernet GPY2xx",
631 .get_features = genphy_c45_pma_read_abilities,
632 .config_init = gpy_config_init,
634 .suspend = genphy_suspend,
635 .resume = genphy_resume,
636 .config_aneg = gpy_config_aneg,
637 .aneg_done = genphy_c45_aneg_done,
638 .read_status = gpy_read_status,
639 .config_intr = gpy_config_intr,
640 .handle_interrupt = gpy_handle_interrupt,
641 .set_wol = gpy_set_wol,
642 .get_wol = gpy_get_wol,
643 .set_loopback = gpy_loopback,
646 .phy_id = PHY_ID_GPY115B,
647 .phy_id_mask = PHY_ID_GPYx15B_MASK,
648 .name = "Maxlinear Ethernet GPY115B",
649 .get_features = genphy_c45_pma_read_abilities,
650 .config_init = gpy_config_init,
652 .suspend = genphy_suspend,
653 .resume = genphy_resume,
654 .config_aneg = gpy_config_aneg,
655 .aneg_done = genphy_c45_aneg_done,
656 .read_status = gpy_read_status,
657 .config_intr = gpy_config_intr,
658 .handle_interrupt = gpy_handle_interrupt,
659 .set_wol = gpy_set_wol,
660 .get_wol = gpy_get_wol,
661 .set_loopback = gpy115_loopback,
664 PHY_ID_MATCH_MODEL(PHY_ID_GPY115C),
665 .name = "Maxlinear Ethernet GPY115C",
666 .get_features = genphy_c45_pma_read_abilities,
667 .config_init = gpy_config_init,
669 .suspend = genphy_suspend,
670 .resume = genphy_resume,
671 .config_aneg = gpy_config_aneg,
672 .aneg_done = genphy_c45_aneg_done,
673 .read_status = gpy_read_status,
674 .config_intr = gpy_config_intr,
675 .handle_interrupt = gpy_handle_interrupt,
676 .set_wol = gpy_set_wol,
677 .get_wol = gpy_get_wol,
678 .set_loopback = gpy115_loopback,
681 .phy_id = PHY_ID_GPY211B,
682 .phy_id_mask = PHY_ID_GPY21xB_MASK,
683 .name = "Maxlinear Ethernet GPY211B",
684 .get_features = genphy_c45_pma_read_abilities,
685 .config_init = gpy_config_init,
687 .suspend = genphy_suspend,
688 .resume = genphy_resume,
689 .config_aneg = gpy_config_aneg,
690 .aneg_done = genphy_c45_aneg_done,
691 .read_status = gpy_read_status,
692 .config_intr = gpy_config_intr,
693 .handle_interrupt = gpy_handle_interrupt,
694 .set_wol = gpy_set_wol,
695 .get_wol = gpy_get_wol,
696 .set_loopback = gpy_loopback,
699 PHY_ID_MATCH_MODEL(PHY_ID_GPY211C),
700 .name = "Maxlinear Ethernet GPY211C",
701 .get_features = genphy_c45_pma_read_abilities,
702 .config_init = gpy_config_init,
704 .suspend = genphy_suspend,
705 .resume = genphy_resume,
706 .config_aneg = gpy_config_aneg,
707 .aneg_done = genphy_c45_aneg_done,
708 .read_status = gpy_read_status,
709 .config_intr = gpy_config_intr,
710 .handle_interrupt = gpy_handle_interrupt,
711 .set_wol = gpy_set_wol,
712 .get_wol = gpy_get_wol,
713 .set_loopback = gpy_loopback,
716 .phy_id = PHY_ID_GPY212B,
717 .phy_id_mask = PHY_ID_GPY21xB_MASK,
718 .name = "Maxlinear Ethernet GPY212B",
719 .get_features = genphy_c45_pma_read_abilities,
720 .config_init = gpy_config_init,
722 .suspend = genphy_suspend,
723 .resume = genphy_resume,
724 .config_aneg = gpy_config_aneg,
725 .aneg_done = genphy_c45_aneg_done,
726 .read_status = gpy_read_status,
727 .config_intr = gpy_config_intr,
728 .handle_interrupt = gpy_handle_interrupt,
729 .set_wol = gpy_set_wol,
730 .get_wol = gpy_get_wol,
731 .set_loopback = gpy_loopback,
734 PHY_ID_MATCH_MODEL(PHY_ID_GPY212C),
735 .name = "Maxlinear Ethernet GPY212C",
736 .get_features = genphy_c45_pma_read_abilities,
737 .config_init = gpy_config_init,
739 .suspend = genphy_suspend,
740 .resume = genphy_resume,
741 .config_aneg = gpy_config_aneg,
742 .aneg_done = genphy_c45_aneg_done,
743 .read_status = gpy_read_status,
744 .config_intr = gpy_config_intr,
745 .handle_interrupt = gpy_handle_interrupt,
746 .set_wol = gpy_set_wol,
747 .get_wol = gpy_get_wol,
748 .set_loopback = gpy_loopback,
751 .phy_id = PHY_ID_GPY215B,
752 .phy_id_mask = PHY_ID_GPYx15B_MASK,
753 .name = "Maxlinear Ethernet GPY215B",
754 .get_features = genphy_c45_pma_read_abilities,
755 .config_init = gpy_config_init,
757 .suspend = genphy_suspend,
758 .resume = genphy_resume,
759 .config_aneg = gpy_config_aneg,
760 .aneg_done = genphy_c45_aneg_done,
761 .read_status = gpy_read_status,
762 .config_intr = gpy_config_intr,
763 .handle_interrupt = gpy_handle_interrupt,
764 .set_wol = gpy_set_wol,
765 .get_wol = gpy_get_wol,
766 .set_loopback = gpy_loopback,
769 PHY_ID_MATCH_MODEL(PHY_ID_GPY215C),
770 .name = "Maxlinear Ethernet GPY215C",
771 .get_features = genphy_c45_pma_read_abilities,
772 .config_init = gpy_config_init,
774 .suspend = genphy_suspend,
775 .resume = genphy_resume,
776 .config_aneg = gpy_config_aneg,
777 .aneg_done = genphy_c45_aneg_done,
778 .read_status = gpy_read_status,
779 .config_intr = gpy_config_intr,
780 .handle_interrupt = gpy_handle_interrupt,
781 .set_wol = gpy_set_wol,
782 .get_wol = gpy_get_wol,
783 .set_loopback = gpy_loopback,
786 PHY_ID_MATCH_MODEL(PHY_ID_GPY241B),
787 .name = "Maxlinear Ethernet GPY241B",
788 .get_features = genphy_c45_pma_read_abilities,
789 .config_init = gpy_config_init,
791 .suspend = genphy_suspend,
792 .resume = genphy_resume,
793 .config_aneg = gpy_config_aneg,
794 .aneg_done = genphy_c45_aneg_done,
795 .read_status = gpy_read_status,
796 .config_intr = gpy_config_intr,
797 .handle_interrupt = gpy_handle_interrupt,
798 .set_wol = gpy_set_wol,
799 .get_wol = gpy_get_wol,
800 .set_loopback = gpy_loopback,
803 PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM),
804 .name = "Maxlinear Ethernet GPY241BM",
805 .get_features = genphy_c45_pma_read_abilities,
806 .config_init = gpy_config_init,
808 .suspend = genphy_suspend,
809 .resume = genphy_resume,
810 .config_aneg = gpy_config_aneg,
811 .aneg_done = genphy_c45_aneg_done,
812 .read_status = gpy_read_status,
813 .config_intr = gpy_config_intr,
814 .handle_interrupt = gpy_handle_interrupt,
815 .set_wol = gpy_set_wol,
816 .get_wol = gpy_get_wol,
817 .set_loopback = gpy_loopback,
820 PHY_ID_MATCH_MODEL(PHY_ID_GPY245B),
821 .name = "Maxlinear Ethernet GPY245B",
822 .get_features = genphy_c45_pma_read_abilities,
823 .config_init = gpy_config_init,
825 .suspend = genphy_suspend,
826 .resume = genphy_resume,
827 .config_aneg = gpy_config_aneg,
828 .aneg_done = genphy_c45_aneg_done,
829 .read_status = gpy_read_status,
830 .config_intr = gpy_config_intr,
831 .handle_interrupt = gpy_handle_interrupt,
832 .set_wol = gpy_set_wol,
833 .get_wol = gpy_get_wol,
834 .set_loopback = gpy_loopback,
837 module_phy_driver(gpy_drivers);
839 static struct mdio_device_id __maybe_unused gpy_tbl[] = {
840 {PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx)},
841 {PHY_ID_GPY115B, PHY_ID_GPYx15B_MASK},
842 {PHY_ID_MATCH_MODEL(PHY_ID_GPY115C)},
843 {PHY_ID_GPY211B, PHY_ID_GPY21xB_MASK},
844 {PHY_ID_MATCH_MODEL(PHY_ID_GPY211C)},
845 {PHY_ID_GPY212B, PHY_ID_GPY21xB_MASK},
846 {PHY_ID_MATCH_MODEL(PHY_ID_GPY212C)},
847 {PHY_ID_GPY215B, PHY_ID_GPYx15B_MASK},
848 {PHY_ID_MATCH_MODEL(PHY_ID_GPY215C)},
849 {PHY_ID_MATCH_MODEL(PHY_ID_GPY241B)},
850 {PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM)},
851 {PHY_ID_MATCH_MODEL(PHY_ID_GPY245B)},
854 MODULE_DEVICE_TABLE(mdio, gpy_tbl);
856 MODULE_DESCRIPTION("Maxlinear Ethernet GPY Driver");
857 MODULE_AUTHOR("Xu Liang");
858 MODULE_LICENSE("GPL");