drivers/net/ethernet/mscc/ocelot_vsc7514.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mscc/ocelot_vsc7514.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mscc/ocelot_vsc7514.c- Extension
.c- Size
- 10213 bytes
- Lines
- 433
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dsa/ocelot.hlinux/interrupt.hlinux/module.hlinux/of_net.hlinux/netdevice.hlinux/phylink.hlinux/of.hlinux/of_mdio.hlinux/platform_device.hlinux/mfd/syscon.hlinux/skbuff.hnet/switchdev.hsoc/mscc/ocelot.hsoc/mscc/ocelot_vcap.hsoc/mscc/vsc7514_regs.hocelot_fdma.hocelot.h
Detected Declarations
function Copyrightfunction ocelot_xtr_irq_handlerfunction ocelot_ptp_rdy_irq_handlerfunction mscc_ocelot_teardown_devlink_portsfunction mscc_ocelot_release_portsfunction mscc_ocelot_init_portsfunction for_each_available_child_of_nodefunction mscc_ocelot_probefunction mscc_ocelot_remove
Annotated Snippet
if (port < 0 || port >= ocelot->num_phys_ports) {
dev_err(ocelot->dev,
"invalid port number: %d >= %d\n", port,
ocelot->num_phys_ports);
continue;
}
snprintf(res_name, sizeof(res_name), "port%d", port);
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
res_name);
target = ocelot_regmap_init(ocelot, res);
if (IS_ERR(target)) {
err = PTR_ERR(target);
of_node_put(portnp);
goto out_teardown;
}
err = ocelot_port_devlink_init(ocelot, port,
DEVLINK_PORT_FLAVOUR_PHYSICAL);
if (err) {
of_node_put(portnp);
goto out_teardown;
}
err = ocelot_probe_port(ocelot, port, target, portnp);
if (err) {
ocelot_port_devlink_teardown(ocelot, port);
continue;
}
devlink_ports_registered |= BIT(port);
}
/* Initialize unused devlink ports at the end */
for (port = 0; port < ocelot->num_phys_ports; port++) {
if (devlink_ports_registered & BIT(port))
continue;
err = ocelot_port_devlink_init(ocelot, port,
DEVLINK_PORT_FLAVOUR_UNUSED);
if (err)
goto out_teardown;
devlink_ports_registered |= BIT(port);
}
return 0;
out_teardown:
/* Unregister the network interfaces */
mscc_ocelot_release_ports(ocelot);
/* Tear down devlink ports for the registered network interfaces */
for (port = 0; port < ocelot->num_phys_ports; port++) {
if (devlink_ports_registered & BIT(port))
ocelot_port_devlink_teardown(ocelot, port);
}
return err;
}
static int mscc_ocelot_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
int err, irq_xtr, irq_ptp_rdy;
struct device_node *ports;
struct devlink *devlink;
struct ocelot *ocelot;
struct regmap *hsio;
unsigned int i;
struct {
enum ocelot_target id;
char *name;
u8 optional:1;
} io_target[] = {
{ SYS, "sys" },
{ REW, "rew" },
{ QSYS, "qsys" },
{ ANA, "ana" },
{ QS, "qs" },
{ S0, "s0" },
{ S1, "s1" },
{ S2, "s2" },
{ PTP, "ptp", 1 },
{ FDMA, "fdma", 1 },
};
if (!np && !pdev->dev.platform_data)
return -ENODEV;
Annotation
- Immediate include surface: `linux/dsa/ocelot.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of_net.h`, `linux/netdevice.h`, `linux/phylink.h`, `linux/of.h`, `linux/of_mdio.h`.
- Detected declarations: `function Copyright`, `function ocelot_xtr_irq_handler`, `function ocelot_ptp_rdy_irq_handler`, `function mscc_ocelot_teardown_devlink_ports`, `function mscc_ocelot_release_ports`, `function mscc_ocelot_init_ports`, `function for_each_available_child_of_node`, `function mscc_ocelot_probe`, `function mscc_ocelot_remove`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.