lan937x_create_phy_addr_map(9)
π
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:
- 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 π
- 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 π
0on success π- an error code on failure π
π§ SEE ALSO π§
- Kernel file
./drivers/net/dsa/microchip/lan937x_main.cβ go read the source, iykyk π lan937x_mdio_bus_preinit(9)lan937x_mdio_register(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms