diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c
index 894b52e..c8a2e28 100644
--- a/drivers/net/fsl_mdio.c
+++ b/drivers/net/fsl_mdio.c
@@ -12,6 +12,12 @@
 #include <asm/io.h>
 #include <linux/errno.h>
 
+#ifdef CONFIG_DM_ETH
+struct tsec_mdio_priv {
+	struct tsec_mii_mng __iomem *regs;
+};
+#endif
+
 void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr,
 		int dev_addr, int regnum, int value)
 {
@@ -58,8 +64,18 @@ int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr,
 
 static int fsl_pq_mdio_reset(struct mii_dev *bus)
 {
-	struct tsec_mii_mng __iomem *regs =
-		(struct tsec_mii_mng __iomem *)bus->priv;
+	struct tsec_mii_mng __iomem *regs;
+#ifndef CONFIG_DM_ETH
+	regs = (struct tsec_mii_mng __iomem *)bus->priv;
+#else
+	struct tsec_mdio_priv *priv;
+
+	if (!bus->priv)
+		return -EINVAL;
+
+	priv = dev_get_priv(bus->priv);
+	regs = priv->regs;
+#endif
 
 	/* Reset MII (due to new addresses) */
 	out_be32(&regs->miimcfg, MIIMCFG_RESET_MGMT);
@@ -74,8 +90,18 @@ static int fsl_pq_mdio_reset(struct mii_dev *bus)
 
 int tsec_phy_read(struct mii_dev *bus, int addr, int dev_addr, int regnum)
 {
-	struct tsec_mii_mng __iomem *phyregs =
-		(struct tsec_mii_mng __iomem *)bus->priv;
+	struct tsec_mii_mng __iomem *phyregs;
+#ifndef CONFIG_DM_ETH
+	phyregs = (struct tsec_mii_mng __iomem *)bus->priv;
+#else
+	struct tsec_mdio_priv *priv;
+
+	if (!bus->priv)
+		return -EINVAL;
+
+	priv = dev_get_priv(bus->priv);
+	phyregs = priv->regs;
+#endif
 
 	return tsec_local_mdio_read(phyregs, addr, dev_addr, regnum);
 }
@@ -83,14 +109,25 @@ int tsec_phy_read(struct mii_dev *bus, int addr, int dev_addr, int regnum)
 int tsec_phy_write(struct mii_dev *bus, int addr, int dev_addr, int regnum,
 			u16 value)
 {
-	struct tsec_mii_mng __iomem *phyregs =
-		(struct tsec_mii_mng __iomem *)bus->priv;
+	struct tsec_mii_mng __iomem *phyregs;
+#ifndef CONFIG_DM_ETH
+	phyregs = (struct tsec_mii_mng __iomem *)bus->priv;
+#else
+	struct tsec_mdio_priv *priv;
+
+	if (!bus->priv)
+		return -EINVAL;
+
+	priv = dev_get_priv(bus->priv);
+	phyregs = priv->regs;
+#endif
 
 	tsec_local_mdio_write(phyregs, addr, dev_addr, regnum, value);
 
 	return 0;
 }
 
+#ifndef CONFIG_DM_ETH
 int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info)
 {
 	struct mii_dev *bus = mdio_alloc();
@@ -109,3 +146,92 @@ int fsl_pq_mdio_init(bd_t *bis, struct fsl_pq_mdio_info *info)
 
 	return mdio_register(bus);
 }
+#else /* CONFIG_DM_ETH */
+#if defined(CONFIG_PHYLIB) && defined(CONFIG_DM_MDIO)
+static int tsec_mdio_read(struct udevice *dev, int addr, int devad, int reg)
+{
+	struct mdio_perdev_priv *pdata = (dev) ? dev_get_uclass_priv(dev) :
+						 NULL;
+
+	if (pdata && pdata->mii_bus)
+		return tsec_phy_read(pdata->mii_bus, addr, devad, reg);
+
+	return -1;
+}
+
+static int tsec_mdio_write(struct udevice *dev, int addr, int devad, int reg,
+			   u16 val)
+{
+	struct mdio_perdev_priv *pdata = (dev) ? dev_get_uclass_priv(dev) :
+						 NULL;
+
+	if (pdata && pdata->mii_bus)
+		return tsec_phy_write(pdata->mii_bus, addr, devad, reg, val);
+
+	return -1;
+}
+
+static int tsec_mdio_reset(struct udevice *dev)
+{
+	struct mdio_perdev_priv *pdata = (dev) ? dev_get_uclass_priv(dev) :
+						 NULL;
+
+	if (pdata && pdata->mii_bus)
+		return fsl_pq_mdio_reset(pdata->mii_bus);
+
+	return -1;
+}
+
+static const struct mdio_ops tsec_mdio_ops = {
+	.read = tsec_mdio_read,
+	.write = tsec_mdio_write,
+	.reset = tsec_mdio_reset,
+};
+
+static const struct udevice_id tsec_mdio_ids[] = {
+	{ .compatible = "fsl,gianfar-tbi" },
+	{ .compatible = "fsl,gianfar-mdio" },
+	{ .compatible = "fsl,etsec2-tbi" },
+	{ .compatible = "fsl,etsec2-mdio" },
+	{ .compatible = "fsl,fman-mdio" },
+	{}
+};
+
+static int tsec_mdio_probe(struct udevice *dev)
+{
+	struct tsec_mdio_priv *priv = (dev) ? dev_get_priv(dev) : NULL;
+	struct mdio_perdev_priv *pdata = (dev) ? dev_get_uclass_priv(dev) :
+						 NULL;
+
+	if (!dev) {
+		printf("%s dev = NULL\n", __func__);
+		return -1;
+	}
+	if (!priv) {
+		printf("dev_get_priv(dev %p) = NULL\n", dev);
+		return -1;
+	}
+	priv->regs = (void *)(uintptr_t)dev_read_addr(dev);
+	debug("%s priv %p @ regs %p, pdata %p\n", __func__,
+	      priv, priv->regs, pdata);
+
+	return 0;
+}
+
+static int tsec_mdio_remove(struct udevice *dev)
+{
+	return 0;
+}
+
+U_BOOT_DRIVER(tsec_mdio) = {
+	.name = "tsec_mdio",
+	.id = UCLASS_MDIO,
+	.of_match = tsec_mdio_ids,
+	.probe = tsec_mdio_probe,
+	.remove = tsec_mdio_remove,
+	.ops = &tsec_mdio_ops,
+	.priv_auto_alloc_size = sizeof(struct tsec_mdio_priv),
+	.platdata_auto_alloc_size = sizeof(struct mdio_perdev_priv),
+};
+#endif /* CONFIG_PHYLIB && CONFIG_DM_MDIO */
+#endif /* CONFIG_DM_ETH */
