net: add MDIO_MUX DM class

Adds a class for MDIO MUXes, which control access to a series of
downstream child MDIOs.
MDIO MUX drivers are required to implement a select function used to switch
between child buses.
MUX children are registered as MDIO buses and they can be used just like
regular MDIOs.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
Alex Marginean
2019-07-12 10:13:50 +03:00
committed by Joe Hershberger
parent c38ac2893c
commit 8880edba06
5 changed files with 266 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ enum uclass_id {
UCLASS_MAILBOX, /* Mailbox controller */
UCLASS_MASS_STORAGE, /* Mass storage device */
UCLASS_MDIO, /* MDIO bus */
UCLASS_MDIO_MUX, /* MDIO MUX/switch */
UCLASS_MISC, /* Miscellaneous device */
UCLASS_MMC, /* SD / MMC card or chip */
UCLASS_MOD_EXP, /* RSA Mod Exp device */

View File

@@ -167,4 +167,24 @@ struct phy_device *dm_mdio_phy_connect(struct udevice *dev, int addr,
#endif
#ifdef CONFIG_DM_MDIO_MUX
/* indicates none of the child buses is selected */
#define MDIO_MUX_SELECT_NONE -1
/**
* struct mdio_mux_ops - MDIO MUX operations
*
* @select: Selects a child bus
* @deselect: Clean up selection. Optional, can be NULL
*/
struct mdio_mux_ops {
int (*select)(struct udevice *mux, int cur, int sel);
int (*deselect)(struct udevice *mux, int sel);
};
#define mdio_mux_get_ops(dev) ((struct mdio_mux_ops *)(dev)->driver->ops)
#endif
#endif