drivers/net/phy/micrel.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/micrel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/micrel.c- Extension
.c- Size
- 199356 bytes
- Lines
- 7080
- 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.
- 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/bitfield.hlinux/ethtool_netlink.hlinux/kernel.hlinux/module.hlinux/phy.hlinux/micrel_phy.hlinux/of.hlinux/clk.hlinux/delay.hlinux/ptp_clock_kernel.hlinux/ptp_clock.hlinux/ptp_classify.hlinux/net_tstamp.hlinux/gpio/consumer.hphylib.h
Detected Declarations
struct kszphy_hw_statstruct kszphy_typestruct lan8814_shared_privstruct lan8814_ptp_rx_tsstruct kszphy_ptp_privstruct kszphy_phy_statsstruct kszphy_privstruct lan8842_phy_statsstruct lan8842_privstruct lanphy_reg_datastruct ksz9477_errata_writefunction kszphy_extended_writefunction kszphy_extended_readfunction kszphy_ack_interruptfunction kszphy_config_intrfunction kszphy_handle_interruptfunction kszphy_rmii_clk_selfunction kszphy_setup_ledfunction uniquefunction kszphy_nand_tree_disablefunction kszphy_config_resetfunction kszphy_config_initfunction ksz8041_fiber_modefunction ksz8041_config_initfunction ksz8041_config_anegfunction ksz8051_ksz8795_match_phy_devicefunction ksz8051_match_phy_devicefunction ksz8081_config_initfunction ksz8081_config_mdixfunction ksz8081_config_anegfunction ksz8081_mdix_updatefunction ksz8081_read_statusfunction ksz8061_config_initfunction ksz8795_match_phy_devicefunction ksz8795_get_tunablefunction ksz8795_set_tunablefunction ksz9021_load_values_from_offunction ksz9021_config_initfunction ksz9031_set_loopbackfunction ksz9031_of_load_skew_valuesfunction ksz9031_center_flp_timingfunction ksz9031_enable_edpdfunction ksz9031_config_rgmii_delayfunction ksz9031_config_initfunction clockfunction ksz9131_of_load_skew_valuesfunction ksz9131_config_rgmii_delayfunction datasheet
Annotated Snippet
struct kszphy_hw_stat {
const char *string;
u8 reg;
u8 bits;
};
static struct kszphy_hw_stat kszphy_hw_stats[] = {
{ "phy_receive_errors", 21, 16},
{ "phy_idle_errors", 10, 8 },
};
struct kszphy_type {
u32 led_mode_reg;
u16 interrupt_level_mask;
u16 cable_diag_reg;
unsigned long pair_mask;
u16 disable_dll_tx_bit;
u16 disable_dll_rx_bit;
u16 disable_dll_mask;
bool has_broadcast_disable;
bool has_nand_tree_disable;
bool has_rmii_ref_clk_sel;
};
/* Shared structure between the PHYs of the same package. */
struct lan8814_shared_priv {
struct phy_device *phydev;
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_clock_info;
struct ptp_pin_desc *pin_config;
/* Lock for ptp_clock */
struct mutex shared_lock;
};
struct lan8814_ptp_rx_ts {
struct list_head list;
u32 seconds;
u32 nsec;
u16 seq_id;
};
struct kszphy_ptp_priv {
struct mii_timestamper mii_ts;
struct phy_device *phydev;
struct sk_buff_head tx_queue;
struct sk_buff_head rx_queue;
struct list_head rx_ts_list;
/* Lock for Rx ts fifo */
spinlock_t rx_ts_lock;
int hwts_tx_type;
enum hwtstamp_rx_filters rx_filter;
int layer;
int version;
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_clock_info;
/* Lock for ptp_clock */
struct mutex ptp_lock;
struct ptp_pin_desc *pin_config;
s64 seconds;
/* Lock for accessing seconds */
spinlock_t seconds_lock;
};
struct kszphy_phy_stats {
u64 rx_err_pkt_cnt;
};
struct kszphy_priv {
struct kszphy_ptp_priv ptp_priv;
const struct kszphy_type *type;
struct clk *clk;
int led_mode;
u16 vct_ctrl1000;
bool rmii_ref_clk_sel;
bool rmii_ref_clk_sel_val;
bool clk_enable;
bool is_ptp_available;
u64 stats[ARRAY_SIZE(kszphy_hw_stats)];
struct kszphy_phy_stats phy_stats;
};
struct lan8842_phy_stats {
u64 rx_packets;
u64 rx_errors;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/ethtool_netlink.h`, `linux/kernel.h`, `linux/module.h`, `linux/phy.h`, `linux/micrel_phy.h`, `linux/of.h`, `linux/clk.h`.
- Detected declarations: `struct kszphy_hw_stat`, `struct kszphy_type`, `struct lan8814_shared_priv`, `struct lan8814_ptp_rx_ts`, `struct kszphy_ptp_priv`, `struct kszphy_phy_stats`, `struct kszphy_priv`, `struct lan8842_phy_stats`, `struct lan8842_priv`, `struct lanphy_reg_data`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.