drivers/net/phy/broadcom.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/broadcom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/broadcom.c- Extension
.c- Size
- 48404 bytes
- Lines
- 1782
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
bcm-phy-lib.hlinux/delay.hlinux/module.hlinux/phy.hlinux/device.hlinux/brcmphy.hlinux/of.hlinux/interrupt.hlinux/irq.hlinux/gpio/consumer.h
Detected Declarations
struct bcm54xx_phy_privstruct bcm54616s_phy_privfunction bcm54xx_phy_can_wakeupfunction bcm54xx_config_clock_delayfunction bcm54210e_config_initfunction bcm54612e_config_initfunction bcm54616s_config_initfunction bcm50610_a0_workaroundfunction bcm54xx_phydsp_configfunction bcm54xx_adjust_rxrefclkfunction bcm54xx_ptp_stopfunction bcm54xx_ptp_config_initfunction bcm5481x_set_brrmodefunction bcm54811_config_initfunction bcm54xx_config_initfunction bcm54xx_iddq_setfunction bcm54xx_set_wakeup_irqfunction bcm54xx_suspendfunction bcm54xx_resumefunction bcm54810_read_mmdfunction bcm54810_write_mmdfunction bcm5481x_read_abilitiesfunction bcm5481x_config_delay_swapfunction bcm5481_config_anegfunction bcm54811_config_anegfunction bcm54616s_probefunction bcm54616s_config_anegfunction bcm54616s_read_statusfunction brcm_fet_config_initfunction brcm_fet_ack_interruptfunction brcm_fet_config_intrfunction brcm_fet_handle_interruptfunction brcm_fet_suspendfunction bcm5221_config_anegfunction bcm5221_read_statusfunction bcm54xx_phy_get_wolfunction bcm54xx_phy_set_wolfunction bcm54xx_phy_probefunction bcm54xx_get_statsfunction bcm54xx_link_change_notifyfunction lre_read_master_slavefunction lre_read_lpafunction lre_read_status_fixedfunction lre_update_linkfunction bcm54811_lre_read_statusfunction bcm54811_read_statusfunction bcm54xx_disable_autonomous_eee
Annotated Snippet
struct bcm54xx_phy_priv {
u64 *stats;
struct bcm_ptp_private *ptp;
int wake_irq;
bool wake_irq_enabled;
bool brr_mode;
};
/* Link modes for BCM58411 PHY */
static const int bcm54811_linkmodes[] = {
ETHTOOL_LINK_MODE_100baseT1_Full_BIT,
ETHTOOL_LINK_MODE_10baseT1BRR_Full_BIT,
ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
ETHTOOL_LINK_MODE_100baseT_Full_BIT,
ETHTOOL_LINK_MODE_100baseT_Half_BIT,
ETHTOOL_LINK_MODE_10baseT_Full_BIT,
ETHTOOL_LINK_MODE_10baseT_Half_BIT
};
/* Long-Distance Signaling (BroadR-Reach mode aneg) relevant linkmode bits */
static const int lds_br_bits[] = {
ETHTOOL_LINK_MODE_Autoneg_BIT,
ETHTOOL_LINK_MODE_Pause_BIT,
ETHTOOL_LINK_MODE_Asym_Pause_BIT,
ETHTOOL_LINK_MODE_10baseT1BRR_Full_BIT,
ETHTOOL_LINK_MODE_100baseT1_Full_BIT
};
static bool bcm54xx_phy_can_wakeup(struct phy_device *phydev)
{
struct bcm54xx_phy_priv *priv = phydev->priv;
return phy_interrupt_is_valid(phydev) || priv->wake_irq >= 0;
}
static int bcm54xx_config_clock_delay(struct phy_device *phydev)
{
int rc, val;
/* handling PHY's internal RX clock delay */
val = bcm54xx_auxctl_read(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC);
val |= MII_BCM54XX_AUXCTL_MISC_WREN;
if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
/* Disable RGMII RXC-RXD skew */
val &= ~MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
}
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
/* Enable RGMII RXC-RXD skew */
val |= MII_BCM54XX_AUXCTL_SHDWSEL_MISC_RGMII_SKEW_EN;
}
rc = bcm54xx_auxctl_write(phydev, MII_BCM54XX_AUXCTL_SHDWSEL_MISC,
val);
if (rc < 0)
return rc;
/* handling PHY's internal TX clock delay */
val = bcm_phy_read_shadow(phydev, BCM54810_SHD_CLK_CTL);
if (phydev->interface == PHY_INTERFACE_MODE_RGMII ||
phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
/* Disable internal TX clock delay */
val &= ~BCM54810_SHD_CLK_CTL_GTXCLK_EN;
}
if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
/* Enable internal TX clock delay */
val |= BCM54810_SHD_CLK_CTL_GTXCLK_EN;
}
rc = bcm_phy_write_shadow(phydev, BCM54810_SHD_CLK_CTL, val);
if (rc < 0)
return rc;
return 0;
}
static int bcm54210e_config_init(struct phy_device *phydev)
{
int val;
bcm54xx_config_clock_delay(phydev);
if (phydev->dev_flags & PHY_BRCM_EN_MASTER_MODE) {
val = phy_read(phydev, MII_CTRL1000);
val |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER;
phy_write(phydev, MII_CTRL1000, val);
}
Annotation
- Immediate include surface: `bcm-phy-lib.h`, `linux/delay.h`, `linux/module.h`, `linux/phy.h`, `linux/device.h`, `linux/brcmphy.h`, `linux/of.h`, `linux/interrupt.h`.
- Detected declarations: `struct bcm54xx_phy_priv`, `struct bcm54616s_phy_priv`, `function bcm54xx_phy_can_wakeup`, `function bcm54xx_config_clock_delay`, `function bcm54210e_config_init`, `function bcm54612e_config_init`, `function bcm54616s_config_init`, `function bcm50610_a0_workaround`, `function bcm54xx_phydsp_config`, `function bcm54xx_adjust_rxrefclk`.
- 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.
- 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.