drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c- Extension
.c- Size
- 2166 bytes
- Lines
- 94
- 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/of.hlinux/pcs-rzn1-miic.hlinux/phylink.hlinux/platform_device.hstmmac_platform.hstmmac.h
Detected Declarations
function Copyrightfunction rzn1_dwmac_pcs_exitfunction rzn1_dwmac_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2024 Schneider-Electric
*
* Clément Léger <clement.leger@bootlin.com>
*/
#include <linux/of.h>
#include <linux/pcs-rzn1-miic.h>
#include <linux/phylink.h>
#include <linux/platform_device.h>
#include "stmmac_platform.h"
#include "stmmac.h"
static int rzn1_dwmac_pcs_init(struct stmmac_priv *priv)
{
struct device_node *np = priv->device->of_node;
struct device_node *pcs_node;
struct phylink_pcs *pcs;
pcs_node = of_parse_phandle(np, "pcs-handle", 0);
if (pcs_node) {
pcs = miic_create(priv->device, pcs_node);
of_node_put(pcs_node);
if (IS_ERR(pcs))
return PTR_ERR(pcs);
priv->hw->phylink_pcs = pcs;
}
return 0;
}
static void rzn1_dwmac_pcs_exit(struct stmmac_priv *priv)
{
if (priv->hw->phylink_pcs)
miic_destroy(priv->hw->phylink_pcs);
}
static struct phylink_pcs *rzn1_dwmac_select_pcs(struct stmmac_priv *priv,
phy_interface_t interface)
{
return priv->hw->phylink_pcs;
}
static int rzn1_dwmac_probe(struct platform_device *pdev)
{
struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res;
struct device *dev = &pdev->dev;
int ret;
ret = stmmac_get_platform_resources(pdev, &stmmac_res);
if (ret)
return ret;
plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
if (IS_ERR(plat_dat))
return PTR_ERR(plat_dat);
plat_dat->bsp_priv = plat_dat;
plat_dat->pcs_init = rzn1_dwmac_pcs_init;
plat_dat->pcs_exit = rzn1_dwmac_pcs_exit;
plat_dat->select_pcs = rzn1_dwmac_select_pcs;
ret = stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
if (ret)
return ret;
return 0;
}
static const struct of_device_id rzn1_dwmac_match[] = {
{ .compatible = "renesas,rzn1-gmac" },
{ }
};
MODULE_DEVICE_TABLE(of, rzn1_dwmac_match);
static struct platform_driver rzn1_dwmac_driver = {
.probe = rzn1_dwmac_probe,
.remove = stmmac_pltfr_remove,
.driver = {
.name = "rzn1-dwmac",
.of_match_table = rzn1_dwmac_match,
},
};
module_platform_driver(rzn1_dwmac_driver);
Annotation
- Immediate include surface: `linux/of.h`, `linux/pcs-rzn1-miic.h`, `linux/phylink.h`, `linux/platform_device.h`, `stmmac_platform.h`, `stmmac.h`.
- Detected declarations: `function Copyright`, `function rzn1_dwmac_pcs_exit`, `function rzn1_dwmac_probe`.
- 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.