Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E6A5C636CC for ; Tue, 7 Feb 2023 23:37:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1CE7785E66; Wed, 8 Feb 2023 00:37:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 16C7C858BE; Wed, 8 Feb 2023 00:37:29 +0100 (CET) Received: from finn.localdomain (finn.gateworks.com [108.161.129.64]) (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 EF86485E21 for ; Wed, 8 Feb 2023 00:37:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gateworks.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=tharvey@gateworks.com Received: from 068-189-091-139.biz.spectrum.com ([68.189.91.139] helo=tharvey.pdc.gateworks.com) by finn.localdomain with esmtp (Exim 4.93) (envelope-from ) id 1pPXWb-002roV-RX; Tue, 07 Feb 2023 23:37:21 +0000 From: Tim Harvey To: u-boot@lists.denx.de, Ramon Fried , Joe Hershberger , Vladimir Oltean Cc: Tim Harvey Subject: [PATCH 3/3] net: ksz9477: add port_probe function to config phy Date: Tue, 7 Feb 2023 15:37:18 -0800 Message-Id: <20230207233718.3162217-3-tharvey@gateworks.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230207233718.3162217-1-tharvey@gateworks.com> References: <20230207233718.3162217-1-tharvey@gateworks.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.6 at phobos.denx.de X-Virus-Status: Clean Add a port_probe function to configure the phy. This leads to earlier link negotiation so the port is more likely to be ready when used. Signed-off-by: Tim Harvey --- drivers/net/ksz9477.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/net/ksz9477.c b/drivers/net/ksz9477.c index 5b0ef78ab93b..6b59b5fcd265 100644 --- a/drivers/net/ksz9477.c +++ b/drivers/net/ksz9477.c @@ -337,11 +337,21 @@ static int ksz_port_setup(struct udevice *dev, int port, return 0; } +static int ksz_port_probe(struct udevice *dev, int port, struct phy_device *phy) +{ + int supported = PHY_GBIT_FEATURES; + + /* configure phy */ + phy->supported &= supported; + phy->advertising &= supported; + + return phy_config(phy); +} + static int ksz_port_enable(struct udevice *dev, int port, struct phy_device *phy) { struct dsa_pdata *pdata = dev_get_uclass_plat(dev); struct ksz_dsa_priv *priv = dev_get_priv(dev); - int supported = PHY_GBIT_FEATURES; u8 data8; int ret; @@ -365,23 +375,12 @@ static int ksz_port_enable(struct udevice *dev, int port, struct phy_device *phy if (port == pdata->cpu_port) return 0; - /* configure phy */ - phy->supported &= supported; - phy->advertising &= supported; - ret = phy_config(phy); - if (ret) - return ret; - - ret = phy_startup(phy); - if (ret) - return ret; - /* start switch */ ksz_read8(priv->dev, REG_SW_OPERATION, &data8); data8 |= SW_START; ksz_write8(priv->dev, REG_SW_OPERATION, data8); - return 0; + return phy_startup(phy); } static void ksz_port_disable(struct udevice *dev, int port, struct phy_device *phy) @@ -410,6 +409,7 @@ static void ksz_port_disable(struct udevice *dev, int port, struct phy_device *p } static const struct dsa_ops ksz_dsa_ops = { + .port_probe = ksz_port_probe, .port_enable = ksz_port_enable, .port_disable = ksz_port_disable, }; -- 2.25.1