Lines Matching +full:led +full:- +full:speed +full:- +full:mode

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Based on code in sungem_phy.c and (long-removed) gianfar_phy.c
79 * Set phydev->irq to PHY_POLL if interrupts are not supported,
83 #define PHY_POLL -1
84 #define PHY_MAC_INTERRUPT -2
93 * enum phy_interface_t - Interface Mode definitions
95 * @PHY_INTERFACE_MODE_NA: Not Applicable - don't touch
97 * @PHY_INTERFACE_MODE_MII: Media-independent interface
98 * @PHY_INTERFACE_MODE_GMII: Gigabit media-independent interface
99 * @PHY_INTERFACE_MODE_SGMII: Serial gigabit media-independent interface
104 * @PHY_INTERFACE_MODE_RGMII: Reduced gigabit media-independent interface
110 * @PHY_INTERFACE_MODE_XGMII: 10 gigabit media-independent interface
111 * @PHY_INTERFACE_MODE_XLGMII:40 gigabit media-independent interface
125 * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN
127 * @PHY_INTERFACE_MODE_1000BASEKX: 1000Base-KX - with Clause 73 AN
160 /* 10GBASE-R, XFI, SFI - single lane 10G Serdes */
164 /* 10GBASE-KR - with Clause 73 AN */
171 /* PHY interface mode bitmap handling */
206 * phy_supported_speeds - return all speeds currently supported by a PHY device
213 * phy_modes - map phy_interface_t enum to device tree binding of phy-mode
217 * into the device tree binding of 'phy-mode', so that Ethernet
236 return "rev-mii"; in phy_modes()
240 return "rev-rmii"; in phy_modes()
244 return "rgmii-id"; in phy_modes()
246 return "rgmii-rxid"; in phy_modes()
248 return "rgmii-txid"; in phy_modes()
266 return "1000base-x"; in phy_modes()
268 return "1000base-kx"; in phy_modes()
270 return "2500base-x"; in phy_modes()
272 return "5gbase-r"; in phy_modes()
278 return "10gbase-r"; in phy_modes()
280 return "25gbase-r"; in phy_modes()
284 return "10gbase-kr"; in phy_modes()
286 return "100base-x"; in phy_modes()
312 * struct mdio_bus_stats - Statistics counters for MDIO busses
329 * struct phy_package_shared - Shared information in PHY packages
360 * struct mii_bus - Represents an MDIO bus
442 * mdiobus_alloc - Allocate an MDIO bus structure
474 * enum phy_state - PHY state machine states:
479 * - PHY driver probe function will set the state to @PHY_READY
484 * - start will set the state to UP
488 * - timer moves to @PHY_NOLINK or @PHY_RUNNING
491 * - irq or timer will set @PHY_RUNNING if link comes back
492 * - phy_stop moves to @PHY_HALTED
496 * - irq or timer will set @PHY_NOLINK if link goes down
497 * - phy_stop moves to @PHY_HALTED
503 * - phy_stop aborts the running test and moves to @PHY_HALTED
506 * - phy_start moves to @PHY_UP
509 * - phy_stop moves to @PHY_HALTED
525 * struct phy_c45_device_ids - 802.3-c45 Device Identifiers
540 * struct phy_device - An instance of a PHY
547 * @c45_ids: 802.3-c45 Device Identifiers if is_c45.
557 * @downshifted_rate: Set true if link speed has been downshifted.
560 * @wol_enabled: Set to true if the PHY or the attached MAC have Wake-on-LAN
563 * @dev_flags: Device-specific flags used by the PHY driver.
565 * - Bits [15:0] are free to use by the PHY driver to communicate
567 * - Bits [23:16] are currently reserved for future use.
568 * - Bits [31:24] are reserved for defining generic
570 * @irq: IRQ number of the PHY's interrupt (-1 if none)
581 * @speed: Current link speed
596 * @rate_matching: Current rate matching mode
611 * @phy_led_triggers: Array of LED triggers
613 * @led_link_trigger: LED trigger for link up/down
614 * @last_triggered: last LED trigger for link speed
615 * @leds: list of PHY LED structures
679 * forced speed & duplex (no autoneg)
680 * partner speed & duplex & pause (autoneg)
682 int speed; member
720 * -1 means no interrupt
775 * struct phy_tdr_config - Configuration of a TDR raw test
793 #define PHY_PAIR_ALL -1
796 * struct phy_plca_cfg - Configuration of the PLCA (Physical Layer Collision
799 * @version: read-only PLCA register map version. -1 = not available. Ignored
801 * IDVER register (31.CA00). -1 = not available.
802 * @enabled: PLCA configured mode (enabled/disabled). -1 = not available / don't
804 * @node_id: the PLCA local node identifier. -1 = not available / don't set.
807 * meaningful for the coordinator (node_id = 0). -1 = not available / don't
809 * @to_tmr: The value of the PLCA to_timer in bit-times, which determines the
812 * -1 = not available / don't set. Allowed values [0 .. 255].
816 * per TO, and so on. -1 = not available / don't set.
820 * greater than the MAC inter-packet gap (which is typically 96 bits).
821 * -1 = not available / don't set. Allowed values [0 .. 255].
838 * struct phy_plca_status - Status of the PLCA (Physical Layer Collision
853 * struct phy_led: An LED driven by the PHY
856 * @phydev: PHY this LED is attached to
857 * @led_cdev: Standard LED class structure
858 * @index: Number of the LED
870 * struct phy_driver - Driver structure for a particular PHY type
878 * @features: A mandatory list of features (speed, duplex, etc)
914 * up device-specific structures, if any
920 * abilities it has. Should only set phydev->supported.
927 * whether to advertise lower-speed modes for that interface. It is
928 * assumed that if a rate matching mode is supported on an interface,
944 * autonegotiation if phydev->autoneg is on,
945 * forces the speed to the current settings in phydev
946 * if phydev->autoneg is off
953 /** @read_status: Determines the negotiated speed and duplex */
977 * @set_wol: Some devices (e.g. qnap TS-119P II) require PHY
1032 * within a plug-in module
1038 * @module_eeprom: Get the eeprom information from the plug-in
1093 * @led_brightness_set: Set a PHY LED brightness. Index
1094 * indicates which of the PHYs led should be set. Value
1095 * follows the standard LED class meaning, e.g. LED_OFF,
1102 * @led_blink_set: Set a PHY LED brightness. Index indicates
1103 * which of the PHYs led should be configured to blink. Delays
1114 * @dev: PHY device which has the LED
1115 * @index: Which LED of the PHY device
1118 * Return 0 if yes, -EOPNOTSUPP if not, or an error code.
1123 * @led_hw_control_set: Set the HW to control the LED
1124 * @dev: PHY device which has the LED
1125 * @index: Which LED of the PHY device
1126 * @rules The rules used to control the LED
1133 * @led_hw_control_get: Get how the HW is controlling the LED
1134 * @dev: PHY device which has the LED
1135 * @index: Which LED of the PHY device
1136 * @rules Pointer to the rules used to control the LED
1157 * phy_id_compare - compare @id1 with @id2 taking account of @mask
1171 * phydev_id_compare - compare @id with the PHY's Clause 22 ID
1181 return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask); in phydev_id_compare()
1193 const char *phy_speed_to_str(int speed);
1199 /* A structure for mapping a particular speed and duplex
1203 u32 speed; member
1209 phy_lookup_setting(int speed, int duplex, const unsigned long *mask,
1218 * phy_is_started - Convenience function to check whether PHY is started
1223 return phydev->state >= PHY_UP; in phy_is_started()
1231 * phy_read - Convenience function for reading a given PHY register
1241 return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum); in phy_read()
1259 * __phy_read - convenience function for reading a given PHY register
1267 return __mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum); in __phy_read()
1271 * phy_write - Convenience function for writing a given PHY register
1282 return mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, val); in phy_write()
1286 * __phy_write - Convenience function for writing a given PHY register
1295 return __mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, regnum, in __phy_write()
1300 * __phy_modify_changed() - Convenience function for modifying a PHY register
1314 return __mdiobus_modify_changed(phydev->mdio.bus, phydev->mdio.addr, in __phy_modify_changed()
1319 * phy_read_mmd - Convenience function for reading a register
1325 * phy_read_mmd_poll_timeout - Periodically poll a PHY register until a
1334 * tight-loops). Should be less than ~20ms since usleep_range
1335 * is used (see Documentation/timers/timers-howto.rst).
1338 * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
1358 * __phy_read_mmd - Convenience function for reading a register
1364 * phy_write_mmd - Convenience function for writing a register
1370 * __phy_write_mmd - Convenience function for writing a register
1392 * __phy_set_bits - Convenience function for setting bits in a PHY register
1405 * __phy_clear_bits - Convenience function for clearing bits in a PHY register
1419 * phy_set_bits - Convenience function for setting bits in a PHY register
1430 * phy_clear_bits - Convenience function for clearing bits in a PHY register
1441 * __phy_set_bits_mmd - Convenience function for setting bits in a register
1457 * __phy_clear_bits_mmd - Convenience function for clearing bits in a register
1473 * phy_set_bits_mmd - Convenience function for setting bits in a register
1487 * phy_clear_bits_mmd - Convenience function for clearing bits in a register
1501 * phy_interrupt_is_valid - Convenience function for testing a given PHY irq
1509 return phydev->irq != PHY_POLL && phydev->irq != PHY_MAC_INTERRUPT; in phy_interrupt_is_valid()
1513 * phy_polling_mode - Convenience function for testing whether polling is
1519 if (phydev->state == PHY_CABLETEST) in phy_polling_mode()
1520 if (phydev->drv->flags & PHY_POLL_CABLE_TEST) in phy_polling_mode()
1523 return phydev->irq == PHY_POLL; in phy_polling_mode()
1527 * phy_has_hwtstamp - Tests whether a PHY time stamp configuration.
1532 return phydev && phydev->mii_ts && phydev->mii_ts->hwtstamp; in phy_has_hwtstamp()
1536 * phy_has_rxtstamp - Tests whether a PHY supports receive time stamping.
1541 return phydev && phydev->mii_ts && phydev->mii_ts->rxtstamp; in phy_has_rxtstamp()
1545 * phy_has_tsinfo - Tests whether a PHY reports time stamping and/or
1551 return phydev && phydev->mii_ts && phydev->mii_ts->ts_info; in phy_has_tsinfo()
1555 * phy_has_txtstamp - Tests whether a PHY supports transmit time stamping.
1560 return phydev && phydev->mii_ts && phydev->mii_ts->txtstamp; in phy_has_txtstamp()
1565 return phydev->mii_ts->hwtstamp(phydev->mii_ts, ifr); in phy_hwtstamp()
1571 return phydev->mii_ts->rxtstamp(phydev->mii_ts, skb, type); in phy_rxtstamp()
1577 return phydev->mii_ts->ts_info(phydev->mii_ts, tsinfo); in phy_ts_info()
1583 phydev->mii_ts->txtstamp(phydev->mii_ts, skb, type); in phy_txtstamp()
1587 * phy_is_internal - Convenience function for testing if a PHY is internal
1592 return phydev->is_internal; in phy_is_internal()
1596 * phy_on_sfp - Convenience function for testing if a PHY is on an SFP module
1601 return phydev->is_on_sfp_module; in phy_on_sfp()
1605 * phy_interface_mode_is_rgmii - Convenience function for testing if a
1606 * PHY interface mode is RGMII (all variants)
1607 * @mode: the &phy_interface_t enum
1609 static inline bool phy_interface_mode_is_rgmii(phy_interface_t mode) in phy_interface_mode_is_rgmii() argument
1611 return mode >= PHY_INTERFACE_MODE_RGMII && in phy_interface_mode_is_rgmii()
1612 mode <= PHY_INTERFACE_MODE_RGMII_TXID; in phy_interface_mode_is_rgmii()
1616 * phy_interface_mode_is_8023z() - does the PHY interface mode use 802.3z
1618 * @mode: one of &enum phy_interface_t
1620 * Returns true if the PHY interface mode uses the 16-bit negotiation
1621 * word as defined in 802.3z. (See 802.3-2015 37.2.1 Config_Reg encoding)
1623 static inline bool phy_interface_mode_is_8023z(phy_interface_t mode) in phy_interface_mode_is_8023z() argument
1625 return mode == PHY_INTERFACE_MODE_1000BASEX || in phy_interface_mode_is_8023z()
1626 mode == PHY_INTERFACE_MODE_2500BASEX; in phy_interface_mode_is_8023z()
1630 * phy_interface_is_rgmii - Convenience function for testing if a PHY interface
1636 return phy_interface_mode_is_rgmii(phydev->interface); in phy_interface_is_rgmii()
1640 * phy_is_pseudo_fixed_link - Convenience function for testing if this
1646 return phydev->is_pseudo_fixed_link; in phy_is_pseudo_fixed_link()
1743 bool phy_check_valid(int speed, int duplex, unsigned long *features);
1760 return -EOPNOTSUPP; in phy_start_cable_test()
1768 return -EOPNOTSUPP; in phy_start_cable_test_tdr()
1774 mdio_device_reset(&phydev->mdio, value); in phy_device_reset()
1778 dev_err(&_phydev->mdio.dev, format, ##args)
1781 dev_err_probe(&_phydev->mdio.dev, err, format, ##args)
1784 dev_info(&_phydev->mdio.dev, format, ##args)
1787 dev_warn(&_phydev->mdio.dev, format, ##args)
1790 dev_dbg(&_phydev->mdio.dev, format, ##args)
1794 return dev_name(&phydev->mdio.dev); in phydev_name()
1799 mutex_lock(&phydev->mdio.bus->mdio_lock); in phy_lock_mdio_bus()
1804 mutex_unlock(&phydev->mdio.bus->mdio_lock); in phy_unlock_mdio_bus()
1897 if (!phydev->drv) in phy_read_status()
1898 return -EIO; in phy_read_status()
1900 if (phydev->drv->read_status) in phy_read_status()
1901 return phydev->drv->read_status(phydev); in phy_read_status()
2000 struct phy_package_shared *shared = phydev->shared; in phy_package_read()
2003 return -EIO; in phy_package_read()
2005 return mdiobus_read(phydev->mdio.bus, shared->addr, regnum); in phy_package_read()
2010 struct phy_package_shared *shared = phydev->shared; in __phy_package_read()
2013 return -EIO; in __phy_package_read()
2015 return __mdiobus_read(phydev->mdio.bus, shared->addr, regnum); in __phy_package_read()
2021 struct phy_package_shared *shared = phydev->shared; in phy_package_write()
2024 return -EIO; in phy_package_write()
2026 return mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val); in phy_package_write()
2032 struct phy_package_shared *shared = phydev->shared; in __phy_package_write()
2035 return -EIO; in __phy_package_write()
2037 return __mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val); in __phy_package_write()
2043 struct phy_package_shared *shared = phydev->shared; in __phy_package_set_once()
2048 return !test_and_set_bit(b, &shared->flags); in __phy_package_set_once()
2083 * phy_module_driver() - Helper macro for registering PHY drivers