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/mutex.h>
13 #include <linux/phy.h>
14 #include <linux/polynomial.h>
15 #include <linux/property.h>
16 #include <linux/netdevice.h>
19 #define PHY_ID_GPYx15B_MASK 0xFFFFFFFC
20 #define PHY_ID_GPY21xB_MASK 0xFFFFFFF9
21 #define PHY_ID_GPY2xx 0x67C9DC00
22 #define PHY_ID_GPY115B 0x67C9DF00
23 #define PHY_ID_GPY115C 0x67C9DF10
24 #define PHY_ID_GPY211B 0x67C9DE08
25 #define PHY_ID_GPY211C 0x67C9DE10
26 #define PHY_ID_GPY212B 0x67C9DE09
27 #define PHY_ID_GPY212C 0x67C9DE20
28 #define PHY_ID_GPY215B 0x67C9DF04
29 #define PHY_ID_GPY215C 0x67C9DF20
30 #define PHY_ID_GPY241B 0x67C9DE40
31 #define PHY_ID_GPY241BM 0x67C9DE80
32 #define PHY_ID_GPY245B 0x67C9DEC0
35 #define PHY_CTL1_MDICD BIT(3)
36 #define PHY_CTL1_MDIAB BIT(2)
37 #define PHY_CTL1_AMDIX BIT(0)
38 #define PHY_MIISTAT 0x18 /* MII state */
39 #define PHY_IMASK 0x19 /* interrupt mask */
40 #define PHY_ISTAT 0x1A /* interrupt status */
41 #define PHY_FWV 0x1E /* firmware version */
43 #define PHY_MIISTAT_SPD_MASK GENMASK(2, 0)
44 #define PHY_MIISTAT_DPX BIT(3)
45 #define PHY_MIISTAT_LS BIT(10)
47 #define PHY_MIISTAT_SPD_10 0
48 #define PHY_MIISTAT_SPD_100 1
49 #define PHY_MIISTAT_SPD_1000 2
50 #define PHY_MIISTAT_SPD_2500 4
52 #define PHY_IMASK_WOL BIT(15) /* Wake-on-LAN */
53 #define PHY_IMASK_ANC BIT(10) /* Auto-Neg complete */
54 #define PHY_IMASK_ADSC BIT(5) /* Link auto-downspeed detect */
55 #define PHY_IMASK_DXMC BIT(2) /* Duplex mode change */
56 #define PHY_IMASK_LSPC BIT(1) /* Link speed change */
57 #define PHY_IMASK_LSTC BIT(0) /* Link state change */
58 #define PHY_IMASK_MASK (PHY_IMASK_LSTC | \
64 #define PHY_FWV_REL_MASK BIT(15)
65 #define PHY_FWV_MAJOR_MASK GENMASK(11, 8)
66 #define PHY_FWV_MINOR_MASK GENMASK(7, 0)
68 #define PHY_PMA_MGBT_POLARITY 0x82
69 #define PHY_MDI_MDI_X_MASK GENMASK(1, 0)
70 #define PHY_MDI_MDI_X_NORMAL 0x3
71 #define PHY_MDI_MDI_X_AB 0x2
72 #define PHY_MDI_MDI_X_CD 0x1
73 #define PHY_MDI_MDI_X_CROSS 0x0
76 #define VSPEC1_SGMII_CTRL 0x08
77 #define VSPEC1_SGMII_CTRL_ANEN BIT(12) /* Aneg enable */
78 #define VSPEC1_SGMII_CTRL_ANRS BIT(9) /* Restart Aneg */
79 #define VSPEC1_SGMII_ANEN_ANRS (VSPEC1_SGMII_CTRL_ANEN | \
80 VSPEC1_SGMII_CTRL_ANRS)
82 /* Temperature sensor */
83 #define VSPEC1_TEMP_STA 0x0E
84 #define VSPEC1_TEMP_STA_DATA GENMASK(9, 0)
87 #define VSPEC1_MBOX_DATA 0x5
88 #define VSPEC1_MBOX_ADDRLO 0x6
89 #define VSPEC1_MBOX_CMD 0x7
90 #define VSPEC1_MBOX_CMD_ADDRHI GENMASK(7, 0)
91 #define VSPEC1_MBOX_CMD_RD (0 << 8)
92 #define VSPEC1_MBOX_CMD_READY BIT(15)
95 #define VPSPEC2_WOL_CTL 0x0E06
96 #define VPSPEC2_WOL_AD01 0x0E08
97 #define VPSPEC2_WOL_AD23 0x0E09
98 #define VPSPEC2_WOL_AD45 0x0E0A
101 /* Internal registers, access via mbox */
102 #define REG_GPIO0_OUT 0xd3ce00
105 /* serialize mailbox acesses */
106 struct mutex mbox_lock;
112 static const struct {
115 } ver_need_sgmii_reaneg[] = {
121 #if IS_ENABLED(CONFIG_HWMON)
122 /* The original translation formulae of the temperature (in degrees of Celsius)
125 * T = -2.5761e-11*(N^4) + 9.7332e-8*(N^3) + -1.9165e-4*(N^2) +
126 * 3.0762e-1*(N^1) + -5.2156e1
128 * where [-52.156, 137.961]C and N = [0, 1023].
130 * They must be accordingly altered to be suitable for the integer arithmetics.
131 * The technique is called 'factor redistribution', which just makes sure the
132 * multiplications and divisions are made so to have a result of the operations
133 * within the integer numbers limit. In addition we need to translate the
134 * formulae to accept millidegrees of Celsius. Here what it looks like after
137 * T = -25761e-12*(N^4) + 97332e-9*(N^3) + -191650e-6*(N^2) +
138 * 307620e-3*(N^1) + -52156
140 * where T = [-52156, 137961]mC and N = [0, 1023].
142 static const struct polynomial poly_N_to_temp = {
144 {4, -25761, 1000, 1},
146 {2, -191650, 1000, 1},
147 {1, 307620, 1000, 1},
152 static int gpy_hwmon_read(struct device *dev,
153 enum hwmon_sensor_types type,
154 u32 attr, int channel, long *value)
156 struct phy_device *phydev = dev_get_drvdata(dev);
159 ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_TEMP_STA);
165 *value = polynomial_calc(&poly_N_to_temp,
166 FIELD_GET(VSPEC1_TEMP_STA_DATA, ret));
171 static umode_t gpy_hwmon_is_visible(const void *data,
172 enum hwmon_sensor_types type,
173 u32 attr, int channel)
178 static const struct hwmon_channel_info *gpy_hwmon_info[] = {
179 HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
183 static const struct hwmon_ops gpy_hwmon_hwmon_ops = {
184 .is_visible = gpy_hwmon_is_visible,
185 .read = gpy_hwmon_read,
188 static const struct hwmon_chip_info gpy_hwmon_chip_info = {
189 .ops = &gpy_hwmon_hwmon_ops,
190 .info = gpy_hwmon_info,
193 static int gpy_hwmon_register(struct phy_device *phydev)
195 struct device *dev = &phydev->mdio.dev;
196 struct device *hwmon_dev;
199 hwmon_name = devm_hwmon_sanitize_name(dev, dev_name(dev));
200 if (IS_ERR(hwmon_name))
201 return PTR_ERR(hwmon_name);
203 hwmon_dev = devm_hwmon_device_register_with_info(dev, hwmon_name,
205 &gpy_hwmon_chip_info,
208 return PTR_ERR_OR_ZERO(hwmon_dev);
211 static int gpy_hwmon_register(struct phy_device *phydev)
217 static int gpy_mbox_read(struct phy_device *phydev, u32 addr)
219 struct gpy_priv *priv = phydev->priv;
223 mutex_lock(&priv->mbox_lock);
225 ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_MBOX_ADDRLO,
230 cmd = VSPEC1_MBOX_CMD_RD;
231 cmd |= FIELD_PREP(VSPEC1_MBOX_CMD_ADDRHI, addr >> 16);
233 ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_MBOX_CMD, cmd);
237 /* The mbox read is used in the interrupt workaround. It was observed
238 * that a read might take up to 2.5ms. This is also the time for which
239 * the interrupt line is stuck low. To be on the safe side, poll the
240 * ready bit for 10ms.
242 ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,
243 VSPEC1_MBOX_CMD, val,
244 (val & VSPEC1_MBOX_CMD_READY),
249 ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_MBOX_DATA);
252 mutex_unlock(&priv->mbox_lock);
256 static int gpy_config_init(struct phy_device *phydev)
260 /* Mask all interrupts */
261 ret = phy_write(phydev, PHY_IMASK, 0);
265 /* Clear all pending interrupts */
266 ret = phy_read(phydev, PHY_ISTAT);
267 return ret < 0 ? ret : 0;
270 static bool gpy_has_broken_mdint(struct phy_device *phydev)
272 /* At least these PHYs are known to have broken interrupt handling */
273 return phydev->drv->phy_id == PHY_ID_GPY215B ||
274 phydev->drv->phy_id == PHY_ID_GPY215C;
277 static int gpy_probe(struct phy_device *phydev)
279 struct device *dev = &phydev->mdio.dev;
280 struct gpy_priv *priv;
284 if (!phydev->is_c45) {
285 ret = phy_get_c45_ids(phydev);
290 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
294 mutex_init(&priv->mbox_lock);
296 if (gpy_has_broken_mdint(phydev) &&
297 !device_property_present(dev, "maxlinear,use-broken-interrupts"))
298 phydev->dev_flags |= PHY_F_NO_IRQ;
300 fw_version = phy_read(phydev, PHY_FWV);
303 priv->fw_major = FIELD_GET(PHY_FWV_MAJOR_MASK, fw_version);
304 priv->fw_minor = FIELD_GET(PHY_FWV_MINOR_MASK, fw_version);
306 ret = gpy_hwmon_register(phydev);
310 /* Show GPY PHY FW version in dmesg */
311 phydev_info(phydev, "Firmware Version: %d.%d (0x%04X%s)\n",
312 priv->fw_major, priv->fw_minor, fw_version,
313 fw_version & PHY_FWV_REL_MASK ? "" : " test version");
318 static bool gpy_sgmii_need_reaneg(struct phy_device *phydev)
320 struct gpy_priv *priv = phydev->priv;
323 for (i = 0; i < ARRAY_SIZE(ver_need_sgmii_reaneg); i++) {
324 if (priv->fw_major != ver_need_sgmii_reaneg[i].major)
326 if (priv->fw_minor < ver_need_sgmii_reaneg[i].minor)
334 static bool gpy_2500basex_chk(struct phy_device *phydev)
338 ret = phy_read(phydev, PHY_MIISTAT);
340 phydev_err(phydev, "Error: MDIO register access failed: %d\n",
345 if (!(ret & PHY_MIISTAT_LS) ||
346 FIELD_GET(PHY_MIISTAT_SPD_MASK, ret) != PHY_MIISTAT_SPD_2500)
349 phydev->speed = SPEED_2500;
350 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
351 phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
352 VSPEC1_SGMII_CTRL_ANEN, 0);
356 static bool gpy_sgmii_aneg_en(struct phy_device *phydev)
360 ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL);
362 phydev_err(phydev, "Error: MMD register access failed: %d\n",
367 return (ret & VSPEC1_SGMII_CTRL_ANEN) ? true : false;
370 static int gpy_config_mdix(struct phy_device *phydev, u8 ctrl)
376 case ETH_TP_MDI_AUTO:
377 val = PHY_CTL1_AMDIX;
380 val = (PHY_CTL1_MDIAB | PHY_CTL1_MDICD);
389 ret = phy_modify(phydev, PHY_CTL1, PHY_CTL1_AMDIX | PHY_CTL1_MDIAB |
390 PHY_CTL1_MDICD, val);
394 return genphy_c45_restart_aneg(phydev);
397 static int gpy_config_aneg(struct phy_device *phydev)
399 bool changed = false;
403 if (phydev->autoneg == AUTONEG_DISABLE) {
404 /* Configure half duplex with genphy_setup_forced,
405 * because genphy_c45_pma_setup_forced does not support.
407 return phydev->duplex != DUPLEX_FULL
408 ? genphy_setup_forced(phydev)
409 : genphy_c45_pma_setup_forced(phydev);
412 ret = gpy_config_mdix(phydev, phydev->mdix_ctrl);
416 ret = genphy_c45_an_config_aneg(phydev);
422 adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising);
423 ret = phy_modify_changed(phydev, MII_CTRL1000,
424 ADVERTISE_1000FULL | ADVERTISE_1000HALF,
431 ret = genphy_c45_check_and_restart_aneg(phydev, changed);
435 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII ||
436 phydev->interface == PHY_INTERFACE_MODE_INTERNAL)
439 /* No need to trigger re-ANEG if link speed is 2.5G or SGMII ANEG is
442 if (!gpy_sgmii_need_reaneg(phydev) || gpy_2500basex_chk(phydev) ||
443 !gpy_sgmii_aneg_en(phydev))
446 /* There is a design constraint in GPY2xx device where SGMII AN is
447 * only triggered when there is change of speed. If, PHY link
448 * partner`s speed is still same even after PHY TPI is down and up
449 * again, SGMII AN is not triggered and hence no new in-band message
450 * from GPY to MAC side SGMII.
451 * This could cause an issue during power up, when PHY is up prior to
452 * MAC. At this condition, once MAC side SGMII is up, MAC side SGMII
453 * wouldn`t receive new in-band message from GPY with correct link
454 * status, speed and duplex info.
456 * 1) If PHY is already up and TPI link status is still down (such as
457 * hard reboot), TPI link status is polled for 4 seconds before
458 * retriggerring SGMII AN.
459 * 2) If PHY is already up and TPI link status is also up (such as soft
460 * reboot), polling of TPI link status is not needed and SGMII AN is
461 * immediately retriggered.
462 * 3) Other conditions such as PHY is down, speed change etc, skip
463 * retriggering SGMII AN. Note: in case of speed change, GPY FW will
467 if (phydev->state != PHY_UP)
470 ret = phy_read_poll_timeout(phydev, MII_BMSR, ret, ret & BMSR_LSTATUS,
471 20000, 4000000, false);
472 if (ret == -ETIMEDOUT)
477 /* Trigger SGMII AN. */
478 return phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
479 VSPEC1_SGMII_CTRL_ANRS, VSPEC1_SGMII_CTRL_ANRS);
482 static int gpy_update_mdix(struct phy_device *phydev)
486 ret = phy_read(phydev, PHY_CTL1);
490 if (ret & PHY_CTL1_AMDIX)
491 phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
493 if (ret & PHY_CTL1_MDICD || ret & PHY_CTL1_MDIAB)
494 phydev->mdix_ctrl = ETH_TP_MDI_X;
496 phydev->mdix_ctrl = ETH_TP_MDI;
498 ret = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, PHY_PMA_MGBT_POLARITY);
502 if ((ret & PHY_MDI_MDI_X_MASK) < PHY_MDI_MDI_X_NORMAL)
503 phydev->mdix = ETH_TP_MDI_X;
505 phydev->mdix = ETH_TP_MDI;
510 static int gpy_update_interface(struct phy_device *phydev)
514 /* Interface mode is fixed for USXGMII and integrated PHY */
515 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII ||
516 phydev->interface == PHY_INTERFACE_MODE_INTERNAL)
519 /* Automatically switch SERDES interface between SGMII and 2500-BaseX
520 * according to speed. Disable ANEG in 2500-BaseX mode.
522 switch (phydev->speed) {
524 phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
525 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
526 VSPEC1_SGMII_CTRL_ANEN, 0);
529 "Error: Disable of SGMII ANEG failed: %d\n",
537 phydev->interface = PHY_INTERFACE_MODE_SGMII;
538 if (gpy_sgmii_aneg_en(phydev))
540 /* Enable and restart SGMII ANEG for 10/100/1000Mbps link speed
541 * if ANEG is disabled (in 2500-BaseX mode).
543 ret = phy_modify_mmd(phydev, MDIO_MMD_VEND1, VSPEC1_SGMII_CTRL,
544 VSPEC1_SGMII_ANEN_ANRS,
545 VSPEC1_SGMII_ANEN_ANRS);
548 "Error: Enable of SGMII ANEG failed: %d\n",
555 if (phydev->speed == SPEED_2500 || phydev->speed == SPEED_1000) {
556 ret = genphy_read_master_slave(phydev);
561 return gpy_update_mdix(phydev);
564 static int gpy_read_status(struct phy_device *phydev)
568 ret = genphy_update_link(phydev);
572 phydev->speed = SPEED_UNKNOWN;
573 phydev->duplex = DUPLEX_UNKNOWN;
575 phydev->asym_pause = 0;
577 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
578 ret = genphy_c45_read_lpa(phydev);
582 /* Read the link partner's 1G advertisement */
583 ret = phy_read(phydev, MII_STAT1000);
586 mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, ret);
587 } else if (phydev->autoneg == AUTONEG_DISABLE) {
588 linkmode_zero(phydev->lp_advertising);
591 ret = phy_read(phydev, PHY_MIISTAT);
595 phydev->link = (ret & PHY_MIISTAT_LS) ? 1 : 0;
596 phydev->duplex = (ret & PHY_MIISTAT_DPX) ? DUPLEX_FULL : DUPLEX_HALF;
597 switch (FIELD_GET(PHY_MIISTAT_SPD_MASK, ret)) {
598 case PHY_MIISTAT_SPD_10:
599 phydev->speed = SPEED_10;
601 case PHY_MIISTAT_SPD_100:
602 phydev->speed = SPEED_100;
604 case PHY_MIISTAT_SPD_1000:
605 phydev->speed = SPEED_1000;
607 case PHY_MIISTAT_SPD_2500:
608 phydev->speed = SPEED_2500;
613 ret = gpy_update_interface(phydev);
621 static int gpy_config_intr(struct phy_device *phydev)
625 if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
626 mask = PHY_IMASK_MASK;
628 return phy_write(phydev, PHY_IMASK, mask);
631 static irqreturn_t gpy_handle_interrupt(struct phy_device *phydev)
635 reg = phy_read(phydev, PHY_ISTAT);
641 if (!(reg & PHY_IMASK_MASK))
644 /* The PHY might leave the interrupt line asserted even after PHY_ISTAT
645 * is read. To avoid interrupt storms, delay the interrupt handling as
646 * long as the PHY drives the interrupt line. An internal bus read will
647 * stall as long as the interrupt line is asserted, thus just read a
648 * random register here.
649 * Because we cannot access the internal bus at all while the interrupt
650 * is driven by the PHY, there is no way to make the interrupt line
651 * unstuck (e.g. by changing the pinmux to GPIO input) during that time
652 * frame. Therefore, polling is the best we can do and won't do any more
654 * It was observed that this bug happens on link state and link speed
655 * changes on a GPY215B and GYP215C independent of the firmware version
656 * (which doesn't mean that this list is exhaustive).
658 if (gpy_has_broken_mdint(phydev) &&
659 (reg & (PHY_IMASK_LSTC | PHY_IMASK_LSPC))) {
660 reg = gpy_mbox_read(phydev, REG_GPIO0_OUT);
667 phy_trigger_machine(phydev);
672 static int gpy_set_wol(struct phy_device *phydev,
673 struct ethtool_wolinfo *wol)
675 struct net_device *attach_dev = phydev->attached_dev;
678 if (wol->wolopts & WAKE_MAGIC) {
679 /* MAC address - Byte0:Byte1:Byte2:Byte3:Byte4:Byte5
680 * VPSPEC2_WOL_AD45 = Byte0:Byte1
681 * VPSPEC2_WOL_AD23 = Byte2:Byte3
682 * VPSPEC2_WOL_AD01 = Byte4:Byte5
684 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
686 ((attach_dev->dev_addr[0] << 8) |
687 attach_dev->dev_addr[1]));
691 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
693 ((attach_dev->dev_addr[2] << 8) |
694 attach_dev->dev_addr[3]));
698 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
700 ((attach_dev->dev_addr[4] << 8) |
701 attach_dev->dev_addr[5]));
705 /* Enable the WOL interrupt */
706 ret = phy_write(phydev, PHY_IMASK, PHY_IMASK_WOL);
710 /* Enable magic packet matching */
711 ret = phy_set_bits_mmd(phydev, MDIO_MMD_VEND2,
717 /* Clear the interrupt status register.
718 * Only WoL is enabled so clear all.
720 ret = phy_read(phydev, PHY_ISTAT);
724 /* Disable magic packet matching */
725 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2,
732 if (wol->wolopts & WAKE_PHY) {
733 /* Enable the link state change interrupt */
734 ret = phy_set_bits(phydev, PHY_IMASK, PHY_IMASK_LSTC);
738 /* Clear the interrupt status register */
739 ret = phy_read(phydev, PHY_ISTAT);
743 if (ret & (PHY_IMASK_MASK & ~PHY_IMASK_LSTC))
744 phy_trigger_machine(phydev);
749 /* Disable the link state change interrupt */
750 return phy_clear_bits(phydev, PHY_IMASK, PHY_IMASK_LSTC);
753 static void gpy_get_wol(struct phy_device *phydev,
754 struct ethtool_wolinfo *wol)
758 wol->supported = WAKE_MAGIC | WAKE_PHY;
761 ret = phy_read_mmd(phydev, MDIO_MMD_VEND2, VPSPEC2_WOL_CTL);
763 wol->wolopts |= WAKE_MAGIC;
765 ret = phy_read(phydev, PHY_IMASK);
766 if (ret & PHY_IMASK_LSTC)
767 wol->wolopts |= WAKE_PHY;
770 static int gpy_loopback(struct phy_device *phydev, bool enable)
774 ret = phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
775 enable ? BMCR_LOOPBACK : 0);
777 /* It takes some time for PHY device to switch
778 * into/out-of loopback mode.
786 static int gpy115_loopback(struct phy_device *phydev, bool enable)
788 struct gpy_priv *priv = phydev->priv;
791 return gpy_loopback(phydev, enable);
793 if (priv->fw_minor > 0x76)
794 return gpy_loopback(phydev, 0);
796 return genphy_soft_reset(phydev);
799 static struct phy_driver gpy_drivers[] = {
801 PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx),
802 .name = "Maxlinear Ethernet GPY2xx",
803 .get_features = genphy_c45_pma_read_abilities,
804 .config_init = gpy_config_init,
806 .suspend = genphy_suspend,
807 .resume = genphy_resume,
808 .config_aneg = gpy_config_aneg,
809 .aneg_done = genphy_c45_aneg_done,
810 .read_status = gpy_read_status,
811 .config_intr = gpy_config_intr,
812 .handle_interrupt = gpy_handle_interrupt,
813 .set_wol = gpy_set_wol,
814 .get_wol = gpy_get_wol,
815 .set_loopback = gpy_loopback,
818 .phy_id = PHY_ID_GPY115B,
819 .phy_id_mask = PHY_ID_GPYx15B_MASK,
820 .name = "Maxlinear Ethernet GPY115B",
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 = gpy115_loopback,
836 PHY_ID_MATCH_MODEL(PHY_ID_GPY115C),
837 .name = "Maxlinear Ethernet GPY115C",
838 .get_features = genphy_c45_pma_read_abilities,
839 .config_init = gpy_config_init,
841 .suspend = genphy_suspend,
842 .resume = genphy_resume,
843 .config_aneg = gpy_config_aneg,
844 .aneg_done = genphy_c45_aneg_done,
845 .read_status = gpy_read_status,
846 .config_intr = gpy_config_intr,
847 .handle_interrupt = gpy_handle_interrupt,
848 .set_wol = gpy_set_wol,
849 .get_wol = gpy_get_wol,
850 .set_loopback = gpy115_loopback,
853 .phy_id = PHY_ID_GPY211B,
854 .phy_id_mask = PHY_ID_GPY21xB_MASK,
855 .name = "Maxlinear Ethernet GPY211B",
856 .get_features = genphy_c45_pma_read_abilities,
857 .config_init = gpy_config_init,
859 .suspend = genphy_suspend,
860 .resume = genphy_resume,
861 .config_aneg = gpy_config_aneg,
862 .aneg_done = genphy_c45_aneg_done,
863 .read_status = gpy_read_status,
864 .config_intr = gpy_config_intr,
865 .handle_interrupt = gpy_handle_interrupt,
866 .set_wol = gpy_set_wol,
867 .get_wol = gpy_get_wol,
868 .set_loopback = gpy_loopback,
871 PHY_ID_MATCH_MODEL(PHY_ID_GPY211C),
872 .name = "Maxlinear Ethernet GPY211C",
873 .get_features = genphy_c45_pma_read_abilities,
874 .config_init = gpy_config_init,
876 .suspend = genphy_suspend,
877 .resume = genphy_resume,
878 .config_aneg = gpy_config_aneg,
879 .aneg_done = genphy_c45_aneg_done,
880 .read_status = gpy_read_status,
881 .config_intr = gpy_config_intr,
882 .handle_interrupt = gpy_handle_interrupt,
883 .set_wol = gpy_set_wol,
884 .get_wol = gpy_get_wol,
885 .set_loopback = gpy_loopback,
888 .phy_id = PHY_ID_GPY212B,
889 .phy_id_mask = PHY_ID_GPY21xB_MASK,
890 .name = "Maxlinear Ethernet GPY212B",
891 .get_features = genphy_c45_pma_read_abilities,
892 .config_init = gpy_config_init,
894 .suspend = genphy_suspend,
895 .resume = genphy_resume,
896 .config_aneg = gpy_config_aneg,
897 .aneg_done = genphy_c45_aneg_done,
898 .read_status = gpy_read_status,
899 .config_intr = gpy_config_intr,
900 .handle_interrupt = gpy_handle_interrupt,
901 .set_wol = gpy_set_wol,
902 .get_wol = gpy_get_wol,
903 .set_loopback = gpy_loopback,
906 PHY_ID_MATCH_MODEL(PHY_ID_GPY212C),
907 .name = "Maxlinear Ethernet GPY212C",
908 .get_features = genphy_c45_pma_read_abilities,
909 .config_init = gpy_config_init,
911 .suspend = genphy_suspend,
912 .resume = genphy_resume,
913 .config_aneg = gpy_config_aneg,
914 .aneg_done = genphy_c45_aneg_done,
915 .read_status = gpy_read_status,
916 .config_intr = gpy_config_intr,
917 .handle_interrupt = gpy_handle_interrupt,
918 .set_wol = gpy_set_wol,
919 .get_wol = gpy_get_wol,
920 .set_loopback = gpy_loopback,
923 .phy_id = PHY_ID_GPY215B,
924 .phy_id_mask = PHY_ID_GPYx15B_MASK,
925 .name = "Maxlinear Ethernet GPY215B",
926 .get_features = genphy_c45_pma_read_abilities,
927 .config_init = gpy_config_init,
929 .suspend = genphy_suspend,
930 .resume = genphy_resume,
931 .config_aneg = gpy_config_aneg,
932 .aneg_done = genphy_c45_aneg_done,
933 .read_status = gpy_read_status,
934 .config_intr = gpy_config_intr,
935 .handle_interrupt = gpy_handle_interrupt,
936 .set_wol = gpy_set_wol,
937 .get_wol = gpy_get_wol,
938 .set_loopback = gpy_loopback,
941 PHY_ID_MATCH_MODEL(PHY_ID_GPY215C),
942 .name = "Maxlinear Ethernet GPY215C",
943 .get_features = genphy_c45_pma_read_abilities,
944 .config_init = gpy_config_init,
946 .suspend = genphy_suspend,
947 .resume = genphy_resume,
948 .config_aneg = gpy_config_aneg,
949 .aneg_done = genphy_c45_aneg_done,
950 .read_status = gpy_read_status,
951 .config_intr = gpy_config_intr,
952 .handle_interrupt = gpy_handle_interrupt,
953 .set_wol = gpy_set_wol,
954 .get_wol = gpy_get_wol,
955 .set_loopback = gpy_loopback,
958 PHY_ID_MATCH_MODEL(PHY_ID_GPY241B),
959 .name = "Maxlinear Ethernet GPY241B",
960 .get_features = genphy_c45_pma_read_abilities,
961 .config_init = gpy_config_init,
963 .suspend = genphy_suspend,
964 .resume = genphy_resume,
965 .config_aneg = gpy_config_aneg,
966 .aneg_done = genphy_c45_aneg_done,
967 .read_status = gpy_read_status,
968 .config_intr = gpy_config_intr,
969 .handle_interrupt = gpy_handle_interrupt,
970 .set_wol = gpy_set_wol,
971 .get_wol = gpy_get_wol,
972 .set_loopback = gpy_loopback,
975 PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM),
976 .name = "Maxlinear Ethernet GPY241BM",
977 .get_features = genphy_c45_pma_read_abilities,
978 .config_init = gpy_config_init,
980 .suspend = genphy_suspend,
981 .resume = genphy_resume,
982 .config_aneg = gpy_config_aneg,
983 .aneg_done = genphy_c45_aneg_done,
984 .read_status = gpy_read_status,
985 .config_intr = gpy_config_intr,
986 .handle_interrupt = gpy_handle_interrupt,
987 .set_wol = gpy_set_wol,
988 .get_wol = gpy_get_wol,
989 .set_loopback = gpy_loopback,
992 PHY_ID_MATCH_MODEL(PHY_ID_GPY245B),
993 .name = "Maxlinear Ethernet GPY245B",
994 .get_features = genphy_c45_pma_read_abilities,
995 .config_init = gpy_config_init,
997 .suspend = genphy_suspend,
998 .resume = genphy_resume,
999 .config_aneg = gpy_config_aneg,
1000 .aneg_done = genphy_c45_aneg_done,
1001 .read_status = gpy_read_status,
1002 .config_intr = gpy_config_intr,
1003 .handle_interrupt = gpy_handle_interrupt,
1004 .set_wol = gpy_set_wol,
1005 .get_wol = gpy_get_wol,
1006 .set_loopback = gpy_loopback,
1009 module_phy_driver(gpy_drivers);
1011 static struct mdio_device_id __maybe_unused gpy_tbl[] = {
1012 {PHY_ID_MATCH_MODEL(PHY_ID_GPY2xx)},
1013 {PHY_ID_GPY115B, PHY_ID_GPYx15B_MASK},
1014 {PHY_ID_MATCH_MODEL(PHY_ID_GPY115C)},
1015 {PHY_ID_GPY211B, PHY_ID_GPY21xB_MASK},
1016 {PHY_ID_MATCH_MODEL(PHY_ID_GPY211C)},
1017 {PHY_ID_GPY212B, PHY_ID_GPY21xB_MASK},
1018 {PHY_ID_MATCH_MODEL(PHY_ID_GPY212C)},
1019 {PHY_ID_GPY215B, PHY_ID_GPYx15B_MASK},
1020 {PHY_ID_MATCH_MODEL(PHY_ID_GPY215C)},
1021 {PHY_ID_MATCH_MODEL(PHY_ID_GPY241B)},
1022 {PHY_ID_MATCH_MODEL(PHY_ID_GPY241BM)},
1023 {PHY_ID_MATCH_MODEL(PHY_ID_GPY245B)},
1026 MODULE_DEVICE_TABLE(mdio, gpy_tbl);
1028 MODULE_DESCRIPTION("Maxlinear Ethernet GPY Driver");
1029 MODULE_AUTHOR("Xu Liang");
1030 MODULE_LICENSE("GPL");