lan937x_create_phy_addr_map(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… lan937x_create_phy_addr_map β€” Kernel API Manual ✨

okay so bestie, welcome to the lan937x_create_phy_addr_map era πŸŽ€ this one's from the Kernel API Manual and it's literally the girl who builds the port-to-PHY address map for the MDIO bus. she's giving infrastructure. she's giving "you literally cannot talk to your PHYs without me." no cap πŸ’…


✨ SYNOPSIS ✨

int lan937x_create_phy_addr_map (struct ksz_device *dev , bool side_mdio
);

like yes, that's the whole signature, she's not doing a lot of talking up front 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” a pointer to the device structure. your whole personality, basically ✨
  • side_mdio β€” a boolean that tells her whether the PHYs are being accessed over a side MDIO bus. <italic>true</italic> = yep, side MDIO. <italic>false</italic> = nope, not today 🌸

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea β˜• this function sets up the PHY address mapping for the LAN937x switches, and those switches support two access modes for internal PHYs:

  1. SPI Access β€” honestly the chill one. a straightforward one-to-one port-to-PHY address mapping gets applied. port one β†’ PHY one, port two β†’ PHY two, you get it, she ate πŸ’…
  2. MDIO Access β€” this is where it gets spicy 🌢️ the PHY address mapping varies based on chip variant and strap configuration. an offset gets calculated from the strap settings so the correct PHY addresses actually get assigned. the offset calculation logic is based on Microchip's Article Number 000015828, available at: https://microchip.my.site.com/s/article/LAN9374-Virtual-PHY-PHY-Address-Mapping

the way she works it: first she checks if side MDIO access is disabled β€” and if it is, boom, a simple direct mapping goes in (port number = PHY address), easy slay ✨. but if side MDIO access is enabled, she reads the strap configuration to figure out the correct offset for the PHY addresses πŸ”₯

then the appropriate mapping table gets selected based on the chip ID πŸ‘‘, and phy_addr_map gets populated with the correct addresses for each port. and any port with no PHY? she assigns it a LAN937X_NO_PHY marker, so nobody's confused about who's invited to the party πŸ™ˆ

ngl this is genuinely important β€” get the mapping wrong and your ports are texting a PHY that doesn't exist. the strap-based offset is not optional vibes, it's load-bearing 😭

🌈 RETURN 🌈

  • 0 on success πŸ’–
  • an error code on failure πŸ’€

🧚 SEE ALSO 🧚


that's the whole page bestie, go forth and map those PHY addresses πŸ¦‹

source path: ./drivers/net/dsa/microchip Β· dated: October 2026 Β· page: lan937x_create_phy_addr_map(9) β€” mwah, stan this manpage, periodt πŸ’…πŸ’œ

πŸ“¦ where this page comes from