drivers/net/ethernet/asix/ax88796c_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/asix/ax88796c_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/asix/ax88796c_main.c- Extension
.c- Size
- 30408 bytes
- Lines
- 1167
- 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
ax88796c_main.hax88796c_ioctl.hlinux/bitmap.hlinux/etherdevice.hlinux/iopoll.hlinux/lockdep.hlinux/mdio.hlinux/minmax.hlinux/module.hlinux/netdevice.hlinux/of.hlinux/phy.hlinux/skbuff.hlinux/spi/spi.h
Detected Declarations
function ax88796c_soft_resetfunction ax88796c_reload_eepromfunction ax88796c_set_hw_multicastfunction netdev_for_each_mc_addrfunction ax88796c_set_mac_addrfunction ax88796c_load_mac_addrfunction is_valid_ether_addrfunction ax88796c_proc_tx_hdrfunction ax88796c_check_free_pagesfunction ax88796c_tx_fixupfunction ax88796c_hard_xmitfunction ax88796c_start_xmitfunction ax88796c_skb_returnfunction ax88796c_rx_fixupfunction ax88796c_receivefunction ax88796c_process_isrfunction ax88796c_interruptfunction ax88796c_workfunction ax88796c_get_stats64function for_each_possible_cpufunction ax88796c_set_macfunction ax88796c_handle_link_changefunction ax88796c_set_csumsfunction ax88796c_openfunction ax88796c_closefunction ax88796c_set_featuresfunction ax88796c_hard_resetfunction ax88796c_probefunction ax88796c_removefunction ax88796c_spi_initfunction ax88796c_spi_exitmodule init ax88796c_spi_init
Annotated Snippet
static const struct net_device_ops ax88796c_netdev_ops = {
.ndo_open = ax88796c_open,
.ndo_stop = ax88796c_close,
.ndo_start_xmit = ax88796c_start_xmit,
.ndo_get_stats64 = ax88796c_get_stats64,
.ndo_eth_ioctl = ax88796c_ioctl,
.ndo_set_mac_address = eth_mac_addr,
.ndo_set_features = ax88796c_set_features,
};
static int ax88796c_hard_reset(struct ax88796c_device *ax_local)
{
struct device *dev = (struct device *)&ax_local->spi->dev;
struct gpio_desc *reset_gpio;
/* reset info */
reset_gpio = gpiod_get(dev, "reset", 0);
if (IS_ERR(reset_gpio)) {
dev_err(dev, "Could not get 'reset' GPIO: %ld", PTR_ERR(reset_gpio));
return PTR_ERR(reset_gpio);
}
/* set reset */
gpiod_direction_output(reset_gpio, 1);
msleep(100);
gpiod_direction_output(reset_gpio, 0);
gpiod_put(reset_gpio);
msleep(20);
return 0;
}
static int ax88796c_probe(struct spi_device *spi)
{
char phy_id[MII_BUS_ID_SIZE + 3];
struct ax88796c_device *ax_local;
struct net_device *ndev;
u16 temp;
int ret;
ndev = devm_alloc_etherdev(&spi->dev, sizeof(*ax_local));
if (!ndev)
return -ENOMEM;
SET_NETDEV_DEV(ndev, &spi->dev);
ax_local = to_ax88796c_device(ndev);
dev_set_drvdata(&spi->dev, ax_local);
ax_local->spi = spi;
ax_local->ax_spi.spi = spi;
ax_local->stats =
devm_netdev_alloc_pcpu_stats(&spi->dev,
struct ax88796c_pcpu_stats);
if (!ax_local->stats)
return -ENOMEM;
ax_local->ndev = ndev;
ax_local->priv_flags |= comp ? AX_CAP_COMP : 0;
ax_local->msg_enable = msg_enable;
mutex_init(&ax_local->spi_lock);
ax_local->mdiobus = devm_mdiobus_alloc(&spi->dev);
if (!ax_local->mdiobus)
return -ENOMEM;
ax_local->mdiobus->priv = ax_local;
ax_local->mdiobus->read = ax88796c_mdio_read;
ax_local->mdiobus->write = ax88796c_mdio_write;
ax_local->mdiobus->name = "ax88976c-mdiobus";
ax_local->mdiobus->phy_mask = (u32)~BIT(AX88796C_PHY_ID);
ax_local->mdiobus->parent = &spi->dev;
snprintf(ax_local->mdiobus->id, MII_BUS_ID_SIZE,
"ax88796c-%s.%u", dev_name(&spi->dev), spi_get_chipselect(spi, 0));
ret = devm_mdiobus_register(&spi->dev, ax_local->mdiobus);
if (ret < 0) {
dev_err(&spi->dev, "Could not register MDIO bus\n");
return ret;
}
if (netif_msg_probe(ax_local)) {
dev_info(&spi->dev, "AX88796C-SPI Configuration:\n");
dev_info(&spi->dev, " Compression : %s\n",
ax_local->priv_flags & AX_CAP_COMP ? "ON" : "OFF");
}
ndev->irq = spi->irq;
Annotation
- Immediate include surface: `ax88796c_main.h`, `ax88796c_ioctl.h`, `linux/bitmap.h`, `linux/etherdevice.h`, `linux/iopoll.h`, `linux/lockdep.h`, `linux/mdio.h`, `linux/minmax.h`.
- Detected declarations: `function ax88796c_soft_reset`, `function ax88796c_reload_eeprom`, `function ax88796c_set_hw_multicast`, `function netdev_for_each_mc_addr`, `function ax88796c_set_mac_addr`, `function ax88796c_load_mac_addr`, `function is_valid_ether_addr`, `function ax88796c_proc_tx_hdr`, `function ax88796c_check_free_pages`, `function ax88796c_tx_fixup`.
- 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.