drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c- Extension
.c- Size
- 6342 bytes
- Lines
- 237
- 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.
- 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/device.hlinux/module.hlinux/of.hlinux/pcs-rzn1-miic.hlinux/platform_device.hlinux/reset.hlinux/types.hstmmac_platform.h
Detected Declarations
struct renesas_gbeth_of_datastruct renesas_gbethfunction renesas_gmac_pcs_initfunction renesas_gmac_pcs_exitfunction renesas_gbeth_initfunction renesas_gbeth_exitfunction renesas_gbeth_probe
Annotated Snippet
struct renesas_gbeth_of_data {
const char * const *clks;
u8 num_clks;
u32 stmmac_flags;
bool handle_reset;
bool set_clk_tx_rate;
bool has_pcs;
};
struct renesas_gbeth {
const struct renesas_gbeth_of_data *of_data;
struct plat_stmmacenet_data *plat_dat;
struct reset_control *rstc;
struct device *dev;
};
static const char *const renesas_gbeth_clks[] = {
"tx", "tx-180", "rx", "rx-180",
};
static const char *const renesas_gmac_clks[] = {
"tx",
};
static int renesas_gmac_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 renesas_gmac_pcs_exit(struct stmmac_priv *priv)
{
if (priv->hw->phylink_pcs)
miic_destroy(priv->hw->phylink_pcs);
}
static struct phylink_pcs *renesas_gmac_select_pcs(struct stmmac_priv *priv,
phy_interface_t interface)
{
return priv->hw->phylink_pcs;
}
static int renesas_gbeth_init(struct device *dev, void *priv)
{
struct plat_stmmacenet_data *plat_dat;
struct renesas_gbeth *gbeth = priv;
int ret;
plat_dat = gbeth->plat_dat;
ret = reset_control_deassert(gbeth->rstc);
if (ret) {
dev_err(gbeth->dev, "Reset deassert failed\n");
return ret;
}
ret = clk_bulk_prepare_enable(plat_dat->num_clks,
plat_dat->clks);
if (ret)
reset_control_assert(gbeth->rstc);
return ret;
}
static void renesas_gbeth_exit(struct device *dev, void *priv)
{
struct plat_stmmacenet_data *plat_dat;
struct renesas_gbeth *gbeth = priv;
int ret;
plat_dat = gbeth->plat_dat;
clk_bulk_disable_unprepare(plat_dat->num_clks, plat_dat->clks);
ret = reset_control_assert(gbeth->rstc);
if (ret)
dev_err(gbeth->dev, "Reset assert failed\n");
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/module.h`, `linux/of.h`, `linux/pcs-rzn1-miic.h`, `linux/platform_device.h`, `linux/reset.h`, `linux/types.h`.
- Detected declarations: `struct renesas_gbeth_of_data`, `struct renesas_gbeth`, `function renesas_gmac_pcs_init`, `function renesas_gmac_pcs_exit`, `function renesas_gbeth_init`, `function renesas_gbeth_exit`, `function renesas_gbeth_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.