Lines Matching +full:eee +full:- +full:broken +full:- +full:100 +full:tx

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Based on code in sungem_phy.c and (long-removed) gianfar_phy.c
33 #include <net/eee.h>
64 * Set phydev->irq to PHY_POLL if interrupts are not supported,
68 #define PHY_POLL -1
69 #define PHY_MAC_INTERRUPT -2
78 * enum phy_interface_t - Interface Mode definitions
80 * @PHY_INTERFACE_MODE_NA: Not Applicable - don't touch
82 * @PHY_INTERFACE_MODE_MII: Media-independent interface
83 * @PHY_INTERFACE_MODE_GMII: Gigabit media-independent interface
84 * @PHY_INTERFACE_MODE_SGMII: Serial gigabit media-independent interface
89 * @PHY_INTERFACE_MODE_RGMII: Reduced gigabit media-independent interface
90 * @PHY_INTERFACE_MODE_RGMII_ID: RGMII with Internal RX+TX delay
95 * @PHY_INTERFACE_MODE_XGMII: 10 gigabit media-independent interface
96 * @PHY_INTERFACE_MODE_XLGMII:40 gigabit media-independent interface
101 * @PHY_INTERFACE_MODE_100BASEX: 100 BaseX
110 * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN
112 * @PHY_INTERFACE_MODE_1000BASEKX: 1000Base-KX - with Clause 73 AN
113 * @PHY_INTERFACE_MODE_10G_QXGMII: 10G-QXGMII - 4 ports over 10G USXGMII
146 /* 10GBASE-R, XFI, SFI - single lane 10G Serdes */
150 /* 10GBASE-KR - with Clause 73 AN */
193 * phy_supported_speeds - return all speeds currently supported by a PHY device
200 * phy_modes - map phy_interface_t enum to device tree binding of phy-mode
204 * into the device tree binding of 'phy-mode', so that Ethernet
223 return "rev-mii"; in phy_modes()
227 return "rev-rmii"; in phy_modes()
231 return "rgmii-id"; in phy_modes()
233 return "rgmii-rxid"; in phy_modes()
235 return "rgmii-txid"; in phy_modes()
253 return "1000base-x"; in phy_modes()
255 return "1000base-kx"; in phy_modes()
257 return "2500base-x"; in phy_modes()
259 return "5gbase-r"; in phy_modes()
265 return "10gbase-r"; in phy_modes()
267 return "25gbase-r"; in phy_modes()
271 return "10gbase-kr"; in phy_modes()
273 return "100base-x"; in phy_modes()
277 return "10g-qxgmii"; in phy_modes()
284 * rgmii_clock - map link speed to the clock rate
302 return -EINVAL; in rgmii_clock()
324 * struct mdio_bus_stats - Statistics counters for MDIO busses
341 * struct phy_package_shared - Shared information in PHY packages
376 * struct mii_bus - Represents an MDIO bus
458 * mdiobus_alloc - Allocate an MDIO bus structure
490 * enum phy_state - PHY state machine states:
495 * - PHY driver probe function will set the state to @PHY_READY
500 * - start will set the state to UP
504 * - timer moves to @PHY_NOLINK or @PHY_RUNNING
507 * - irq or timer will set @PHY_RUNNING if link comes back
508 * - phy_stop moves to @PHY_HALTED
512 * - irq or timer will set @PHY_NOLINK if link goes down
513 * - phy_stop moves to @PHY_HALTED
519 * - phy_stop aborts the running test and moves to @PHY_HALTED
522 * - phy_start moves to @PHY_UP
525 * - phy_stop moves to @PHY_HALTED
541 * struct phy_c45_device_ids - 802.3-c45 Device Identifiers
556 * struct phy_device - An instance of a PHY
566 * @c45_ids: 802.3-c45 Device Identifiers if is_c45.
579 * @wol_enabled: Set to true if the PHY or the attached MAC have Wake-on-LAN
582 * @dev_flags: Device-specific flags used by the PHY driver.
584 * - Bits [15:0] are free to use by the PHY driver to communicate
586 * - Bits [23:16] are currently reserved for future use.
587 * - Bits [31:24] are reserved for defining generic
589 * @irq: IRQ number of the PHY's interrupt (-1 if none)
607 * @supported_eee: supported PHY EEE linkmodes
608 * @advertising_eee: Currently advertised EEE linkmodes
610 * @eee_active: phylib private state, indicating that EEE has been negotiated
611 * @eee_cfg: User configuration of EEE
726 /* used for eee validation and configuration*/
749 * -1 means no interrupt
805 * struct phy_tdr_config - Configuration of a TDR raw test
823 #define PHY_PAIR_ALL -1
826 * enum link_inband_signalling - in-band signalling modes that are supported
828 * @LINK_INBAND_DISABLE: in-band signalling can be disabled
829 * @LINK_INBAND_ENABLE: in-band signalling can be enabled without bypass
830 * @LINK_INBAND_BYPASS: in-band signalling can be enabled with bypass
844 * struct phy_plca_cfg - Configuration of the PLCA (Physical Layer Collision
847 * @version: read-only PLCA register map version. -1 = not available. Ignored
849 * IDVER register (31.CA00). -1 = not available.
850 * @enabled: PLCA configured mode (enabled/disabled). -1 = not available / don't
852 * @node_id: the PLCA local node identifier. -1 = not available / don't set.
855 * meaningful for the coordinator (node_id = 0). -1 = not available / don't
857 * @to_tmr: The value of the PLCA to_timer in bit-times, which determines the
860 * -1 = not available / don't set. Allowed values [0 .. 255].
864 * per TO, and so on. -1 = not available / don't set.
868 * greater than the MAC inter-packet gap (which is typically 96 bits).
869 * -1 = not available / don't set. Allowed values [0 .. 255].
886 * struct phy_plca_status - Status of the PLCA (Physical Layer Collision
928 * struct phy_driver - Driver structure for a particular PHY type
972 * up device-specific structures, if any
978 * abilities it has. Should only set phydev->supported.
983 * @inband_caps: query whether in-band is supported for the given PHY
991 * @config_inband: configure in-band mode for the PHY
998 * whether to advertise lower-speed modes for that interface. It is
1015 * autonegotiation if phydev->autoneg is on,
1017 * if phydev->autoneg is off
1048 * @set_wol: Some devices (e.g. qnap TS-119P II) require PHY
1103 * within a plug-in module
1109 * @module_eeprom: Get the eeprom information from the plug-in
1133 * @stats: structure where additional PHY-specific stats will be stored.
1136 * structures. The input structures are pre-initialized with
1148 * @link_stats: structure where link-specific stats will be stored.
1150 * Retrieves link-related statistics for the given PHY device. The input
1151 * structure is pre-initialized with `ETHTOOL_STAT_NOT_SET`, and the
1164 * maintained 64-bit counters. This is necessary for PHYs that implement
1165 * reduced-width counters (e.g., 16-bit or 32-bit) which can overflow
1166 * more frequently compared to 64-bit counters. By invoking this
1168 * overflow detection, and accumulate the results into local 64-bit
1236 * Return 0 if yes, -EOPNOTSUPP if not, or an error code.
1288 * phy_id_compare - compare @id1 with @id2 taking account of @mask
1302 * phydev_id_compare - compare @id with the PHY's Clause 22 ID
1312 return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask); in phydev_id_compare()
1350 * phy_set_eee_broken - Mark an EEE mode as broken so that it isn't advertised.
1352 * @link_mode: The broken EEE mode
1356 linkmode_set_bit(link_mode, phydev->eee_broken_modes); in phy_set_eee_broken()
1360 * phy_is_started - Convenience function to check whether PHY is started
1365 return phydev->state >= PHY_UP; in phy_is_started()
1373 * phy_read - Convenience function for reading a given PHY register
1383 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum); in phy_read()
1401 * __phy_read - convenience function for reading a given PHY register
1409 return __mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum); in __phy_read()
1413 * phy_write - Convenience function for writing a given PHY register
1424 return mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, val); in phy_write()
1428 * __phy_write - Convenience function for writing a given PHY register
1437 return __mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, in __phy_write()
1442 * __phy_modify_changed() - Convenience function for modifying a PHY register
1456 return __mdiobus_modify_changed(phydev->mdio.bus, phydev->mdio.addr, in __phy_modify_changed()
1461 * phy_read_mmd - Convenience function for reading a register
1467 * phy_read_mmd_poll_timeout - Periodically poll a PHY register until a
1475 * @sleep_us: Maximum time to sleep between reads in us (0 tight-loops). Please
1481 * Returns: 0 on success and -ETIMEDOUT upon a timeout. In either
1501 * __phy_read_mmd - Convenience function for reading a register
1507 * phy_write_mmd - Convenience function for writing a register
1513 * __phy_write_mmd - Convenience function for writing a register
1535 * __phy_set_bits - Convenience function for setting bits in a PHY register
1548 * __phy_clear_bits - Convenience function for clearing bits in a PHY register
1562 * phy_set_bits - Convenience function for setting bits in a PHY register
1573 * phy_clear_bits - Convenience function for clearing bits in a PHY register
1584 * __phy_set_bits_mmd - Convenience function for setting bits in a register
1600 * __phy_clear_bits_mmd - Convenience function for clearing bits in a register
1616 * phy_set_bits_mmd - Convenience function for setting bits in a register
1630 * phy_clear_bits_mmd - Convenience function for clearing bits in a register
1644 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
1652 return phydev->irq != PHY_POLL && phydev->irq != PHY_MAC_INTERRUPT; in phy_interrupt_is_valid()
1656 * phy_polling_mode - Convenience function for testing whether polling is
1662 if (phydev->state == PHY_CABLETEST) in phy_polling_mode()
1663 if (phydev->drv->flags & PHY_POLL_CABLE_TEST) in phy_polling_mode()
1666 if (phydev->drv->update_stats) in phy_polling_mode()
1669 return phydev->irq == PHY_POLL; in phy_polling_mode()
1673 * phy_has_hwtstamp - Tests whether a PHY time stamp configuration.
1678 return phydev && phydev->mii_ts && phydev->mii_ts->hwtstamp; in phy_has_hwtstamp()
1682 * phy_has_rxtstamp - Tests whether a PHY supports receive time stamping.
1687 return phydev && phydev->mii_ts && phydev->mii_ts->rxtstamp; in phy_has_rxtstamp()
1691 * phy_has_tsinfo - Tests whether a PHY reports time stamping and/or
1697 return phydev && phydev->mii_ts && phydev->mii_ts->ts_info; in phy_has_tsinfo()
1701 * phy_has_txtstamp - Tests whether a PHY supports transmit time stamping.
1706 return phydev && phydev->mii_ts && phydev->mii_ts->txtstamp; in phy_has_txtstamp()
1713 return phydev->mii_ts->hwtstamp(phydev->mii_ts, cfg, extack); in phy_hwtstamp()
1719 return phydev->mii_ts->rxtstamp(phydev->mii_ts, skb, type); in phy_rxtstamp()
1725 return phydev->mii_ts->ts_info(phydev->mii_ts, tsinfo); in phy_ts_info()
1731 phydev->mii_ts->txtstamp(phydev->mii_ts, skb, type); in phy_txtstamp()
1735 * phy_is_default_hwtstamp - Is the PHY hwtstamp the default timestamp
1746 return phy_has_hwtstamp(phydev) && phydev->default_timestamp; in phy_is_default_hwtstamp()
1750 * phy_is_internal - Convenience function for testing if a PHY is internal
1755 return phydev->is_internal; in phy_is_internal()
1759 * phy_on_sfp - Convenience function for testing if a PHY is on an SFP module
1764 return phydev->is_on_sfp_module; in phy_on_sfp()
1768 * phy_interface_mode_is_rgmii - Convenience function for testing if a
1779 * phy_interface_mode_is_8023z() - does the PHY interface mode use 802.3z
1783 * Returns true if the PHY interface mode uses the 16-bit negotiation
1784 * word as defined in 802.3z. (See 802.3-2015 37.2.1 Config_Reg encoding)
1793 * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
1799 return phy_interface_mode_is_rgmii(phydev->interface); in phy_interface_is_rgmii()
1803 * phy_is_pseudo_fixed_link - Convenience function for testing if this
1809 return phydev->is_pseudo_fixed_link; in phy_is_pseudo_fixed_link()
1929 return -EOPNOTSUPP; in phy_start_cable_test()
1937 return -EOPNOTSUPP; in phy_start_cable_test_tdr()
1943 mdio_device_reset(&phydev->mdio, value); in phy_device_reset()
1947 dev_err(&_phydev->mdio.dev, format, ##args)
1950 dev_err_probe(&_phydev->mdio.dev, err, format, ##args)
1953 dev_info(&_phydev->mdio.dev, format, ##args)
1956 dev_warn(&_phydev->mdio.dev, format, ##args)
1959 dev_dbg(&_phydev->mdio.dev, format, ##args)
1963 return dev_name(&phydev->mdio.dev); in phydev_name()
1968 mutex_lock(&phydev->mdio.bus->mdio_lock); in phy_lock_mdio_bus()
1973 mutex_unlock(&phydev->mdio.bus->mdio_lock); in phy_unlock_mdio_bus()
2065 if (!phydev->drv) in phy_read_status()
2066 return -EIO; in phy_read_status()
2068 if (phydev->drv->read_status) in phy_read_status()
2069 return phydev->drv->read_status(phydev); in phy_read_status()
2107 void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
2109 void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);
2184 struct phy_package_shared *shared = phydev->shared; in phy_package_address()
2185 u8 base_addr = shared->base_addr; in phy_package_address()
2187 if (addr_offset >= PHY_MAX_ADDR - base_addr) in phy_package_address()
2188 return -EIO; in phy_package_address()
2204 return mdiobus_read(phydev->mdio.bus, addr, regnum); in phy_package_read()
2215 return __mdiobus_read(phydev->mdio.bus, addr, regnum); in __phy_package_read()
2227 return mdiobus_write(phydev->mdio.bus, addr, regnum, val); in phy_package_write()
2239 return __mdiobus_write(phydev->mdio.bus, addr, regnum, val); in __phy_package_write()
2261 struct phy_package_shared *shared = phydev->shared; in __phy_package_set_once()
2266 return !test_and_set_bit(b, &shared->flags); in __phy_package_set_once()
2301 * phy_module_driver() - Helper macro for registering PHY drivers