drivers/net/ethernet/renesas/sh_eth.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/renesas/sh_eth.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/renesas/sh_eth.c- Extension
.c- Size
- 88429 bytes
- Lines
- 3561
- 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/module.hlinux/kernel.hlinux/spinlock.hlinux/interrupt.hlinux/dma-mapping.hlinux/etherdevice.hlinux/delay.hlinux/platform_device.hlinux/mdio-bitbang.hlinux/netdevice.hlinux/of.hlinux/of_net.hlinux/phy.hlinux/cache.hlinux/io.hlinux/pm_runtime.hlinux/slab.hlinux/ethtool.hlinux/if_vlan.hlinux/sh_eth.hlinux/of_mdio.hsh_eth.h
Detected Declarations
struct bb_infofunction sh_eth_writefunction sh_eth_readfunction sh_eth_modifyfunction sh_eth_tsu_get_offsetfunction sh_eth_tsu_writefunction sh_eth_tsu_readfunction sh_eth_soft_swapfunction sh_eth_select_miifunction sh_eth_set_duplexfunction sh_eth_chip_resetfunction sh_eth_soft_resetfunction sh_eth_check_soft_resetfunction sh_eth_soft_reset_getherfunction sh_eth_set_rate_getherfunction sh_eth_chip_reset_r8a7740function sh_eth_set_rate_rcarfunction sh_eth_set_rate_sh7724function sh_eth_set_rate_sh7757function sh_eth_chip_reset_gigafunction sh_eth_set_rate_gigafunction sh_eth_set_default_cpu_datafunction sh_eth_set_receive_alignfunction update_mac_addressfunction bootloaderfunction sh_mdio_ctrlfunction sh_mmd_ctrlfunction sh_set_mdiofunction sh_get_mdiofunction sh_mdc_ctrlfunction sh_eth_tx_freefunction sh_eth_ring_freefunction sh_eth_ring_formatfunction sh_eth_ring_initfunction sh_eth_dev_initfunction sh_eth_dev_exitfunction sh_eth_rx_csumfunction sh_eth_rxfunction sh_eth_rcv_snd_disablefunction sh_eth_rcv_snd_enablefunction sh_eth_emac_interruptfunction sh_eth_errorfunction sh_eth_interruptfunction sh_eth_pollfunction sh_eth_adjust_linkfunction sh_eth_phy_initfunction sh_eth_phy_startfunction __sh_eth_get_regs
Annotated Snippet
static const struct net_device_ops sh_eth_netdev_ops = {
.ndo_open = sh_eth_open,
.ndo_stop = sh_eth_close,
.ndo_start_xmit = sh_eth_start_xmit,
.ndo_get_stats = sh_eth_get_stats,
.ndo_set_rx_mode = sh_eth_set_rx_mode,
.ndo_tx_timeout = sh_eth_tx_timeout,
.ndo_eth_ioctl = phy_do_ioctl_running,
.ndo_change_mtu = sh_eth_change_mtu,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
.ndo_set_features = sh_eth_set_features,
};
static const struct net_device_ops sh_eth_netdev_ops_tsu = {
.ndo_open = sh_eth_open,
.ndo_stop = sh_eth_close,
.ndo_start_xmit = sh_eth_start_xmit,
.ndo_get_stats = sh_eth_get_stats,
.ndo_set_rx_mode = sh_eth_set_rx_mode,
.ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid,
.ndo_tx_timeout = sh_eth_tx_timeout,
.ndo_eth_ioctl = phy_do_ioctl_running,
.ndo_change_mtu = sh_eth_change_mtu,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
.ndo_set_features = sh_eth_set_features,
};
#ifdef CONFIG_OF
static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
{
struct device_node *np = dev->of_node;
struct sh_eth_plat_data *pdata;
phy_interface_t interface;
int ret;
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return NULL;
ret = of_get_phy_mode(np, &interface);
if (ret)
return NULL;
pdata->phy_interface = interface;
of_get_mac_address(np, pdata->mac_addr);
pdata->no_ether_link =
of_property_read_bool(np, "renesas,no-ether-link");
pdata->ether_link_active_low =
of_property_read_bool(np, "renesas,ether-link-active-low");
return pdata;
}
static const struct of_device_id sh_eth_match_table[] = {
{ .compatible = "renesas,gether-r8a7740", .data = &r8a7740_data },
{ .compatible = "renesas,ether-r8a7743", .data = &rcar_gen2_data },
{ .compatible = "renesas,ether-r8a7745", .data = &rcar_gen2_data },
{ .compatible = "renesas,ether-r8a7778", .data = &rcar_gen1_data },
{ .compatible = "renesas,ether-r8a7779", .data = &rcar_gen1_data },
{ .compatible = "renesas,ether-r8a7790", .data = &rcar_gen2_data },
{ .compatible = "renesas,ether-r8a7791", .data = &rcar_gen2_data },
{ .compatible = "renesas,ether-r8a7793", .data = &rcar_gen2_data },
{ .compatible = "renesas,ether-r8a7794", .data = &rcar_gen2_data },
{ .compatible = "renesas,gether-r8a77980", .data = &r8a77980_data },
{ .compatible = "renesas,ether-r7s72100", .data = &r7s72100_data },
{ .compatible = "renesas,ether-r7s9210", .data = &r7s9210_data },
{ .compatible = "renesas,rcar-gen1-ether", .data = &rcar_gen1_data },
{ .compatible = "renesas,rcar-gen2-ether", .data = &rcar_gen2_data },
{ }
};
MODULE_DEVICE_TABLE(of, sh_eth_match_table);
#else
static inline struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
{
return NULL;
}
#endif
static int sh_eth_drv_probe(struct platform_device *pdev)
{
struct resource *res;
struct sh_eth_plat_data *pd = dev_get_platdata(&pdev->dev);
const struct platform_device_id *id = platform_get_device_id(pdev);
struct sh_eth_private *mdp;
struct net_device *ndev;
int ret;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/spinlock.h`, `linux/interrupt.h`, `linux/dma-mapping.h`, `linux/etherdevice.h`, `linux/delay.h`, `linux/platform_device.h`.
- Detected declarations: `struct bb_info`, `function sh_eth_write`, `function sh_eth_read`, `function sh_eth_modify`, `function sh_eth_tsu_get_offset`, `function sh_eth_tsu_write`, `function sh_eth_tsu_read`, `function sh_eth_soft_swap`, `function sh_eth_select_mii`, `function sh_eth_set_duplex`.
- 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.