drivers/net/ethernet/freescale/ucc_geth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/ucc_geth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/ucc_geth.c- Extension
.c- Size
- 109851 bytes
- Lines
- 3660
- 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/kernel.hlinux/init.hlinux/errno.hlinux/slab.hlinux/stddef.hlinux/module.hlinux/interrupt.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/spinlock.hlinux/mm.hlinux/dma-mapping.hlinux/mii.hlinux/phy.hlinux/phylink.hlinux/workqueue.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/of_mdio.hlinux/of_net.hlinux/platform_device.hlinux/rtnetlink.hlinux/uaccess.hasm/irq.hasm/io.hsoc/fsl/qe/immap_qe.hsoc/fsl/qe/qe.hsoc/fsl/qe/ucc.hsoc/fsl/qe/ucc_fast.hasm/machdep.h
Detected Declarations
function ucc_geth_thread_countfunction ucc_geth_tx_queuesfunction ucc_geth_rx_queuesfunction mem_dispfunction rx_bd_buffer_setfunction fill_init_enet_entriesfunction return_init_enet_entriesfunction dump_init_enet_entriesfunction put_enet_addr_containerfunction set_mac_addrfunction hw_clear_addr_in_paddrfunction hw_add_addr_in_hashfunction get_statisticsfunction dump_bdsfunction dump_regsfunction init_default_reg_valsfunction init_half_duplex_paramsfunction init_inter_frame_gap_paramsfunction init_flow_control_paramsfunction init_hw_statistics_gathering_modefunction init_firmware_statistics_gathering_modefunction init_mac_station_addr_regsfunction init_rx_parametersfunction init_max_rx_buff_lenfunction init_min_frame_lenfunction phy_interface_mode_is_reducedfunction ugeth_graceful_stop_txfunction ugeth_graceful_stop_rxfunction ugeth_restart_txfunction ugeth_restart_rxfunction ugeth_enablefunction ugeth_disablefunction ugeth_quiescefunction ugeth_activatefunction uec_configure_serdesfunction ugeth_mac_link_upfunction ugeth_mac_link_downfunction ugeth_mac_configfunction ugeth_dump_regsfunction ugeth_82xx_filtering_clear_all_addr_in_hashfunction ugeth_82xx_filtering_clear_addr_in_paddrfunction ucc_geth_free_rxfunction ucc_geth_free_txfunction ucc_geth_memcleanfunction ucc_geth_set_multifunction netdev_for_each_mc_addrfunction ucc_geth_stopfunction ucc_struct_init
Annotated Snippet
static const struct net_device_ops ucc_geth_netdev_ops = {
.ndo_open = ucc_geth_open,
.ndo_stop = ucc_geth_close,
.ndo_start_xmit = ucc_geth_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = ucc_geth_set_mac_addr,
.ndo_set_rx_mode = ucc_geth_set_multi,
.ndo_tx_timeout = ucc_geth_timeout,
.ndo_eth_ioctl = ucc_geth_ioctl,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = ucc_netpoll,
#endif
};
static int ucc_geth_parse_clock(struct device_node *np, const char *which,
enum qe_clock *out)
{
const char *sprop;
char buf[24];
snprintf(buf, sizeof(buf), "%s-clock-name", which);
sprop = of_get_property(np, buf, NULL);
if (sprop) {
*out = qe_clock_source(sprop);
} else {
u32 val;
snprintf(buf, sizeof(buf), "%s-clock", which);
if (of_property_read_u32(np, buf, &val)) {
/* If both *-clock-name and *-clock are missing,
* we want to tell people to use *-clock-name.
*/
pr_err("missing %s-clock-name property\n", buf);
return -EINVAL;
}
*out = val;
}
if (*out < QE_CLK_NONE || *out > QE_CLK24) {
pr_err("invalid %s property\n", buf);
return -EINVAL;
}
return 0;
}
static const struct phylink_mac_ops ugeth_mac_ops = {
.mac_link_up = ugeth_mac_link_up,
.mac_link_down = ugeth_mac_link_down,
.mac_config = ugeth_mac_config,
};
static int ucc_geth_probe(struct platform_device* ofdev)
{
struct device *device = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node;
struct net_device *dev = NULL;
struct ucc_geth_private *ugeth = NULL;
struct ucc_geth_info *ug_info;
struct device_node *phy_node;
struct phylink *phylink;
struct resource res;
int err, ucc_num;
const unsigned int *prop;
phy_interface_t phy_interface;
ugeth_vdbg("%s: IN", __func__);
prop = of_get_property(np, "cell-index", NULL);
if (!prop) {
prop = of_get_property(np, "device-id", NULL);
if (!prop)
return -ENODEV;
}
ucc_num = *prop - 1;
if ((ucc_num < 0) || (ucc_num > 7))
return -ENODEV;
ug_info = devm_kmemdup(&ofdev->dev, &ugeth_primary_info,
sizeof(*ug_info), GFP_KERNEL);
if (!ug_info)
return -ENOMEM;
ug_info->uf_info.ucc_num = ucc_num;
err = ucc_geth_parse_clock(np, "rx", &ug_info->uf_info.rx_clock);
if (err)
return err;
err = ucc_geth_parse_clock(np, "tx", &ug_info->uf_info.tx_clock);
if (err)
return err;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/errno.h`, `linux/slab.h`, `linux/stddef.h`, `linux/module.h`, `linux/interrupt.h`, `linux/netdevice.h`.
- Detected declarations: `function ucc_geth_thread_count`, `function ucc_geth_tx_queues`, `function ucc_geth_rx_queues`, `function mem_disp`, `function rx_bd_buffer_set`, `function fill_init_enet_entries`, `function return_init_enet_entries`, `function dump_init_enet_entries`, `function put_enet_addr_container`, `function set_mac_addr`.
- 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.