drivers/net/dsa/mv88e6xxx/phy.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/mv88e6xxx/phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/mv88e6xxx/phy.c- Extension
.c- Size
- 6580 bytes
- Lines
- 282
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mdio.hlinux/module.hchip.hphy.h
Detected Declarations
function Copyrightfunction mv88e6165_phy_writefunction mv88e6xxx_phy_readfunction mv88e6xxx_phy_writefunction mv88e6xxx_phy_read_c45function mv88e6xxx_phy_write_c45function mv88e6xxx_phy_page_getfunction mv88e6xxx_phy_page_putfunction mv88e6xxx_phy_page_readfunction mv88e6xxx_phy_page_writefunction mv88e6xxx_phy_ppu_disablefunction mv88e6xxx_phy_ppu_enablefunction mv88e6xxx_phy_ppu_reenable_workfunction mv88e6xxx_phy_ppu_reenable_timerfunction mv88e6xxx_phy_ppu_access_getfunction mv88e6xxx_phy_ppu_access_putfunction mv88e6xxx_phy_ppu_state_initfunction mv88e6xxx_phy_ppu_state_destroyfunction mv88e6185_phy_ppu_readfunction mv88e6185_phy_ppu_writefunction mv88e6xxx_phy_initfunction mv88e6xxx_phy_destroyfunction mv88e6xxx_phy_setup
Annotated Snippet
if (ret < 0) {
mutex_unlock(&chip->ppu_mutex);
return ret;
}
chip->ppu_disabled = 1;
} else {
timer_delete(&chip->ppu_timer);
ret = 0;
}
return ret;
}
static void mv88e6xxx_phy_ppu_access_put(struct mv88e6xxx_chip *chip)
{
/* Schedule a timer to re-enable the PHY polling unit. */
mod_timer(&chip->ppu_timer, jiffies + msecs_to_jiffies(10));
mutex_unlock(&chip->ppu_mutex);
}
static void mv88e6xxx_phy_ppu_state_init(struct mv88e6xxx_chip *chip)
{
mutex_init(&chip->ppu_mutex);
INIT_WORK(&chip->ppu_work, mv88e6xxx_phy_ppu_reenable_work);
timer_setup(&chip->ppu_timer, mv88e6xxx_phy_ppu_reenable_timer, 0);
}
static void mv88e6xxx_phy_ppu_state_destroy(struct mv88e6xxx_chip *chip)
{
mutex_lock(&chip->ppu_mutex);
timer_delete_sync(&chip->ppu_timer);
cancel_work_sync(&chip->ppu_work);
mutex_unlock(&chip->ppu_mutex);
}
int mv88e6185_phy_ppu_read(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 *val)
{
int err;
err = mv88e6xxx_phy_ppu_access_get(chip);
if (!err) {
err = mv88e6xxx_read(chip, addr, reg, val);
mv88e6xxx_phy_ppu_access_put(chip);
}
return err;
}
int mv88e6185_phy_ppu_write(struct mv88e6xxx_chip *chip, struct mii_bus *bus,
int addr, int reg, u16 val)
{
int err;
err = mv88e6xxx_phy_ppu_access_get(chip);
if (!err) {
err = mv88e6xxx_write(chip, addr, reg, val);
mv88e6xxx_phy_ppu_access_put(chip);
}
return err;
}
void mv88e6xxx_phy_init(struct mv88e6xxx_chip *chip)
{
if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable)
mv88e6xxx_phy_ppu_state_init(chip);
}
void mv88e6xxx_phy_destroy(struct mv88e6xxx_chip *chip)
{
if (chip->info->ops->ppu_enable && chip->info->ops->ppu_disable)
mv88e6xxx_phy_ppu_state_destroy(chip);
}
int mv88e6xxx_phy_setup(struct mv88e6xxx_chip *chip)
{
return mv88e6xxx_phy_ppu_enable(chip);
}
Annotation
- Immediate include surface: `linux/mdio.h`, `linux/module.h`, `chip.h`, `phy.h`.
- Detected declarations: `function Copyright`, `function mv88e6165_phy_write`, `function mv88e6xxx_phy_read`, `function mv88e6xxx_phy_write`, `function mv88e6xxx_phy_read_c45`, `function mv88e6xxx_phy_write_c45`, `function mv88e6xxx_phy_page_get`, `function mv88e6xxx_phy_page_put`, `function mv88e6xxx_phy_page_read`, `function mv88e6xxx_phy_page_write`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.