From patchwork Wed Mar 24 09:20:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roese X-Patchwork-Id: 1457809 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=Hfw1aOhp; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F52lj0PMBz9sRN for ; Wed, 24 Mar 2021 20:20:49 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 67EF88284D; Wed, 24 Mar 2021 10:20:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1616577638; bh=wpM1c2ZT7TCUygUORlhHId55fpagN8ijpEDpVj5ZrBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Hfw1aOhpeJYNNRq0qvvGpy2SmobZMZ0Sku+9GIymCmJQ4R8lgJgvLHeo+1AH4aglp 2hw9+f+ssrkbG2BkdTKLvaCVWW/vH1Kw7lzH/08Kshc+jEobJO5RvrwqEYu+ptcwwi icigwTNwQJINhIlrXbrdaDxUfwZmSoYLRVnEs3DnVRUGXq8Q+k1+bCCbVDkBVXljPF 61M8kV65F7S/Sa5o4Z6uJjb8/fOm5P4TlaRRdRIViSEdM+fEFL3XMMdAA6j+RCEhMM pL5miuvBuHGp8TsB3muGXAsYG+kSe6wTUwxkaOs1vFPBf4km9OPPjs/22lOdQIg47Y Emz2R1lkwQTyg== Received: by phobos.denx.de (Postfix, from userid 109) id F3A558282E; Wed, 24 Mar 2021 10:20:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [IPv6:2001:67c:2050:1::465:204]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 000BC825F1 for ; Wed, 24 Mar 2021 10:20:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4F52l34ysvzQjp5; Wed, 24 Mar 2021 10:20:15 +0100 (CET) Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id zu5kk5Gwpa5p; Wed, 24 Mar 2021 10:20:11 +0100 (CET) From: Stefan Roese To: u-boot@lists.denx.de Cc: Kostya Porotchkin , Stefan Chulski , Ramon Fried , Nadav Haklai , Joe Hershberger , Marcin Wojtas , sa_ip-sw-jenkins , Yan Markman , Marcin Wojtas , Igal Liberman , Simon Glass Subject: [PATCH v1 5/5] net: phy: marvell: Fix 2210 link and speed detection resolution Date: Wed, 24 Mar 2021 10:20:08 +0100 Message-Id: <20210324101949.v1.5.I67a56cf3de91b8ac3dde86e7ca49e0ab61b5e18f@changeid> In-Reply-To: <20210324092008.1300548-1-sr@denx.de> References: <20210324092008.1300548-1-sr@denx.de> MIME-Version: 1.0 X-MBO-SPAM-Probability: * X-Rspamd-Score: 1.41 / 15.00 / 15.00 X-Rspamd-Queue-Id: DDFF81893 X-Rspamd-UID: 1975c8 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Stefan Chulski Patch fix couple of link and speed detection resolution bugs: 1. Waiting for PHY real time link condition. 2. Replace PHYSTAT_SPDDONE with PHYSTAT_LINK in while loop, PHYSTAT_SPDDONE could be enabled before link status changed to enable. 3. Update link status after link resolution loop. Signed-off-by: Stefan Chulski Tested-by: sa_ip-sw-jenkins Reviewed-by: Kostya Porotchkin Reviewed-by: Yan Markman Reviewed-by: Marcin Wojtas Signed-off-by: Stefan Roese --- drivers/net/phy/marvell.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 36e678755ae8..3bcb0033b391 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -659,12 +659,11 @@ static uint m88e2110_parse_status(struct phy_device *phydev) mii_reg = phy_read(phydev, 3, MIIM_88E2110_PHY_STATUS); - if ((mii_reg & MIIM_88E2110_PHYSTAT_LINK) && - !(mii_reg & MIIM_88E2110_PHYSTAT_SPDDONE)) { + if (!(mii_reg & MIIM_88E2110_PHYSTAT_LINK)) { int i = 0; puts("Waiting for PHY realtime link"); - while (!(mii_reg & MIIM_88E2110_PHYSTAT_SPDDONE)) { + while (!(mii_reg & MIIM_88E2110_PHYSTAT_LINK)) { /* Timeout reached ? */ if (i > PHY_AUTONEGOTIATE_TIMEOUT) { puts(" TIMEOUT !\n"); @@ -679,13 +678,13 @@ static uint m88e2110_parse_status(struct phy_device *phydev) } puts(" done\n"); mdelay(500); /* another 500 ms (results in faster booting) */ - } else { - if (mii_reg & MIIM_88E2110_PHYSTAT_LINK) - phydev->link = 1; - else - phydev->link = 0; } + if (mii_reg & MIIM_88E2110_PHYSTAT_LINK) + phydev->link = 1; + else + phydev->link = 0; + if (mii_reg & MIIM_88E2110_PHYSTAT_DUPLEX) phydev->duplex = DUPLEX_FULL; else