From patchwork Tue Aug 6 15:51:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nevo Hed X-Patchwork-Id: 1142900 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=starry.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=starry.com header.i=@starry.com header.b="hOvTAzHZ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 462zhJ6CPBz9s7T for ; Wed, 7 Aug 2019 01:53:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 82F9AC21EBA; Tue, 6 Aug 2019 15:52:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 87B27C21ED6; Tue, 6 Aug 2019 15:52:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6383AC21F02; Tue, 6 Aug 2019 15:52:03 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by lists.denx.de (Postfix) with ESMTPS id 77716C21EF2 for ; Tue, 6 Aug 2019 15:52:03 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id z4so85072391qtc.3 for ; Tue, 06 Aug 2019 08:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starry.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uuu7ANZRC/ZwZj2ZKYVcLql2HelxV6nMCjTm8uKTCWQ=; b=hOvTAzHZt4z20ipOlVorSvb365PT52nSxspzGKsHfodw5phfTpCEzWr9u5JCOsZyyg RysS+tBYy9xMGhj+g+4CBS7NmeTickh+K+kJKE4ofZ1nJXeLfZqPACZ0Hmcg0zixDjFM hL+sQpI3SR6XAkcWE7uVsZ/ETfk/84gLtg+qk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uuu7ANZRC/ZwZj2ZKYVcLql2HelxV6nMCjTm8uKTCWQ=; b=LmkG+iiqclX4bOPpKF1G4PtR/9nCBQOh9A7NhA7UfHjbIK/A0sy8IW16BfckH/BlnW uMqRod5WUmktKfLvmELZWSxqGRa7Zt+1XOakJZ7kp4yTVLf662hSqI2AXU0HKj/Hy3Lm FBB2GYIFeKCRAwwSgBf3/4CyOVDG/wYjcKFlnkAVXDjNPSo4nGL5m/eHocf6DZLvWMgu xkt8P907l9xwo2+Nd+G35fNVjpjHSgBDAY1cP4AIxXeczDnjJ8OeN+0/tGHQUzBxoUJf XQXYX2sb32lH5GQrcEANTBZy4IPf4aOVYqpE/1w1uR5aGjohn7YsRJJTxM1hyGBAP8Yn Xp7Q== X-Gm-Message-State: APjAAAVbP6Y//u9yzeLe8NUNXCVSjE5AfaONWb8GDZZBTTy7Ya+xwZUv nwHfoWWF37euvV9cU3Lh6D6vrQ== X-Google-Smtp-Source: APXvYqyrWVZNDfLod38wUbc3VevrywnKc8NPB8A6Z5G8ZV0oF8PLcJYJFkdLbyeZCCUmVa40yDCX3g== X-Received: by 2002:ac8:c45:: with SMTP id l5mr3551237qti.63.1565106722103; Tue, 06 Aug 2019 08:52:02 -0700 (PDT) Received: from nhed-lt1 (205-201-16-55.starry-inc.net. [205.201.16.55]) by smtp.gmail.com with ESMTPSA id q6sm210542qtr.23.2019.08.06.08.52.01 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Aug 2019 08:52:01 -0700 (PDT) From: nhed+uboot@starry.com To: u-boot@lists.denx.de Date: Tue, 6 Aug 2019 11:51:40 -0400 Message-Id: <20190806155144.19301-4-nhed+uboot@starry.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190806155144.19301-1-nhed+uboot@starry.com> References: <20190806155144.19301-1-nhed+uboot@starry.com> MIME-Version: 1.0 Cc: make@marvell.com, Grzegorz Jaszczyk Subject: [U-Boot] [PATCH v3 3/7] net: mvpp2: mark phy as invalid in case of missing appropriate driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Grzegorz Jaszczyk 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 Reviewed-by: Igal Liberman Tested-by: Igal Liberman Reviewed-By: Ramon Fried --- 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");