diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2022-09-20 14:55:32 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-09-22 11:28:47 +0200 |
commit | 8abc2059298d228eefbd851b713c6cb50d6f5e11 (patch) | |
tree | b30807819b062105ea02c65a7720b706b8c2acfc /include | |
parent | 5a2f0d141912524c6e39349f53519bd7f77f1e5c (diff) | |
download | barebox-8abc2059298d228eefbd851b713c6cb50d6f5e11.tar.gz barebox-8abc2059298d228eefbd851b713c6cb50d6f5e11.tar.xz |
net: add support for MDIO devices
On the MDIO bus we can have PHYs and some other type of devices.
Typical not_PHY MDIO devices do not have easy detectable ID and can't be
used as-is by the PHY framework. So, add additional handler to register
MDIO devices and drivers alongside with the PHY devices/drivers.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20220920125533.2497108-2-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mdio.h | 14 | ||||
-rw-r--r-- | include/linux/phy.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/mdio.h b/include/linux/mdio.h index b910b05cec..a4aee49d8d 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -326,4 +326,18 @@ static inline __u16 mdio_phy_id_c45(int prtad, int devad) #define MDIO_DEVAD_NONE (-1) +struct phy_driver; + +int mdio_driver_register(struct phy_driver *drv); + +#define mdio_register_driver_macro(level, drv) \ + static int __init drv##_register(void) \ + { \ + return mdio_driver_register(&drv); \ + } \ + level##_initcall(drv##_register) + +#define device_mdio_driver(drv) \ + mdio_register_driver_macro(device, drv) + #endif /* _UAPI__LINUX_MDIO_H__ */ diff --git a/include/linux/phy.h b/include/linux/phy.h index a4c3f43c06..ba1740ff55 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -223,6 +223,7 @@ struct phy_driver { unsigned int phy_id_mask; u32 features; const void *driver_data; + bool is_phy; /* * Called to initialize the PHY, |