drivers/net/phy/qcom/qca808x.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/qcom/qca808x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/qcom/qca808x.c- Extension
.c- Size
- 19545 bytes
- Lines
- 687
- 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.hqcom.h
Detected Declarations
struct qca808x_privfunction qca808x_phy_fast_retrain_configfunction qca808x_phy_ms_seed_enablefunction qca808x_is_prefer_masterfunction qca808x_has_fast_retrain_or_slave_seedfunction qca808x_is_1g_onlyfunction qca808x_fill_possible_interfacesfunction qca808x_probefunction qca808x_config_initfunction qca808x_read_statusfunction qca808x_soft_resetfunction qca808x_cable_test_startfunction qca808x_get_featuresfunction qca808x_config_anegfunction qca808x_link_change_notifyfunction qca808x_led_parse_netdevfunction qca808x_led_hw_control_enablefunction qca808x_led_hw_is_supportedfunction qca808x_led_hw_control_setfunction qca808x_led_hw_control_statusfunction qca808x_led_hw_control_getfunction qca808x_led_hw_control_resetfunction qca808x_led_brightness_setfunction qca808x_led_blink_setfunction qca808x_led_polarity_setfunction for_each_set_bitfunction qca808x_update_statsfunction qca808x_get_phy_stats
Annotated Snippet
struct qca808x_priv {
int led_polarity_mode;
struct qcom_phy_hw_stats hw_stats;
};
static int qca808x_phy_fast_retrain_config(struct phy_device *phydev)
{
int ret;
/* Enable fast retrain */
ret = genphy_c45_fast_retrain(phydev, true);
if (ret)
return ret;
phy_write_mmd(phydev, MDIO_MMD_AN, QCA808X_PHY_MMD7_TOP_OPTION1,
QCA808X_TOP_OPTION1_DATA);
phy_write_mmd(phydev, MDIO_MMD_PMAPMD, QCA808X_PHY_MMD1_MSE_THRESHOLD_20DB,
QCA808X_MSE_THRESHOLD_20DB_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PMAPMD, QCA808X_PHY_MMD1_MSE_THRESHOLD_17DB,
QCA808X_MSE_THRESHOLD_17DB_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PMAPMD, QCA808X_PHY_MMD1_MSE_THRESHOLD_27DB,
QCA808X_MSE_THRESHOLD_27DB_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PMAPMD, QCA808X_PHY_MMD1_MSE_THRESHOLD_28DB,
QCA808X_MSE_THRESHOLD_28DB_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_DEBUG_1,
QCA808X_MMD3_DEBUG_1_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_DEBUG_4,
QCA808X_MMD3_DEBUG_4_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_DEBUG_5,
QCA808X_MMD3_DEBUG_5_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_DEBUG_3,
QCA808X_MMD3_DEBUG_3_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_DEBUG_6,
QCA808X_MMD3_DEBUG_6_VALUE);
phy_write_mmd(phydev, MDIO_MMD_PCS, QCA808X_PHY_MMD3_DEBUG_2,
QCA808X_MMD3_DEBUG_2_VALUE);
return 0;
}
static int qca808x_phy_ms_seed_enable(struct phy_device *phydev, bool enable)
{
u16 seed_value;
if (!enable)
return at803x_debug_reg_mask(phydev, QCA808X_PHY_DEBUG_LOCAL_SEED,
QCA808X_MASTER_SLAVE_SEED_ENABLE, 0);
seed_value = get_random_u32_below(QCA808X_MASTER_SLAVE_SEED_RANGE);
return at803x_debug_reg_mask(phydev, QCA808X_PHY_DEBUG_LOCAL_SEED,
QCA808X_MASTER_SLAVE_SEED_CFG | QCA808X_MASTER_SLAVE_SEED_ENABLE,
FIELD_PREP(QCA808X_MASTER_SLAVE_SEED_CFG, seed_value) |
QCA808X_MASTER_SLAVE_SEED_ENABLE);
}
static bool qca808x_is_prefer_master(struct phy_device *phydev)
{
return (phydev->master_slave_get == MASTER_SLAVE_CFG_MASTER_FORCE) ||
(phydev->master_slave_get == MASTER_SLAVE_CFG_MASTER_PREFERRED);
}
static bool qca808x_has_fast_retrain_or_slave_seed(struct phy_device *phydev)
{
return linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported);
}
static bool qca808x_is_1g_only(struct phy_device *phydev)
{
int ret;
ret = phy_read_mmd(phydev, MDIO_MMD_AN, QCA808X_PHY_MMD7_CHIP_TYPE);
if (ret < 0)
return true;
return !!(QCA808X_PHY_CHIP_TYPE_1G & ret);
}
static void qca808x_fill_possible_interfaces(struct phy_device *phydev)
{
unsigned long *possible = phydev->possible_interfaces;
__set_bit(PHY_INTERFACE_MODE_SGMII, possible);
if (!qca808x_is_1g_only(phydev))
__set_bit(PHY_INTERFACE_MODE_2500BASEX, possible);
}
static int qca808x_probe(struct phy_device *phydev)
{
struct device *dev = &phydev->mdio.dev;
Annotation
- Immediate include surface: `linux/phy.h`, `linux/module.h`, `qcom.h`.
- Detected declarations: `struct qca808x_priv`, `function qca808x_phy_fast_retrain_config`, `function qca808x_phy_ms_seed_enable`, `function qca808x_is_prefer_master`, `function qca808x_has_fast_retrain_or_slave_seed`, `function qca808x_is_1g_only`, `function qca808x_fill_possible_interfaces`, `function qca808x_probe`, `function qca808x_config_init`, `function qca808x_read_status`.
- 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.