drivers/net/phy/air_an8801.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/air_an8801.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/air_an8801.c- Extension
.c- Size
- 29837 bytes
- Lines
- 1157
- 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.
- 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/bitfield.hlinux/bitops.hlinux/delay.hlinux/errno.hlinux/etherdevice.hlinux/init.hlinux/minmax.hlinux/netdevice.hlinux/of.hlinux/phy.hlinux/pm_wakeirq.hair_phy_lib.h
Detected Declarations
struct an8801r_privenum an8801r_led_fnfunction an8801_buckpbus_reg_rmwfunction an8801_buckpbus_reg_set_bitsfunction an8801_buckpbus_reg_clear_bitsfunction an8801_buckpbus_reg_writefunction an8801_buckpbus_reg_readfunction an8801r_led_blink_ms_to_hwfunction an8801r_led_blink_setfunction an8801r_led_brightness_setfunction an8801r_led_hw_control_getfunction an8801r_led_trig_to_hwfunction an8801r_led_hw_is_supportedfunction an8801r_led_hw_control_setfunction an8801r_led_polarity_setfunction for_each_set_bitfunction an8801r_led_initfunction an8801r_reset_wakefunction an8801r_ack_interruptfunction an8801r_config_intrfunction an8801r_handle_interruptfunction an8801r_get_wolfunction an8801r_set_wolfunction an8801r_of_init_ledsfunction for_each_available_child_of_node_scopedfunction an8801r_rgmii_rxdelayfunction an8801r_rgmii_txdelayfunction an8801r_rgmii_delay_configfunction an8801r_config_initfunction an8801r_read_statusfunction an8801r_probefunction phy_interrupt_is_validfunction an8801r_suspendfunction an8801r_resume
Annotated Snippet
struct an8801r_priv {
bool wake_magic_enabled;
bool wake_lnkchg_enabled;
};
static const unsigned long an8801r_led_trig = BIT(TRIGGER_NETDEV_LINK) |
BIT(TRIGGER_NETDEV_LINK_10) |
BIT(TRIGGER_NETDEV_LINK_100) |
BIT(TRIGGER_NETDEV_LINK_1000) |
BIT(TRIGGER_NETDEV_RX) |
BIT(TRIGGER_NETDEV_RX_ERR) |
BIT(TRIGGER_NETDEV_TX);
static int an8801_buckpbus_reg_rmw(struct phy_device *phydev,
u32 addr, u32 mask, u32 set)
{
return air_phy_buckpbus_reg_modify(phydev,
addr | AN8801_PBUS_ACCESS,
mask, set);
}
static int an8801_buckpbus_reg_set_bits(struct phy_device *phydev,
u32 addr, u32 mask)
{
return air_phy_buckpbus_reg_modify(phydev,
addr | AN8801_PBUS_ACCESS,
mask, mask);
}
static int an8801_buckpbus_reg_clear_bits(struct phy_device *phydev,
u32 addr, u32 mask)
{
return air_phy_buckpbus_reg_modify(phydev,
addr | AN8801_PBUS_ACCESS,
mask, 0);
}
static int an8801_buckpbus_reg_write(struct phy_device *phydev, u32 addr,
u32 data)
{
return air_phy_buckpbus_reg_write(phydev,
addr | AN8801_PBUS_ACCESS,
data);
}
static int an8801_buckpbus_reg_read(struct phy_device *phydev, u32 addr,
u32 *data)
{
return air_phy_buckpbus_reg_read(phydev,
addr | AN8801_PBUS_ACCESS,
data);
}
static u32 an8801r_led_blink_ms_to_hw(unsigned long req_ms)
{
u32 req_ns, regval;
if (req_ms > AN8801_MAX_PERIOD_MS)
req_ms = AN8801_MAX_PERIOD_MS;
req_ns = req_ms * NSEC_PER_MSEC;
/* Round to the nearest period unit... */
regval = req_ns + (AN8801_PERIOD_UNIT / 2);
/* ...and now divide by the full period */
regval >>= AN8801_PERIOD_SHIFT;
return regval;
}
static int an8801r_led_blink_set(struct phy_device *phydev, u8 index,
unsigned long *delay_on,
unsigned long *delay_off)
{
u32 hw_delay_on, hw_delay_off;
u16 blink_dur;
bool blink;
int ret;
if (index >= AN8801R_NUM_LEDS)
return -EINVAL;
if (delay_on && delay_off) {
blink = true;
if (*delay_on == 0 || *delay_off == 0) {
*delay_on = 64;
*delay_off = 64;
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/delay.h`, `linux/errno.h`, `linux/etherdevice.h`, `linux/init.h`, `linux/minmax.h`, `linux/netdevice.h`.
- Detected declarations: `struct an8801r_priv`, `enum an8801r_led_fn`, `function an8801_buckpbus_reg_rmw`, `function an8801_buckpbus_reg_set_bits`, `function an8801_buckpbus_reg_clear_bits`, `function an8801_buckpbus_reg_write`, `function an8801_buckpbus_reg_read`, `function an8801r_led_blink_ms_to_hw`, `function an8801r_led_blink_set`, `function an8801r_led_brightness_set`.
- 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.