drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/samsung/sxgbe/sxgbe_mdio.c- Extension
.c- Size
- 7825 bytes
- Lines
- 309
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/mii.hlinux/netdevice.hlinux/platform_device.hlinux/phy.hlinux/slab.hlinux/sxgbe_platform.hsxgbe_common.hsxgbe_reg.h
Detected Declarations
function Copyrightfunction sxgbe_mdio_ctrl_datafunction sxgbe_mdio_c45function sxgbe_mdio_c22function sxgbe_mdio_access_c22function sxgbe_mdio_access_c45function sxgbe_mdio_read_c22function sxgbe_mdio_read_c45function sxgbe_mdio_write_c22function sxgbe_mdio_write_c45function sxgbe_mdio_registerfunction sxgbe_mdio_unregister
Annotated Snippet
if (phy) {
char irq_num[4];
char *irq_str;
/* If an IRQ was provided to be assigned after
* the bus probe, do it here.
*/
if ((mdio_data->irqs == NULL) &&
(mdio_data->probed_phy_irq > 0)) {
irqlist[phy_addr] = mdio_data->probed_phy_irq;
phy->irq = mdio_data->probed_phy_irq;
}
/* If we're going to bind the MAC to this PHY bus,
* and no PHY number was provided to the MAC,
* use the one probed here.
*/
if (priv->plat->phy_addr == -1)
priv->plat->phy_addr = phy_addr;
act = (priv->plat->phy_addr == phy_addr);
switch (phy->irq) {
case PHY_POLL:
irq_str = "POLL";
break;
case PHY_MAC_INTERRUPT:
irq_str = "MAC";
break;
default:
sprintf(irq_num, "%d", phy->irq);
irq_str = irq_num;
break;
}
netdev_info(ndev, "PHY ID %08x at %d IRQ %s (%s)%s\n",
phy->phy_id, phy_addr, irq_str,
phydev_name(phy), act ? " active" : "");
phy_found = true;
}
}
if (!phy_found) {
netdev_err(ndev, "PHY not found\n");
goto phyfound_err;
}
priv->mii = mdio_bus;
return 0;
phyfound_err:
err = -ENODEV;
mdiobus_unregister(mdio_bus);
mdiobus_err:
mdiobus_free(mdio_bus);
return err;
}
int sxgbe_mdio_unregister(struct net_device *ndev)
{
struct sxgbe_priv_data *priv = netdev_priv(ndev);
if (!priv->mii)
return 0;
mdiobus_unregister(priv->mii);
priv->mii->priv = NULL;
mdiobus_free(priv->mii);
priv->mii = NULL;
return 0;
}
Annotation
- Immediate include surface: `linux/io.h`, `linux/mii.h`, `linux/netdevice.h`, `linux/platform_device.h`, `linux/phy.h`, `linux/slab.h`, `linux/sxgbe_platform.h`, `sxgbe_common.h`.
- Detected declarations: `function Copyright`, `function sxgbe_mdio_ctrl_data`, `function sxgbe_mdio_c45`, `function sxgbe_mdio_c22`, `function sxgbe_mdio_access_c22`, `function sxgbe_mdio_access_c45`, `function sxgbe_mdio_read_c22`, `function sxgbe_mdio_read_c45`, `function sxgbe_mdio_write_c22`, `function sxgbe_mdio_write_c45`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.