drivers/net/phy/mediatek/mtk-2p5ge.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/mediatek/mtk-2p5ge.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/mediatek/mtk-2p5ge.c- Extension
.c- Size
- 11432 bytes
- Lines
- 414
- 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/bitfield.hlinux/firmware.hlinux/module.hlinux/of_address.hlinux/of_platform.hlinux/pinctrl/consumer.hlinux/phy.hmtk.h
Detected Declarations
function mt798x_2p5ge_phy_load_fwfunction mt798x_2p5ge_phy_config_initfunction mt798x_2p5ge_phy_config_anegfunction mt798x_2p5ge_phy_get_featuresfunction mt798x_2p5ge_phy_read_statusfunction phy_resolve_aneg_linkmodefunction mt798x_2p5ge_phy_get_rate_matchingfunction mt798x_2p5ge_phy_led_blink_setfunction mt798x_2p5ge_phy_led_brightness_setfunction mt798x_2p5ge_phy_led_hw_is_supportedfunction mt798x_2p5ge_phy_led_hw_control_getfunction mt798x_2p5ge_phy_led_hw_control_setfunction mt798x_2p5ge_phy_probe
Annotated Snippet
switch (FIELD_GET(PHY_AUX_SPEED_MASK, ret)) {
case PHY_AUX_SPD_10:
phydev->speed = SPEED_10;
break;
case PHY_AUX_SPD_100:
phydev->speed = SPEED_100;
break;
case PHY_AUX_SPD_1000:
phydev->speed = SPEED_1000;
break;
case PHY_AUX_SPD_2500:
phydev->speed = SPEED_2500;
break;
}
phydev->duplex = DUPLEX_FULL;
phydev->rate_matching = RATE_MATCH_PAUSE;
}
return 0;
}
static int mt798x_2p5ge_phy_get_rate_matching(struct phy_device *phydev,
phy_interface_t iface)
{
return RATE_MATCH_PAUSE;
}
static const unsigned long supported_triggers =
BIT(TRIGGER_NETDEV_FULL_DUPLEX) |
BIT(TRIGGER_NETDEV_LINK) |
BIT(TRIGGER_NETDEV_LINK_10) |
BIT(TRIGGER_NETDEV_LINK_100) |
BIT(TRIGGER_NETDEV_LINK_1000) |
BIT(TRIGGER_NETDEV_LINK_2500) |
BIT(TRIGGER_NETDEV_RX) |
BIT(TRIGGER_NETDEV_TX);
static int mt798x_2p5ge_phy_led_blink_set(struct phy_device *phydev, u8 index,
unsigned long *delay_on,
unsigned long *delay_off)
{
bool blinking = false;
int err = 0;
err = mtk_phy_led_num_dly_cfg(index, delay_on, delay_off, &blinking);
if (err < 0)
return err;
err = mtk_phy_hw_led_blink_set(phydev, index, blinking);
if (err)
return err;
if (blinking)
mtk_phy_hw_led_on_set(phydev, index, MTK_2P5GPHY_LED_ON_MASK,
false);
return 0;
}
static int mt798x_2p5ge_phy_led_brightness_set(struct phy_device *phydev,
u8 index,
enum led_brightness value)
{
int err;
err = mtk_phy_hw_led_blink_set(phydev, index, false);
if (err)
return err;
return mtk_phy_hw_led_on_set(phydev, index, MTK_2P5GPHY_LED_ON_MASK,
(value != LED_OFF));
}
static int mt798x_2p5ge_phy_led_hw_is_supported(struct phy_device *phydev,
u8 index, unsigned long rules)
{
return mtk_phy_led_hw_is_supported(phydev, index, rules,
supported_triggers);
}
static int mt798x_2p5ge_phy_led_hw_control_get(struct phy_device *phydev,
u8 index, unsigned long *rules)
{
return mtk_phy_led_hw_ctrl_get(phydev, index, rules,
MTK_2P5GPHY_LED_ON_SET,
MTK_2P5GPHY_LED_RX_BLINK_SET,
MTK_2P5GPHY_LED_TX_BLINK_SET);
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/firmware.h`, `linux/module.h`, `linux/of_address.h`, `linux/of_platform.h`, `linux/pinctrl/consumer.h`, `linux/phy.h`, `mtk.h`.
- Detected declarations: `function mt798x_2p5ge_phy_load_fw`, `function mt798x_2p5ge_phy_config_init`, `function mt798x_2p5ge_phy_config_aneg`, `function mt798x_2p5ge_phy_get_features`, `function mt798x_2p5ge_phy_read_status`, `function phy_resolve_aneg_linkmode`, `function mt798x_2p5ge_phy_get_rate_matching`, `function mt798x_2p5ge_phy_led_blink_set`, `function mt798x_2p5ge_phy_led_brightness_set`, `function mt798x_2p5ge_phy_led_hw_is_supported`.
- 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.