drivers/net/phy/microchip_t1s.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/microchip_t1s.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/microchip_t1s.c- Extension
.c- Size
- 17862 bytes
- Lines
- 611
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/phy.h
Detected Declarations
function write_registerfunction lan865x_generate_cfg_offsetsfunction lan865x_read_cfg_paramsfunction lan865x_write_cfg_paramsfunction lan865x_setup_cfgparamfunction lan865x_setup_sqi_cfgparamfunction lan865x_revb_config_initfunction lan867x_check_reset_completefunction lan867x_revc_config_initfunction lan867x_revb1_config_initfunction lan867x_revd0_link_active_selectionfunction lan86xx_plca_set_cfgfunction lan867x_revd0_config_initfunction lan86xx_read_statusfunction lan865x_phy_read_mmdfunction lan865x_phy_write_mmd
Annotated Snippet
if (i == 1) {
ret = lan865x_setup_cfgparam(phydev, offsets);
if (ret)
return ret;
}
}
ret = lan865x_setup_sqi_cfgparam(phydev, offsets);
if (ret)
return ret;
for (int i = 0; i < ARRAY_SIZE(lan865x_revb_sqi_fixup_regs); i++) {
ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
lan865x_revb_sqi_fixup_regs[i],
lan865x_revb_sqi_fixup_values[i]);
if (ret)
return ret;
}
return 0;
}
static int lan867x_check_reset_complete(struct phy_device *phydev)
{
int err;
/* The chip completes a reset in 3us, we might get here earlier than
* that, as an added margin we'll conditionally sleep 5us.
*/
err = phy_read_mmd(phydev, MDIO_MMD_VEND2, LAN867X_REG_STS2);
if (err < 0)
return err;
if (!(err & LAN867x_RESET_COMPLETE_STS)) {
udelay(5);
err = phy_read_mmd(phydev, MDIO_MMD_VEND2, LAN867X_REG_STS2);
if (err < 0)
return err;
if (!(err & LAN867x_RESET_COMPLETE_STS)) {
phydev_err(phydev, "PHY reset failed\n");
return -ENODEV;
}
}
return 0;
}
static int lan867x_revc_config_init(struct phy_device *phydev)
{
s8 offsets[2];
int ret;
ret = lan867x_check_reset_complete(phydev);
if (ret)
return ret;
ret = lan865x_generate_cfg_offsets(phydev, offsets);
if (ret)
return ret;
/* LAN867x Rev.C1/C2 configuration settings are equal to the first 9
* configuration settings and all the sqi fixup settings from LAN865x
* Rev.B0/B1. So the same fixup registers and values from LAN865x
* Rev.B0/B1 are used for LAN867x Rev.C1/C2 to avoid duplication.
* Refer the below links for the comparison.
* https://www.microchip.com/en-us/application-notes/an1760
* Revision F (DS60001760G - June 2024)
* https://www.microchip.com/en-us/application-notes/an1699
* Revision E (DS60001699F - June 2024)
*/
for (int i = 0; i < 9; i++) {
ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
lan865x_revb_fixup_registers[i],
lan865x_revb_fixup_values[i]);
if (ret)
return ret;
if (i == 1) {
ret = lan865x_setup_cfgparam(phydev, offsets);
if (ret)
return ret;
}
}
ret = lan865x_setup_sqi_cfgparam(phydev, offsets);
if (ret)
return ret;
for (int i = 0; i < ARRAY_SIZE(lan865x_revb_sqi_fixup_regs); i++) {
ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/phy.h`.
- Detected declarations: `function write_register`, `function lan865x_generate_cfg_offsets`, `function lan865x_read_cfg_params`, `function lan865x_write_cfg_params`, `function lan865x_setup_cfgparam`, `function lan865x_setup_sqi_cfgparam`, `function lan865x_revb_config_init`, `function lan867x_check_reset_complete`, `function lan867x_revc_config_init`, `function lan867x_revb1_config_init`.
- 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.