ks8851_phy_read(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ks8851_phy_read β€” from the Kernel API Manual

okay so bestie, welcome to ks8851_phy_read(9) ✨ this is the lil function that goes and reads a PHY register over the MII interface, and honestly? it's doing the most with the least. let's get into it πŸŽ€


✨ NAME ✨

ks8851_phy_read β€” MII interface PHY register read. that's it, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

int ks8851_phy_read (struct net_device *dev , int phy_addr , int reg );

three args in, one int out, no cap 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the network device the PHY is on. that's the whole context, she lives there 🏠
  • phy_addr β€” address of the PHY, but like... it's ignored, because we only have one. so yeah, bestie, it's giving decorative parameter 😭
  • reg β€” the register to read. this one actually matters πŸ’–

πŸ‘‘ DESCRIPTION πŸ‘‘

so this call reads data from the PHY register specified in reg. simple enough, right? except the device does not support all the MII registers, and for the ones that don't exist? the values come back as zero. always. every time. zero 🫠

and here's the tea on why we return zero for unsupported registers: the MII code does not check the value returned for any error status β€” it literally just hands it straight back to the caller, no vibe check, nothing. and the mii-tool that the driver was tested with? she takes any -ve error as real PHY capabilities, which means it'd display straight-up incorrect data to the user. we're not doing that to people. so, zero it is ✨


πŸ”₯ SEE ALSO πŸ”₯

kernel file: ./drivers/net/ethernet/micrel/ks8851_common.c

and the whole friend group, no one left out:

ks8851_lock(9), ks8851_unlock(9), ks8851_wrreg16(9), ks8851_rdreg16(9), ks8851_soft_reset(9), ks8851_set_powermode(9), ks8851_write_mac_addr(9), ks8851_read_mac_addr(9), ks8851_init_mac(9), ks8851_rx_pkts(9), ks8851_irq(9), ks8851_flush_tx_work(9), ks8851_net_open(9), ks8851_net_stop(9), ks8851_start_xmit(9), ks8851_rxctrl_work(9), ks8851_eeprom_claim(9), ks8851_eeprom_release(9), ks8851_phy_reg(9), ks8851_read_selftest(9)


okay that's the page!! this one lives in ./drivers/net/ethernet/micrel, dated October 2026, and it's filed under ks8851_phy_read(9) β€” mwah, go read some registers responsibly πŸ’œβœ¨

πŸ“¦ where this page comes from