From patchwork Thu Dec 12 17:25:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "A. Sverdlin" X-Patchwork-Id: 849735 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp1060591wry; Thu, 12 Dec 2024 09:25:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWLB2c4IoqI5SeWWB9fxHKg0NX9iHEuSQfEBciay6N0mFm5vtElFfCG6ZLWpF7T9DjY/opBbA==@linaro.org X-Google-Smtp-Source: AGHT+IHB0XexU0UgY/Jv0VE8HgshrMCA6O58jx8lGMJwly/qhXQzBO/YKu3gGzMq4CuzJT4/VSuu X-Received: by 2002:a17:906:1daa:b0:aa6:abb2:31f4 with SMTP id a640c23a62f3a-aa6b11e8f29mr703837366b.25.1734024339096; Thu, 12 Dec 2024 09:25:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734024339; cv=none; d=google.com; s=arc-20240605; b=FqcW28ysfIr+GVQ4qpgRGAhqLsk/U6hdVf99yhZFfad1Y4WSM95HXWmUPqg1m9Z0DS kk2WpwgTaRVaCnHKsk5LJpjaUEm1GVXAOuVnNQYLUY8bvwQ1biNd/XdIn5RsRLV6zv8s 9nd/DjtlA2uX5R+Rj4WeDRPS+KdYQNdzQYCWYN/HOKhsPwYqfvcztAWN3aeEzhlQ9zOS 4+7nmbQKXvtv5TqAbV0FiLLCZqSnCJiNIIjDWuezH/GHiM5SxwfEcL4go80/57JwyzuN MnzKX6eRjejpHGEC91SGUmvTUjPMi9T+clxosr2Ff+yu8vZPihX1jvX61ay7Iu5te/br eDmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=9Kp+3JKY3GkIruGfWZm3AE5mUd4RzbiVbF5A8JxSw9o=; fh=JfU87FeEKTqoVaQuuUPbEtxUlo7PptQ4KtHIxPjOh90=; b=ZU/u2axho50Q7YJHUABXpFZ+YA1Bp6JEavo5+5lTfuMYOA3jmnyiUFUiGjRkcMrbKe 777gN5DiAWSLlPfcnH1sVpVDxjjG8VW+Jv8xx5bPqb433qXwy8VbF5C7sbJIBCmOBODk rwdOYI/bZ5cMd4sLTvMUZQdzIRRIqGXNCZHJ/U6qlrR8QgsPIGh5JfhFvldpLYzSNEhq aY4v8XDFLnjQK4lC0+xh2Im6wgfXCfY24XrcVWK/dKmkYTPu/lnys29R/DMOdPCpivEy nXanGYvGd1wUrxZbpfoExD0nglY5WUc4fLOnPc3NPEsvfE9yzO5xziTnzaRI3nGDDcVa wecA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b="W/wbeVNQ"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id a640c23a62f3a-aa694c11e07si562540366b.740.2024.12.12.09.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 09:25:39 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b="W/wbeVNQ"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D19B3801BF; Thu, 12 Dec 2024 18:25:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=siemens.com header.i=alexander.sverdlin@siemens.com header.b="W/wbeVNQ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 40B7B801FE; Thu, 12 Dec 2024 18:25:36 +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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 12325801B0 for ; Thu, 12 Dec 2024 18:25:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alexander.sverdlin@siemens.com Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20241212172533682635317660639d34 for ; Thu, 12 Dec 2024 18:25:33 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=alexander.sverdlin@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc; bh=9Kp+3JKY3GkIruGfWZm3AE5mUd4RzbiVbF5A8JxSw9o=; b=W/wbeVNQ/t6g0jT4PJA+XpDfc7PfAmy3lpnkGB45U5eCTehcn1ULb5W7fQYWm6kF5cZSaW TyApyWVfJ2Nf8s6JtUuUmsaVolJ6pzCg56RhL6lVGzYcTYfbj1bYcNL68ZpnDAhGO79OxYaz EPQ6TlIl2Yi5BTw0evg2oji6xxEzpUrpja6wI8xMXs92EZmDOxFdOnhdqwF1H7m8nTshdqyQ glpKZtP5I3BiP4ucrIV3DIbjBCKBdq2TuNaA8KoG/E4b8EtK824uqlJDt8KoDJOWau9hzDDx zth7h4KHV/Aeh8zoUM20MwLIpOruFxWO+uPmj+ir6BScSmsyIeXgXTVQ==; From: "A. Sverdlin" To: u-boot@lists.denx.de Cc: Alexander Sverdlin , Joe Hershberger , Ramon Fried , Tom Rini , Peng Fan , Ye Li , Heiko Schocher Subject: [PATCH] net: fec: phy: Don't advertise Gbit on (R)MII Date: Thu, 12 Dec 2024 18:25:24 +0100 Message-ID: <20241212172530.2551014-1-alexander.sverdlin@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-456497:519-21489:flowmailer 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.8 at phobos.denx.de X-Virus-Status: Clean From: Alexander Sverdlin Currently if a gigabit-capable PHY is connected to FEC via RMII or MII, it will advertise 1000FULL and 1000HALF to a link partner. Different problems may arise here: - usually with (R)MII between MAC and PHY the PHY's connection to magnetics would have only 2 pairs routed as well, otherwise a PHY can negotiate 1000 speed and there will be no traffic possible; - but even if there is no way to negotiate 1000 speed in HW (only 2 signal pairs routed), it may take a lot of time for PHY to figure this out; in case of AD1300 it takes 17-20 seconds, which is waay longer than default 4s PHY_ANEG_TIMEOUT. Use phy_set_supported() in such cases to disable gigabit advertised options. Signed-off-by: Alexander Sverdlin --- drivers/net/fec_mxc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index eca681b16d1..7d2170ae72c 100644 --- a/drivers/net/fec_mxc.c +++ b/drivers/net/fec_mxc.c @@ -1162,6 +1162,7 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev) { struct phy_device *phydev = NULL; int addr; + int ret; addr = device_get_phy_addr(priv, dev); #ifdef CFG_FEC_MXC_PHYADDR @@ -1175,6 +1176,17 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev) if (!phydev) return -ENODEV; + switch (priv->interface) { + case PHY_INTERFACE_MODE_MII: + case PHY_INTERFACE_MODE_RMII: + ret = phy_set_supported(phydev, SPEED_100); + if (ret) + return ret; + break; + default: + break; + } + priv->phydev = phydev; priv->phydev->node = priv->phy_of_node; phy_config(phydev);