Lines Matching +full:mac +full:- +full:wol

1 // SPDX-License-Identifier: GPL-2.0+
53 #define PHY_IMASK_WOL BIT(15) /* Wake-on-LAN */
54 #define PHY_IMASK_ANC BIT(10) /* Auto-Neg complete */
55 #define PHY_IMASK_ADSC BIT(5) /* Link auto-downspeed detect */
117 /* WoL */
136 * it can safely re-enter loopback mode. Record the time when
156 * T = -2.5761e-11*(N^4) + 9.7332e-8*(N^3) + -1.9165e-4*(N^2) +
157 * 3.0762e-1*(N^1) + -5.2156e1
159 * where [-52.156, 137.961]C and N = [0, 1023].
168 * T = -25761e-12*(N^4) + 97332e-9*(N^3) + -191650e-6*(N^2) +
169 * 307620e-3*(N^1) + -52156
171 * where T = [-52156, 137961]mC and N = [0, 1023].
175 {4, -25761, 1000, 1},
177 {2, -191650, 1000, 1},
179 {0, -52156, 1, 1}
194 return -ENODATA; in gpy_hwmon_read()
226 struct device *dev = &phydev->mdio.dev; in gpy_hwmon_register()
259 struct gpy_priv *priv = phydev->priv; in gpy_mbox_read()
263 mutex_lock(&priv->mbox_lock); in gpy_mbox_read()
292 mutex_unlock(&priv->mbox_lock); in gpy_mbox_read()
304 __set_bit(PHY_INTERFACE_MODE_2500BASEX, phydev->possible_interfaces); in gpy21x_config_init()
305 __set_bit(PHY_INTERFACE_MODE_SGMII, phydev->possible_interfaces); in gpy21x_config_init()
312 struct device *dev = &phydev->mdio.dev; in gpy_probe()
317 if (!phydev->is_c45) { in gpy_probe()
325 return -ENOMEM; in gpy_probe()
326 phydev->priv = priv; in gpy_probe()
327 mutex_init(&priv->mbox_lock); in gpy_probe()
329 if (!device_property_present(dev, "maxlinear,use-broken-interrupts")) in gpy_probe()
330 phydev->dev_flags |= PHY_F_NO_IRQ; in gpy_probe()
335 priv->fw_major = FIELD_GET(PHY_FWV_MAJOR_MASK, fw_version); in gpy_probe()
336 priv->fw_minor = FIELD_GET(PHY_FWV_MINOR_MASK, fw_version); in gpy_probe()
344 priv->fw_major, priv->fw_minor, fw_version, in gpy_probe()
352 struct gpy_priv *priv = phydev->priv; in gpy_sgmii_need_reaneg()
356 if (priv->fw_major != ver_need_sgmii_reaneg[i].major) in gpy_sgmii_need_reaneg()
358 if (priv->fw_minor < ver_need_sgmii_reaneg[i].minor) in gpy_sgmii_need_reaneg()
381 phydev->speed = SPEED_2500; in gpy_2500basex_chk()
382 phydev->interface = PHY_INTERFACE_MODE_2500BASEX; in gpy_2500basex_chk()
435 if (phydev->autoneg == AUTONEG_DISABLE) { in gpy_config_aneg()
439 return phydev->duplex != DUPLEX_FULL in gpy_config_aneg()
444 ret = gpy_config_mdix(phydev, phydev->mdix_ctrl); in gpy_config_aneg()
454 adv = linkmode_adv_to_mii_ctrl1000_t(phydev->advertising); in gpy_config_aneg()
467 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII || in gpy_config_aneg()
468 phydev->interface == PHY_INTERFACE_MODE_INTERNAL) in gpy_config_aneg()
471 /* No need to trigger re-ANEG if link speed is 2.5G or SGMII ANEG is in gpy_config_aneg()
481 * again, SGMII AN is not triggered and hence no new in-band message in gpy_config_aneg()
482 * from GPY to MAC side SGMII. in gpy_config_aneg()
484 * MAC. At this condition, once MAC side SGMII is up, MAC side SGMII in gpy_config_aneg()
485 * wouldn`t receive new in-band message from GPY with correct link in gpy_config_aneg()
499 if (phydev->state != PHY_UP) in gpy_config_aneg()
504 if (ret == -ETIMEDOUT) in gpy_config_aneg()
523 phydev->mdix_ctrl = ETH_TP_MDI_AUTO; in gpy_update_mdix()
526 phydev->mdix_ctrl = ETH_TP_MDI_X; in gpy_update_mdix()
528 phydev->mdix_ctrl = ETH_TP_MDI; in gpy_update_mdix()
535 phydev->mdix = ETH_TP_MDI_X; in gpy_update_mdix()
537 phydev->mdix = ETH_TP_MDI; in gpy_update_mdix()
547 if (phydev->interface == PHY_INTERFACE_MODE_USXGMII || in gpy_update_interface()
548 phydev->interface == PHY_INTERFACE_MODE_INTERNAL) in gpy_update_interface()
549 return -EINVAL; in gpy_update_interface()
551 /* Automatically switch SERDES interface between SGMII and 2500-BaseX in gpy_update_interface()
552 * according to speed. Disable ANEG in 2500-BaseX mode. in gpy_update_interface()
554 switch (phydev->speed) { in gpy_update_interface()
556 phydev->interface = PHY_INTERFACE_MODE_2500BASEX; in gpy_update_interface()
569 phydev->interface = PHY_INTERFACE_MODE_SGMII; in gpy_update_interface()
573 * if ANEG is disabled (in 2500-BaseX mode). in gpy_update_interface()
587 if (phydev->speed == SPEED_2500 || phydev->speed == SPEED_1000) { in gpy_update_interface()
604 phydev->speed = SPEED_UNKNOWN; in gpy_read_status()
605 phydev->duplex = DUPLEX_UNKNOWN; in gpy_read_status()
606 phydev->pause = 0; in gpy_read_status()
607 phydev->asym_pause = 0; in gpy_read_status()
609 if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) { in gpy_read_status()
618 mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, ret); in gpy_read_status()
619 } else if (phydev->autoneg == AUTONEG_DISABLE) { in gpy_read_status()
620 linkmode_zero(phydev->lp_advertising); in gpy_read_status()
627 phydev->link = (ret & PHY_MIISTAT_LS) ? 1 : 0; in gpy_read_status()
628 phydev->duplex = (ret & PHY_MIISTAT_DPX) ? DUPLEX_FULL : DUPLEX_HALF; in gpy_read_status()
631 phydev->speed = SPEED_10; in gpy_read_status()
634 phydev->speed = SPEED_100; in gpy_read_status()
637 phydev->speed = SPEED_1000; in gpy_read_status()
640 phydev->speed = SPEED_2500; in gpy_read_status()
644 if (phydev->link) { in gpy_read_status()
655 struct gpy_priv *priv = phydev->priv; in gpy_config_intr()
663 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) in gpy_config_intr()
666 if (priv->wolopts & WAKE_MAGIC) in gpy_config_intr()
669 if (priv->wolopts & WAKE_PHY) in gpy_config_intr()
715 struct ethtool_wolinfo *wol) in gpy_set_wol() argument
717 struct net_device *attach_dev = phydev->attached_dev; in gpy_set_wol()
718 struct gpy_priv *priv = phydev->priv; in gpy_set_wol()
721 if (wol->wolopts & WAKE_MAGIC) { in gpy_set_wol()
722 /* MAC address - Byte0:Byte1:Byte2:Byte3:Byte4:Byte5 in gpy_set_wol()
729 ((attach_dev->dev_addr[0] << 8) | in gpy_set_wol()
730 attach_dev->dev_addr[1])); in gpy_set_wol()
736 ((attach_dev->dev_addr[2] << 8) | in gpy_set_wol()
737 attach_dev->dev_addr[3])); in gpy_set_wol()
743 ((attach_dev->dev_addr[4] << 8) | in gpy_set_wol()
744 attach_dev->dev_addr[5])); in gpy_set_wol()
748 /* Enable the WOL interrupt */ in gpy_set_wol()
761 * Only WoL is enabled so clear all. in gpy_set_wol()
767 priv->wolopts |= WAKE_MAGIC; in gpy_set_wol()
776 /* Disable the WOL interrupt */ in gpy_set_wol()
781 priv->wolopts &= ~WAKE_MAGIC; in gpy_set_wol()
784 if (wol->wolopts & WAKE_PHY) { in gpy_set_wol()
798 priv->wolopts |= WAKE_PHY; in gpy_set_wol()
802 priv->wolopts &= ~WAKE_PHY; in gpy_set_wol()
808 struct ethtool_wolinfo *wol) in gpy_get_wol() argument
810 struct gpy_priv *priv = phydev->priv; in gpy_get_wol()
812 wol->supported = WAKE_MAGIC | WAKE_PHY; in gpy_get_wol()
813 wol->wolopts = priv->wolopts; in gpy_get_wol()
818 struct gpy_priv *priv = phydev->priv; in gpy_loopback()
826 if (time_before64(now, priv->lb_dis_to)) in gpy_loopback()
827 msleep(jiffies64_to_msecs(priv->lb_dis_to - now)); in gpy_loopback()
842 priv->lb_dis_to = get_jiffies_64() + HZ * 3; in gpy_loopback()
850 struct gpy_priv *priv = phydev->priv; in gpy115_loopback()
855 if (priv->fw_minor > 0x76) in gpy115_loopback()
867 return -EINVAL; in gpy_led_brightness_set()
898 return -EINVAL; in gpy_led_hw_is_supported()
902 return -EOPNOTSUPP; in gpy_led_hw_is_supported()
913 return -EINVAL; in gpy_led_hw_control_get()
953 return -EINVAL; in gpy_led_hw_control_set()
996 return -EINVAL; in gpy_led_polarity_set()
1007 return -EINVAL; in gpy_led_polarity_set()
1017 return -EINVAL; in gpy_led_polarity_set()