drivers/net/phy/nxp-tja11xx.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/nxp-tja11xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/nxp-tja11xx.c- Extension
.c- Size
- 23132 bytes
- Lines
- 934
- 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/delay.hlinux/ethtool.hlinux/ethtool_netlink.hlinux/kernel.hlinux/mdio.hlinux/mii.hlinux/module.hlinux/of.hlinux/phy.hlinux/hwmon.hlinux/bitfield.hlinux/of_mdio.hlinux/of_irq.h
Detected Declarations
struct tja11xx_privstruct tja11xx_phy_statsfunction tja11xx_checkfunction phy_modify_checkfunction tja11xx_enable_reg_writefunction tja11xx_enable_link_controlfunction tja11xx_disable_link_controlfunction tja11xx_wakeupfunction tja11xx_soft_resetfunction tja11xx_config_aneg_cable_testfunction tja11xx_config_anegfunction tja11xx_get_interface_modefunction tja11xx_config_initfunction tja11xx_read_statusfunction tja11xx_get_sqifunction tja11xx_get_sqi_maxfunction tja11xx_get_sset_countfunction tja11xx_get_stringsfunction tja11xx_get_statsfunction tja11xx_hwmon_readfunction tja11xx_hwmon_is_visiblefunction tja11xx_hwmon_registerfunction tja11xx_parse_dtfunction tja11xx_probefunction tja1102_p1_registerfunction for_each_available_child_of_nodefunction tja1102_p0_probefunction tja1102_match_phy_devicefunction tja1102_p0_match_phy_devicefunction tja1102_p1_match_phy_devicefunction tja11xx_ack_interruptfunction tja11xx_config_intrfunction tja11xx_handle_interruptfunction tja11xx_cable_test_startfunction tja11xx_cable_test_report_transfunction tja11xx_cable_test_reportfunction tja11xx_cable_test_get_status
Annotated Snippet
struct tja11xx_priv {
struct phy_device *phydev;
struct work_struct phy_register_work;
u32 flags;
};
struct tja11xx_phy_stats {
const char *string;
u8 reg;
u8 off;
u16 mask;
};
static struct tja11xx_phy_stats tja11xx_hw_stats[] = {
{ "phy_symbol_error_count", 20, 0, GENMASK(15, 0) },
{ "phy_polarity_detect", 25, 6, BIT(6) },
{ "phy_open_detect", 25, 7, BIT(7) },
{ "phy_short_detect", 25, 8, BIT(8) },
{ "phy_rem_rcvr_count", 26, 0, GENMASK(7, 0) },
{ "phy_loc_rcvr_count", 26, 8, GENMASK(15, 8) },
};
static int tja11xx_check(struct phy_device *phydev, u8 reg, u16 mask, u16 set)
{
int val;
return phy_read_poll_timeout(phydev, reg, val, (val & mask) == set,
150, 30000, false);
}
static int phy_modify_check(struct phy_device *phydev, u8 reg,
u16 mask, u16 set)
{
int ret;
ret = phy_modify(phydev, reg, mask, set);
if (ret)
return ret;
return tja11xx_check(phydev, reg, mask, set);
}
static int tja11xx_enable_reg_write(struct phy_device *phydev)
{
return phy_set_bits(phydev, MII_ECTRL, MII_ECTRL_CONFIG_EN);
}
static int tja11xx_enable_link_control(struct phy_device *phydev)
{
return phy_set_bits(phydev, MII_ECTRL, MII_ECTRL_LINK_CONTROL);
}
static int tja11xx_disable_link_control(struct phy_device *phydev)
{
return phy_clear_bits(phydev, MII_ECTRL, MII_ECTRL_LINK_CONTROL);
}
static int tja11xx_wakeup(struct phy_device *phydev)
{
int ret;
ret = phy_read(phydev, MII_ECTRL);
if (ret < 0)
return ret;
switch (ret & MII_ECTRL_POWER_MODE_MASK) {
case MII_ECTRL_POWER_MODE_NO_CHANGE:
break;
case MII_ECTRL_POWER_MODE_NORMAL:
ret = phy_set_bits(phydev, MII_ECTRL, MII_ECTRL_WAKE_REQUEST);
if (ret)
return ret;
ret = phy_clear_bits(phydev, MII_ECTRL, MII_ECTRL_WAKE_REQUEST);
if (ret)
return ret;
break;
case MII_ECTRL_POWER_MODE_STANDBY:
ret = phy_modify_check(phydev, MII_ECTRL,
MII_ECTRL_POWER_MODE_MASK,
MII_ECTRL_POWER_MODE_STANDBY);
if (ret)
return ret;
ret = phy_modify(phydev, MII_ECTRL, MII_ECTRL_POWER_MODE_MASK,
MII_ECTRL_POWER_MODE_NORMAL);
if (ret)
return ret;
ret = phy_modify_check(phydev, MII_GENSTAT,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/ethtool.h`, `linux/ethtool_netlink.h`, `linux/kernel.h`, `linux/mdio.h`, `linux/mii.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct tja11xx_priv`, `struct tja11xx_phy_stats`, `function tja11xx_check`, `function phy_modify_check`, `function tja11xx_enable_reg_write`, `function tja11xx_enable_link_control`, `function tja11xx_disable_link_control`, `function tja11xx_wakeup`, `function tja11xx_soft_reset`, `function tja11xx_config_aneg_cable_test`.
- 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.