Lines Matching +full:quad +full:- +full:sgmii
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Based on code in sungem_phy.c and (long-removed) gianfar_phy.c
82 * Set phydev->irq to PHY_POLL if interrupts are not supported,
86 #define PHY_POLL -1
87 #define PHY_MAC_INTERRUPT -2
96 * enum phy_interface_t - Interface Mode definitions
98 * @PHY_INTERFACE_MODE_NA: Not Applicable - don't touch
100 * @PHY_INTERFACE_MODE_MII: Media-independent interface
101 * @PHY_INTERFACE_MODE_GMII: Gigabit media-independent interface
102 * @PHY_INTERFACE_MODE_SGMII: Serial gigabit media-independent interface
107 * @PHY_INTERFACE_MODE_RGMII: Reduced gigabit media-independent interface
113 * @PHY_INTERFACE_MODE_XGMII: 10 gigabit media-independent interface
114 * @PHY_INTERFACE_MODE_XLGMII:40 gigabit media-independent interface
116 * @PHY_INTERFACE_MODE_PSGMII: Penta SGMII
117 * @PHY_INTERFACE_MODE_QSGMII: Quad SGMII
128 * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN
129 * @PHY_INTERFACE_MODE_QUSGMII: Quad Universal SGMII
130 * @PHY_INTERFACE_MODE_1000BASEKX: 1000Base-KX - with Clause 73 AN
131 * @PHY_INTERFACE_MODE_10G_QXGMII: 10G-QXGMII - 4 ports over 10G USXGMII
164 /* 10GBASE-R, XFI, SFI - single lane 10G Serdes */
168 /* 10GBASE-KR - with Clause 73 AN */
211 * phy_supported_speeds - return all speeds currently supported by a PHY device
218 * phy_modes - map phy_interface_t enum to device tree binding of phy-mode
222 * into the device tree binding of 'phy-mode', so that Ethernet
237 return "sgmii"; in phy_modes()
241 return "rev-mii"; in phy_modes()
245 return "rev-rmii"; in phy_modes()
249 return "rgmii-id"; in phy_modes()
251 return "rgmii-rxid"; in phy_modes()
253 return "rgmii-txid"; in phy_modes()
271 return "1000base-x"; in phy_modes()
273 return "1000base-kx"; in phy_modes()
275 return "2500base-x"; in phy_modes()
277 return "5gbase-r"; in phy_modes()
283 return "10gbase-r"; in phy_modes()
285 return "25gbase-r"; in phy_modes()
289 return "10gbase-kr"; in phy_modes()
291 return "100base-x"; in phy_modes()
295 return "10g-qxgmii"; in phy_modes()
319 * struct mdio_bus_stats - Statistics counters for MDIO busses
336 * struct phy_package_shared - Shared information in PHY packages
346 * package, for example a quad PHY. See phy_package_join() and
371 * struct mii_bus - Represents an MDIO bus
453 * mdiobus_alloc - Allocate an MDIO bus structure
485 * enum phy_state - PHY state machine states:
490 * - PHY driver probe function will set the state to @PHY_READY
495 * - start will set the state to UP
499 * - timer moves to @PHY_NOLINK or @PHY_RUNNING
502 * - irq or timer will set @PHY_RUNNING if link comes back
503 * - phy_stop moves to @PHY_HALTED
507 * - irq or timer will set @PHY_NOLINK if link goes down
508 * - phy_stop moves to @PHY_HALTED
514 * - phy_stop aborts the running test and moves to @PHY_HALTED
517 * - phy_start moves to @PHY_UP
520 * - phy_stop moves to @PHY_HALTED
536 * struct phy_c45_device_ids - 802.3-c45 Device Identifiers
551 * struct phy_device - An instance of a PHY
561 * @c45_ids: 802.3-c45 Device Identifiers if is_c45.
574 * @wol_enabled: Set to true if the PHY or the attached MAC have Wake-on-LAN
577 * @dev_flags: Device-specific flags used by the PHY driver.
579 * - Bits [15:0] are free to use by the PHY driver to communicate
581 * - Bits [23:16] are currently reserved for future use.
582 * - Bits [31:24] are reserved for defining generic
584 * @irq: IRQ number of the PHY's interrupt (-1 if none)
745 * -1 means no interrupt
801 * struct phy_tdr_config - Configuration of a TDR raw test
819 #define PHY_PAIR_ALL -1
822 * struct phy_plca_cfg - Configuration of the PLCA (Physical Layer Collision
825 * @version: read-only PLCA register map version. -1 = not available. Ignored
827 * IDVER register (31.CA00). -1 = not available.
828 * @enabled: PLCA configured mode (enabled/disabled). -1 = not available / don't
830 * @node_id: the PLCA local node identifier. -1 = not available / don't set.
833 * meaningful for the coordinator (node_id = 0). -1 = not available / don't
835 * @to_tmr: The value of the PLCA to_timer in bit-times, which determines the
838 * -1 = not available / don't set. Allowed values [0 .. 255].
842 * per TO, and so on. -1 = not available / don't set.
846 * greater than the MAC inter-packet gap (which is typically 96 bits).
847 * -1 = not available / don't set. Allowed values [0 .. 255].
864 * struct phy_plca_status - Status of the PLCA (Physical Layer Collision
905 * struct phy_driver - Driver structure for a particular PHY type
949 * up device-specific structures, if any
955 * abilities it has. Should only set phydev->supported.
962 * whether to advertise lower-speed modes for that interface. It is
979 * autonegotiation if phydev->autoneg is on,
981 * if phydev->autoneg is off
1012 * @set_wol: Some devices (e.g. qnap TS-119P II) require PHY
1067 * within a plug-in module
1073 * @module_eeprom: Get the eeprom information from the plug-in
1153 * Return 0 if yes, -EOPNOTSUPP if not, or an error code.
1205 * phy_id_compare - compare @id1 with @id2 taking account of @mask
1219 * phydev_id_compare - compare @id with the PHY's Clause 22 ID
1229 return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask); in phydev_id_compare()
1266 * phy_is_started - Convenience function to check whether PHY is started
1271 return phydev->state >= PHY_UP; in phy_is_started()
1279 * phy_read - Convenience function for reading a given PHY register
1289 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum); in phy_read()
1307 * __phy_read - convenience function for reading a given PHY register
1315 return __mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum); in __phy_read()
1319 * phy_write - Convenience function for writing a given PHY register
1330 return mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, val); in phy_write()
1334 * __phy_write - Convenience function for writing a given PHY register
1343 return __mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, in __phy_write()
1348 * __phy_modify_changed() - Convenience function for modifying a PHY register
1362 return __mdiobus_modify_changed(phydev->mdio.bus, phydev->mdio.addr, in __phy_modify_changed()
1367 * phy_read_mmd - Convenience function for reading a register
1373 * phy_read_mmd_poll_timeout - Periodically poll a PHY register until a
1382 * tight-loops). Should be less than ~20ms since usleep_range
1383 * is used (see Documentation/timers/timers-howto.rst).
1386 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
1406 * __phy_read_mmd - Convenience function for reading a register
1412 * phy_write_mmd - Convenience function for writing a register
1418 * __phy_write_mmd - Convenience function for writing a register
1440 * __phy_set_bits - Convenience function for setting bits in a PHY register
1453 * __phy_clear_bits - Convenience function for clearing bits in a PHY register
1467 * phy_set_bits - Convenience function for setting bits in a PHY register
1478 * phy_clear_bits - Convenience function for clearing bits in a PHY register
1489 * __phy_set_bits_mmd - Convenience function for setting bits in a register
1505 * __phy_clear_bits_mmd - Convenience function for clearing bits in a register
1521 * phy_set_bits_mmd - Convenience function for setting bits in a register
1535 * phy_clear_bits_mmd - Convenience function for clearing bits in a register
1549 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
1557 return phydev->irq != PHY_POLL && phydev->irq != PHY_MAC_INTERRUPT; in phy_interrupt_is_valid()
1561 * phy_polling_mode - Convenience function for testing whether polling is
1567 if (phydev->state == PHY_CABLETEST) in phy_polling_mode()
1568 if (phydev->drv->flags & PHY_POLL_CABLE_TEST) in phy_polling_mode()
1571 return phydev->irq == PHY_POLL; in phy_polling_mode()
1575 * phy_has_hwtstamp - Tests whether a PHY time stamp configuration.
1580 return phydev && phydev->mii_ts && phydev->mii_ts->hwtstamp; in phy_has_hwtstamp()
1584 * phy_has_rxtstamp - Tests whether a PHY supports receive time stamping.
1589 return phydev && phydev->mii_ts && phydev->mii_ts->rxtstamp; in phy_has_rxtstamp()
1593 * phy_has_tsinfo - Tests whether a PHY reports time stamping and/or
1599 return phydev && phydev->mii_ts && phydev->mii_ts->ts_info; in phy_has_tsinfo()
1603 * phy_has_txtstamp - Tests whether a PHY supports transmit time stamping.
1608 return phydev && phydev->mii_ts && phydev->mii_ts->txtstamp; in phy_has_txtstamp()
1615 return phydev->mii_ts->hwtstamp(phydev->mii_ts, cfg, extack); in phy_hwtstamp()
1621 return phydev->mii_ts->rxtstamp(phydev->mii_ts, skb, type); in phy_rxtstamp()
1627 return phydev->mii_ts->ts_info(phydev->mii_ts, tsinfo); in phy_ts_info()
1633 phydev->mii_ts->txtstamp(phydev->mii_ts, skb, type); in phy_txtstamp()
1637 * phy_is_default_hwtstamp - Is the PHY hwtstamp the default timestamp
1648 return phy_has_hwtstamp(phydev) && phydev->default_timestamp; in phy_is_default_hwtstamp()
1652 * phy_is_internal - Convenience function for testing if a PHY is internal
1657 return phydev->is_internal; in phy_is_internal()
1661 * phy_on_sfp - Convenience function for testing if a PHY is on an SFP module
1666 return phydev->is_on_sfp_module; in phy_on_sfp()
1670 * phy_interface_mode_is_rgmii - Convenience function for testing if a
1681 * phy_interface_mode_is_8023z() - does the PHY interface mode use 802.3z
1685 * Returns true if the PHY interface mode uses the 16-bit negotiation
1686 * word as defined in 802.3z. (See 802.3-2015 37.2.1 Config_Reg encoding)
1695 * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
1701 return phy_interface_mode_is_rgmii(phydev->interface); in phy_interface_is_rgmii()
1705 * phy_is_pseudo_fixed_link - Convenience function for testing if this
1711 return phydev->is_pseudo_fixed_link; in phy_is_pseudo_fixed_link()
1828 return -EOPNOTSUPP; in phy_start_cable_test()
1836 return -EOPNOTSUPP; in phy_start_cable_test_tdr()
1842 mdio_device_reset(&phydev->mdio, value); in phy_device_reset()
1846 dev_err(&_phydev->mdio.dev, format, ##args)
1849 dev_err_probe(&_phydev->mdio.dev, err, format, ##args)
1852 dev_info(&_phydev->mdio.dev, format, ##args)
1855 dev_warn(&_phydev->mdio.dev, format, ##args)
1858 dev_dbg(&_phydev->mdio.dev, format, ##args)
1862 return dev_name(&phydev->mdio.dev); in phydev_name()
1867 mutex_lock(&phydev->mdio.bus->mdio_lock); in phy_lock_mdio_bus()
1872 mutex_unlock(&phydev->mdio.bus->mdio_lock); in phy_unlock_mdio_bus()
1966 if (!phydev->drv) in phy_read_status()
1967 return -EIO; in phy_read_status()
1969 if (phydev->drv->read_status) in phy_read_status()
1970 return phydev->drv->read_status(phydev); in phy_read_status()
2075 struct phy_package_shared *shared = phydev->shared; in phy_package_address()
2076 u8 base_addr = shared->base_addr; in phy_package_address()
2078 if (addr_offset >= PHY_MAX_ADDR - base_addr) in phy_package_address()
2079 return -EIO; in phy_package_address()
2095 return mdiobus_read(phydev->mdio.bus, addr, regnum); in phy_package_read()
2106 return __mdiobus_read(phydev->mdio.bus, addr, regnum); in __phy_package_read()
2118 return mdiobus_write(phydev->mdio.bus, addr, regnum, val); in phy_package_write()
2130 return __mdiobus_write(phydev->mdio.bus, addr, regnum, val); in __phy_package_write()
2152 struct phy_package_shared *shared = phydev->shared; in __phy_package_set_once()
2157 return !test_and_set_bit(b, &shared->flags); in __phy_package_set_once()
2192 * phy_module_driver() - Helper macro for registering PHY drivers