drivers/net/phy/adin.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/adin.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/adin.c- Extension
.c- Size
- 26699 bytes
- Lines
- 1070
- 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/kernel.hlinux/bitfield.hlinux/delay.hlinux/errno.hlinux/ethtool_netlink.hlinux/init.hlinux/module.hlinux/mii.hlinux/phy.hlinux/property.h
Detected Declarations
struct adin_cfg_reg_mapstruct adin_clause45_mmd_mapstruct adin_hw_statstruct adin_privfunction adin_lookup_reg_valuefunction adin_get_reg_valuefunction adin_config_rgmii_modefunction adin_config_rmii_modefunction adin_get_downshiftfunction adin_set_downshiftfunction adin_get_edpdfunction adin_set_edpdfunction adin_get_fast_downfunction adin_set_fast_downfunction adin_get_tunablefunction adin_set_tunablefunction adin_config_clk_outfunction adin_config_zptm100function adin_config_initfunction adin_phy_ack_intrfunction adin_phy_config_intrfunction adin_phy_handle_interruptfunction adin_cl45_to_adin_regfunction adin_read_mmdfunction adin_write_mmdfunction adin_config_mdixfunction adin_config_anegfunction adin_mdix_updatefunction adin_read_statusfunction adin_soft_resetfunction adin_get_sset_countfunction adin_get_stringsfunction adin_read_mmd_stat_regsfunction adin_get_statfunction adin_get_statsfunction adin_probefunction adin_cable_test_startfunction adin_cable_test_report_transfunction adin_cable_test_report_pairfunction adin_cable_test_reportfunction adin_cable_test_get_status
Annotated Snippet
struct adin_cfg_reg_map {
int cfg;
int reg;
};
static const struct adin_cfg_reg_map adin_rgmii_delays[] = {
{ 1600, ADIN1300_RGMII_1_60_NS },
{ 1800, ADIN1300_RGMII_1_80_NS },
{ 2000, ADIN1300_RGMII_2_00_NS },
{ 2200, ADIN1300_RGMII_2_20_NS },
{ 2400, ADIN1300_RGMII_2_40_NS },
{ },
};
static const struct adin_cfg_reg_map adin_rmii_fifo_depths[] = {
{ 4, ADIN1300_RMII_4_BITS },
{ 8, ADIN1300_RMII_8_BITS },
{ 12, ADIN1300_RMII_12_BITS },
{ 16, ADIN1300_RMII_16_BITS },
{ 20, ADIN1300_RMII_20_BITS },
{ 24, ADIN1300_RMII_24_BITS },
{ },
};
/**
* struct adin_clause45_mmd_map - map to convert Clause 45 regs to Clause 22
* @devad: device address used in Clause 45 access
* @cl45_regnum: register address defined by Clause 45
* @adin_regnum: equivalent register address accessible via Clause 22
*/
struct adin_clause45_mmd_map {
int devad;
u16 cl45_regnum;
u16 adin_regnum;
};
static const struct adin_clause45_mmd_map adin_clause45_mmd_map[] = {
{ MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE, ADIN1300_EEE_CAP_REG },
{ MDIO_MMD_AN, MDIO_AN_EEE_LPABLE, ADIN1300_EEE_LPABLE_REG },
{ MDIO_MMD_AN, MDIO_AN_EEE_ADV, ADIN1300_EEE_ADV_REG },
{ MDIO_MMD_PCS, MDIO_CTRL1, ADIN1300_CLOCK_STOP_REG },
{ MDIO_MMD_PCS, MDIO_PCS_EEE_WK_ERR, ADIN1300_LPI_WAKE_ERR_CNT_REG },
};
struct adin_hw_stat {
const char *string;
u16 reg1;
u16 reg2;
};
static const struct adin_hw_stat adin_hw_stats[] = {
{ "total_frames_checked_count", 0x940A, 0x940B }, /* hi + lo */
{ "length_error_frames_count", 0x940C },
{ "alignment_error_frames_count", 0x940D },
{ "symbol_error_count", 0x940E },
{ "oversized_frames_count", 0x940F },
{ "undersized_frames_count", 0x9410 },
{ "odd_nibble_frames_count", 0x9411 },
{ "odd_preamble_packet_count", 0x9412 },
{ "dribble_bits_frames_count", 0x9413 },
{ "false_carrier_events_count", 0x9414 },
};
/**
* struct adin_priv - ADIN PHY driver private data
* @stats: statistic counters for the PHY
*/
struct adin_priv {
u64 stats[ARRAY_SIZE(adin_hw_stats)];
};
static int adin_lookup_reg_value(const struct adin_cfg_reg_map *tbl, int cfg)
{
size_t i;
for (i = 0; tbl[i].cfg; i++) {
if (tbl[i].cfg == cfg)
return tbl[i].reg;
}
return -EINVAL;
}
static u32 adin_get_reg_value(struct phy_device *phydev,
const char *prop_name,
const struct adin_cfg_reg_map *tbl,
u32 dflt)
{
struct device *dev = &phydev->mdio.dev;
u32 val;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/bitfield.h`, `linux/delay.h`, `linux/errno.h`, `linux/ethtool_netlink.h`, `linux/init.h`, `linux/module.h`, `linux/mii.h`.
- Detected declarations: `struct adin_cfg_reg_map`, `struct adin_clause45_mmd_map`, `struct adin_hw_stat`, `struct adin_priv`, `function adin_lookup_reg_value`, `function adin_get_reg_value`, `function adin_config_rgmii_mode`, `function adin_config_rmii_mode`, `function adin_get_downshift`, `function adin_set_downshift`.
- 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.