drivers/net/phy/qcom/qcom-phy-lib.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/qcom/qcom-phy-lib.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/qcom/qcom-phy-lib.c- Extension
.c- Size
- 19528 bytes
- Lines
- 777
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/phy.hlinux/module.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool_netlink.hqcom.h
Detected Declarations
function at803x_debug_reg_readfunction at803x_debug_reg_maskfunction at803x_debug_reg_writefunction at803x_set_wolfunction at8031_set_wolfunction at803x_get_wolfunction at803x_ack_interruptfunction at803x_config_intrfunction at803x_handle_interruptfunction at803x_read_specific_statusfunction at803x_config_mdixfunction at803x_prepare_config_anegfunction at803x_read_statusfunction at803x_get_downshiftfunction at803x_set_downshiftfunction at803x_get_tunablefunction at803x_set_tunablefunction at803x_cdt_fault_lengthfunction at803x_cdt_startfunction at803x_cdt_wait_for_completionfunction qca808x_cdt_fault_length_validfunction qca808x_cable_test_result_transfunction qca808x_cdt_fault_lengthfunction qca808x_cable_test_get_pair_statusfunction qca808x_cable_test_get_statusfunction qca808x_led_reg_hw_control_enablefunction qca808x_led_reg_hw_control_statusfunction qca808x_led_reg_brightness_setfunction qca808x_led_reg_blink_setfunction qcom_phy_counter_configfunction qcom_phy_update_statsfunction qcom_phy_get_statsexport at803x_debug_reg_readexport at803x_debug_reg_maskexport at803x_debug_reg_writeexport at803x_set_wolexport at8031_set_wolexport at803x_get_wolexport at803x_ack_interruptexport at803x_config_intrexport at803x_handle_interruptexport at803x_read_specific_statusexport at803x_config_mdixexport at803x_prepare_config_anegexport at803x_read_statusexport at803x_get_tunableexport at803x_set_tunableexport at803x_cdt_fault_length
Annotated Snippet
switch (speed) {
case AT803X_SS_SPEED_10:
phydev->speed = SPEED_10;
break;
case AT803X_SS_SPEED_100:
phydev->speed = SPEED_100;
break;
case AT803X_SS_SPEED_1000:
phydev->speed = SPEED_1000;
break;
case QCA808X_SS_SPEED_2500:
phydev->speed = SPEED_2500;
break;
}
if (ss & AT803X_SS_DUPLEX)
phydev->duplex = DUPLEX_FULL;
else
phydev->duplex = DUPLEX_HALF;
if (ss & AT803X_SS_MDIX)
phydev->mdix = ETH_TP_MDI_X;
else
phydev->mdix = ETH_TP_MDI;
switch (FIELD_GET(AT803X_SFC_MDI_CROSSOVER_MODE_M, sfc)) {
case AT803X_SFC_MANUAL_MDI:
phydev->mdix_ctrl = ETH_TP_MDI;
break;
case AT803X_SFC_MANUAL_MDIX:
phydev->mdix_ctrl = ETH_TP_MDI_X;
break;
case AT803X_SFC_AUTOMATIC_CROSSOVER:
phydev->mdix_ctrl = ETH_TP_MDI_AUTO;
break;
}
}
return 0;
}
EXPORT_SYMBOL_GPL(at803x_read_specific_status);
int at803x_config_mdix(struct phy_device *phydev, u8 ctrl)
{
u16 val;
switch (ctrl) {
case ETH_TP_MDI:
val = AT803X_SFC_MANUAL_MDI;
break;
case ETH_TP_MDI_X:
val = AT803X_SFC_MANUAL_MDIX;
break;
case ETH_TP_MDI_AUTO:
val = AT803X_SFC_AUTOMATIC_CROSSOVER;
break;
default:
return 0;
}
return phy_modify_changed(phydev, AT803X_SPECIFIC_FUNCTION_CONTROL,
AT803X_SFC_MDI_CROSSOVER_MODE_M,
FIELD_PREP(AT803X_SFC_MDI_CROSSOVER_MODE_M, val));
}
EXPORT_SYMBOL_GPL(at803x_config_mdix);
int at803x_prepare_config_aneg(struct phy_device *phydev)
{
int ret;
ret = at803x_config_mdix(phydev, phydev->mdix_ctrl);
if (ret < 0)
return ret;
/* Changes of the midx bits are disruptive to the normal operation;
* therefore any changes to these registers must be followed by a
* software reset to take effect.
*/
if (ret == 1) {
ret = genphy_soft_reset(phydev);
if (ret < 0)
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(at803x_prepare_config_aneg);
int at803x_read_status(struct phy_device *phydev)
{
struct at803x_ss_mask ss_mask = { 0 };
Annotation
- Immediate include surface: `linux/phy.h`, `linux/module.h`, `linux/netdevice.h`, `linux/etherdevice.h`, `linux/ethtool_netlink.h`, `qcom.h`.
- Detected declarations: `function at803x_debug_reg_read`, `function at803x_debug_reg_mask`, `function at803x_debug_reg_write`, `function at803x_set_wol`, `function at8031_set_wol`, `function at803x_get_wol`, `function at803x_ack_interrupt`, `function at803x_config_intr`, `function at803x_handle_interrupt`, `function at803x_read_specific_status`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.