drivers/net/phy/bcm87xx.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/bcm87xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/bcm87xx.c- Extension
.c- Size
- 4954 bytes
- Lines
- 223
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/phy.hlinux/of.h
Detected Declarations
function bcm87xx_of_reg_initfunction bcm87xx_of_reg_initfunction bcm87xx_get_featuresfunction bcm87xx_config_initfunction bcm87xx_config_anegfunction bcm87xx_read_statusfunction bcm87xx_config_intrfunction bcm87xx_handle_interruptfunction bcm87xx_match_phy_device
Annotated Snippet
if (mask) {
val = phy_read_mmd(phydev, devid, reg);
if (val < 0) {
ret = val;
goto err;
}
val &= mask;
}
val |= val_bits;
ret = phy_write_mmd(phydev, devid, reg, val);
if (ret < 0)
goto err;
}
err:
return ret;
}
#else
static int bcm87xx_of_reg_init(struct phy_device *phydev)
{
return 0;
}
#endif /* CONFIG_OF_MDIO */
static int bcm87xx_get_features(struct phy_device *phydev)
{
linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseR_FEC_BIT,
phydev->supported);
return 0;
}
static int bcm87xx_config_init(struct phy_device *phydev)
{
return bcm87xx_of_reg_init(phydev);
}
static int bcm87xx_config_aneg(struct phy_device *phydev)
{
return -EINVAL;
}
static int bcm87xx_read_status(struct phy_device *phydev)
{
int rx_signal_detect;
int pcs_status;
int xgxs_lane_status;
rx_signal_detect = phy_read_mmd(phydev, MDIO_MMD_PMAPMD,
BCM87XX_PMD_RX_SIGNAL_DETECT);
if (rx_signal_detect < 0)
return rx_signal_detect;
if ((rx_signal_detect & 1) == 0)
goto no_link;
pcs_status = phy_read_mmd(phydev, MDIO_MMD_PCS,
BCM87XX_10GBASER_PCS_STATUS);
if (pcs_status < 0)
return pcs_status;
if ((pcs_status & 1) == 0)
goto no_link;
xgxs_lane_status = phy_read_mmd(phydev, MDIO_MMD_PHYXS,
BCM87XX_XGXS_LANE_STATUS);
if (xgxs_lane_status < 0)
return xgxs_lane_status;
if ((xgxs_lane_status & 0x1000) == 0)
goto no_link;
phydev->speed = 10000;
phydev->link = 1;
phydev->duplex = 1;
return 0;
no_link:
phydev->link = 0;
return 0;
}
static int bcm87xx_config_intr(struct phy_device *phydev)
{
int reg, err;
reg = phy_read_mmd(phydev, MDIO_MMD_PCS, BCM87XX_LASI_CONTROL);
if (reg < 0)
return reg;
Annotation
- Immediate include surface: `linux/module.h`, `linux/phy.h`, `linux/of.h`.
- Detected declarations: `function bcm87xx_of_reg_init`, `function bcm87xx_of_reg_init`, `function bcm87xx_get_features`, `function bcm87xx_config_init`, `function bcm87xx_config_aneg`, `function bcm87xx_read_status`, `function bcm87xx_config_intr`, `function bcm87xx_handle_interrupt`, `function bcm87xx_match_phy_device`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.