drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c- Extension
.c- Size
- 14078 bytes
- Lines
- 539
- 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/acpi.hlinux/clk.hlinux/err.hlinux/gpio/consumer.hlinux/io.hlinux/types.hlinux/workqueue.hxgene_enet_main.hxgene_enet_hw.hxgene_enet_xgmac.h
Detected Declarations
function Copyrightfunction xgene_enet_wr_ring_iffunction xgene_enet_wr_diag_csrfunction xgene_enet_wr_indirectfunction xgene_enet_wr_pcsfunction xgene_enet_wr_axg_csrfunction xgene_enet_rd_csrfunction xgene_enet_rd_diag_csrfunction xgene_enet_rd_indirectfunction xgene_enet_rd_pcsfunction xgene_enet_rd_axg_csrfunction xgene_enet_ecc_initfunction xgene_xgmac_get_drop_cntfunction xgene_enet_config_ring_if_assocfunction xgene_xgmac_resetfunction xgene_pcs_resetfunction xgene_xgmac_set_mac_addrfunction xgene_xgmac_set_mssfunction xgene_xgmac_set_frame_sizefunction xgene_enet_link_statusfunction xgene_xgmac_enable_tx_pausefunction xgene_xgmac_flowctl_txfunction xgene_xgmac_flowctl_rxfunction xgene_xgmac_initfunction xgene_xgmac_rx_enablefunction xgene_xgmac_tx_enablefunction xgene_xgmac_rx_disablefunction xgene_xgmac_tx_disablefunction xgene_enet_resetfunction xgene_enet_xgcle_bypassfunction xgene_enet_shutdownfunction xgene_enet_clearfunction xgene_enet_gpio_lookupfunction xgene_enet_link_state
Annotated Snippet
if (ACPI_FAILURE(status)) {
acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
"_INI", NULL, NULL);
}
#endif
}
xgene_enet_ecc_init(pdata);
xgene_enet_config_ring_if_assoc(pdata);
return 0;
}
static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata,
u32 dst_ring_num, u16 bufpool_id,
u16 nxtbufpool_id)
{
u32 cb, fpsel, nxtfpsel;
xgene_enet_rd_csr(pdata, XCLE_BYPASS_REG0_ADDR, &cb);
cb |= CFG_CLE_BYPASS_EN0;
CFG_CLE_IP_PROTOCOL0_SET(&cb, 3);
xgene_enet_wr_csr(pdata, XCLE_BYPASS_REG0_ADDR, cb);
fpsel = xgene_enet_get_fpsel(bufpool_id);
nxtfpsel = xgene_enet_get_fpsel(nxtbufpool_id);
xgene_enet_rd_csr(pdata, XCLE_BYPASS_REG1_ADDR, &cb);
CFG_CLE_DSTQID0_SET(&cb, dst_ring_num);
CFG_CLE_FPSEL0_SET(&cb, fpsel);
CFG_CLE_NXTFPSEL0_SET(&cb, nxtfpsel);
xgene_enet_wr_csr(pdata, XCLE_BYPASS_REG1_ADDR, cb);
pr_info("+ cle_bypass: fpsel: %d nxtfpsel: %d\n", fpsel, nxtfpsel);
}
static void xgene_enet_shutdown(struct xgene_enet_pdata *pdata)
{
struct device *dev = &pdata->pdev->dev;
if (dev->of_node) {
if (!IS_ERR(pdata->clk))
clk_disable_unprepare(pdata->clk);
}
}
static void xgene_enet_clear(struct xgene_enet_pdata *pdata,
struct xgene_enet_desc_ring *ring)
{
u32 addr, data;
if (xgene_enet_is_bufpool(ring->id)) {
addr = ENET_CFGSSQMIFPRESET_ADDR;
data = BIT(xgene_enet_get_fpsel(ring->id));
} else {
addr = ENET_CFGSSQMIWQRESET_ADDR;
data = BIT(xgene_enet_ring_bufnum(ring->id));
}
xgene_enet_wr_ring_if(pdata, addr, data);
}
static int xgene_enet_gpio_lookup(struct xgene_enet_pdata *pdata)
{
struct device *dev = &pdata->pdev->dev;
pdata->sfp_rdy = gpiod_get(dev, "rxlos", GPIOD_IN);
if (IS_ERR(pdata->sfp_rdy))
pdata->sfp_rdy = gpiod_get(dev, "sfp", GPIOD_IN);
if (IS_ERR(pdata->sfp_rdy))
return -ENODEV;
return 0;
}
static void xgene_enet_link_state(struct work_struct *work)
{
struct xgene_enet_pdata *pdata = container_of(to_delayed_work(work),
struct xgene_enet_pdata, link_work);
struct net_device *ndev = pdata->ndev;
u32 link_status, poll_interval;
link_status = xgene_enet_link_status(pdata);
if (pdata->sfp_gpio_en && link_status &&
(!IS_ERR(pdata->sfp_rdy) || !xgene_enet_gpio_lookup(pdata)) &&
!gpiod_get_value(pdata->sfp_rdy))
link_status = 0;
if (link_status) {
if (!netif_carrier_ok(ndev)) {
netif_carrier_on(ndev);
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/io.h`, `linux/types.h`, `linux/workqueue.h`, `xgene_enet_main.h`.
- Detected declarations: `function Copyright`, `function xgene_enet_wr_ring_if`, `function xgene_enet_wr_diag_csr`, `function xgene_enet_wr_indirect`, `function xgene_enet_wr_pcs`, `function xgene_enet_wr_axg_csr`, `function xgene_enet_rd_csr`, `function xgene_enet_rd_diag_csr`, `function xgene_enet_rd_indirect`, `function xgene_enet_rd_pcs`.
- 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.