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_TYPE_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_type = FIELD_GET(PHY_FWV_TYPE_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: 0x%04X (%s)\n", fw_version,
234 (fw_version & PHY_FWV_REL_MASK) ? "release" : "test");
239 static bool gpy_sgmii_need_reaneg(struct phy_device *phydev)
241 struct gpy_priv *priv = phydev->priv;
244 for (i = 0; i < ARRAY_SIZE(ver_need_sgmii_reaneg); i++) {
245 if (priv->fw_type != ver_need_sgmii_reaneg[i].type)
247 if (priv->fw_minor < ver_need_sgmii_reaneg[i].minor)
255 static bool gpy_2500basex_chk(struct phy_device *phydev)
259 ret = phy_read(phydev, PHY_MIISTAT);
261 phydev_err(phydev, "Error: MDIO register access failed: %d\n",
266 if (!(ret & PHY_MIISTAT_LS) ||
267 FIELD_GET(PHY_MIISTAT_SPD_MASK, ret) != PHY_MIISTAT_SPD_2500)
270 phydev->speed = SPEED_2500;
271 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
272 phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
273 VSPEC1_SGMII_CTRL_ANEN, 0);
277 static bool gpy_sgmii_aneg_en(struct phy_device *phydev)
281 ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL);
283 phydev_err(phydev, "Error: MMD register access failed: %d\n",
288 return (ret & VSPEC1_SGMII_CTRL_ANEN) ? true : false;
291 static int gpy_config_aneg(struct phy_device *phydev)
293 bool changed = false;
297 if (phydev->autoneg == AUTONEG_DISABLE) {
298 /* Configure half duplex with genphy_setup_forced,
299 * because genphy_c45_pma_setup_forced does not support.
301 return phydev->duplex != DUPLEX_FULL
302 ? genphy_setup_forced(phydev)
303 : genphy_c45_pma_setup_forced(phydev);
306 ret = genphy_c45_an_config_aneg(phydev);
312 adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising);
313 ret = phy_modify_changed(phydev, MII_CTRL1000,
314 ADVERTISE_1000FULL | ADVERTISE_1000HALF,
321 ret = genphy_c45_check_and_restart_aneg(phydev, changed);
325 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII ||
326 phydev->interface == PHY_INTERFACE_MODE_INTERNAL)
329 /* No need to trigger re-ANEG if link speed is 2.5G or SGMII ANEG is
332 if (!gpy_sgmii_need_reaneg(phydev) || gpy_2500basex_chk(phydev) ||
333 !gpy_sgmii_aneg_en(phydev))
336 /* There is a design constraint in GPY2xx device where SGMII AN is
337 * only triggered when there is change of speed. If, PHY link
338 * partner`s speed is still same even after PHY TPI is down and up
339 * again, SGMII AN is not triggered and hence no new in-band message
340 * from GPY to MAC side SGMII.
341 * This could cause an issue during power up, when PHY is up prior to
342 * MAC. At this condition, once MAC side SGMII is up, MAC side SGMII
343 * wouldn`t receive new in-band message from GPY with correct link
344 * status, speed and duplex info.
346 * 1) If PHY is already up and TPI link status is still down (such as
347 * hard reboot), TPI link status is polled for 4 seconds before
348 * retriggerring SGMII AN.
349 * 2) If PHY is already up and TPI link status is also up (such as soft
350 * reboot), polling of TPI link status is not needed and SGMII AN is
351 * immediately retriggered.
352 * 3) Other conditions such as PHY is down, speed change etc, skip
353 * retriggering SGMII AN. Note: in case of speed change, GPY FW will
357 if (phydev->state != PHY_UP)
360 ret = phy_read_poll_timeout(phydev, MII_BMSR, ret, ret & BMSR_LSTATUS,
361 20000, 4000000, false);
362 if (ret == -ETIMEDOUT)
367 /* Trigger SGMII AN. */
368 return phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
369 VSPEC1_SGMII_CTRL_ANRS, VSPEC1_SGMII_CTRL_ANRS);
372 static void gpy_update_interface(struct phy_device *phydev)
376 /* Interface mode is fixed for USXGMII and integrated PHY */
377 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII ||
378 phydev->interface == PHY_INTERFACE_MODE_INTERNAL)
381 /* Automatically switch SERDES interface between SGMII and 2500-BaseX
382 * according to speed. Disable ANEG in 2500-BaseX mode.
384 switch (phydev->speed) {
386 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
387 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
388 VSPEC1_SGMII_CTRL_ANEN, 0);
391 "Error: Disable of SGMII ANEG failed: %d\n",
397 phydev->interface = PHY_INTERFACE_MODE_SGMII;
398 if (gpy_sgmii_aneg_en(phydev))
400 /* Enable and restart SGMII ANEG for 10/100/1000Mbps link speed
401 * if ANEG is disabled (in 2500-BaseX mode).
403 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
404 VSPEC1_SGMII_ANEN_ANRS,
405 VSPEC1_SGMII_ANEN_ANRS);
408 "Error: Enable of SGMII ANEG failed: %d\n",
413 if (phydev->speed == SPEED_2500 || phydev->speed == SPEED_1000)
414 genphy_read_master_slave(phydev);
417 static int gpy_read_status(struct phy_device *phydev)
421 ret = genphy_update_link(phydev);
425 phydev->speed = SPEED_UNKNOWN;
426 phydev->duplex = DUPLEX_UNKNOWN;
428 phydev->asym_pause = 0;
430 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
431 ret = genphy_c45_read_lpa(phydev);
435 /* Read the link partner's 1G advertisement */
436 ret = phy_read(phydev, MII_STAT1000);
439 mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, ret);
440 } else if (phydev->autoneg == AUTONEG_DISABLE) {
441 linkmode_zero(phydev->lp_advertising);
444 ret = phy_read(phydev, PHY_MIISTAT);
448 phydev->link = (ret & PHY_MIISTAT_LS) ? 1 : 0;
449 phydev->duplex = (ret & PHY_MIISTAT_DPX) ? DUPLEX_FULL : DUPLEX_HALF;
450 switch (FIELD_GET(PHY_MIISTAT_SPD_MASK, ret)) {
451 case PHY_MIISTAT_SPD_10:
452 phydev->speed = SPEED_10;
454 case PHY_MIISTAT_SPD_100:
455 phydev->speed = SPEED_100;
457 case PHY_MIISTAT_SPD_1000:
458 phydev->speed = SPEED_1000;
460 case PHY_MIISTAT_SPD_2500:
461 phydev->speed = SPEED_2500;
466 gpy_update_interface(phydev);
471 static int gpy_config_intr(struct phy_device *phydev)
475 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
476 mask = PHY_IMASK_MASK;
478 return phy_write(phydev, PHY_IMASK, mask);
481 static irqreturn_t gpy_handle_interrupt(struct phy_device *phydev)
485 reg = phy_read(phydev, PHY_ISTAT);
491 if (!(reg & PHY_IMASK_MASK))
494 phy_trigger_machine(phydev);
499 static int gpy_set_wol(struct phy_device *phydev,
500 struct ethtool_wolinfo *wol)
502 struct net_device *attach_dev = phydev->attached_dev;
505 if (wol->wolopts & WAKE_MAGIC) {
506 /* MAC address - Byte0:Byte1:Byte2:Byte3:Byte4:Byte5
507 * VPSPEC2_WOL_AD45 = Byte0:Byte1
508 * VPSPEC2_WOL_AD23 = Byte2:Byte3
509 * VPSPEC2_WOL_AD01 = Byte4:Byte5
511 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
513 ((attach_dev->dev_addr[0] << 8) |
514 attach_dev->dev_addr[1]));
518 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
520 ((attach_dev->dev_addr[2] << 8) |
521 attach_dev->dev_addr[3]));
525 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
527 ((attach_dev->dev_addr[4] << 8) |
528 attach_dev->dev_addr[5]));
532 /* Enable the WOL interrupt */
533 ret = phy_write(phydev, PHY_IMASK, PHY_IMASK_WOL);
537 /* Enable magic packet matching */
538 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
544 /* Clear the interrupt status register.
545 * Only WoL is enabled so clear all.
547 ret = phy_read(phydev, PHY_ISTAT);
551 /* Disable magic packet matching */
552 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
559 if (wol->wolopts & WAKE_PHY) {
560 /* Enable the link state change interrupt */
561 ret = phy_set_bits(phydev, PHY_IMASK, PHY_IMASK_LSTC);
565 /* Clear the interrupt status register */
566 ret = phy_read(phydev, PHY_ISTAT);
570 if (ret & (PHY_IMASK_MASK & ~PHY_IMASK_LSTC))
571 phy_trigger_machine(phydev);
576 /* Disable the link state change interrupt */
577 return phy_clear_bits(phydev, PHY_IMASK, PHY_IMASK_LSTC);
580 static void gpy_get_wol(struct phy_device *phydev,
581 struct ethtool_wolinfo *wol)
585 wol->supported = WAKE_MAGIC | WAKE_PHY;
588 ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, VPSPEC2_WOL_CTL);
590 wol->wolopts |= WAKE_MAGIC;
592 ret = phy_read(phydev, PHY_IMASK);
593 if (ret & PHY_IMASK_LSTC)
594 wol->wolopts |= WAKE_PHY;
597 static int gpy_loopback(struct phy_device *phydev, bool enable)
601 ret = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
602 enable ? BMCR_LOOPBACK : 0);
604 /* It takes some time for PHY device to switch
605 * into/out-of loopback mode.
613 static int gpy115_loopback(struct phy_device *phydev, bool enable)
615 struct gpy_priv *priv = phydev->priv;
618 return gpy_loopback(phydev, enable);
620 if (priv->fw_minor > 0x76)
621 return gpy_loopback(phydev, 0);
623 return genphy_soft_reset(phydev);
626 static struct phy_driver gpy_drivers[] = {
628 PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx),
629 .name = "Maxlinear Ethernet GPY2xx",
630 .get_features = genphy_c45_pma_read_abilities,
631 .config_init = gpy_config_init,
633 .suspend = genphy_suspend,
634 .resume = genphy_resume,
635 .config_aneg = gpy_config_aneg,
636 .aneg_done = genphy_c45_aneg_done,
637 .read_status = gpy_read_status,
638 .config_intr = gpy_config_intr,
639 .handle_interrupt = gpy_handle_interrupt,
640 .set_wol = gpy_set_wol,
641 .get_wol = gpy_get_wol,
642 .set_loopback = gpy_loopback,
645 .phy_id = PHY_ID_GPY115B,
646 .phy_id_mask = PHY_ID_GPYx15B_MASK,
647 .name = "Maxlinear Ethernet GPY115B",
648 .get_features = genphy_c45_pma_read_abilities,
649 .config_init = gpy_config_init,
651 .suspend = genphy_suspend,
652 .resume = genphy_resume,
653 .config_aneg = gpy_config_aneg,
654 .aneg_done = genphy_c45_aneg_done,
655 .read_status = gpy_read_status,
656 .config_intr = gpy_config_intr,
657 .handle_interrupt = gpy_handle_interrupt,
658 .set_wol = gpy_set_wol,
659 .get_wol = gpy_get_wol,
660 .set_loopback = gpy115_loopback,
663 PHY_ID_MATCH_MODEL(PHY_ID_GPY115C),
664 .name = "Maxlinear Ethernet GPY115C",
665 .get_features = genphy_c45_pma_read_abilities,
666 .config_init = gpy_config_init,
668 .suspend = genphy_suspend,
669 .resume = genphy_resume,
670 .config_aneg = gpy_config_aneg,
671 .aneg_done = genphy_c45_aneg_done,
672 .read_status = gpy_read_status,
673 .config_intr = gpy_config_intr,
674 .handle_interrupt = gpy_handle_interrupt,
675 .set_wol = gpy_set_wol,
676 .get_wol = gpy_get_wol,
677 .set_loopback = gpy115_loopback,
680 .phy_id = PHY_ID_GPY211B,
681 .phy_id_mask = PHY_ID_GPY21xB_MASK,
682 .name = "Maxlinear Ethernet GPY211B",
683 .get_features = genphy_c45_pma_read_abilities,
684 .config_init = gpy_config_init,
686 .suspend = genphy_suspend,
687 .resume = genphy_resume,
688 .config_aneg = gpy_config_aneg,
689 .aneg_done = genphy_c45_aneg_done,
690 .read_status = gpy_read_status,
691 .config_intr = gpy_config_intr,
692 .handle_interrupt = gpy_handle_interrupt,
693 .set_wol = gpy_set_wol,
694 .get_wol = gpy_get_wol,
695 .set_loopback = gpy_loopback,
698 PHY_ID_MATCH_MODEL(PHY_ID_GPY211C),
699 .name = "Maxlinear Ethernet GPY211C",
700 .get_features = genphy_c45_pma_read_abilities,
701 .config_init = gpy_config_init,
703 .suspend = genphy_suspend,
704 .resume = genphy_resume,
705 .config_aneg = gpy_config_aneg,
706 .aneg_done = genphy_c45_aneg_done,
707 .read_status = gpy_read_status,
708 .config_intr = gpy_config_intr,
709 .handle_interrupt = gpy_handle_interrupt,
710 .set_wol = gpy_set_wol,
711 .get_wol = gpy_get_wol,
712 .set_loopback = gpy_loopback,
715 .phy_id = PHY_ID_GPY212B,
716 .phy_id_mask = PHY_ID_GPY21xB_MASK,
717 .name = "Maxlinear Ethernet GPY212B",
718 .get_features = genphy_c45_pma_read_abilities,
719 .config_init = gpy_config_init,
721 .suspend = genphy_suspend,
722 .resume = genphy_resume,
723 .config_aneg = gpy_config_aneg,
724 .aneg_done = genphy_c45_aneg_done,
725 .read_status = gpy_read_status,
726 .config_intr = gpy_config_intr,
727 .handle_interrupt = gpy_handle_interrupt,
728 .set_wol = gpy_set_wol,
729 .get_wol = gpy_get_wol,
730 .set_loopback = gpy_loopback,
733 PHY_ID_MATCH_MODEL(PHY_ID_GPY212C),
734 .name = "Maxlinear Ethernet GPY212C",
735 .get_features = genphy_c45_pma_read_abilities,
736 .config_init = gpy_config_init,
738 .suspend = genphy_suspend,
739 .resume = genphy_resume,
740 .config_aneg = gpy_config_aneg,
741 .aneg_done = genphy_c45_aneg_done,
742 .read_status = gpy_read_status,
743 .config_intr = gpy_config_intr,
744 .handle_interrupt = gpy_handle_interrupt,
745 .set_wol = gpy_set_wol,
746 .get_wol = gpy_get_wol,
747 .set_loopback = gpy_loopback,
750 .phy_id = PHY_ID_GPY215B,
751 .phy_id_mask = PHY_ID_GPYx15B_MASK,
752 .name = "Maxlinear Ethernet GPY215B",
753 .get_features = genphy_c45_pma_read_abilities,
754 .config_init = gpy_config_init,
756 .suspend = genphy_suspend,
757 .resume = genphy_resume,
758 .config_aneg = gpy_config_aneg,
759 .aneg_done = genphy_c45_aneg_done,
760 .read_status = gpy_read_status,
761 .config_intr = gpy_config_intr,
762 .handle_interrupt = gpy_handle_interrupt,
763 .set_wol = gpy_set_wol,
764 .get_wol = gpy_get_wol,
765 .set_loopback = gpy_loopback,
768 PHY_ID_MATCH_MODEL(PHY_ID_GPY215C),
769 .name = "Maxlinear Ethernet GPY215C",
770 .get_features = genphy_c45_pma_read_abilities,
771 .config_init = gpy_config_init,
773 .suspend = genphy_suspend,
774 .resume = genphy_resume,
775 .config_aneg = gpy_config_aneg,
776 .aneg_done = genphy_c45_aneg_done,
777 .read_status = gpy_read_status,
778 .config_intr = gpy_config_intr,
779 .handle_interrupt = gpy_handle_interrupt,
780 .set_wol = gpy_set_wol,
781 .get_wol = gpy_get_wol,
782 .set_loopback = gpy_loopback,
785 PHY_ID_MATCH_MODEL(PHY_ID_GPY241B),
786 .name = "Maxlinear Ethernet GPY241B",
787 .get_features = genphy_c45_pma_read_abilities,
788 .config_init = gpy_config_init,
790 .suspend = genphy_suspend,
791 .resume = genphy_resume,
792 .config_aneg = gpy_config_aneg,
793 .aneg_done = genphy_c45_aneg_done,
794 .read_status = gpy_read_status,
795 .config_intr = gpy_config_intr,
796 .handle_interrupt = gpy_handle_interrupt,
797 .set_wol = gpy_set_wol,
798 .get_wol = gpy_get_wol,
799 .set_loopback = gpy_loopback,
802 PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM),
803 .name = "Maxlinear Ethernet GPY241BM",
804 .get_features = genphy_c45_pma_read_abilities,
805 .config_init = gpy_config_init,
807 .suspend = genphy_suspend,
808 .resume = genphy_resume,
809 .config_aneg = gpy_config_aneg,
810 .aneg_done = genphy_c45_aneg_done,
811 .read_status = gpy_read_status,
812 .config_intr = gpy_config_intr,
813 .handle_interrupt = gpy_handle_interrupt,
814 .set_wol = gpy_set_wol,
815 .get_wol = gpy_get_wol,
816 .set_loopback = gpy_loopback,
819 PHY_ID_MATCH_MODEL(PHY_ID_GPY245B),
820 .name = "Maxlinear Ethernet GPY245B",
821 .get_features = genphy_c45_pma_read_abilities,
822 .config_init = gpy_config_init,
824 .suspend = genphy_suspend,
825 .resume = genphy_resume,
826 .config_aneg = gpy_config_aneg,
827 .aneg_done = genphy_c45_aneg_done,
828 .read_status = gpy_read_status,
829 .config_intr = gpy_config_intr,
830 .handle_interrupt = gpy_handle_interrupt,
831 .set_wol = gpy_set_wol,
832 .get_wol = gpy_get_wol,
833 .set_loopback = gpy_loopback,
836 module_phy_driver(gpy_drivers);
838 static struct mdio_device_id __maybe_unused gpy_tbl[] = {
839 {PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx)},
840 {PHY_ID_GPY115B, PHY_ID_GPYx15B_MASK},
841 {PHY_ID_MATCH_MODEL(PHY_ID_GPY115C)},
842 {PHY_ID_GPY211B, PHY_ID_GPY21xB_MASK},
843 {PHY_ID_MATCH_MODEL(PHY_ID_GPY211C)},
844 {PHY_ID_GPY212B, PHY_ID_GPY21xB_MASK},
845 {PHY_ID_MATCH_MODEL(PHY_ID_GPY212C)},
846 {PHY_ID_GPY215B, PHY_ID_GPYx15B_MASK},
847 {PHY_ID_MATCH_MODEL(PHY_ID_GPY215C)},
848 {PHY_ID_MATCH_MODEL(PHY_ID_GPY241B)},
849 {PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM)},
850 {PHY_ID_MATCH_MODEL(PHY_ID_GPY245B)},
853 MODULE_DEVICE_TABLE(mdio, gpy_tbl);
855 MODULE_DESCRIPTION("Maxlinear Ethernet GPY Driver");
856 MODULE_AUTHOR("Xu Liang");
857 MODULE_LICENSE("GPL");