drivers/net/sungem_phy.c
Source file repositories/reference/linux-study-clean/drivers/net/sungem_phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/sungem_phy.c- Extension
.c- Size
- 30661 bytes
- Lines
- 1202
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/types.hlinux/netdevice.hlinux/etherdevice.hlinux/mii.hlinux/ethtool.hlinux/delay.hlinux/of.hlinux/sungem_phy.h
Detected Declarations
function __sungem_phy_readfunction __sungem_phy_writefunction sungem_phy_readfunction sungem_phy_writefunction reset_one_mii_phyfunction bcm5201_initfunction bcm5201_suspendfunction bcm5221_initfunction bcm5221_suspendfunction bcm5241_initfunction bcm5241_suspendfunction bcm5400_initfunction bcm5400_suspendfunction bcm5401_initfunction bcm5401_suspendfunction bcm5411_initfunction genmii_setup_anegfunction genmii_setup_forcedfunction genmii_poll_linkfunction genmii_read_linkfunction generic_suspendfunction bcm5421_initfunction bcm54xx_setup_anegfunction bcm54xx_setup_forcedfunction bcm54xx_read_linkfunction marvell88e1111_initfunction bcm5421_poll_linkfunction bcm5421_read_linkfunction bcm5421_enable_fiberfunction bcm5461_poll_linkfunction bcm5461_read_linkfunction bcm5461_enable_fiberfunction marvell_setup_anegfunction marvell_setup_forcedfunction marvell_read_linkfunction sungem_phy_probeexport sungem_phy_probe
Annotated Snippet
if (can_low_power) {
/* Enable automatic low-power */
sungem_phy_write(phy, 0x1c, 0x9002);
sungem_phy_write(phy, 0x1c, 0xa821);
sungem_phy_write(phy, 0x1c, 0x941d);
}
}
#endif /* CONFIG_PPC_PMAC */
return 0;
}
static int bcm54xx_setup_aneg(struct mii_phy *phy, u32 advertise)
{
u16 ctl, adv;
phy->autoneg = 1;
phy->speed = SPEED_10;
phy->duplex = DUPLEX_HALF;
phy->pause = 0;
phy->advertising = advertise;
/* Setup standard advertise */
adv = sungem_phy_read(phy, MII_ADVERTISE);
adv &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
if (advertise & ADVERTISED_10baseT_Half)
adv |= ADVERTISE_10HALF;
if (advertise & ADVERTISED_10baseT_Full)
adv |= ADVERTISE_10FULL;
if (advertise & ADVERTISED_100baseT_Half)
adv |= ADVERTISE_100HALF;
if (advertise & ADVERTISED_100baseT_Full)
adv |= ADVERTISE_100FULL;
if (advertise & ADVERTISED_Pause)
adv |= ADVERTISE_PAUSE_CAP;
if (advertise & ADVERTISED_Asym_Pause)
adv |= ADVERTISE_PAUSE_ASYM;
sungem_phy_write(phy, MII_ADVERTISE, adv);
/* Setup 1000BT advertise */
adv = sungem_phy_read(phy, MII_1000BASETCONTROL);
adv &= ~(MII_1000BASETCONTROL_FULLDUPLEXCAP|MII_1000BASETCONTROL_HALFDUPLEXCAP);
if (advertise & SUPPORTED_1000baseT_Half)
adv |= MII_1000BASETCONTROL_HALFDUPLEXCAP;
if (advertise & SUPPORTED_1000baseT_Full)
adv |= MII_1000BASETCONTROL_FULLDUPLEXCAP;
sungem_phy_write(phy, MII_1000BASETCONTROL, adv);
/* Start/Restart aneg */
ctl = sungem_phy_read(phy, MII_BMCR);
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
sungem_phy_write(phy, MII_BMCR, ctl);
return 0;
}
static int bcm54xx_setup_forced(struct mii_phy *phy, int speed, int fd)
{
u16 ctl;
phy->autoneg = 0;
phy->speed = speed;
phy->duplex = fd;
phy->pause = 0;
ctl = sungem_phy_read(phy, MII_BMCR);
ctl &= ~(BMCR_FULLDPLX|BMCR_SPEED100|BMCR_SPD2|BMCR_ANENABLE);
/* First reset the PHY */
sungem_phy_write(phy, MII_BMCR, ctl | BMCR_RESET);
/* Select speed & duplex */
switch(speed) {
case SPEED_10:
break;
case SPEED_100:
ctl |= BMCR_SPEED100;
break;
case SPEED_1000:
ctl |= BMCR_SPD2;
}
if (fd == DUPLEX_FULL)
ctl |= BMCR_FULLDPLX;
// XXX Should we set the sungem to GII now on 1000BT ?
sungem_phy_write(phy, MII_BMCR, ctl);
return 0;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/mii.h`, `linux/ethtool.h`, `linux/delay.h`.
- Detected declarations: `function __sungem_phy_read`, `function __sungem_phy_write`, `function sungem_phy_read`, `function sungem_phy_write`, `function reset_one_mii_phy`, `function bcm5201_init`, `function bcm5201_suspend`, `function bcm5221_init`, `function bcm5221_suspend`, `function bcm5241_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
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.