drivers/net/phy/ste10Xp.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/ste10Xp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/ste10Xp.c- Extension
.c- Size
- 3034 bytes
- Lines
- 138
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/sched.hlinux/kernel.hlinux/moduleparam.hlinux/interrupt.hlinux/netdevice.hlinux/ethtool.hlinux/mii.hlinux/phy.h
Detected Declarations
function Copyrightfunction ste10Xp_ack_interruptfunction ste10Xp_config_intrfunction ste10Xp_handle_interrupt
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* drivers/net/phy/ste10Xp.c
*
* Driver for STMicroelectronics STe10Xp PHYs
*
* Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
*
* Copyright (c) 2008 STMicroelectronics Limited
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/moduleparam.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/phy.h>
#define MII_XCIIS 0x11 /* Configuration Info IRQ & Status Reg */
#define MII_XIE 0x12 /* Interrupt Enable Register */
#define MII_XIE_DEFAULT_MASK 0x0070 /* ANE complete, Remote Fault, Link Down */
#define STE101P_PHY_ID 0x00061c50
#define STE100P_PHY_ID 0x1c040011
static int ste10Xp_config_init(struct phy_device *phydev)
{
int value, err;
/* Software Reset PHY */
value = phy_read(phydev, MII_BMCR);
if (value < 0)
return value;
value |= BMCR_RESET;
err = phy_write(phydev, MII_BMCR, value);
if (err < 0)
return err;
do {
value = phy_read(phydev, MII_BMCR);
} while (value & BMCR_RESET);
return 0;
}
static int ste10Xp_ack_interrupt(struct phy_device *phydev)
{
int err = phy_read(phydev, MII_XCIIS);
if (err < 0)
return err;
return 0;
}
static int ste10Xp_config_intr(struct phy_device *phydev)
{
int err;
if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
/* clear any pending interrupts */
err = ste10Xp_ack_interrupt(phydev);
if (err)
return err;
/* Enable all STe101P interrupts (PR12) */
err = phy_write(phydev, MII_XIE, MII_XIE_DEFAULT_MASK);
} else {
err = phy_write(phydev, MII_XIE, 0);
if (err)
return err;
err = ste10Xp_ack_interrupt(phydev);
}
return err;
}
static irqreturn_t ste10Xp_handle_interrupt(struct phy_device *phydev)
{
int irq_status;
irq_status = phy_read(phydev, MII_XCIIS);
if (irq_status < 0) {
phy_error(phydev);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/sched.h`, `linux/kernel.h`, `linux/moduleparam.h`, `linux/interrupt.h`, `linux/netdevice.h`, `linux/ethtool.h`.
- Detected declarations: `function Copyright`, `function ste10Xp_ack_interrupt`, `function ste10Xp_config_intr`, `function ste10Xp_handle_interrupt`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.