drivers/net/phy/marvell10g.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/marvell10g.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/marvell10g.c- Extension
.c- Size
- 40045 bytes
- Lines
- 1487
- 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/ctype.hlinux/delay.hlinux/hwmon.hlinux/marvell_phy.hlinux/phy.hlinux/phy_port.hlinux/netdevice.h
Detected Declarations
struct mv3310_mactypestruct mv3310_chipstruct mv3310_privfunction mv3310_hwmon_is_visiblefunction mv3310_hwmon_read_temp_regfunction mv2110_hwmon_read_temp_regfunction mv3310_hwmon_readfunction mv3310_hwmon_configfunction mv3310_hwmon_probefunction mv3310_hwmon_configfunction mv3310_hwmon_probefunction mv3310_power_downfunction mv3310_power_upfunction mv3310_resetfunction mv3310_get_downshiftfunction mv3310_set_downshiftfunction mv3310_get_edpdfunction mv3310_set_edpdfunction mv3310_attach_mii_portfunction mv3310_attach_mdi_portfunction mv3310_probefunction mv3310_removefunction mv3310_suspendfunction mv3310_resumefunction mv3310_has_pma_ngbaset_quirkfunction mv2110_get_mactypefunction mv2110_set_mactypefunction mv2110_select_mactypefunction mv3310_get_mactypefunction mv3310_set_mactypefunction mv3310_select_mactypefunction mv3310_fill_possible_interfacesfunction mv3310_config_initfunction mv3310_get_featuresfunction mv3310_config_mdixfunction mv3310_config_anegfunction mv3310_aneg_donefunction mv3310_update_interfacefunction mv3310_read_status_10gbaserfunction mv3310_read_status_copperfunction mv3310_read_statusfunction mv3310_get_tunablefunction mv3310_set_tunablefunction mv3310_has_downshiftfunction mv3310_init_supported_interfacesfunction mv3340_init_supported_interfacesfunction mv2110_init_supported_interfacesfunction mv2111_init_supported_interfaces
Annotated Snippet
struct mv3310_mactype {
bool valid;
bool fixed_interface;
phy_interface_t interface_10g;
};
struct mv3310_chip {
bool (*has_downshift)(struct phy_device *phydev);
void (*init_supported_interfaces)(unsigned long *mask);
int (*get_mactype)(struct phy_device *phydev);
int (*set_mactype)(struct phy_device *phydev, int mactype);
int (*select_mactype)(unsigned long *interfaces);
const struct mv3310_mactype *mactypes;
size_t n_mactypes;
#ifdef CONFIG_HWMON
int (*hwmon_read_temp_reg)(struct phy_device *phydev);
#endif
};
struct mv3310_priv {
DECLARE_BITMAP(supported_interfaces, PHY_INTERFACE_MODE_MAX);
const struct mv3310_mactype *mactype;
u32 firmware_ver;
bool has_downshift;
struct device *hwmon_dev;
char *hwmon_name;
};
static const struct mv3310_chip *to_mv3310_chip(struct phy_device *phydev)
{
return phydev->drv->driver_data;
}
#ifdef CONFIG_HWMON
static umode_t mv3310_hwmon_is_visible(const void *data,
enum hwmon_sensor_types type,
u32 attr, int channel)
{
if (type == hwmon_chip && attr == hwmon_chip_update_interval)
return 0444;
if (type == hwmon_temp && attr == hwmon_temp_input)
return 0444;
return 0;
}
static int mv3310_hwmon_read_temp_reg(struct phy_device *phydev)
{
return phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_TEMP);
}
static int mv2110_hwmon_read_temp_reg(struct phy_device *phydev)
{
return phy_read_mmd(phydev, MDIO_MMD_PCS, MV_PCS_TEMP);
}
static int mv3310_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
u32 attr, int channel, long *value)
{
struct phy_device *phydev = dev_get_drvdata(dev);
const struct mv3310_chip *chip = to_mv3310_chip(phydev);
int temp;
if (type == hwmon_chip && attr == hwmon_chip_update_interval) {
*value = MSEC_PER_SEC;
return 0;
}
if (type == hwmon_temp && attr == hwmon_temp_input) {
temp = chip->hwmon_read_temp_reg(phydev);
if (temp < 0)
return temp;
*value = ((temp & 0xff) - 75) * 1000;
return 0;
}
return -EOPNOTSUPP;
}
static const struct hwmon_ops mv3310_hwmon_ops = {
.is_visible = mv3310_hwmon_is_visible,
.read = mv3310_hwmon_read,
};
static const struct hwmon_channel_info * const mv3310_hwmon_info[] = {
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/ctype.h`, `linux/delay.h`, `linux/hwmon.h`, `linux/marvell_phy.h`, `linux/phy.h`, `linux/phy_port.h`, `linux/netdevice.h`.
- Detected declarations: `struct mv3310_mactype`, `struct mv3310_chip`, `struct mv3310_priv`, `function mv3310_hwmon_is_visible`, `function mv3310_hwmon_read_temp_reg`, `function mv2110_hwmon_read_temp_reg`, `function mv3310_hwmon_read`, `function mv3310_hwmon_config`, `function mv3310_hwmon_probe`, `function mv3310_hwmon_config`.
- 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.