STRUCT MII_BUS(9)
β¨ struct mii_bus(9) β¨
okay so bestie, we're in the struct mii_bus(9) page β the Kernel API Manual entry β and it's literally the blueprint for an MDIO bus. no cap, this is the glow-up doc for the thing that talks to your PHYs. let's get into it π
πΈ NAME πΈ
struct mii_bus β Represents an MDIO bus π¦
π SYNOPSIS π
like, here's the whole struct, every single field, in order, don't touch:
struct mii_bus {
struct module *owner;
const char *name;
char id[MII_BUS_ID_SIZE];
void *priv;
int (*read)(struct mii_bus *bus, int addr, int regnum);
int (*write)(struct mii_bus *bus, int addr, int regnum, u16 val);
int (*read_c45)(struct mii_bus *bus, int addr, int devnum, int regnum);
int (*write_c45)(struct mii_bus *bus, int addr, int devnum, int regnum, u16 val);
int (*reset)(struct mii_bus *bus);
struct mdio_bus_stats stats[PHY_MAX_ADDR];
struct mutex mdio_lock;
struct device *parent;
enum {
MDIOBUS_ALLOCATED = 1,
MDIOBUS_REGISTERED,
MDIOBUS_UNREGISTERED,
MDIOBUS_RELEASED,
} state;
struct device dev;
struct mdio_device *mdio_map[PHY_MAX_ADDR];
u32 phy_mask;
u32 phy_ignore_ta_mask;
int irq[PHY_MAX_ADDR];
int reset_delay_us;
int reset_post_delay_us;
struct gpio_desc *reset_gpiod;
struct mutex shared_lock;
#if IS_ENABLED(CONFIG_PHY_PACKAGE);
struct phy_package_shared *shared[PHY_MAX_ADDR];
#endif;
};
π«Ά Members π«Ά
every field gets its moment, bestie, no skipping:
ownerβ who owns this device πnameβ user friendly name for this MDIO device, or the driver nameidβ unique identifier for this bus, typically from bus hierarchyprivβ driver private data πreadβ perform a read transfer on the buswriteβ perform a write transfer on the busread_c45β perform a C45 read transfer on the buswrite_c45β perform a C45 write transfer on the busresetβ perform a reset of the bus π₯statsβ statistic counters per device on the busmdio_lockβ a lock to ensure that only one thing can read/write the MDIO bus at a timeparentβ parent device of this busstateβ state of bus structuredevβ kernel device representationmdio_mapβ list of all MDIO devices on busphy_maskβ PHY addresses to be ignored when probingphy_ignore_ta_maskβ PHY addresses to ignore the TA/read failureirqβ an array of interrupts, each PHY's interrupt at the index matching its addressreset_delay_usβ GPIO reset pulse width in microsecondsreset_post_delay_usβ GPIO reset deassert delay in microsecondsreset_gpiodβ Reset GPIO descriptor pointershared_lockβ protect access to the shared elementsharedβ shared state across different PHYs
π Description π
the Bus class for PHYs, periodt. devices which provide access to PHYs should register using this structure β¨
π SEE ALSO π
kernel file ./include/linux/phy.h β and yes, the whole friend group is here π
enum phy_interface_t(9)phy_modes(9)rgmii_clock(9)struct mdio_bus_stats(9)mdiobus_alloc(9)enum phy_state(9)struct phy_c45_device_ids(9)struct phy_oatc14_sqi_capability(9)struct phy_device(9)struct phy_tdr_config(9)enum link_inband_signalling(9)struct phy_plca_cfg(9)struct phy_plca_status(9)struct phy_led(9)struct phy_mse_capability(9)struct phy_mse_snapshot(9)struct phy_driver(9)phy_id_compare(9)phy_id_compare_vendor(9)phy_id_compare_model(9)phydev_id_compare(9)phy_is_started(9)phy_driver_is_genphy(9)phy_disable_eee_mode(9)phy_can_wakeup(9)phy_may_wakeup(9)phy_read(9)__phy_read(9)phy_write(9)__phy_write(9)__phy_modify_changed(9)phy_read_mmd_poll_timeout(9)__phy_set_bits(9)__phy_clear_bits(9)phy_set_bits(9)phy_clear_bits(9)__phy_set_bits_mmd(9)__phy_clear_bits_mmd(9)phy_set_bits_mmd(9)phy_clear_bits_mmd(9)phy_interrupt_is_valid(9)phy_polling_mode(9)phy_has_hwtstamp(9)phy_has_rxtstamp(9)phy_has_tsinfo(9)phy_has_txtstamp(9)phy_is_default_hwtstamp(9)phy_on_sfp(9)phy_interface_mode_is_rgmii(9)phy_interface_mode_is_8023z(9)phy_interface_is_rgmii(9)phy_is_pseudo_fixed_link(9)phy_module_driver(9)
and that's the whole thing, bestie π this page lives in ./include/linux and it's dated October 2026 β so like, future vibes, iconic. go read your PHY headers, mwah ππ
π¦ 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