diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3672262..1121b99 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -490,6 +490,9 @@
 #ifdef CONFIG_MV88E61XX_SWITCH
 	phy_mv88e61xx_init();
 #endif
+#ifdef CONFIG_PHY_ADIN
+	phy_adin_init();
+#endif
 #ifdef CONFIG_PHY_AQUANTIA
 	phy_aquantia_init();
 #endif
@@ -635,18 +638,17 @@
 	return err;
 }
 
-static struct phy_driver *generic_for_interface(phy_interface_t interface)
+static struct phy_driver *generic_for_phy(struct phy_device *phydev)
 {
 #ifdef CONFIG_PHYLIB_10G
-	if (is_10g_interface(interface))
+	if (phydev->is_c45)
 		return &gen10g_driver;
 #endif
 
 	return &genphy_driver;
 }
 
-static struct phy_driver *get_phy_driver(struct phy_device *phydev,
-					 phy_interface_t interface)
+static struct phy_driver *get_phy_driver(struct phy_device *phydev)
 {
 	struct list_head *entry;
 	int phy_id = phydev->phy_id;
@@ -659,12 +661,11 @@
 	}
 
 	/* If we made it here, there's no driver for this PHY */
-	return generic_for_interface(interface);
+	return generic_for_phy(phydev);
 }
 
 struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
-				     u32 phy_id, bool is_c45,
-				     phy_interface_t interface)
+				     u32 phy_id, bool is_c45)
 {
 	struct phy_device *dev;
 
@@ -683,7 +684,7 @@
 
 	dev->duplex = -1;
 	dev->link = 0;
-	dev->interface = interface;
+	dev->interface = PHY_INTERFACE_MODE_NA;
 
 #ifdef CONFIG_DM_ETH
 	dev->node = ofnode_null();
@@ -696,7 +697,7 @@
 	dev->is_c45 = is_c45;
 	dev->bus = bus;
 
-	dev->drv = get_phy_driver(dev, interface);
+	dev->drv = get_phy_driver(dev);
 
 	if (phy_probe(dev)) {
 		printf("%s, PHY probe failed\n", __func__);
@@ -745,8 +746,7 @@
 }
 
 static struct phy_device *create_phy_by_mask(struct mii_dev *bus,
-					     uint phy_mask, int devad,
-					     phy_interface_t interface)
+					     uint phy_mask, int devad)
 {
 	u32 phy_id = 0xffffffff;
 	bool is_c45;
@@ -767,8 +767,7 @@
 		/* If the PHY ID is mostly f's, we didn't find anything */
 		if (r == 0 && (phy_id & 0x1fffffff) != 0x1fffffff) {
 			is_c45 = (devad == MDIO_DEVAD_NONE) ? false : true;
-			return phy_device_create(bus, addr, phy_id, is_c45,
-						 interface);
+			return phy_device_create(bus, addr, phy_id, is_c45);
 		}
 next:
 		phy_mask &= ~(1 << addr);
@@ -777,25 +776,22 @@
 }
 
 static struct phy_device *search_for_existing_phy(struct mii_dev *bus,
-						  uint phy_mask,
-						  phy_interface_t interface)
+						  uint phy_mask)
 {
 	/* If we have one, return the existing device, with new interface */
 	while (phy_mask) {
 		int addr = ffs(phy_mask) - 1;
 
-		if (bus->phymap[addr]) {
-			bus->phymap[addr]->interface = interface;
+		if (bus->phymap[addr])
 			return bus->phymap[addr];
-		}
+
 		phy_mask &= ~(1 << addr);
 	}
 	return NULL;
 }
 
 static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,
-						 uint phy_mask,
-						 phy_interface_t interface)
+						 uint phy_mask)
 {
 	struct phy_device *phydev;
 	int devad[] = {
@@ -811,13 +807,12 @@
 	int i, devad_cnt;
 
 	devad_cnt = sizeof(devad)/sizeof(int);
-	phydev = search_for_existing_phy(bus, phy_mask, interface);
+	phydev = search_for_existing_phy(bus, phy_mask);
 	if (phydev)
 		return phydev;
 	/* try different access clauses  */
 	for (i = 0; i < devad_cnt; i++) {
-		phydev = create_phy_by_mask(bus, phy_mask,
-					    devad[i], interface);
+		phydev = create_phy_by_mask(bus, phy_mask, devad[i]);
 		if (IS_ERR(phydev))
 			return NULL;
 		if (phydev)
@@ -845,10 +840,9 @@
  * Description: Reads the ID registers of the PHY at @addr on the
  *   @bus, then allocates and returns the phy_device to represent it.
  */
-static struct phy_device *get_phy_device(struct mii_dev *bus, int addr,
-					 phy_interface_t interface)
+static struct phy_device *get_phy_device(struct mii_dev *bus, int addr)
 {
-	return get_phy_device_by_mask(bus, 1 << addr, interface);
+	return get_phy_device_by_mask(bus, 1 << addr);
 }
 
 int phy_reset(struct phy_device *phydev)
@@ -862,7 +856,7 @@
 
 #ifdef CONFIG_PHYLIB_10G
 	/* If it's 10G, we need to issue reset through one of the MMDs */
-	if (is_10g_interface(phydev->interface)) {
+	if (phydev->is_c45) {
 		if (!phydev->mmds)
 			gen10g_discover_mmds(phydev);
 
@@ -907,18 +901,12 @@
 	struct mii_dev *bus = miiphy_get_dev_by_name(devname);
 	struct phy_device *phydev;
 
-	/*
-	 * miiphy_reset was only used on standard PHYs, so we'll fake it here.
-	 * If later code tries to connect with the right interface, this will
-	 * be corrected by get_phy_device in phy_connect()
-	 */
-	phydev = get_phy_device(bus, addr, PHY_INTERFACE_MODE_MII);
+	phydev = get_phy_device(bus, addr);
 
 	return phy_reset(phydev);
 }
 
-struct phy_device *phy_find_by_mask(struct mii_dev *bus, uint phy_mask,
-				    phy_interface_t interface)
+struct phy_device *phy_find_by_mask(struct mii_dev *bus, uint phy_mask)
 {
 	/* Reset the bus */
 	if (bus->reset) {
@@ -928,13 +916,15 @@
 		mdelay(15);
 	}
 
-	return get_phy_device_by_mask(bus, phy_mask, interface);
+	return get_phy_device_by_mask(bus, phy_mask);
 }
 
 #ifdef CONFIG_DM_ETH
-void phy_connect_dev(struct phy_device *phydev, struct udevice *dev)
+void phy_connect_dev(struct phy_device *phydev, struct udevice *dev,
+		     phy_interface_t interface)
 #else
-void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev)
+void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev,
+		     phy_interface_t interface)
 #endif
 {
 	/* Soft Reset the PHY */
@@ -945,13 +935,14 @@
 		       phydev->dev->name, dev->name);
 	}
 	phydev->dev = dev;
-	debug("%s connected to %s\n", dev->name, phydev->drv->name);
+	phydev->interface = interface;
+	debug("%s connected to %s mode %s\n", dev->name, phydev->drv->name,
+	      phy_string_for_interface(interface));
 }
 
 #ifdef CONFIG_PHY_XILINX_GMII2RGMII
 static struct phy_device *phy_connect_gmii2rgmii(struct mii_dev *bus,
-						 struct udevice *dev,
-						 phy_interface_t interface)
+						 struct udevice *dev)
 {
 	struct phy_device *phydev = NULL;
 	ofnode node;
@@ -960,8 +951,7 @@
 		node = ofnode_by_compatible(node, "xlnx,gmii-to-rgmii-1.0");
 		if (ofnode_valid(node)) {
 			phydev = phy_device_create(bus, 0,
-						   PHY_GMII2RGMII_ID, false,
-						   interface);
+						   PHY_GMII2RGMII_ID, false);
 			if (phydev)
 				phydev->node = node;
 			break;
@@ -985,41 +975,31 @@
  */
 struct phy_device *fixed_phy_create(ofnode node)
 {
-	phy_interface_t interface = PHY_INTERFACE_MODE_NONE;
 	struct phy_device *phydev;
-	const char *if_str;
 	ofnode subnode;
 
-	if_str = ofnode_read_string(node, "phy-mode");
-	if (!if_str) {
-		if_str = ofnode_read_string(node, "phy-interface-type");
-	}
-	if (if_str) {
-		interface = phy_get_interface_by_name(if_str);
-	}
-
 	subnode = ofnode_find_subnode(node, "fixed-link");
 	if (!ofnode_valid(subnode)) {
 		return NULL;
 	}
 
-	phydev = phy_device_create(NULL, 0, PHY_FIXED_ID, false, interface);
+	phydev = phy_device_create(NULL, 0, PHY_FIXED_ID, false);
 	if (phydev)
 		phydev->node = subnode;
 
+	phydev->interface = ofnode_read_phy_mode(node);
+
 	return phydev;
 }
 
 static struct phy_device *phy_connect_fixed(struct mii_dev *bus,
-					    struct udevice *dev,
-					    phy_interface_t interface)
+					    struct udevice *dev)
 {
 	ofnode node = dev_ofnode(dev), subnode;
 	struct phy_device *phydev = NULL;
 
 	if (ofnode_phy_is_fixed_link(node, &subnode)) {
-		phydev = phy_device_create(bus, 0, PHY_FIXED_ID,
-					   false, interface);
+		phydev = phy_device_create(bus, 0, PHY_FIXED_ID, false);
 		if (phydev)
 			phydev->node = subnode;
 	}
@@ -1042,29 +1022,29 @@
 	uint mask = (addr >= 0) ? (1 << addr) : 0xffffffff;
 
 #ifdef CONFIG_PHY_FIXED
-	phydev = phy_connect_fixed(bus, dev, interface);
+	phydev = phy_connect_fixed(bus, dev);
 #endif
 
 #ifdef CONFIG_PHY_NCSI
 	if (!phydev)
-		phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false, interface);
+		phydev = phy_device_create(bus, 0, PHY_NCSI_ID, false);
 #endif
 
 #ifdef CONFIG_PHY_ETHERNET_ID
 	if (!phydev)
-		phydev = phy_connect_phy_id(bus, dev, addr, interface);
+		phydev = phy_connect_phy_id(bus, dev, addr);
 #endif
 
 #ifdef CONFIG_PHY_XILINX_GMII2RGMII
 	if (!phydev)
-		phydev = phy_connect_gmii2rgmii(bus, dev, interface);
+		phydev = phy_connect_gmii2rgmii(bus, dev);
 #endif
 
 	if (!phydev)
-		phydev = phy_find_by_mask(bus, mask, interface);
+		phydev = phy_find_by_mask(bus, mask);
 
 	if (phydev)
-		phy_connect_dev(phydev, dev);
+		phy_connect_dev(phydev, dev, interface);
 	else
 		printf("Could not get PHY for %s: addr %d\n", bus->name, addr);
 	return phydev;
@@ -1102,18 +1082,6 @@
 	return 0;
 }
 
-int phy_get_interface_by_name(const char *str)
-{
-	int i;
-
-	for (i = 0; i < PHY_INTERFACE_MODE_COUNT; i++) {
-		if (!strcmp(str, phy_interface_strings[i]))
-			return i;
-	}
-
-	return -1;
-}
-
 /**
  * phy_modify - Convenience function for modifying a given PHY register
  * @phydev: the phy_device struct
