From fc7b4295a24771be99eb1afb374608562706f4d8 Mon Sep 17 00:00:00 2001
From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Date: Thu, 18 Oct 2018 20:02:44 +0300
Subject: [PATCH] staging: fsl-dpaa2/mac: probe phy as fixed link based on
 dpmac properties

Keep in sync the PHY type settings in DPC and Linux device tree.

If the dpmac is connected to a fixed link PHY based on dpc config,
treat it as a fixed-link device, regardless of whether the "phy-handle"
property is present in the device tree node or not.

Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com>
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
---
 drivers/staging/fsl-dpaa2/mac/mac.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/staging/fsl-dpaa2/mac/mac.c
+++ b/drivers/staging/fsl-dpaa2/mac/mac.c
@@ -545,9 +545,11 @@ static int dpaa2_mac_probe(struct fsl_mc
 	}
 #endif /* CONFIG_FSL_DPAA2_MAC_NETDEVS */
 
-	/* probe the PHY as a fixed-link if there's a phy-handle defined
-	 * in the device tree
-	 */
+	/* probe the PHY as fixed-link if the DPMAC attribute indicates so */
+	if (priv->attr.link_type == DPMAC_LINK_TYPE_FIXED)
+		goto probe_fixed_link;
+
+	/* or if there's no phy-handle defined in the device tree */
 	phy_node = of_parse_phandle(dpmac_node, "phy-handle", 0);
 	if (!phy_node) {
 		goto probe_fixed_link;
