drivers/net/ethernet/apm/xgene-v2/enet.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/apm/xgene-v2/enet.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/apm/xgene-v2/enet.c- Extension
.c- Size
- 1673 bytes
- Lines
- 72
- 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
main.h
Detected Declarations
function Copyrightfunction xge_rd_csrfunction xge_port_resetfunction xge_traffic_resumefunction xge_port_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Applied Micro X-Gene SoC Ethernet v2 Driver
*
* Copyright (c) 2017, Applied Micro Circuits Corporation
* Author(s): Iyappan Subramanian <isubramanian@apm.com>
* Keyur Chudgar <kchudgar@apm.com>
*/
#include "main.h"
void xge_wr_csr(struct xge_pdata *pdata, u32 offset, u32 val)
{
void __iomem *addr = pdata->resources.base_addr + offset;
iowrite32(val, addr);
}
u32 xge_rd_csr(struct xge_pdata *pdata, u32 offset)
{
void __iomem *addr = pdata->resources.base_addr + offset;
return ioread32(addr);
}
int xge_port_reset(struct net_device *ndev)
{
struct xge_pdata *pdata = netdev_priv(ndev);
struct device *dev = &pdata->pdev->dev;
u32 data, wait = 10;
xge_wr_csr(pdata, ENET_CLKEN, 0x3);
xge_wr_csr(pdata, ENET_SRST, 0xf);
xge_wr_csr(pdata, ENET_SRST, 0);
xge_wr_csr(pdata, CFG_MEM_RAM_SHUTDOWN, 1);
xge_wr_csr(pdata, CFG_MEM_RAM_SHUTDOWN, 0);
do {
usleep_range(100, 110);
data = xge_rd_csr(pdata, BLOCK_MEM_RDY);
} while (data != MEM_RDY && wait--);
if (data != MEM_RDY) {
dev_err(dev, "ECC init failed: %x\n", data);
return -ETIMEDOUT;
}
xge_wr_csr(pdata, ENET_SHIM, DEVM_ARAUX_COH | DEVM_AWAUX_COH);
return 0;
}
static void xge_traffic_resume(struct net_device *ndev)
{
struct xge_pdata *pdata = netdev_priv(ndev);
xge_wr_csr(pdata, CFG_FORCE_LINK_STATUS_EN, 1);
xge_wr_csr(pdata, FORCE_LINK_STATUS, 1);
xge_wr_csr(pdata, CFG_LINK_AGGR_RESUME, 1);
xge_wr_csr(pdata, RX_DV_GATE_REG, 1);
}
void xge_port_init(struct net_device *ndev)
{
struct xge_pdata *pdata = netdev_priv(ndev);
pdata->phy_speed = SPEED_1000;
xge_mac_init(pdata);
xge_traffic_resume(ndev);
}
Annotation
- Immediate include surface: `main.h`.
- Detected declarations: `function Copyright`, `function xge_rd_csr`, `function xge_port_reset`, `function xge_traffic_resume`, `function xge_port_init`.
- 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.