drivers/net/phy/dp83848.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/dp83848.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/dp83848.c- Extension
.c- Size
- 4529 bytes
- Lines
- 169
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/module.hlinux/phy.h
Detected Declarations
function Copyrightfunction dp83848_config_intrfunction dp83848_handle_interruptfunction dp83848_config_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Driver for the Texas Instruments DP83848 PHY
*
* Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/
*/
#include <linux/module.h>
#include <linux/phy.h>
#define TI_DP83848C_PHY_ID 0x20005ca0
#define TI_DP83620_PHY_ID 0x20005ce0
#define NS_DP83848C_PHY_ID 0x20005c90
#define TLK10X_PHY_ID 0x2000a210
/* Registers */
#define DP83848_MICR 0x11 /* MII Interrupt Control Register */
#define DP83848_MISR 0x12 /* MII Interrupt Status Register */
/* MICR Register Fields */
#define DP83848_MICR_INT_OE BIT(0) /* Interrupt Output Enable */
#define DP83848_MICR_INTEN BIT(1) /* Interrupt Enable */
/* MISR Register Fields */
#define DP83848_MISR_RHF_INT_EN BIT(0) /* Receive Error Counter */
#define DP83848_MISR_FHF_INT_EN BIT(1) /* False Carrier Counter */
#define DP83848_MISR_ANC_INT_EN BIT(2) /* Auto-negotiation complete */
#define DP83848_MISR_DUP_INT_EN BIT(3) /* Duplex Status */
#define DP83848_MISR_SPD_INT_EN BIT(4) /* Speed status */
#define DP83848_MISR_LINK_INT_EN BIT(5) /* Link status */
#define DP83848_MISR_ED_INT_EN BIT(6) /* Energy detect */
#define DP83848_MISR_LQM_INT_EN BIT(7) /* Link Quality Monitor */
#define DP83848_INT_EN_MASK \
(DP83848_MISR_ANC_INT_EN | \
DP83848_MISR_DUP_INT_EN | \
DP83848_MISR_SPD_INT_EN | \
DP83848_MISR_LINK_INT_EN)
#define DP83848_MISR_RHF_INT BIT(8)
#define DP83848_MISR_FHF_INT BIT(9)
#define DP83848_MISR_ANC_INT BIT(10)
#define DP83848_MISR_DUP_INT BIT(11)
#define DP83848_MISR_SPD_INT BIT(12)
#define DP83848_MISR_LINK_INT BIT(13)
#define DP83848_MISR_ED_INT BIT(14)
#define DP83848_INT_MASK \
(DP83848_MISR_ANC_INT | \
DP83848_MISR_DUP_INT | \
DP83848_MISR_SPD_INT | \
DP83848_MISR_LINK_INT)
static int dp83848_ack_interrupt(struct phy_device *phydev)
{
int err = phy_read(phydev, DP83848_MISR);
return err < 0 ? err : 0;
}
static int dp83848_config_intr(struct phy_device *phydev)
{
int control, ret;
control = phy_read(phydev, DP83848_MICR);
if (control < 0)
return control;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
ret = dp83848_ack_interrupt(phydev);
if (ret)
return ret;
control |= DP83848_MICR_INT_OE;
control |= DP83848_MICR_INTEN;
ret = phy_write(phydev, DP83848_MISR, DP83848_INT_EN_MASK);
if (ret < 0)
return ret;
ret = phy_write(phydev, DP83848_MICR, control);
} else {
control &= ~DP83848_MICR_INTEN;
ret = phy_write(phydev, DP83848_MICR, control);
if (ret)
return ret;
ret = dp83848_ack_interrupt(phydev);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/phy.h`.
- Detected declarations: `function Copyright`, `function dp83848_config_intr`, `function dp83848_handle_interrupt`, `function dp83848_config_init`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.