drivers/net/phy/qcom/at803x.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/qcom/at803x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/qcom/at803x.c- Extension
.c- Size
- 35521 bytes
- Lines
- 1250
- 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.
- 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/phy.hlinux/module.hlinux/string.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool_netlink.hlinux/bitfield.hlinux/regulator/of_regulator.hlinux/regulator/driver.hlinux/regulator/consumer.hlinux/of.hlinux/phylink.hlinux/clk.hlinux/reset.hlinux/phy_port.hdt-bindings/net/qca-ar803x.hqcom.h
Detected Declarations
struct at803x_privstruct at803x_contextstruct ipq5018_privfunction at803x_write_pagefunction at803x_read_pagefunction at803x_enable_rx_delayfunction at803x_enable_tx_delayfunction at803x_disable_rx_delayfunction at803x_disable_tx_delayfunction at803x_context_savefunction at803x_context_restorefunction at803x_suspendfunction at803x_resumefunction at803x_parse_dtfunction at803x_probefunction at803x_get_featuresfunction at803x_smarteee_configfunction at803x_clk_out_configfunction at8031_pll_configfunction at803x_hibernation_mode_configfunction at803x_config_initfunction at803x_link_change_notifyfunction at803x_config_anegfunction at803x_cable_test_result_transfunction at803x_cdt_test_failedfunction at803x_cdt_fault_length_validfunction at803x_cable_test_one_pairfunction at803x_cable_test_get_statusfunction for_each_set_bitfunction at803x_cable_test_autonegfunction at803x_cable_test_startfunction at8031_rgmii_reg_set_voltage_selfunction at8031_rgmii_reg_get_voltage_selfunction at8031_register_regulatorsfunction at803x_configure_miifunction at8031_attach_mii_portfunction at8031_parse_dtfunction at8031_probefunction at8031_config_initfunction at8031_config_intrfunction at8031_read_statusfunction at8031_cable_test_get_statusfunction at8031_cable_test_startfunction at8032_cable_test_get_statusfunction at8035_parse_dtfunction at8035_probefunction ipq5018_cable_test_startfunction ipq5018_config_init
Annotated Snippet
struct at803x_priv {
int flags;
u16 clk_25m_reg;
u16 clk_25m_mask;
u8 smarteee_lpi_tw_1g;
u8 smarteee_lpi_tw_100m;
bool is_fiber;
bool is_1000basex;
struct regulator_dev *vddio_rdev;
struct regulator_dev *vddh_rdev;
};
struct at803x_context {
u16 bmcr;
u16 advertise;
u16 control1000;
u16 int_enable;
u16 smart_speed;
u16 led_control;
};
struct ipq5018_priv {
struct reset_control *rst;
bool set_short_cable_dac;
};
static int at803x_write_page(struct phy_device *phydev, int page)
{
int mask;
int set;
if (page == AT803X_PAGE_COPPER) {
set = AT803X_BT_BX_REG_SEL;
mask = 0;
} else {
set = 0;
mask = AT803X_BT_BX_REG_SEL;
}
return __phy_modify(phydev, AT803X_REG_CHIP_CONFIG, mask, set);
}
static int at803x_read_page(struct phy_device *phydev)
{
int ccr = __phy_read(phydev, AT803X_REG_CHIP_CONFIG);
if (ccr < 0)
return ccr;
if (ccr & AT803X_BT_BX_REG_SEL)
return AT803X_PAGE_COPPER;
return AT803X_PAGE_FIBER;
}
static int at803x_enable_rx_delay(struct phy_device *phydev)
{
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL, 0,
AT803X_DEBUG_RX_CLK_DLY_EN);
}
static int at803x_enable_tx_delay(struct phy_device *phydev)
{
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE, 0,
AT803X_DEBUG_TX_CLK_DLY_EN);
}
static int at803x_disable_rx_delay(struct phy_device *phydev)
{
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_ANALOG_TEST_CTRL,
AT803X_DEBUG_RX_CLK_DLY_EN, 0);
}
static int at803x_disable_tx_delay(struct phy_device *phydev)
{
return at803x_debug_reg_mask(phydev, AT803X_DEBUG_SYSTEM_CTRL_MODE,
AT803X_DEBUG_TX_CLK_DLY_EN, 0);
}
/* save relevant PHY registers to private copy */
static void at803x_context_save(struct phy_device *phydev,
struct at803x_context *context)
{
context->bmcr = phy_read(phydev, MII_BMCR);
context->advertise = phy_read(phydev, MII_ADVERTISE);
context->control1000 = phy_read(phydev, MII_CTRL1000);
context->int_enable = phy_read(phydev, AT803X_INTR_ENABLE);
context->smart_speed = phy_read(phydev, AT803X_SMART_SPEED);
context->led_control = phy_read(phydev, AT803X_LED_CONTROL);
}
Annotation
- Immediate include surface: `linux/phy.h`, `linux/module.h`, `linux/string.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/ethtool_netlink.h`, `linux/bitfield.h`, `linux/regulator/of_regulator.h`.
- Detected declarations: `struct at803x_priv`, `struct at803x_context`, `struct ipq5018_priv`, `function at803x_write_page`, `function at803x_read_page`, `function at803x_enable_rx_delay`, `function at803x_enable_tx_delay`, `function at803x_disable_rx_delay`, `function at803x_disable_tx_delay`, `function at803x_context_save`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.