diff options
-rw-r--r-- | common/miiphyutil.c | 12 | ||||
-rw-r--r-- | include/miiphy.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/common/miiphyutil.c b/common/miiphyutil.c index aca18db52a..0a83d6463d 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -107,6 +107,18 @@ int mdio_register(struct mii_dev *bus) return 0; } +int mdio_register_seq_name(struct mii_dev *bus, int seq) +{ + int ret; + + /* Setup a unique name for each mdio bus */ + ret = snprintf(bus->name, MDIO_NAME_LEN, "eth%d", seq); + if (ret < 0) + return ret; + + return mdio_register(bus); +} + int mdio_unregister(struct mii_dev *bus) { if (!bus) diff --git a/include/miiphy.h b/include/miiphy.h index 83141b4a6a..47923bfbf6 100644 --- a/include/miiphy.h +++ b/include/miiphy.h @@ -48,6 +48,7 @@ void miiphy_listdev(void); struct mii_dev *mdio_alloc(void); void mdio_free(struct mii_dev *bus); int mdio_register(struct mii_dev *bus); +int mdio_register_seq_name(struct mii_dev *bus, int seq); int mdio_unregister(struct mii_dev *bus); void mdio_list_devices(void); |