drivers/net/ethernet/natsemi/jazzsonic.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/natsemi/jazzsonic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/natsemi/jazzsonic.c- Extension
.c- Size
- 5879 bytes
- Lines
- 251
- 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.
- 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
linux/kernel.hlinux/module.hlinux/types.hlinux/fcntl.hlinux/gfp.hlinux/interrupt.hlinux/ioport.hlinux/in.hlinux/string.hlinux/delay.hlinux/errno.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/platform_device.hlinux/dma-mapping.hlinux/slab.hlinux/pgtable.hasm/bootinfo.hasm/io.hasm/dma.hasm/jazz.hasm/jazzdma.hsonic.hsonic.c
Detected Declarations
function jazzsonic_openfunction jazzsonic_closefunction sonic_probe1function jazz_sonic_probefunction jazz_sonic_device_remove
Annotated Snippet
static const struct net_device_ops sonic_netdev_ops = {
.ndo_open = jazzsonic_open,
.ndo_stop = jazzsonic_close,
.ndo_start_xmit = sonic_send_packet,
.ndo_get_stats = sonic_get_stats,
.ndo_set_rx_mode = sonic_multicast_list,
.ndo_tx_timeout = sonic_tx_timeout,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
};
static int sonic_probe1(struct net_device *dev)
{
unsigned int silicon_revision;
unsigned int val;
struct sonic_local *lp = netdev_priv(dev);
int err = -ENODEV;
int i;
unsigned char addr[ETH_ALEN];
if (!request_mem_region(dev->base_addr, SONIC_MEM_SIZE, jazz_sonic_string))
return -EBUSY;
/*
* get the Silicon Revision ID. If this is one of the known
* one assume that we found a SONIC ethernet controller at
* the expected location.
*/
silicon_revision = SONIC_READ(SONIC_SR);
i = 0;
while (known_revisions[i] != 0xffff &&
known_revisions[i] != silicon_revision)
i++;
if (known_revisions[i] == 0xffff) {
pr_info("SONIC ethernet controller not found (0x%4x)\n",
silicon_revision);
goto out;
}
/*
* Put the sonic into software reset, then
* retrieve and print the ethernet address.
*/
SONIC_WRITE(SONIC_CMD,SONIC_CR_RST);
SONIC_WRITE(SONIC_CEP,0);
for (i=0; i<3; i++) {
val = SONIC_READ(SONIC_CAP0-i);
addr[i*2] = val;
addr[i*2+1] = val >> 8;
}
eth_hw_addr_set(dev, addr);
lp->dma_bitmode = SONIC_BITMODE32;
err = sonic_alloc_descriptors(dev);
if (err)
goto out;
dev->netdev_ops = &sonic_netdev_ops;
dev->watchdog_timeo = TX_TIMEOUT;
/*
* clear tally counter
*/
SONIC_WRITE(SONIC_CRCT,0xffff);
SONIC_WRITE(SONIC_FAET,0xffff);
SONIC_WRITE(SONIC_MPT,0xffff);
return 0;
out:
release_mem_region(dev->base_addr, SONIC_MEM_SIZE);
return err;
}
/*
* Probe for a SONIC ethernet controller on a Mips Jazz board.
* Actually probing is superfluous but we're paranoid.
*/
static int jazz_sonic_probe(struct platform_device *pdev)
{
struct net_device *dev;
struct sonic_local *lp;
struct resource *res;
int err = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/types.h`, `linux/fcntl.h`, `linux/gfp.h`, `linux/interrupt.h`, `linux/ioport.h`, `linux/in.h`.
- Detected declarations: `function jazzsonic_open`, `function jazzsonic_close`, `function sonic_probe1`, `function jazz_sonic_probe`, `function jazz_sonic_device_remove`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- 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.