Lines Matching +full:phy +full:- +full:device

5  * SPDX-License-Identifier:	GPL-2.0+
7 * This file pretty much stolen from Linux's mii.h/ethtool.h/phy.h
70 /* struct phy_driver: a structure which defines PHY behavior
72 * uid will contain a number which represents the PHY. During
73 * startup, the driver will poll the PHY to find out what its
74 * UID--as defined by registers 2 and 3--is. The 32-bit result
75 * gotten from the PHY will be masked to
92 /* Called to configure the PHY, and modify the controller
106 /* Phy specific driver override for reading a MMD register */
109 /* Phy specific driver override for writing a MMD register */
117 /* Information about the PHY type */
164 struct mii_dev *bus = phydev->bus; in phy_read()
166 return bus->read(bus, phydev->addr, devad, regnum); in phy_read()
172 struct mii_dev *bus = phydev->bus; in phy_write()
174 return bus->write(bus, phydev->addr, devad, regnum, val); in phy_write()
194 struct phy_driver *drv = phydev->drv; in phy_read_mmd()
197 return -EINVAL; in phy_read_mmd()
199 /* driver-specific access */ in phy_read_mmd()
200 if (drv->read_mmd) in phy_read_mmd()
201 return drv->read_mmd(phydev, devad, regnum); in phy_read_mmd()
204 if ((drv->features & PHY_10G_FEATURES) == PHY_10G_FEATURES || in phy_read_mmd()
218 struct phy_driver *drv = phydev->drv; in phy_write_mmd()
221 return -EINVAL; in phy_write_mmd()
223 /* driver-specific access */ in phy_write_mmd()
224 if (drv->write_mmd) in phy_write_mmd()
225 return drv->write_mmd(phydev, devad, regnum, val); in phy_write_mmd()
228 if ((drv->features & PHY_10G_FEATURES) == PHY_10G_FEATURES || in phy_write_mmd()
251 * phy_init() - Initializes the PHY drivers
253 * This function registers all available PHY drivers
255 * @return 0 if OK, -ve on error
260 * phy_reset() - Resets the specified PHY
262 * Issues a reset of the PHY and waits for it to complete
264 * @phydev: PHY to reset
265 * @return 0 if OK, -ve on error
270 * phy_find_by_mask() - Searches for a PHY on the specified MDIO bus
272 * The function checks the PHY addresses flagged in phy_mask and returns a
273 * phy_device pointer if it detects a PHY.
274 * This function should only be called if just one PHY is expected to be present
280 * @interface: type of MAC-PHY interface
281 * @return pointer to phy_device if a PHY is found, or NULL otherwise
289 * phy_connect_dev() - Associates the given pair of PHY and Ethernet devices
290 * @phydev: PHY device
291 * @dev: Ethernet device
296 * phy_connect() - Creates a PHY device for the Ethernet interface
298 * Creates a PHY device for the PHY at the given address, if one doesn't exist
299 * already, and associates it with the Ethernet device.
301 * and the bus is scanned to detect a PHY. Scanning should only be used if only
302 * one PHY is expected to be present on the MDIO bus, otherwise it is undefined
303 * which PHY is returned.
305 * @bus: MII/MDIO bus that hosts the PHY
306 * @addr: PHY address on MDIO bus
307 * @dev: Ethernet device to associate to the PHY
308 * @interface: type of MAC-PHY interface
309 * @return pointer to phy_device if a PHY is found, or NULL otherwise
317 if (ofnode_valid(phydev->node)) in phy_get_ofnode()
318 return phydev->node; in phy_get_ofnode()
320 return dev_ofnode(phydev->dev); in phy_get_ofnode()
325 * phy_connect_dev() - Associates the given pair of PHY and Ethernet devices
326 * @phydev: PHY device
327 * @dev: Ethernet device
332 * phy_connect() - Creates a PHY device for the Ethernet interface
334 * Creates a PHY device for the PHY at the given address, if one doesn't exist
335 * already, and associates it with the Ethernet device.
337 * and the bus is scanned to detect a PHY. Scanning should only be used if only
338 * one PHY is expected to be present on the MDIO bus, otherwise it is undefined
339 * which PHY is returned.
341 * @bus: MII/MDIO bus that hosts the PHY
342 * @addr: PHY address on MDIO bus
343 * @dev: Ethernet device to associate to the PHY
344 * @interface: type of MAC-PHY interface
345 * @return pointer to phy_device if a PHY is found, or NULL otherwise
399 * phy_get_interface_by_name() - Look up a PHY interface name
401 * @str: PHY interface name, e.g. "mii"
402 * @return PHY_INTERFACE_MODE_... value, or -1 if not found
407 * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
413 return phydev->interface >= PHY_INTERFACE_MODE_RGMII && in phy_interface_is_rgmii()
414 phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID; in phy_interface_is_rgmii()
418 * phy_interface_is_sgmii - Convenience function for testing if a PHY interface
424 return phydev->interface >= PHY_INTERFACE_MODE_SGMII && in phy_interface_is_sgmii()
425 phydev->interface <= PHY_INTERFACE_MODE_QSGMII; in phy_interface_is_sgmii()
428 /* PHY UIDs for various PHYs that are referenced in external code */