All of lore.kernel.org
 help / color / mirror / Atom feed
From: nhed+uboot at starry.com <nhed+uboot@starry.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/7] net: mvpp2: mark phy as invalid in case of missing appropriate driver
Date: Tue,  6 Aug 2019 11:51:40 -0400	[thread overview]
Message-ID: <20190806155144.19301-4-nhed+uboot@starry.com> (raw)
In-Reply-To: <20190806155144.19301-1-nhed+uboot@starry.com>

From: Grzegorz Jaszczyk <jaz@semihalf.com>

If the phy doesn't match with any existing u-boot drivers, the phy
framework will connect it to the generic one which uid ==
0xffffffff. In this case, act as if the phy wouldn't be declared in
dts. Otherwise, in case of 3310 (for which the driver doesn't exist)
the link is marked as always down. Removing phy entry from dts in case
of 3310 is not a good option because it is required for the
phy_fw_down procedure.

This patch fixes the issue with the link always down on MCBIN board.

Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
Reviewed-by: Igal Liberman <igall@marvell.com>
Tested-by: Igal Liberman <igall@marvell.com>
---
 drivers/net/mvpp2.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index b6dfed5c54..fae7090121 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -4484,6 +4484,27 @@ static void mvpp2_phy_connect(struct udevice *dev, struct mvpp2_port *port)
 	if (!port->init || port->link == 0) {
 		phy_dev = phy_connect(port->bus, port->phyaddr, dev,
 				      port->phy_interface);
+
+		/* If the phy doesn't match with any existing u-boot drivers the
+		 * phy framework will connect it to generic one which
+		 * uid == 0xffffffff. In this case act as if the phy wouldn't be
+		 * declared in dts. Otherwise in case of 3310 (for which the
+		 * driver doesn't exist) the link will not be correctly
+		 * detected. Removing phy entry from dts in case of 3310 is not
+		 * an option because it is required for the phy_fw_down
+		 * procedure.
+		 */
+		if (phy_dev->drv->uid == 0xffffffff) {/* Generic phy */
+			netdev_warn(port->dev,
+				    "Marking phy as invalid, link will not be checked\n");
+			/* set phy_addr to invalid value */
+			port->phyaddr = PHY_MAX_ADDR;
+			mvpp2_egress_enable(port);
+			mvpp2_ingress_enable(port);
+
+			return;
+		}
+
 		port->phy_dev = phy_dev;
 		if (!phy_dev) {
 			netdev_err(port->dev, "cannot connect to phy\n");
-- 
2.21.0

  parent reply	other threads:[~2019-08-06 15:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 15:51 [U-Boot] [PATCH v3 0/7] Switch MVPP2 to use new MVMDIO nhed+uboot at starry.com
2019-08-06 15:51 ` [U-Boot] [PATCH v3 1/7] net: mvpp2x: fix traffic stuck after PHY start error nhed+uboot at starry.com
2019-08-07 17:50   ` Ramon Fried
2019-08-14 15:59   ` Joe Hershberger
2019-08-06 15:51 ` [U-Boot] [PATCH v3 2/7] net: mvpp2: Replace SMI implementation with marvell MDIO API nhed+uboot at starry.com
2019-08-07 17:52   ` Ramon Fried
2019-08-06 15:51 ` nhed+uboot at starry.com [this message]
2019-08-07 17:52   ` [U-Boot] [PATCH v3 3/7] net: mvpp2: mark phy as invalid in case of missing appropriate driver Ramon Fried
2019-08-06 15:51 ` [U-Boot] [PATCH v3 4/7] net: mvpp2: no deref null nhed+uboot at starry.com
2019-08-07 14:57   ` Ramon Fried
2019-08-06 15:51 ` [U-Boot] [PATCH v3 5/7] arm: dts: armada-cp110-*dtsi: add xmdio nodes nhed+uboot at starry.com
2019-08-07 17:54   ` Ramon Fried
2019-08-14 15:55   ` Joe Hershberger
2019-08-06 15:51 ` [U-Boot] [PATCH v3 6/7] net: mvpp2: use new MVMDIO driver nhed+uboot at starry.com
2019-08-14 15:59   ` Joe Hershberger
2019-08-06 15:51 ` [U-Boot] [PATCH v3 7/7] net: mvpp2: MVPP2 now needs MVMDIO nhed+uboot at starry.com
2019-08-07 14:56   ` Ramon Fried
2019-08-14 15:49   ` Joe Hershberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190806155144.19301-4-nhed+uboot@starry.com \
    --to=nhed+uboot@starry.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.