summaryrefslogtreecommitdiff
path: root/include/miiphy.h
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2016-12-08 09:06:26 (GMT)
committerMichal Simek <michal.simek@xilinx.com>2016-12-20 06:40:04 (GMT)
commit79e2a6a04a2159c81dd08a2ba538edbe158e8a4e (patch)
tree73277ac60e4362d54722a3119738239ae6a11a34 /include/miiphy.h
parent4cf5c5f1e60e6541630ae829b5fa2db704c268f0 (diff)
downloadu-boot-fsl-qoriq-79e2a6a04a2159c81dd08a2ba538edbe158e8a4e.tar.xz
common: miiphyutil: Add helper function for mdio bus name
The most of ethernet drivers are using this mdio registration sequence. strcpy(priv->bus->name, "emac"); mdio_register(priv->bus); Where driver can be used only with one MDIO bus because only unique name should be used. Other drivers are using unique device name for MDIO registration to support multiple instances. snprintf(priv->bus->name, sizeof(bus->name), "%s", name); With DM dev->seq is used more even in logs (like random MAC address generation: printf("\nWarning: %s (eth%d) using random MAC address - %pM\n", dev->name, dev->seq, pdata->enetaddr); ) where eth%d prefix is used. Simplify driver code to register mdio device with dev->seq number to simplify mdio registration and reduce code duplication across all drivers. With DM_SEQ_ALIAS enabled dev->seq reflects alias setting. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/miiphy.h')
-rw-r--r--include/miiphy.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/miiphy.h b/include/miiphy.h
index 83141b4..fe8928a 100644
--- a/include/miiphy.h
+++ b/include/miiphy.h
@@ -48,6 +48,15 @@ void miiphy_listdev(void);
struct mii_dev *mdio_alloc(void);
void mdio_free(struct mii_dev *bus);
int mdio_register(struct mii_dev *bus);
+
+/**
+ * mdio_register_seq - Register mdio bus with sequence number
+ * @bus: mii device structure
+ * @seq: sequence number
+ *
+ * Return: 0 if success, negative value if error
+ */
+int mdio_register_seq(struct mii_dev *bus, int seq);
int mdio_unregister(struct mii_dev *bus);
void mdio_list_devices(void);