drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c- Extension
.c- Size
- 29026 bytes
- Lines
- 1011
- 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.
- 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/device.hlinux/platform_device.hlinux/pm_runtime.hlinux/module.hlinux/io.hlinux/of.hlinux/of_net.hlinux/of_mdio.hstmmac.hstmmac_platform.h
Detected Declarations
function Copyrightfunction dwmac1000_validate_ucast_entriesfunction stmmac_mtl_setupfunction stmmac_of_get_mdiofunction for_each_child_of_nodefunction stmmac_mdio_setupfunction stmmac_of_get_mac_modefunction stmmac_probe_config_dtfunction of_device_is_compatiblefunction devm_stmmac_remove_config_dtfunction devm_stmmac_probe_config_dtfunction devm_stmmac_probe_config_dtfunction stmmac_pltfr_get_irq_arrayfunction stmmac_get_platform_resourcesfunction stmmac_pltfr_initfunction stmmac_pltfr_exitfunction stmmac_plat_suspendfunction stmmac_plat_resumefunction stmmac_pltfr_probefunction devm_stmmac_pltfr_removefunction stmmac_pltfr_removefunction stmmac_pltfr_removefunction stmmac_bus_clks_configfunction stmmac_runtime_suspendfunction stmmac_runtime_resumefunction stmmac_pltfr_noirq_suspendfunction stmmac_pltfr_noirq_resumeexport devm_stmmac_probe_config_dtexport stmmac_pltfr_find_clkexport stmmac_get_platform_resourcesexport stmmac_pltfr_probeexport devm_stmmac_pltfr_probeexport stmmac_pltfr_removeexport stmmac_pltfr_pm_ops
Annotated Snippet
if (of_property_read_bool(q_node, "snps,dcb-algorithm")) {
plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
} else if (of_property_read_bool(q_node,
"snps,avb-algorithm")) {
plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_AVB;
/* Credit Base Shaper parameters used by AVB */
if (of_property_read_u32(q_node, "snps,send_slope",
&plat->tx_queues_cfg[queue].send_slope))
plat->tx_queues_cfg[queue].send_slope = 0x0;
if (of_property_read_u32(q_node, "snps,idle_slope",
&plat->tx_queues_cfg[queue].idle_slope))
plat->tx_queues_cfg[queue].idle_slope = 0x0;
if (of_property_read_u32(q_node, "snps,high_credit",
&plat->tx_queues_cfg[queue].high_credit))
plat->tx_queues_cfg[queue].high_credit = 0x0;
if (of_property_read_u32(q_node, "snps,low_credit",
&plat->tx_queues_cfg[queue].low_credit))
plat->tx_queues_cfg[queue].low_credit = 0x0;
} else {
plat->tx_queues_cfg[queue].mode_to_use = MTL_QUEUE_DCB;
}
if (!of_property_read_u32(q_node, "snps,priority",
&plat->tx_queues_cfg[queue].prio))
plat->tx_queues_cfg[queue].use_prio = true;
plat->tx_queues_cfg[queue].coe_unsupported =
of_property_read_bool(q_node, "snps,coe-unsupported");
queue++;
}
if (queue != plat->tx_queues_to_use) {
ret = -EINVAL;
dev_err(&pdev->dev, "Not all TX queues were configured\n");
goto out;
}
out:
of_node_put(rx_node);
of_node_put(tx_node);
of_node_put(q_node);
return ret;
}
/**
* stmmac_of_get_mdio() - Gets the MDIO bus from the devicetree.
* @np: devicetree node
*
* The MDIO bus will be searched for in the following ways:
* 1. The compatible is "snps,dwc-qos-ethernet-4.10" && a "mdio" named
* child node exists
* 2. A child node with the "snps,dwmac-mdio" compatible is present
*
* Return: The MDIO node if present otherwise NULL
*/
static struct device_node *stmmac_of_get_mdio(struct device_node *np)
{
static const struct of_device_id need_mdio_ids[] = {
{ .compatible = "snps,dwc-qos-ethernet-4.10" },
{},
};
struct device_node *mdio_node = NULL;
if (of_match_node(need_mdio_ids, np)) {
mdio_node = of_get_child_by_name(np, "mdio");
} else {
/**
* If snps,dwmac-mdio is passed from DT, always register
* the MDIO
*/
for_each_child_of_node(np, mdio_node) {
if (of_device_is_compatible(mdio_node,
"snps,dwmac-mdio"))
break;
}
}
return mdio_node;
}
/**
* stmmac_mdio_setup() - Populate platform related MDIO structures.
* @plat: driver data platform structure
* @np: devicetree node
* @dev: device pointer
*
* This searches for MDIO information from the devicetree.
* If an MDIO node is found, it's assigned to plat->mdio_node and
Annotation
- Immediate include surface: `linux/device.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/module.h`, `linux/io.h`, `linux/of.h`, `linux/of_net.h`, `linux/of_mdio.h`.
- Detected declarations: `function Copyright`, `function dwmac1000_validate_ucast_entries`, `function stmmac_mtl_setup`, `function stmmac_of_get_mdio`, `function for_each_child_of_node`, `function stmmac_mdio_setup`, `function stmmac_of_get_mac_mode`, `function stmmac_probe_config_dt`, `function of_device_is_compatible`, `function devm_stmmac_remove_config_dt`.
- 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.