From patchwork Tue Mar 29 14:05:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1610646 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=8JWL5qvQ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KSWZG32CMz9s0r for ; Wed, 30 Mar 2022 01:06:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 953A68403A; Tue, 29 Mar 2022 16:06:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="8JWL5qvQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A328C84039; Tue, 29 Mar 2022 16:06:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 048338403B for ; Tue, 29 Mar 2022 16:06:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ed1-x531.google.com with SMTP id x34so20820905ede.8 for ; Tue, 29 Mar 2022 07:06:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+I2AkTVoHlCpaxjT00dcONvgLWoQ3ZtTWMID4/f036o=; b=8JWL5qvQweIH3Zqp7FUF06bzsfCSbI5rhgDwA14U4guYj7Lmr01lH6KDzT5a57yPP0 CCCzyUSH3IcDI2oZ0uWyqC3dPGnebTh5IVRSiYs/092J/1cK7Lqkfr2x80C2cqBJNcyb yC4EANZPPr5D5+f8ItwYSm0OLLPFQ9IWz5RIB/gLM2Ge1sT7km6LQgKI4cVr3X71wFnI e0oUcwTvur8jgB15vmrX6FtYczUSJlPjb3qNe9lxqjAZ+ZiqKX9sSUzEOp9P5MOcFFCa Hfgx9MVCc3b2HcNrm6Dw1aDvNKEuJ9o/GTnbbxOqsR/ERno3Ir/XRFMUyGjiWChbC3Yq 5rxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=+I2AkTVoHlCpaxjT00dcONvgLWoQ3ZtTWMID4/f036o=; b=cM/Bt/kFX3sLW9rrS/a2btgS231xnFeklY7UAC2Ql1vCAoqYmt6bgU1+WURjOxMDN/ hx5xvkeDfpyomorsnmxD8Ui/DcR4hlU8jK1aEYg8X6IKariNCsGbx6qgDswpK6+Zxf9W bV9eS3upkOgFARyp2mUGwZ7H5fGlajDr0RWzFlXQTpDFKB1QhrA+h2ozTdi4mBxKTfmB 3z4oKmcfy6Ri4KuCBaexm3j5SCiWn7ia9fY6qxLs4dzdgYfo3PbTPGbwO9Lh3MT0vlcA ykQpuQEAN6Gb9zreyN/xGmH6ZqL8ue3exG/k1fzOY0xw56EfN6s6K4pT2LOXYiYjYGVs xgTw== X-Gm-Message-State: AOAM532sMws/LBEaUJNKZKySJi831+MsdsgwWI4TpQZZWRsryk3JSkaL wEbWi9YdrEt983QyDmDfKbutGSMaoHTyGA== X-Google-Smtp-Source: ABdhPJxQNTcxuAD6Md8XM1eIDx2xiQRbNHqhpTLPPn+rBBezq/fT0YCbrPgwsFLHOUVb+EPxSEo+ow== X-Received: by 2002:a05:6402:35c2:b0:419:9383:4123 with SMTP id z2-20020a05640235c200b0041993834123mr4855605edc.28.1648562762214; Tue, 29 Mar 2022 07:06:02 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id m20-20020a056402431400b00419315cc3e2sm8638196edc.61.2022.03.29.07.06.01 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Mar 2022 07:06:01 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: T Karthik Reddy , Bin Meng , Joe Hershberger , Priyanka Jain , "Radu Pirea (NXP OSS)" , Ramon Fried , Vladimir Oltean , Wolfgang Denk Subject: [PATCH] net: phy: Fix rgmii-id phy reset timeout issue Date: Tue, 29 Mar 2022 16:05:57 +0200 Message-Id: X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 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.5 at phobos.denx.de X-Virus-Status: Clean From: T Karthik Reddy While creating a phy device using phy_device_create(), we need to provide a valid phyaddr instead of 0 causing phy address being registered as 0 with mdio bus and shows mdio phy list as below ZynqMP> mdio list eth0: 0 - TI DP83867 <--> ethernet@ff0b0000 eth1: 0 - TI DP83867 <--> ethernet@ff0c0000 Also PHY soft reset is being requested on 0 instead of valid address causing "PHY reset timed out" error. So add phyaddr argument to phy_connect_phy_id() and to its prototype to create phy device with valid phyaddress. Fixes: a744a284e354 ("net: phy: Add support for ethernet-phy-id with gpio reset") Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek Reviewed-by: Bin Meng --- drivers/net/phy/ethernet_id.c | 4 ++-- drivers/net/phy/phy.c | 2 +- include/phy.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/ethernet_id.c b/drivers/net/phy/ethernet_id.c index 5617ac3ad62f..44abc5bfb301 100644 --- a/drivers/net/phy/ethernet_id.c +++ b/drivers/net/phy/ethernet_id.c @@ -12,7 +12,7 @@ #include struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev, - phy_interface_t interface) + int phyaddr, phy_interface_t interface) { struct phy_device *phydev; struct ofnode_phandle_args phandle_args; @@ -61,7 +61,7 @@ struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev, } id = vendor << 16 | device; - phydev = phy_device_create(bus, 0, id, false, interface); + phydev = phy_device_create(bus, phyaddr, id, false, interface); if (phydev) phydev->node = node; diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 08a37a344e65..690ed38ba622 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1049,7 +1049,7 @@ struct phy_device *phy_connect(struct mii_dev *bus, int addr, #ifdef CONFIG_PHY_ETHERNET_ID if (!phydev) - phydev = phy_connect_phy_id(bus, dev, interface); + phydev = phy_connect_phy_id(bus, dev, addr, interface); #endif #ifdef CONFIG_PHY_XILINX_GMII2RGMII diff --git a/include/phy.h b/include/phy.h index 9ea4bd42db4d..5e3da4b01b6c 100644 --- a/include/phy.h +++ b/include/phy.h @@ -479,7 +479,7 @@ struct phy_device *phy_device_create(struct mii_dev *bus, int addr, * or NULL otherwise */ struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev, - phy_interface_t interface); + int phyaddr, phy_interface_t interface); static inline ofnode phy_get_ofnode(struct phy_device *phydev) {