drivers/net/phy/icplus.c
Source file repositories/reference/linux-study-clean/drivers/net/phy/icplus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/phy/icplus.c- Extension
.c- Size
- 15319 bytes
- Lines
- 636
- 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.
- 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/kernel.hlinux/string.hlinux/errno.hlinux/unistd.hlinux/interrupt.hlinux/init.hlinux/delay.hlinux/netdevice.hlinux/etherdevice.hlinux/skbuff.hlinux/spinlock.hlinux/mm.hlinux/module.hlinux/mii.hlinux/ethtool.hlinux/phy.hlinux/property.hasm/io.hasm/irq.hlinux/uaccess.h
Detected Declarations
struct ip101g_hw_statstruct ip101a_g_phy_privenum ip101gr_sel_intr32function ip175c_config_initfunction ip1001_config_initfunction ip175c_read_statusfunction ip175c_config_anegfunction ip101a_g_probefunction device_property_read_boolfunction ip101a_g_config_intr_pinfunction ip101a_config_initfunction ip101g_config_initfunction ip101a_g_read_statusfunction ip101a_g_config_mdixfunction ip101a_g_config_anegfunction ip101a_g_ack_interruptfunction ip101a_g_config_intrfunction ip101a_g_handle_interruptfunction ip101a_read_pagefunction ip101a_write_pagefunction ip101g_read_pagefunction ip101g_write_pagefunction ip101a_g_has_page_registerfunction ip101a_g_match_phy_devicefunction ip101a_match_phy_devicefunction ip101g_match_phy_devicefunction ip101g_get_sset_countfunction ip101g_get_stringsfunction ip101g_get_statfunction ip101g_get_stats
Annotated Snippet
struct ip101g_hw_stat {
const char *name;
int page;
};
static struct ip101g_hw_stat ip101g_hw_stats[] = {
{ "phy_crc_errors", 1 },
{ "phy_symbol_errors", 11, },
};
struct ip101a_g_phy_priv {
enum ip101gr_sel_intr32 sel_intr32;
u64 stats[ARRAY_SIZE(ip101g_hw_stats)];
};
static int ip175c_config_init(struct phy_device *phydev)
{
int err, i;
static int full_reset_performed;
if (full_reset_performed == 0) {
/* master reset */
err = mdiobus_write(phydev->mdio.bus, 30, 0, 0x175c);
if (err < 0)
return err;
/* ensure no bus delays overlap reset period */
err = mdiobus_read(phydev->mdio.bus, 30, 0);
/* data sheet specifies reset period is 2 msec */
mdelay(2);
/* enable IP175C mode */
err = mdiobus_write(phydev->mdio.bus, 29, 31, 0x175c);
if (err < 0)
return err;
/* Set MII0 speed and duplex (in PHY mode) */
err = mdiobus_write(phydev->mdio.bus, 29, 22, 0x420);
if (err < 0)
return err;
/* reset switch ports */
for (i = 0; i < 5; i++) {
err = mdiobus_write(phydev->mdio.bus, i,
MII_BMCR, BMCR_RESET);
if (err < 0)
return err;
}
for (i = 0; i < 5; i++)
err = mdiobus_read(phydev->mdio.bus, i, MII_BMCR);
mdelay(2);
full_reset_performed = 1;
}
if (phydev->mdio.addr != 4) {
phydev->state = PHY_RUNNING;
phydev->speed = SPEED_100;
phydev->duplex = DUPLEX_FULL;
phydev->link = 1;
netif_carrier_on(phydev->attached_dev);
}
return 0;
}
static int ip1001_config_init(struct phy_device *phydev)
{
int c;
/* Enable Auto Power Saving mode */
c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2);
if (c < 0)
return c;
c |= IP1001_APS_ON;
c = phy_write(phydev, IP1001_SPEC_CTRL_STATUS_2, c);
if (c < 0)
return c;
if (phy_interface_is_rgmii(phydev)) {
c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
if (c < 0)
return c;
c &= ~(IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/string.h`, `linux/errno.h`, `linux/unistd.h`, `linux/interrupt.h`, `linux/init.h`, `linux/delay.h`, `linux/netdevice.h`.
- Detected declarations: `struct ip101g_hw_stat`, `struct ip101a_g_phy_priv`, `enum ip101gr_sel_intr32`, `function ip175c_config_init`, `function ip1001_config_init`, `function ip175c_read_status`, `function ip175c_config_aneg`, `function ip101a_g_probe`, `function device_property_read_bool`, `function ip101a_g_config_intr_pin`.
- 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.