drivers/net/phy/smsc.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/smsc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/smsc.c- Extension
.c- Size
- 22004 bytes
- Lines
- 901
- 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.
- 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
linux/clk.hlinux/kernel.hlinux/module.hlinux/mii.hlinux/ethtool.hlinux/of.hlinux/phy.hlinux/netdevice.hlinux/crc16.hlinux/etherdevice.hlinux/smscphy.h
Detected Declarations
struct smsc_hw_statstruct smsc_phy_privfunction smsc_phy_ack_interruptfunction smsc_phy_config_intrfunction smsc_phy_config_edpdfunction smsc_phy_handle_interruptfunction smsc_phy_config_initfunction smsc_phy_resetfunction lan87xx_config_anegfunction modefunction lan95xx_config_aneg_extfunction lan87xx_read_statusfunction lan87xx_phy_config_initfunction lan874x_phy_config_initfunction lan874x_get_wolfunction smsc_crc16function lan874x_chk_wol_patternfunction lan874x_set_wol_patternfunction lan874x_set_wolfunction smsc_get_sset_countfunction smsc_get_stringsfunction smsc_get_statfunction smsc_get_statsfunction smsc_phy_get_edpdfunction smsc_phy_set_edpdfunction smsc_phy_get_tunablefunction smsc_phy_set_tunablefunction smsc_phy_probeexport smsc_phy_config_intrexport smsc_phy_handle_interruptexport smsc_phy_config_initexport lan87xx_read_statusexport smsc_phy_get_tunableexport smsc_phy_set_tunableexport smsc_phy_probe
Annotated Snippet
struct smsc_hw_stat {
const char *string;
u8 reg;
u8 bits;
};
static struct smsc_hw_stat smsc_hw_stats[] = {
{ "phy_symbol_errors", 26, 16},
};
struct smsc_phy_priv {
unsigned int edpd_enable:1;
unsigned int edpd_mode_set_by_user:1;
unsigned int edpd_max_wait_ms;
bool wol_arp;
};
static int smsc_phy_ack_interrupt(struct phy_device *phydev)
{
int rc = phy_read(phydev, MII_LAN83C185_ISF);
return rc < 0 ? rc : 0;
}
int smsc_phy_config_intr(struct phy_device *phydev)
{
int rc;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
rc = smsc_phy_ack_interrupt(phydev);
if (rc)
return rc;
rc = phy_write(phydev, MII_LAN83C185_IM,
MII_LAN83C185_ISF_INT_PHYLIB_EVENTS);
} else {
rc = phy_write(phydev, MII_LAN83C185_IM, 0);
if (rc)
return rc;
rc = smsc_phy_ack_interrupt(phydev);
}
return rc < 0 ? rc : 0;
}
EXPORT_SYMBOL_GPL(smsc_phy_config_intr);
static int smsc_phy_config_edpd(struct phy_device *phydev)
{
struct smsc_phy_priv *priv = phydev->priv;
if (priv->edpd_enable)
return phy_set_bits(phydev, MII_LAN83C185_CTRL_STATUS,
MII_LAN83C185_EDPWRDOWN);
else
return phy_clear_bits(phydev, MII_LAN83C185_CTRL_STATUS,
MII_LAN83C185_EDPWRDOWN);
}
irqreturn_t smsc_phy_handle_interrupt(struct phy_device *phydev)
{
int irq_status;
irq_status = phy_read(phydev, MII_LAN83C185_ISF);
if (irq_status < 0) {
if (irq_status != -ENODEV)
phy_error(phydev);
return IRQ_NONE;
}
if (!(irq_status & MII_LAN83C185_ISF_INT_PHYLIB_EVENTS))
return IRQ_NONE;
phy_trigger_machine(phydev);
return IRQ_HANDLED;
}
EXPORT_SYMBOL_GPL(smsc_phy_handle_interrupt);
int smsc_phy_config_init(struct phy_device *phydev)
{
struct smsc_phy_priv *priv = phydev->priv;
if (!priv)
return 0;
/* don't use EDPD in irq mode except overridden by user */
if (!priv->edpd_mode_set_by_user && phydev->irq != PHY_POLL)
priv->edpd_enable = false;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/kernel.h`, `linux/module.h`, `linux/mii.h`, `linux/ethtool.h`, `linux/of.h`, `linux/phy.h`, `linux/netdevice.h`.
- Detected declarations: `struct smsc_hw_stat`, `struct smsc_phy_priv`, `function smsc_phy_ack_interrupt`, `function smsc_phy_config_intr`, `function smsc_phy_config_edpd`, `function smsc_phy_handle_interrupt`, `function smsc_phy_config_init`, `function smsc_phy_reset`, `function lan87xx_config_aneg`, `function mode`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.