drivers/net/ethernet/ti/am65-cpsw-nuss.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ti/am65-cpsw-nuss.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/ti/am65-cpsw-nuss.c- Extension
.c- Size
- 105594 bytes
- Lines
- 3825
- 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.
- 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/bpf_trace.hlinux/clk.hlinux/etherdevice.hlinux/if_vlan.hlinux/interrupt.hlinux/irqdomain.hlinux/kernel.hlinux/kmemleak.hlinux/module.hlinux/netdevice.hlinux/net_tstamp.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/of_device.hlinux/of_platform.hlinux/phylink.hlinux/phy/phy.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/rtnetlink.hlinux/mfd/syscon.hlinux/sys_soc.hlinux/dma/ti-cppi5.hlinux/dma/k3-udma-glue.hnet/page_pool/helpers.hnet/dsa.hnet/switchdev.hcpsw_ale.hcpsw_sl.ham65-cpsw-nuss.h
Detected Declarations
struct am65_cpsw_soc_pdatafunction Copyrightfunction am65_cpsw_port_set_dscp_mapfunction am65_cpsw_port_enable_dscp_mapfunction am65_cpsw_sl_ctl_resetfunction am65_cpsw_nuss_get_verfunction am65_cpsw_nuss_ndo_slave_add_vidfunction am65_cpsw_nuss_ndo_slave_kill_vidfunction am65_cpsw_slave_set_promiscfunction am65_cpsw_nuss_ndo_slave_set_rx_modefunction netdev_for_each_mc_addrfunction am65_cpsw_nuss_ndo_host_tx_timeoutfunction am65_cpsw_nuss_rx_pushfunction am65_cpsw_nuss_set_p0_ptypefunction am65_cpsw_destroy_rxqfunction am65_cpsw_destroy_rxqsfunction am65_cpsw_create_rxqfunction am65_cpsw_create_rxqsfunction am65_cpsw_destroy_txqfunction am65_cpsw_destroy_txqsfunction am65_cpsw_create_txqfunction am65_cpsw_create_txqsfunction am65_cpsw_nuss_desc_idxfunction am65_cpsw_nuss_set_buf_typefunction am65_cpsw_nuss_buf_typefunction am65_cpsw_put_pagefunction am65_cpsw_nuss_rx_cleanupfunction am65_cpsw_nuss_xmit_freefunction am65_cpsw_nuss_tx_cleanupfunction am65_cpsw_nuss_common_openfunction am65_cpsw_nuss_common_stopfunction am65_cpsw_nuss_ndo_slave_stopfunction cpsw_restore_vlansfunction am65_cpsw_nuss_ndo_slave_openfunction am65_cpsw_xdp_tx_framefunction am65_cpsw_run_xdpfunction am65_cpsw_nuss_rx_csumfunction am65_cpsw_nuss_rx_packetsfunction am65_cpsw_nuss_rx_timer_callbackfunction am65_cpsw_nuss_rx_pollfunction am65_cpsw_nuss_tx_wakefunction am65_cpsw_nuss_tx_compl_packetsfunction am65_cpsw_nuss_tx_timer_callbackfunction am65_cpsw_nuss_tx_pollfunction am65_cpsw_nuss_rx_irqfunction am65_cpsw_nuss_tx_irqfunction am65_cpsw_nuss_ndo_slave_xmitfunction am65_cpsw_nuss_ndo_slave_set_mac_address
Annotated Snippet
static const struct net_device_ops am65_cpsw_nuss_netdev_ops = {
.ndo_open = am65_cpsw_nuss_ndo_slave_open,
.ndo_stop = am65_cpsw_nuss_ndo_slave_stop,
.ndo_start_xmit = am65_cpsw_nuss_ndo_slave_xmit,
.ndo_set_rx_mode = am65_cpsw_nuss_ndo_slave_set_rx_mode,
.ndo_get_stats64 = am65_cpsw_nuss_ndo_get_stats,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = am65_cpsw_nuss_ndo_slave_set_mac_address,
.ndo_tx_timeout = am65_cpsw_nuss_ndo_host_tx_timeout,
.ndo_vlan_rx_add_vid = am65_cpsw_nuss_ndo_slave_add_vid,
.ndo_vlan_rx_kill_vid = am65_cpsw_nuss_ndo_slave_kill_vid,
.ndo_eth_ioctl = am65_cpsw_nuss_ndo_slave_ioctl,
.ndo_setup_tc = am65_cpsw_qos_ndo_setup_tc,
.ndo_set_tx_maxrate = am65_cpsw_qos_ndo_tx_p0_set_maxrate,
.ndo_bpf = am65_cpsw_ndo_bpf,
.ndo_xdp_xmit = am65_cpsw_ndo_xdp_xmit,
.ndo_hwtstamp_get = am65_cpsw_nuss_hwtstamp_get,
.ndo_hwtstamp_set = am65_cpsw_nuss_hwtstamp_set,
};
static void am65_cpsw_disable_phy(struct phy *phy)
{
phy_power_off(phy);
phy_exit(phy);
}
static int am65_cpsw_enable_phy(struct phy *phy)
{
int ret;
ret = phy_init(phy);
if (ret < 0)
return ret;
ret = phy_power_on(phy);
if (ret < 0) {
phy_exit(phy);
return ret;
}
return 0;
}
static void am65_cpsw_disable_serdes_phy(struct am65_cpsw_common *common)
{
struct am65_cpsw_port *port;
struct phy *phy;
int i;
for (i = 0; i < common->port_num; i++) {
port = &common->ports[i];
phy = port->slave.serdes_phy;
if (phy)
am65_cpsw_disable_phy(phy);
}
}
static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *port_np,
struct am65_cpsw_port *port)
{
const char *name = "serdes";
struct phy *phy;
int ret;
phy = devm_of_phy_optional_get(dev, port_np, name);
if (IS_ERR_OR_NULL(phy))
return PTR_ERR_OR_ZERO(phy);
/* Serdes PHY exists. Store it. */
port->slave.serdes_phy = phy;
ret = am65_cpsw_enable_phy(phy);
if (ret < 0)
goto err_phy;
return 0;
err_phy:
devm_phy_put(dev, phy);
return ret;
}
static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned int mode,
const struct phylink_link_state *state)
{
struct am65_cpsw_slave_data *slave = container_of(config, struct am65_cpsw_slave_data,
phylink_config);
struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave);
struct am65_cpsw_common *common = port->common;
Annotation
- Immediate include surface: `linux/bpf_trace.h`, `linux/clk.h`, `linux/etherdevice.h`, `linux/if_vlan.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `linux/kernel.h`, `linux/kmemleak.h`.
- Detected declarations: `struct am65_cpsw_soc_pdata`, `function Copyright`, `function am65_cpsw_port_set_dscp_map`, `function am65_cpsw_port_enable_dscp_map`, `function am65_cpsw_sl_ctl_reset`, `function am65_cpsw_nuss_get_ver`, `function am65_cpsw_nuss_ndo_slave_add_vid`, `function am65_cpsw_nuss_ndo_slave_kill_vid`, `function am65_cpsw_slave_set_promisc`, `function am65_cpsw_nuss_ndo_slave_set_rx_mode`.
- 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.