diff mbox

[U-Boot,02/10] net: mvpp2x: fix phy connected to wrong mdio issue

Message ID 1498033898-15650-3-git-send-email-stefanc@malvell.com
State Superseded
Delegated to: Stefan Roese
Headers show

Commit Message

stefanc@malvell.com June 21, 2017, 8:31 a.m. UTC
From: Stefan Chulski <stefanc@marvell.com>

This WA for mdio issue. U-boot 2017 don't have mdio driver
and on MACHIATOBin board ports from CP1 connected to mdio on
CP0. WA is to get mdio address from phy handler parent base address.
WA should be removed after mdio driver implementation.

Change-Id: Ice33c318a2872e750c8a2004763e6b2198c0537e
Signed-off-by: Stefan Chulski <stefanc@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/39032
Tested-by: iSoC Platform CI <ykjenk@marvell.com>
Reviewed-by: Igal Liberman <igall@marvell.com>
---
 drivers/net/mvpp2.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

Comments

Joe Hershberger Aug. 8, 2017, 3:52 p.m. UTC | #1
On Wed, Jun 21, 2017 at 3:31 AM,  <stefanc@malvell.com> wrote:
> From: Stefan Chulski <stefanc@marvell.com>
>
> This WA for mdio issue. U-boot 2017 don't have mdio driver
> and on MACHIATOBin board ports from CP1 connected to mdio on
> CP0. WA is to get mdio address from phy handler parent base address.
> WA should be removed after mdio driver implementation.
>
> Change-Id: Ice33c318a2872e750c8a2004763e6b2198c0537e
> Signed-off-by: Stefan Chulski <stefanc@marvell.com>
> Reviewed-on: http://vgitil04.il.marvell.com:8080/39032
> Tested-by: iSoC Platform CI <ykjenk@marvell.com>
> Reviewed-by: Igal Liberman <igall@marvell.com>

This is a pretty bad commit message. Any chance of fixing the grammar
and removing unknown (to me) acronyms? What is "WA"?

Also, drop the internal references (Change-Id and Reviewed-on).

Thanks,
-Joe
diff mbox

Patch

diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index 2198b73..1264f14 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -31,6 +31,7 @@ 
 #include <linux/compat.h>
 #include <linux/mbus.h>
 #include <asm-generic/gpio.h>
+#include <fdt_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -4739,10 +4740,11 @@  static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
 {
 	int port_node = dev_of_offset(dev);
 	const char *phy_mode_str;
-	int phy_node;
+	int phy_node, mdio_off, cp_node;
 	u32 id;
 	u32 phyaddr = 0;
 	int phy_mode = -1;
+	u64 mdio_addr;
 
 	phy_node = fdtdec_lookup_phandle(gd->fdt_blob, port_node, "phy");
 
@@ -4752,6 +4754,28 @@  static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
 			dev_err(&pdev->dev, "could not find phy address\n");
 			return -1;
 		}
+		mdio_off = fdt_parent_offset(gd->fdt_blob, phy_node);
+
+		/* TODO: This WA for mdio issue. U-boot 2017 don't have
+		 * mdio driver and on MACHIATOBin board ports from CP1
+		 * connected to mdio on CP0.
+		 * WA is to get mdio address from phy handler parent
+		 * base address. WA should be removed after
+		 * mdio driver implementation.
+		 */
+		mdio_addr = fdtdec_get_uint(gd->fdt_blob,
+					    mdio_off, "reg", 0);
+
+		cp_node = fdt_parent_offset(gd->fdt_blob, mdio_off);
+		mdio_addr |= fdt_get_base_address((void *)gd->fdt_blob,
+						  cp_node);
+
+		port->priv->mdio_base = (void *)mdio_addr;
+
+		if (port->priv->mdio_base < 0) {
+			dev_err(&pdev->dev, "could not find mdio base address\n");
+			return -1;
+		}
 	} else {
 		phy_node = 0;
 	}