drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c- Extension
.c- Size
- 33321 bytes
- Lines
- 1244
- 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/etherdevice.hlinux/genalloc.hlinux/kernel.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_mdio.hlinux/of_net.hlinux/platform_device.hlinux/property.hlinux/phy.hlinux/remoteproc/pruss.hlinux/pruss_driver.hicssg_prueth.hicssg_mii_rt.h../k3-cppi-desc-pool.h
Detected Declarations
function icssg_config_sr1function emac_send_command_sr1function icssg_config_set_speed_sr1function emac_adjust_link_sr1function emac_phy_connectfunction prueth_tx_ts_sr1function prueth_rx_mgm_ts_thread_sr1function prueth_rx_mgm_rsp_threadfunction prueth_emac_startfunction prueth_emac_stopfunction emac_ndo_openfunction emac_ndo_stopfunction emac_ndo_set_rx_mode_sr1function prueth_netdev_initfunction prueth_probefunction for_each_child_of_nodefunction prueth_remove
Annotated Snippet
static const struct net_device_ops emac_netdev_ops = {
.ndo_open = emac_ndo_open,
.ndo_stop = emac_ndo_stop,
.ndo_start_xmit = icssg_ndo_start_xmit,
.ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr,
.ndo_tx_timeout = icssg_ndo_tx_timeout,
.ndo_set_rx_mode = emac_ndo_set_rx_mode_sr1,
.ndo_eth_ioctl = phy_do_ioctl,
.ndo_get_stats64 = icssg_ndo_get_stats64,
.ndo_get_phys_port_name = icssg_ndo_get_phys_port_name,
.ndo_hwtstamp_get = icssg_ndo_get_ts_config,
.ndo_hwtstamp_set = icssg_ndo_set_ts_config,
};
static int prueth_netdev_init(struct prueth *prueth,
struct device_node *eth_node)
{
struct prueth_emac *emac;
struct net_device *ndev;
enum prueth_port port;
enum prueth_mac mac;
/* Only enable one TX channel due to timeouts when
* using multiple channels */
int num_tx_chn = 1;
int ret;
port = prueth_node_port(eth_node);
if (port == PRUETH_PORT_INVALID)
return -EINVAL;
mac = prueth_node_mac(eth_node);
if (mac == PRUETH_MAC_INVALID)
return -EINVAL;
ndev = alloc_etherdev_mq(sizeof(*emac), num_tx_chn);
if (!ndev)
return -ENOMEM;
emac = netdev_priv(ndev);
emac->is_sr1 = 1;
emac->prueth = prueth;
emac->ndev = ndev;
emac->port_id = port;
INIT_DELAYED_WORK(&emac->stats_work, icssg_stats_work_handler);
ret = pruss_request_mem_region(prueth->pruss,
port == PRUETH_PORT_MII0 ?
PRUSS_MEM_DRAM0 : PRUSS_MEM_DRAM1,
&emac->dram);
if (ret) {
dev_err(prueth->dev, "unable to get DRAM: %d\n", ret);
ret = -ENOMEM;
goto free_ndev;
}
/* SR1.0 uses a dedicated high priority channel
* to send commands to the firmware
*/
emac->tx_ch_num = 2;
SET_NETDEV_DEV(ndev, prueth->dev);
spin_lock_init(&emac->lock);
mutex_init(&emac->cmd_lock);
emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0);
if (!emac->phy_node && !of_phy_is_fixed_link(eth_node)) {
dev_err(prueth->dev, "couldn't find phy-handle\n");
ret = -ENODEV;
goto free;
} else if (of_phy_is_fixed_link(eth_node)) {
ret = of_phy_register_fixed_link(eth_node);
if (ret) {
dev_err_probe(prueth->dev, ret, "failed to register fixed-link phy\n");
goto free;
}
emac->phy_node = eth_node;
}
ret = of_get_phy_mode(eth_node, &emac->phy_if);
if (ret) {
dev_err(prueth->dev, "could not get phy-mode property\n");
goto free;
}
if (emac->phy_if != PHY_INTERFACE_MODE_MII &&
!phy_interface_mode_is_rgmii(emac->phy_if)) {
dev_err(prueth->dev, "PHY mode unsupported %s\n", phy_modes(emac->phy_if));
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/genalloc.h`, `linux/kernel.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/of_mdio.h`, `linux/of_net.h`.
- Detected declarations: `function icssg_config_sr1`, `function emac_send_command_sr1`, `function icssg_config_set_speed_sr1`, `function emac_adjust_link_sr1`, `function emac_phy_connect`, `function prueth_tx_ts_sr1`, `function prueth_rx_mgm_ts_thread_sr1`, `function prueth_rx_mgm_rsp_thread`, `function prueth_emac_start`, `function prueth_emac_stop`.
- 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.