lan78xx_mac_prepare_for_phy(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… lan78xx_mac_prepare_for_phy(9)

okay so this is a page straight out of the Kernel API Manual, and bestie, it's literally about preconfiguring the MAC-side interface settings before the PHY stuff happens. tiny function, big main character energy. let's get into it 🫢


✨ NAME ✨

lan78xx_mac_prepare_for_phy β€” preconfigure MAC-side interface settings ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

int lan78xx_mac_prepare_for_phy (struct lan78xx_net *dev );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” the LAN78xx device, obvs πŸ’–

🌸 DESCRIPTION 🌸

So what this does is configure the MAC-side registers according to dev->interface, and ngl that field should already be set by lan78xx_get_phy. like, that's the whole vibe check here πŸ’…

Here's the tea, per interface mode:

  • For PHY_INTERFACE_MODE_RGMII: it enables MAC-side TXC delay. no cap, this mode seems to be used in a special setup without a real PHY β€” likely on EVB-KSZ9897-1. in that design, LAN7801 is connected to the KSZ9897 switch, and the link timing is expected to be hardwired (e.g. via strapping or board layout). and no devicetree support is assumed here either. that's just how it is πŸ€·β€β™€οΈ
  • For PHY_INTERFACE_MODE_RGMII_ID: it disables the MAC-side delay and relies on the PHY driver to provide the delay instead. handing off the job, iconic behavior πŸ’…
  • For GMII: no MAC-specific config is needed. nothing to do, we love a low-effort moment ✨

⭐ RETURN ⭐

0 on success, or a negative error code 😭 (so like, check the return value, bestie, pls)

πŸ¦„ SEE ALSO πŸ¦„

Kernel file ./drivers/net/usb/lan78xx.c plus all these lil friends:

lowkey go read those too, iykyk πŸ‘€

and that's the whole page fr fr πŸ“ this lil gem lives in ./drivers/net/usb and the version/date on it is October 2026 β€” so yeah, future-coded docs, slay πŸ’œβœ¨

πŸ“¦ where this page comes from