drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c- Extension
.c- Size
- 98546 bytes
- Lines
- 3766
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/device.hlinux/kmod.hlinux/mdio.hlinux/phy.hlinux/ethtool.hxgbe.hxgbe-common.h
Detected Declarations
struct xgbe_sfp_eepromstruct xgbe_sfp_asciistruct xgbe_phy_dataenum xgbe_port_modeenum xgbe_conn_typeenum xgbe_sfp_commenum xgbe_sfp_cableenum xgbe_sfp_baseenum xgbe_sfp_speedenum xgbe_mdio_resetenum xgbe_phy_redrv_ifenum xgbe_phy_redrv_modelenum xgbe_phy_redrv_modefunction xgbe_phy_i2c_xferfunction xgbe_phy_redrv_writefunction xgbe_phy_i2c_writefunction xgbe_phy_i2c_readfunction xgbe_phy_sfp_put_muxfunction xgbe_phy_sfp_get_muxfunction xgbe_phy_put_comm_ownershipfunction xgbe_phy_get_comm_ownershipfunction xgbe_phy_mdio_mii_write_c22function xgbe_phy_mdio_mii_write_c45function xgbe_phy_i2c_mii_writefunction xgbe_phy_mii_write_c22function xgbe_phy_mii_write_c45function xgbe_phy_mdio_mii_read_c22function xgbe_phy_mdio_mii_read_c45function xgbe_phy_i2c_mii_readfunction xgbe_phy_mii_read_c22function xgbe_phy_mii_read_c45function xgbe_phy_sfp_phy_settingsfunction xgbe_phy_sfp_bit_ratefunction xgbe_phy_free_phy_devicefunction xgbe_phy_finisar_phy_quirksfunction xgbe_phy_belfuse_phy_quirksfunction xgbe_phy_external_phy_quirksfunction xgbe_phy_find_phy_devicefunction xgbe_phy_sfp_external_phyfunction xgbe_phy_check_sfp_rx_losfunction xgbe_phy_check_sfp_tx_faultfunction xgbe_phy_check_sfp_mod_absentfunction xgbe_phy_sfp_parse_eepromfunction xgbe_phy_sfp_eeprom_infofunction xgbe_phy_sfp_verify_eepromfunction xgbe_phy_sfp_read_eepromfunction xgbe_phy_sfp_signalsfunction xgbe_phy_sfp_mod_absent
Annotated Snippet
struct xgbe_sfp_eeprom {
u8 base[64];
u8 extd[32];
u8 vendor[32];
};
#define XGBE_SFP_DIAGS_SUPPORTED(_x) \
((_x)->extd[XGBE_SFP_EXTD_SFF_8472] && \
!((_x)->extd[XGBE_SFP_EXTD_DIAG] & XGBE_SFP_EXTD_DIAG_ADDR_CHANGE))
#define XGBE_SFP_EEPROM_BASE_LEN 256
#define XGBE_SFP_EEPROM_DIAG_LEN 256
#define XGBE_SFP_EEPROM_MAX (XGBE_SFP_EEPROM_BASE_LEN + \
XGBE_SFP_EEPROM_DIAG_LEN)
#define XGBE_BEL_FUSE_VENDOR "BEL-FUSE "
#define XGBE_BEL_FUSE_PARTNO "1GBT-SFP06 "
#define XGBE_MOLEX_VENDOR "Molex Inc. "
struct xgbe_sfp_ascii {
union {
char vendor[XGBE_SFP_BASE_VENDOR_NAME_LEN + 1];
char partno[XGBE_SFP_BASE_VENDOR_PN_LEN + 1];
char rev[XGBE_SFP_BASE_VENDOR_REV_LEN + 1];
char serno[XGBE_SFP_BASE_VENDOR_SN_LEN + 1];
} u;
};
/* MDIO PHY reset types */
enum xgbe_mdio_reset {
XGBE_MDIO_RESET_NONE = 0,
XGBE_MDIO_RESET_I2C_GPIO,
XGBE_MDIO_RESET_INT_GPIO,
XGBE_MDIO_RESET_MAX,
};
/* Re-driver related definitions */
enum xgbe_phy_redrv_if {
XGBE_PHY_REDRV_IF_MDIO = 0,
XGBE_PHY_REDRV_IF_I2C,
XGBE_PHY_REDRV_IF_MAX,
};
enum xgbe_phy_redrv_model {
XGBE_PHY_REDRV_MODEL_4223 = 0,
XGBE_PHY_REDRV_MODEL_4227,
XGBE_PHY_REDRV_MODEL_MAX,
};
enum xgbe_phy_redrv_mode {
XGBE_PHY_REDRV_MODE_CX = 5,
XGBE_PHY_REDRV_MODE_SR = 9,
};
#define XGBE_PHY_REDRV_MODE_REG 0x12b0
/* PHY related configuration information */
struct xgbe_phy_data {
enum xgbe_port_mode port_mode;
unsigned int port_id;
unsigned int port_speeds;
enum xgbe_conn_type conn_type;
enum xgbe_mode cur_mode;
enum xgbe_mode start_mode;
unsigned int rrc_count;
unsigned int mdio_addr;
/* SFP Support */
enum xgbe_sfp_comm sfp_comm;
unsigned int sfp_mux_address;
unsigned int sfp_mux_channel;
unsigned int sfp_gpio_address;
unsigned int sfp_gpio_mask;
unsigned int sfp_gpio_inputs;
unsigned int sfp_gpio_rx_los;
unsigned int sfp_gpio_tx_fault;
unsigned int sfp_gpio_mod_absent;
unsigned int sfp_gpio_rate_select;
unsigned int sfp_rx_los;
unsigned int sfp_tx_fault;
unsigned int sfp_mod_absent;
Annotation
- Immediate include surface: `linux/module.h`, `linux/device.h`, `linux/kmod.h`, `linux/mdio.h`, `linux/phy.h`, `linux/ethtool.h`, `xgbe.h`, `xgbe-common.h`.
- Detected declarations: `struct xgbe_sfp_eeprom`, `struct xgbe_sfp_ascii`, `struct xgbe_phy_data`, `enum xgbe_port_mode`, `enum xgbe_conn_type`, `enum xgbe_sfp_comm`, `enum xgbe_sfp_cable`, `enum xgbe_sfp_base`, `enum xgbe_sfp_speed`, `enum xgbe_mdio_reset`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.