/** *phy_modes-mapphy_interface_tenumtodevicetreebindingofphy-mode *@interface:enumphy_interface_tvalue * *Description:mapsenum&phy_interface_tdefinedinthisfile *intothedevicetreebindingof'phy-mode',sothatEthernet *devicedrivercangetPHYinterfacefromdevicetree.
*/ staticinlineconstchar *phy_modes(phy_interface_t interface)
{ switch (interface) { case PHY_INTERFACE_MODE_NA: return""; case PHY_INTERFACE_MODE_INTERNAL: return"internal"; case PHY_INTERFACE_MODE_MII: return"mii"; case PHY_INTERFACE_MODE_GMII: return"gmii"; case PHY_INTERFACE_MODE_SGMII: return"sgmii"; case PHY_INTERFACE_MODE_TBI: return"tbi"; case PHY_INTERFACE_MODE_REVMII: return"rev-mii"; case PHY_INTERFACE_MODE_RMII: return"rmii"; case PHY_INTERFACE_MODE_REVRMII: return"rev-rmii"; case PHY_INTERFACE_MODE_RGMII: return"rgmii"; case PHY_INTERFACE_MODE_RGMII_ID: return"rgmii-id"; case PHY_INTERFACE_MODE_RGMII_RXID: return"rgmii-rxid"; case PHY_INTERFACE_MODE_RGMII_TXID: return"rgmii-txid"; case PHY_INTERFACE_MODE_RTBI: return"rtbi"; case PHY_INTERFACE_MODE_SMII: return"smii"; case PHY_INTERFACE_MODE_XGMII: return"xgmii"; case PHY_INTERFACE_MODE_XLGMII: return"xlgmii"; case PHY_INTERFACE_MODE_MOCA: return"moca"; case PHY_INTERFACE_MODE_PSGMII: return"psgmii"; case PHY_INTERFACE_MODE_QSGMII: return"qsgmii"; case PHY_INTERFACE_MODE_TRGMII: return"trgmii"; case PHY_INTERFACE_MODE_1000BASEX: return"1000base-x"; case PHY_INTERFACE_MODE_1000BASEKX: return"1000base-kx"; case PHY_INTERFACE_MODE_2500BASEX: return"2500base-x"; case PHY_INTERFACE_MODE_5GBASER: return"5gbase-r"; case PHY_INTERFACE_MODE_RXAUI: return"rxaui"; case PHY_INTERFACE_MODE_XAUI: return"xaui"; case PHY_INTERFACE_MODE_10GBASER: return"10gbase-r"; case PHY_INTERFACE_MODE_25GBASER: return"25gbase-r"; case PHY_INTERFACE_MODE_USXGMII: return"usxgmii"; case PHY_INTERFACE_MODE_10GKR: return"10gbase-kr"; case PHY_INTERFACE_MODE_100BASEX: return"100base-x"; case PHY_INTERFACE_MODE_QUSGMII: return"qusgmii"; case PHY_INTERFACE_MODE_10G_QXGMII: return"10g-qxgmii"; case PHY_INTERFACE_MODE_50GBASER: return"50gbase-r"; case PHY_INTERFACE_MODE_LAUI: return"laui"; case PHY_INTERFACE_MODE_100GBASEP: return"100gbase-p"; case PHY_INTERFACE_MODE_MIILITE: return"mii-lite"; default: return"unknown";
}
}
/** *structmdio_bus_stats-StatisticscountersforMDIObusses *@transfers:Totalnumberoftransfers,i.e.@writes+@reads *@errors:NumberofMDIOtransfersthatreturnedanerror *@writes:Numberofwritetransfers *@reads:Numberofreadtransfers *@syncp:Synchronisationforincrementingstatistics
*/ struct mdio_bus_stats {
u64_stats_t transfers;
u64_stats_t errors;
u64_stats_t writes;
u64_stats_t reads; /* Must be last, add new statistics above */ struct u64_stats_sync syncp;
};
/** *structmii_bus-RepresentsanMDIObus * *@owner:Whoownsthisdevice *@name:UserfriendlynameforthisMDIOdevice,ordrivername *@id:Uniqueidentifierforthisbus,typicalfrombushierarchy *@priv:Driverprivatedata * *TheBusclassforPHYs.Deviceswhichprovideaccessto *PHYsshouldregisterusingthisstructure
*/ struct mii_bus { struct module *owner; constchar *name; char id[MII_BUS_ID_SIZE]; void *priv; /** @read: Perform a read transfer on the bus */ int (*read)(struct mii_bus *bus, int addr, int regnum); /** @write: Perform a write transfer on the bus */ int (*write)(struct mii_bus *bus, int addr, int regnum, u16 val); /** @read_c45: Perform a C45 read transfer on the bus */ int (*read_c45)(struct mii_bus *bus, int addr, int devnum, int regnum); /** @write_c45: Perform a C45 write transfer on the bus */ int (*write_c45)(struct mii_bus *bus, int addr, int devnum, int regnum, u16 val); /** @reset: Perform a reset of the bus */ int (*reset)(struct mii_bus *bus);
/** @stats: Statistic counters per device on the bus */ struct mdio_bus_stats stats[PHY_MAX_ADDR];
/** @parent: Parent device of this bus */ struct device *parent; /** @state: State of bus structure */ enum {
MDIOBUS_ALLOCATED = 1,
MDIOBUS_REGISTERED,
MDIOBUS_UNREGISTERED,
MDIOBUS_RELEASED,
} state;
/* *forcedspeed&duplex(noautoneg) *partnerspeed&duplex&pause(autoneg)
*/ int speed; int duplex; int port; int pause; int asym_pause;
u8 master_slave_get;
u8 master_slave_set;
u8 master_slave_state;
/* Union of PHY and Attached devices' supported link modes */ /* See ethtool.h for more info */
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported);
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising);
__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising); /* used with phy_speed_down */
__ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old); /* used for eee validation and configuration*/
__ETHTOOL_DECLARE_LINK_MODE_MASK(supported_eee);
__ETHTOOL_DECLARE_LINK_MODE_MASK(advertising_eee); /* Energy efficient ethernet modes which should be prohibited */
__ETHTOOL_DECLARE_LINK_MODE_MASK(eee_disabled_modes); bool enable_tx_lpi; bool eee_active; struct eee_config eee_cfg;
/* Host supported PHY interface types. Should be ignored if empty. */
DECLARE_PHY_INTERFACE_MASK(host_interfaces);
/* *InterruptnumberforthisPHY *-1meansnointerrupt
*/ int irq;
/* private data pointer */ /* For use by PHYs to maintain extra state */ void *priv;
#if IS_ENABLED(CONFIG_PHY_PACKAGE) /* shared data pointer */ /* For use by PHYs inside the same package that need a shared state. */ struct phy_package_shared *shared; #endif
/* PHY Power Management */ /** @suspend: Suspend the hardware, saving state if needed */ int (*suspend)(struct phy_device *phydev); /** @resume: Resume the hardware, restoring state if needed */ int (*resume)(struct phy_device *phydev);
/** *@config_aneg:Configurestheadvertisementandresets *autonegotiationifphydev->autonegison, *forcesthespeedtothecurrentsettingsinphydev *ifphydev->autonegisoff
*/ int (*config_aneg)(struct phy_device *phydev);
/** @aneg_done: Determines the auto negotiation result */ int (*aneg_done)(struct phy_device *phydev);
/** @read_status: Determines the negotiated speed and duplex */ int (*read_status)(struct phy_device *phydev);
/** *@config_intr:Enablesordisablesinterrupts. *Itshouldalsoclearanypendinginterruptspriortoenablingthe *IRQsandafterdisablingthem.
*/ int (*config_intr)(struct phy_device *phydev);
/** *@read_mmd:PHYspecificdriveroverrideforreadingaMMD *register.ThisfunctionisoptionalforPHYspecific *drivers.Whennotprovided,thedefaultMMDreadfunction *willbeusedbyphy_read_mmd(),whichwilluseeithera *directreadforClause45PHYsoranindirectreadfor *Clause22PHYs.devnumistheMMDdevicenumberwithinthe *PHYdevice,regnumistheregisterwithintheselectedMMD *device.
*/ int (*read_mmd)(struct phy_device *dev, int devnum, u16 regnum);
/** *@write_mmd:PHYspecificdriveroverrideforwritingaMMD *register.ThisfunctionisoptionalforPHYspecific *drivers.Whennotprovided,thedefaultMMDwritefunction *willbeusedbyphy_write_mmd(),whichwilluseeithera *directwriteforClause45PHYs,oranindirectwritefor *Clause22PHYs.devnumistheMMDdevicenumberwithinthe *PHYdevice,regnumistheregisterwithintheselectedMMD *device.valisthevaluetobewritten.
*/ int (*write_mmd)(struct phy_device *dev, int devnum, u16 regnum,
u16 val);
/** @read_page: Return the current PHY register page number */ int (*read_page)(struct phy_device *dev); /** @write_page: Set the current PHY register page number */ int (*write_page)(struct phy_device *dev, int page);
/** @get_sset_count: Number of statistic counters */ int (*get_sset_count)(struct phy_device *dev); /** @get_strings: Names of the statistic counters */ void (*get_strings)(struct phy_device *dev, u8 *data); /** @get_stats: Return the statistic counter values */ void (*get_stats)(struct phy_device *dev, struct ethtool_stats *stats, u64 *data);
/* Get and Set PHY tunables */ /** @get_tunable: Return the value of a tunable */ int (*get_tunable)(struct phy_device *dev, struct ethtool_tunable *tuna, void *data); /** @set_tunable: Set the value of a tunable */ int (*set_tunable)(struct phy_device *dev, struct ethtool_tunable *tuna, constvoid *data); /** *@set_loopback:SettheloopbackmodeofthePHY *enableselectsiftheloopbackmodeisenabledordisabled.Ifthe *loopbackmodeisenabled,thenthespeedoftheloopbackmodecanbe *requestedwiththespeedargument.Ifthespeedargumentiszero, *thenanyspeedcanbeselected.Ifthespeedargumentis>0,then *thisspeedshallbeselectedfortheloopbackmodeorEOPNOTSUPP *shallbereturnedifspeedselectionisnotsupported.
*/ int (*set_loopback)(struct phy_device *dev, bool enable, int speed); /** @get_sqi: Get the signal quality indication */ int (*get_sqi)(struct phy_device *dev); /** @get_sqi_max: Get the maximum signal quality indication */ int (*get_sqi_max)(struct phy_device *dev);
/* PLCA RS interface */ /** @get_plca_cfg: Return the current PLCA configuration */ int (*get_plca_cfg)(struct phy_device *dev, struct phy_plca_cfg *plca_cfg); /** @set_plca_cfg: Set the PLCA configuration */ int (*set_plca_cfg)(struct phy_device *dev, conststruct phy_plca_cfg *plca_cfg); /** @get_plca_status: Return the current PLCA status info */ int (*get_plca_status)(struct phy_device *dev, struct phy_plca_status *plca_st);
int phy_save_page(struct phy_device *phydev); int phy_select_page(struct phy_device *phydev, int page); int phy_restore_page(struct phy_device *phydev, int oldpage, int ret); int phy_read_paged(struct phy_device *phydev, int page, u32 regnum); int phy_write_paged(struct phy_device *phydev, int page, u32 regnum, u16 val); int phy_modify_paged_changed(struct phy_device *phydev, int page, u32 regnum,
u16 mask, u16 set); int phy_modify_paged(struct phy_device *phydev, int page, u32 regnum,
u16 mask, u16 set);
struct phy_device *phy_device_create(struct mii_bus *bus, int addr, u32 phy_id, bool is_c45, struct phy_c45_device_ids *c45_ids); int fwnode_get_phy_id(struct fwnode_handle *fwnode, u32 *phy_id); struct mdio_device *fwnode_mdio_find_device(struct fwnode_handle *fwnode); struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode); struct fwnode_handle *fwnode_get_phy_node(conststruct fwnode_handle *fwnode); struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45); int phy_device_register(struct phy_device *phy); void phy_device_free(struct phy_device *phydev); void phy_device_remove(struct phy_device *phydev); int phy_get_c45_ids(struct phy_device *phydev); int phy_init_hw(struct phy_device *phydev); int phy_suspend(struct phy_device *phydev); int phy_resume(struct phy_device *phydev); int __phy_resume(struct phy_device *phydev); int phy_loopback(struct phy_device *phydev, bool enable, int speed); int phy_sfp_connect_phy(void *upstream, struct phy_device *phy); void phy_sfp_disconnect_phy(void *upstream, struct phy_device *phy); void phy_sfp_attach(void *upstream, struct sfp_bus *bus); void phy_sfp_detach(void *upstream, struct sfp_bus *bus); int phy_sfp_probe(struct phy_device *phydev, conststruct sfp_upstream_ops *ops); struct phy_device *phy_attach(struct net_device *dev, constchar *bus_id,
phy_interface_t interface); struct phy_device *phy_find_first(struct mii_bus *bus); int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
u32 flags, phy_interface_t interface); int phy_connect_direct(struct net_device *dev, struct phy_device *phydev, void (*handler)(struct net_device *),
phy_interface_t interface); struct phy_device *phy_connect(struct net_device *dev, constchar *bus_id, void (*handler)(struct net_device *),
phy_interface_t interface); void phy_disconnect(struct phy_device *phydev); void phy_detach(struct phy_device *phydev); void phy_start(struct phy_device *phydev); void phy_stop(struct phy_device *phydev); int phy_config_aneg(struct phy_device *phydev); int _phy_start_aneg(struct phy_device *phydev); int phy_start_aneg(struct phy_device *phydev); int phy_aneg_done(struct phy_device *phydev); unsignedint phy_inband_caps(struct phy_device *phydev,
phy_interface_t interface); int phy_config_inband(struct phy_device *phydev, unsignedint modes); int phy_speed_down(struct phy_device *phydev, bool sync); int phy_speed_up(struct phy_device *phydev); bool phy_check_valid(int speed, int duplex, unsignedlong *features);
int phy_restart_aneg(struct phy_device *phydev); int phy_reset_after_clk_enable(struct phy_device *phydev);
#if IS_ENABLED(CONFIG_PHYLIB) int phy_start_cable_test(struct phy_device *phydev, struct netlink_ext_ack *extack); int phy_start_cable_test_tdr(struct phy_device *phydev, struct netlink_ext_ack *extack, conststruct phy_tdr_config *config); #else staticinline int phy_start_cable_test(struct phy_device *phydev, struct netlink_ext_ack *extack)
{
NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support"); return -EOPNOTSUPP;
} staticinline int phy_start_cable_test_tdr(struct phy_device *phydev, struct netlink_ext_ack *extack, conststruct phy_tdr_config *config)
{
NL_SET_ERR_MSG(extack, "Kernel not compiled with PHYLIB support"); return -EOPNOTSUPP;
} #endif
staticinlinevoid phy_device_reset(struct phy_device *phydev, int value)
{
mdio_device_reset(&phydev->mdio, value);
}
#define phydev_err(_phydev, format, args...) \
dev_err(&_phydev->mdio.dev, format, ##args)
#define phydev_err_probe(_phydev, err, format, args...) \
dev_err_probe(&_phydev->mdio.dev, err, format, ##args)
#define phydev_info(_phydev, format, args...) \
dev_info(&_phydev->mdio.dev, format, ##args)
#define phydev_warn(_phydev, format, args...) \
dev_warn(&_phydev->mdio.dev, format, ##args)
#define phydev_dbg(_phydev, format, args...) \
dev_dbg(&_phydev->mdio.dev, format, ##args)
int genphy_match_phy_device(struct phy_device *phydev, conststruct phy_driver *phydrv);
/* Clause 22 PHY */ int genphy_read_abilities(struct phy_device *phydev); int genphy_setup_forced(struct phy_device *phydev); int genphy_restart_aneg(struct phy_device *phydev); int genphy_check_and_restart_aneg(struct phy_device *phydev, bool restart); int __genphy_config_aneg(struct phy_device *phydev, bool changed); int genphy_aneg_done(struct phy_device *phydev); int genphy_update_link(struct phy_device *phydev); int genphy_read_lpa(struct phy_device *phydev); int genphy_read_status_fixed(struct phy_device *phydev); int genphy_read_status(struct phy_device *phydev); int genphy_read_master_slave(struct phy_device *phydev); int genphy_suspend(struct phy_device *phydev); int genphy_resume(struct phy_device *phydev); int genphy_loopback(struct phy_device *phydev, bool enable, int speed); int genphy_soft_reset(struct phy_device *phydev);
irqreturn_t genphy_handle_interrupt_no_ack(struct phy_device *phydev);
staticinlineint genphy_no_config_intr(struct phy_device *phydev)
{ return0;
} int genphy_read_mmd_unsupported(struct phy_device *phdev, int devad,
u16 regnum); int genphy_write_mmd_unsupported(struct phy_device *phdev, int devnum,
u16 regnum, u16 val);
/* Clause 37 */ int genphy_c37_config_aneg(struct phy_device *phydev); int genphy_c37_read_status(struct phy_device *phydev, bool *changed);
/* Clause 45 PHY */ int genphy_c45_restart_aneg(struct phy_device *phydev); int genphy_c45_check_and_restart_aneg(struct phy_device *phydev, bool restart); int genphy_c45_aneg_done(struct phy_device *phydev); int genphy_c45_read_link(struct phy_device *phydev); int genphy_c45_read_lpa(struct phy_device *phydev); int genphy_c45_read_pma(struct phy_device *phydev); int genphy_c45_pma_setup_forced(struct phy_device *phydev); int genphy_c45_pma_baset1_setup_master_slave(struct phy_device *phydev); int genphy_c45_an_config_aneg(struct phy_device *phydev); int genphy_c45_an_disable_aneg(struct phy_device *phydev); int genphy_c45_read_mdix(struct phy_device *phydev); int genphy_c45_pma_read_abilities(struct phy_device *phydev); int genphy_c45_pma_read_ext_abilities(struct phy_device *phydev); int genphy_c45_pma_baset1_read_abilities(struct phy_device *phydev); int genphy_c45_read_eee_abilities(struct phy_device *phydev); int genphy_c45_pma_baset1_read_master_slave(struct phy_device *phydev); int genphy_c45_read_status(struct phy_device *phydev); int genphy_c45_baset1_read_status(struct phy_device *phydev); int genphy_c45_config_aneg(struct phy_device *phydev); int genphy_c45_loopback(struct phy_device *phydev, bool enable, int speed); int genphy_c45_pma_resume(struct phy_device *phydev); int genphy_c45_pma_suspend(struct phy_device *phydev); int genphy_c45_fast_retrain(struct phy_device *phydev, bool enable); int genphy_c45_plca_get_cfg(struct phy_device *phydev, struct phy_plca_cfg *plca_cfg); int genphy_c45_plca_set_cfg(struct phy_device *phydev, conststruct phy_plca_cfg *plca_cfg); int genphy_c45_plca_get_status(struct phy_device *phydev, struct phy_plca_status *plca_st); int genphy_c45_eee_is_active(struct phy_device *phydev, unsignedlong *lp); int genphy_c45_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data); int genphy_c45_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data); int genphy_c45_an_config_eee_aneg(struct phy_device *phydev);
/* The gen10g_* functions are the old Clause 45 stub */ int gen10g_config_aneg(struct phy_device *phydev);
staticinlineint phy_read_status(struct phy_device *phydev)
{ if (!phydev->drv) return -EIO;
if (phydev->drv->read_status) return phydev->drv->read_status(phydev); else return genphy_read_status(phydev);
}
int phy_register_fixup_for_id(constchar *bus_id, int (*run)(struct phy_device *)); int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask, int (*run)(struct phy_device *));
int phy_unregister_fixup(constchar *bus_id, u32 phy_uid, u32 phy_uid_mask); int phy_unregister_fixup_for_id(constchar *bus_id); int phy_unregister_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask);
int phy_eee_tx_clock_stop_capable(struct phy_device *phydev); int phy_eee_rx_clock_stop(struct phy_device *phydev, bool clk_stop_enable); int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable); int phy_get_eee_err(struct phy_device *phydev); int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_keee *data); int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data); int phy_ethtool_set_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); void phy_ethtool_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol); int phy_ethtool_get_link_ksettings(struct net_device *ndev, struct ethtool_link_ksettings *cmd); int phy_ethtool_set_link_ksettings(struct net_device *ndev, conststruct ethtool_link_ksettings *cmd); int phy_ethtool_nway_reset(struct net_device *ndev);
int phy_ethtool_get_strings(struct phy_device *phydev, u8 *data); int phy_ethtool_get_sset_count(struct phy_device *phydev); int phy_ethtool_get_stats(struct phy_device *phydev, struct ethtool_stats *stats, u64 *data);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.