drivers/net/ethernet/actions/owl-emac.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/actions/owl-emac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/actions/owl-emac.c- Extension
.c- Size
- 40571 bytes
- Lines
- 1613
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/circ_buf.hlinux/clk.hlinux/dma-mapping.hlinux/etherdevice.hlinux/of_mdio.hlinux/of_net.hlinux/platform_device.hlinux/pm.hlinux/reset.howl-emac.h
Detected Declarations
function Copyrightfunction owl_emac_reg_writefunction owl_emac_reg_updatefunction owl_emac_reg_setfunction owl_emac_reg_clearfunction owl_emac_irq_enablefunction owl_emac_irq_disablefunction owl_emac_irq_statusfunction owl_emac_irq_clearfunction owl_emac_dma_map_rxfunction owl_emac_dma_unmap_rxfunction owl_emac_dma_map_txfunction owl_emac_dma_unmap_txfunction owl_emac_ring_num_unusedfunction owl_emac_ring_get_nextfunction owl_emac_ring_push_headfunction owl_emac_ring_pop_tailfunction owl_emac_ring_prepare_rxfunction owl_emac_ring_prepare_txfunction owl_emac_ring_unprepare_rxfunction owl_emac_ring_unprepare_txfunction owl_emac_ring_allocfunction owl_emac_dma_cmd_resume_rxfunction owl_emac_dma_cmd_resume_txfunction owl_emac_dma_cmd_set_txfunction owl_emac_dma_cmd_start_txfunction owl_emac_dma_cmd_setfunction owl_emac_dma_cmd_startfunction owl_emac_dma_cmd_stopfunction owl_emac_set_hw_mac_addrfunction owl_emac_update_link_statefunction owl_emac_adjust_linkfunction owl_emac_handle_irqfunction owl_emac_ether_addr_pushfunction owl_emac_setup_frame_preparefunction addressesfunction owl_emac_ndo_start_xmitfunction owl_emac_tx_complete_tailfunction owl_emac_tx_completefunction owl_emac_rx_processfunction owl_emac_pollfunction owl_emac_mdio_clock_enablefunction owl_emac_core_hw_resetfunction owl_emac_core_sw_resetfunction owl_emac_enablefunction owl_emac_disablefunction owl_emac_ndo_openfunction owl_emac_ndo_stop
Annotated Snippet
static const struct net_device_ops owl_emac_netdev_ops = {
.ndo_open = owl_emac_ndo_open,
.ndo_stop = owl_emac_ndo_stop,
.ndo_start_xmit = owl_emac_ndo_start_xmit,
.ndo_set_rx_mode = owl_emac_ndo_set_rx_mode,
.ndo_set_mac_address = owl_emac_ndo_set_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_eth_ioctl = owl_emac_ndo_eth_ioctl,
.ndo_tx_timeout = owl_emac_ndo_tx_timeout,
.ndo_get_stats = owl_emac_ndo_get_stats,
};
static void owl_emac_ethtool_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
strscpy(info->driver, OWL_EMAC_DRVNAME, sizeof(info->driver));
}
static u32 owl_emac_ethtool_get_msglevel(struct net_device *netdev)
{
struct owl_emac_priv *priv = netdev_priv(netdev);
return priv->msg_enable;
}
static void owl_emac_ethtool_set_msglevel(struct net_device *ndev, u32 val)
{
struct owl_emac_priv *priv = netdev_priv(ndev);
priv->msg_enable = val;
}
static const struct ethtool_ops owl_emac_ethtool_ops = {
.get_drvinfo = owl_emac_ethtool_get_drvinfo,
.get_link = ethtool_op_get_link,
.get_link_ksettings = phy_ethtool_get_link_ksettings,
.set_link_ksettings = phy_ethtool_set_link_ksettings,
.get_msglevel = owl_emac_ethtool_get_msglevel,
.set_msglevel = owl_emac_ethtool_set_msglevel,
};
static int owl_emac_mdio_wait(struct owl_emac_priv *priv)
{
u32 val;
/* Wait while data transfer is in progress. */
return readl_poll_timeout(priv->base + OWL_EMAC_REG_MAC_CSR10,
val, !(val & OWL_EMAC_BIT_MAC_CSR10_SB),
OWL_EMAC_POLL_DELAY_USEC,
OWL_EMAC_MDIO_POLL_TIMEOUT_USEC);
}
static int owl_emac_mdio_read(struct mii_bus *bus, int addr, int regnum)
{
struct owl_emac_priv *priv = bus->priv;
u32 data, tmp;
int ret;
data = OWL_EMAC_BIT_MAC_CSR10_SB;
data |= OWL_EMAC_VAL_MAC_CSR10_OPCODE_RD << OWL_EMAC_OFF_MAC_CSR10_OPCODE;
tmp = addr << OWL_EMAC_OFF_MAC_CSR10_PHYADD;
data |= tmp & OWL_EMAC_MSK_MAC_CSR10_PHYADD;
tmp = regnum << OWL_EMAC_OFF_MAC_CSR10_REGADD;
data |= tmp & OWL_EMAC_MSK_MAC_CSR10_REGADD;
owl_emac_reg_write(priv, OWL_EMAC_REG_MAC_CSR10, data);
ret = owl_emac_mdio_wait(priv);
if (ret)
return ret;
data = owl_emac_reg_read(priv, OWL_EMAC_REG_MAC_CSR10);
data &= OWL_EMAC_MSK_MAC_CSR10_DATA;
return data;
}
static int
owl_emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)
{
struct owl_emac_priv *priv = bus->priv;
u32 data, tmp;
data = OWL_EMAC_BIT_MAC_CSR10_SB;
data |= OWL_EMAC_VAL_MAC_CSR10_OPCODE_WR << OWL_EMAC_OFF_MAC_CSR10_OPCODE;
tmp = addr << OWL_EMAC_OFF_MAC_CSR10_PHYADD;
data |= tmp & OWL_EMAC_MSK_MAC_CSR10_PHYADD;
Annotation
- Immediate include surface: `linux/circ_buf.h`, `linux/clk.h`, `linux/dma-mapping.h`, `linux/etherdevice.h`, `linux/of_mdio.h`, `linux/of_net.h`, `linux/platform_device.h`, `linux/pm.h`.
- Detected declarations: `function Copyright`, `function owl_emac_reg_write`, `function owl_emac_reg_update`, `function owl_emac_reg_set`, `function owl_emac_reg_clear`, `function owl_emac_irq_enable`, `function owl_emac_irq_disable`, `function owl_emac_irq_status`, `function owl_emac_irq_clear`, `function owl_emac_dma_map_rx`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.