drivers/net/phy/motorcomm.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/motorcomm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/motorcomm.c- Extension
.c- Size
- 86915 bytes
- Lines
- 3168
- 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/etherdevice.hlinux/kernel.hlinux/module.hlinux/phy.hlinux/property.h
Detected Declarations
struct yt8521_privstruct ytphy_cfg_reg_mapstruct ytphy_ldo_vol_mapfunction ytphy_read_extfunction ytphy_read_ext_with_lockfunction ytphy_write_extfunction ytphy_write_ext_with_lockfunction ytphy_modify_extfunction ytphy_modify_ext_with_lockfunction ytphy_get_wolfunction ytphy_set_wolfunction yt8531_set_wolfunction yt8511_read_pagefunction yt8511_write_pagefunction yt8511_config_initfunction yt8521_read_pagefunction yt8521_write_pagefunction ytphy_get_delay_reg_valuefunction ytphy_rgmii_clk_delay_configfunction ytphy_rgmii_clk_delay_config_with_lockfunction yt8531_get_ldo_volfunction yt8531_get_ds_mapfunction yt8531_set_dsfunction yt8521_probefunction yt8531_probefunction ytphy_utp_read_lpafunction yt8521_adjust_statusfunction yt8521_read_status_pagedfunction yt8521_read_statusfunction spacefunction spacefunction yt8521_soft_resetfunction yt8521_suspendfunction yt8521_resumefunction yt8521_config_initfunction yt8521_led_hw_is_supportedfunction yt8521_led_hw_control_setfunction yt8521_led_hw_control_getfunction yt8531_config_initfunction yt8522_config_initfunction yt8531_link_change_notifyfunction yt8521_prepare_fiber_featuresfunction yt8521_fiber_setup_forcedfunction ytphy_check_and_restart_anegfunction yt8521_fiber_config_anegfunction ytphy_setup_master_slavefunction ytphy_utp_config_advertfunction ytphy_utp_config_aneg
Annotated Snippet
struct yt8521_priv {
/* combo_advertising is used for case of YT8521 in combo mode,
* this means that yt8521 may work in utp or fiber mode which depends
* on which media is connected (YT8521_RSSR_TO_BE_ARBITRATED).
*/
__ETHTOOL_DECLARE_LINK_MODE_MASK(combo_advertising);
/* YT8521_MODE_FIBER / YT8521_MODE_UTP / YT8521_MODE_POLL*/
u8 polling_mode;
u8 strap_mode; /* 8 working modes */
/* current reg page of yt8521 phy:
* YT8521_RSSR_UTP_SPACE
* YT8521_RSSR_FIBER_SPACE
* YT8521_RSSR_TO_BE_ARBITRATED
*/
u8 reg_page;
};
/**
* ytphy_read_ext() - read a PHY's extended register
* @phydev: a pointer to a &struct phy_device
* @regnum: register number to read
*
* NOTE:The caller must have taken the MDIO bus lock.
*
* returns the value of regnum reg or negative error code
*/
static int ytphy_read_ext(struct phy_device *phydev, u16 regnum)
{
int ret;
ret = __phy_write(phydev, YTPHY_PAGE_SELECT, regnum);
if (ret < 0)
return ret;
return __phy_read(phydev, YTPHY_PAGE_DATA);
}
/**
* ytphy_read_ext_with_lock() - read a PHY's extended register
* @phydev: a pointer to a &struct phy_device
* @regnum: register number to read
*
* returns the value of regnum reg or negative error code
*/
static int ytphy_read_ext_with_lock(struct phy_device *phydev, u16 regnum)
{
int ret;
phy_lock_mdio_bus(phydev);
ret = ytphy_read_ext(phydev, regnum);
phy_unlock_mdio_bus(phydev);
return ret;
}
/**
* ytphy_write_ext() - write a PHY's extended register
* @phydev: a pointer to a &struct phy_device
* @regnum: register number to write
* @val: value to write to @regnum
*
* NOTE:The caller must have taken the MDIO bus lock.
*
* returns 0 or negative error code
*/
static int ytphy_write_ext(struct phy_device *phydev, u16 regnum, u16 val)
{
int ret;
ret = __phy_write(phydev, YTPHY_PAGE_SELECT, regnum);
if (ret < 0)
return ret;
return __phy_write(phydev, YTPHY_PAGE_DATA, val);
}
/**
* ytphy_write_ext_with_lock() - write a PHY's extended register
* @phydev: a pointer to a &struct phy_device
* @regnum: register number to write
* @val: value to write to @regnum
*
* returns 0 or negative error code
*/
static int ytphy_write_ext_with_lock(struct phy_device *phydev, u16 regnum,
u16 val)
{
int ret;
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/kernel.h`, `linux/module.h`, `linux/phy.h`, `linux/property.h`.
- Detected declarations: `struct yt8521_priv`, `struct ytphy_cfg_reg_map`, `struct ytphy_ldo_vol_map`, `function ytphy_read_ext`, `function ytphy_read_ext_with_lock`, `function ytphy_write_ext`, `function ytphy_write_ext_with_lock`, `function ytphy_modify_ext`, `function ytphy_modify_ext_with_lock`, `function ytphy_get_wol`.
- 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.