Lines Matching +full:reset +full:- +full:pin +full:- +full:assert +full:- +full:time +full:- +full:ms

1 // SPDX-License-Identifier: GPL-2.0+
27 /* Vendor-specific PHY Definitions */
28 /* EDPD NLP / crossover time configuration */
39 /* interval between phylib state machine runs in ms */
70 if (phydev->interrupts == PHY_INTERRUPT_ENABLED) { in smsc_phy_config_intr()
91 struct smsc_phy_priv *priv = phydev->priv; in smsc_phy_config_edpd()
93 if (priv->edpd_enable) in smsc_phy_config_edpd()
107 if (irq_status != -ENODEV) in smsc_phy_handle_interrupt()
124 struct smsc_phy_priv *priv = phydev->priv; in smsc_phy_config_init()
130 if (!priv->edpd_mode_set_by_user && phydev->irq != PHY_POLL) in smsc_phy_config_init()
131 priv->edpd_enable = false; in smsc_phy_config_init()
152 /* reset the phy */ in smsc_phy_reset()
161 switch (phydev->mdix_ctrl) { in lan87xx_config_aneg()
186 phydev->mdix = phydev->mdix_ctrl; in lan87xx_config_aneg()
192 if (phydev->phy_id == 0x0007c0f0) { /* LAN9500A or LAN9505A */ in lan95xx_config_aneg_ext()
205 * The LAN87xx suffers from rare absence of the ENERGYON-bit when Ethernet cable
206 * plugs in while LAN87xx is in Energy Detect Power-Down mode. This leads to
208 * This workaround disables Energy Detect Power-Down mode and waiting for
210 * The Energy Detect Power-Down mode is enabled again in the end of procedure to
212 * The workaround is only applicable to poll mode. Energy Detect Power-Down may
217 struct smsc_phy_priv *priv = phydev->priv; in lan87xx_read_status()
224 if (!phydev->link && priv && priv->edpd_enable && in lan87xx_read_status()
225 priv->edpd_max_wait_ms) { in lan87xx_read_status()
226 unsigned int max_wait = priv->edpd_max_wait_ms * 1000; in lan87xx_read_status()
239 /* Wait max 640 ms to detect energy and the timeout is not in lan87xx_read_status()
249 /* Re-enable EDPD */ in lan87xx_read_status()
269 /* Setup LED2/nINT/nPME pin to function as nPME. May need user option in lan874x_phy_config_init()
276 * be cleared to de-assert PME signal after a WoL event happens, but in lan874x_phy_config_init()
285 /* set nPME self clear delay time */ in lan874x_phy_config_init()
297 struct smsc_phy_priv *priv = phydev->priv; in lan874x_get_wol()
300 wol->supported = (WAKE_UCAST | WAKE_BCAST | WAKE_MAGIC | in lan874x_get_wol()
302 wol->wolopts = 0; in lan874x_get_wol()
309 wol->wolopts |= WAKE_UCAST; in lan874x_get_wol()
312 wol->wolopts |= WAKE_BCAST; in lan874x_get_wol()
315 wol->wolopts |= WAKE_MAGIC; in lan874x_get_wol()
318 if (priv->wol_arp) in lan874x_get_wol()
319 wol->wolopts |= WAKE_ARP; in lan874x_get_wol()
321 wol->wolopts |= WAKE_MCAST; in lan874x_get_wol()
338 * are 8 registers to program the 16-bit masks, where each bit means in lan874x_chk_wol_pattern()
349 for (j = 0; j < 16; j++, i++, len--) { in lan874x_chk_wol_pattern()
393 reg--; in lan874x_set_wol_pattern()
395 masklen -= 16; in lan874x_set_wol_pattern()
401 reg--; in lan874x_set_wol_pattern()
409 struct net_device *ndev = phydev->attached_dev; in lan874x_set_wol()
410 struct smsc_phy_priv *priv = phydev->priv; in lan874x_set_wol()
417 if ((wol->wolopts & (WAKE_ARP | WAKE_MCAST)) == in lan874x_set_wol()
420 "lan874x WoL supports one of ARP|MCAST at a time\n"); in lan874x_set_wol()
421 return -EOPNOTSUPP; in lan874x_set_wol()
430 if (wol->wolopts & WAKE_UCAST) in lan874x_set_wol()
435 if (wol->wolopts & WAKE_BCAST) in lan874x_set_wol()
440 if (wol->wolopts & WAKE_MAGIC) in lan874x_set_wol()
446 if (wol->wolopts & (WAKE_ARP | WAKE_MCAST)) in lan874x_set_wol()
451 if (wol->wolopts & WAKE_ARP) { in lan874x_set_wol()
468 priv->wol_arp = true; in lan874x_set_wol()
471 if (wol->wolopts & WAKE_MCAST) { in lan874x_set_wol()
477 priv->wol_arp = false; in lan874x_set_wol()
480 if (wol->wolopts & (WAKE_MAGIC | WAKE_UCAST)) { in lan874x_set_wol()
481 const u8 *mac = (const u8 *)ndev->dev_addr; in lan874x_set_wol()
485 for (i = 0; i < 6; i += 2, reg--) { in lan874x_set_wol()
540 struct smsc_phy_priv *priv = phydev->priv; in smsc_phy_get_edpd()
543 return -EOPNOTSUPP; in smsc_phy_get_edpd()
545 if (!priv->edpd_enable) in smsc_phy_get_edpd()
547 else if (!priv->edpd_max_wait_ms) in smsc_phy_get_edpd()
550 *edpd = PHY_STATE_MACH_MS + priv->edpd_max_wait_ms; in smsc_phy_get_edpd()
557 struct smsc_phy_priv *priv = phydev->priv; in smsc_phy_set_edpd()
560 return -EOPNOTSUPP; in smsc_phy_set_edpd()
564 priv->edpd_enable = false; in smsc_phy_set_edpd()
567 priv->edpd_enable = true; in smsc_phy_set_edpd()
568 priv->edpd_max_wait_ms = 0; in smsc_phy_set_edpd()
574 if (phydev->irq != PHY_POLL) in smsc_phy_set_edpd()
575 return -EOPNOTSUPP; in smsc_phy_set_edpd()
577 return -EINVAL; in smsc_phy_set_edpd()
578 priv->edpd_enable = true; in smsc_phy_set_edpd()
579 priv->edpd_max_wait_ms = edpd - PHY_STATE_MACH_MS; in smsc_phy_set_edpd()
582 priv->edpd_mode_set_by_user = true; in smsc_phy_set_edpd()
590 switch (tuna->id) { in smsc_phy_get_tunable()
594 return -EOPNOTSUPP; in smsc_phy_get_tunable()
602 switch (tuna->id) { in smsc_phy_set_tunable()
606 return -EOPNOTSUPP; in smsc_phy_set_tunable()
613 struct device *dev = &phydev->mdio.dev; in smsc_phy_probe()
619 return -ENOMEM; in smsc_phy_probe()
621 priv->edpd_enable = true; in smsc_phy_probe()
622 priv->edpd_max_wait_ms = EDPD_MAX_WAIT_DFLT_MS; in smsc_phy_probe()
624 if (device_property_present(dev, "smsc,disable-energy-detect")) in smsc_phy_probe()
625 priv->edpd_enable = false; in smsc_phy_probe()
627 phydev->priv = priv; in smsc_phy_probe()