drivers/net/phy/bcm7xxx.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/bcm7xxx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/bcm7xxx.c- Extension
.c- Size
- 27293 bytes
- Lines
- 977
- 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/phy.hlinux/delay.hbcm-phy-lib.hlinux/bitops.hlinux/brcmphy.hlinux/clk.hlinux/mdio.h
Detected Declarations
struct bcm7xxx_phy_privfunction bcm7xxx_28nm_d0_afe_config_initfunction bcm7xxx_28nm_e0_plus_afe_config_initfunction bcm7xxx_28nm_a0_patch_afe_config_initfunction bcm7xxx_28nm_config_initfunction bcm7xxx_28nm_resumefunction __phy_set_clr_bitsfunction phy_set_clr_bitsfunction bcm7xxx_28nm_ephy_01_afe_config_initfunction bcm7xxx_28nm_ephy_apd_enablefunction bcm7xxx_28nm_ephy_eee_enablefunction bcm7xxx_28nm_ephy_config_initfunction bcm7xxx_16nm_ephy_afe_configfunction bcm7xxx_16nm_ephy_config_initfunction bcm7xxx_16nm_ephy_resumefunction bcm7xxx_28nm_ephy_regnum_to_shdfunction bcm7xxx_28nm_ephy_dev_validfunction bcm7xxx_28nm_ephy_read_mmdfunction bcm7xxx_28nm_ephy_write_mmdfunction bcm7xxx_28nm_ephy_resumefunction bcm7xxx_config_initfunction bcm7xxx_suspendfunction bcm7xxx_28nm_get_tunablefunction bcm7xxx_28nm_set_tunablefunction bcm7xxx_28nm_get_phy_statsfunction bcm7xxx_28nm_suspendfunction bcm7xxx_28nm_probe
Annotated Snippet
struct bcm7xxx_phy_priv {
u64 *stats;
};
static int bcm7xxx_28nm_d0_afe_config_init(struct phy_device *phydev)
{
/* AFE_RXCONFIG_0 */
bcm_phy_write_misc(phydev, AFE_RXCONFIG_0, 0xeb15);
/* AFE_RXCONFIG_1 */
bcm_phy_write_misc(phydev, AFE_RXCONFIG_1, 0x9b2f);
/* AFE_RXCONFIG_2, set rCal offset for HT=0 code and LT=-2 code */
bcm_phy_write_misc(phydev, AFE_RXCONFIG_2, 0x2003);
/* AFE_RX_LP_COUNTER, set RX bandwidth to maximum */
bcm_phy_write_misc(phydev, AFE_RX_LP_COUNTER, 0x7fc0);
/* AFE_TX_CONFIG, set 100BT Cfeed=011 to improve rise/fall time */
bcm_phy_write_misc(phydev, AFE_TX_CONFIG, 0x431);
/* AFE_VDCA_ICTRL_0, set Iq=1101 instead of 0111 for AB symmetry */
bcm_phy_write_misc(phydev, AFE_VDCA_ICTRL_0, 0xa7da);
/* AFE_VDAC_OTHERS_0, set 1000BT Cidac=010 for all ports */
bcm_phy_write_misc(phydev, AFE_VDAC_OTHERS_0, 0xa020);
/* AFE_HPF_TRIM_OTHERS, set 100Tx/10BT to -4.5% swing and set rCal
* offset for HT=0 code
*/
bcm_phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x00e3);
/* CORE_BASE1E, force trim to overwrite and set I_ext trim to 0000 */
phy_write(phydev, MII_BRCM_CORE_BASE1E, 0x0010);
/* DSP_TAP10, adjust bias current trim (+0% swing, +0 tick) */
bcm_phy_write_misc(phydev, DSP_TAP10, 0x011b);
/* Reset R_CAL/RC_CAL engine */
bcm_phy_r_rc_cal_reset(phydev);
return 0;
}
static int bcm7xxx_28nm_e0_plus_afe_config_init(struct phy_device *phydev)
{
/* AFE_RXCONFIG_1, provide more margin for INL/DNL measurement */
bcm_phy_write_misc(phydev, AFE_RXCONFIG_1, 0x9b2f);
/* AFE_TX_CONFIG, set 100BT Cfeed=011 to improve rise/fall time */
bcm_phy_write_misc(phydev, AFE_TX_CONFIG, 0x431);
/* AFE_VDCA_ICTRL_0, set Iq=1101 instead of 0111 for AB symmetry */
bcm_phy_write_misc(phydev, AFE_VDCA_ICTRL_0, 0xa7da);
/* AFE_HPF_TRIM_OTHERS, set 100Tx/10BT to -4.5% swing and set rCal
* offset for HT=0 code
*/
bcm_phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x00e3);
/* CORE_BASE1E, force trim to overwrite and set I_ext trim to 0000 */
phy_write(phydev, MII_BRCM_CORE_BASE1E, 0x0010);
/* DSP_TAP10, adjust bias current trim (+0% swing, +0 tick) */
bcm_phy_write_misc(phydev, DSP_TAP10, 0x011b);
/* Reset R_CAL/RC_CAL engine */
bcm_phy_r_rc_cal_reset(phydev);
return 0;
}
static int bcm7xxx_28nm_a0_patch_afe_config_init(struct phy_device *phydev)
{
/* +1 RC_CAL codes for RL centering for both LT and HT conditions */
bcm_phy_write_misc(phydev, AFE_RXCONFIG_2, 0xd003);
/* Cut master bias current by 2% to compensate for RC_CAL offset */
bcm_phy_write_misc(phydev, DSP_TAP10, 0x791b);
/* Improve hybrid leakage */
bcm_phy_write_misc(phydev, AFE_HPF_TRIM_OTHERS, 0x10e3);
/* Change rx_on_tune 8 to 0xf */
bcm_phy_write_misc(phydev, 0x21, 0x2, 0x87f6);
/* Change 100Tx EEE bandwidth */
bcm_phy_write_misc(phydev, 0x22, 0x2, 0x017d);
/* Enable ffe zero detection for Vitesse interoperability */
Annotation
- Immediate include surface: `linux/module.h`, `linux/phy.h`, `linux/delay.h`, `bcm-phy-lib.h`, `linux/bitops.h`, `linux/brcmphy.h`, `linux/clk.h`, `linux/mdio.h`.
- Detected declarations: `struct bcm7xxx_phy_priv`, `function bcm7xxx_28nm_d0_afe_config_init`, `function bcm7xxx_28nm_e0_plus_afe_config_init`, `function bcm7xxx_28nm_a0_patch_afe_config_init`, `function bcm7xxx_28nm_config_init`, `function bcm7xxx_28nm_resume`, `function __phy_set_clr_bits`, `function phy_set_clr_bits`, `function bcm7xxx_28nm_ephy_01_afe_config_init`, `function bcm7xxx_28nm_ephy_apd_enable`.
- 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.