From patchwork Fri Jan 10 14:48:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerhard Engleder X-Patchwork-Id: 13934783 X-Patchwork-Delegate: kuba@kernel.org Received: from mx18lb.world4you.com (mx18lb.world4you.com [81.19.149.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19406211464 for ; Fri, 10 Jan 2025 14:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.19.149.128 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736520533; cv=none; b=tH/ggNSVX7j4XFy7w6FSt11/ecuFFjkHAEPhF99o5jJ5qChWx1KRck1kg+7P/UEL6CL1x+4w1uROLvTunkUoc3D3NkeLq486VcKhaJawggnifGtbcHCCJ2LJLi+c0bxgwJ6MW6kS5Ys42GJJNUDWI8U/1oQCFKg7YjG0r0r6Uc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736520533; c=relaxed/simple; bh=mcXzb1go+vbgLR6N1Q5XbVtquExUot5h4o/0jh7/Jjw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y2suLf27gPmNCj7JBbhF0aj0cuAkVdFqwcYyNdLmX6xDdnbanFwNmXTukdFFn6VVmGlAaHHWIQgIqCzYGYGLRojDo328A6Zyo7FgL8kpQGASmvyIBLGhlm/ig/78ft4QLahf5hsURXk7ASNVldVwoLI8qvBD3UXvRgDKn3tzCNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=engleder-embedded.com; spf=pass smtp.mailfrom=engleder-embedded.com; dkim=pass (1024-bit key) header.d=engleder-embedded.com header.i=@engleder-embedded.com header.b=Rq7pdy/O; arc=none smtp.client-ip=81.19.149.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=engleder-embedded.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=engleder-embedded.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=engleder-embedded.com header.i=@engleder-embedded.com header.b="Rq7pdy/O" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=engleder-embedded.com; s=dkim11; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gSlvKuY0FEC4Nr9uEiEPuKjaqvh7m3V2qy8cgmrwRLI=; b=Rq7pdy/OtkBL4N29D3hBXQOEQp oPL+ZKBVre1czVgd1KV14XGWzMg8Da48fQjkr7xO2SiN82T1aUYZUwEROMFmJe+sDrXs+1AGFIuhO okmGmmGMt/oCa5wKnLjR8xDP9XcfSeVc593uG8j7DeJrdzwRpnQdTdnXfHcy6sJok14w=; Received: from 88-117-60-28.adsl.highway.telekom.at ([88.117.60.28] helo=hornet.engleder.at) by mx18lb.world4you.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1tWGJc-000000006oP-33bT; Fri, 10 Jan 2025 15:48:48 +0100 From: Gerhard Engleder To: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, Gerhard Engleder Subject: [PATCH net-next v2 4/5] tsnep: Select speed for loopback Date: Fri, 10 Jan 2025 15:48:27 +0100 Message-Id: <20250110144828.4943-5-gerhard@engleder-embedded.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110144828.4943-1-gerhard@engleder-embedded.com> References: <20250110144828.4943-1-gerhard@engleder-embedded.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-AV-Do-Run: Yes X-ACL-Warn: X-W4Y-Internal X-Patchwork-Delegate: kuba@kernel.org Use 100 Mbps only if the PHY is configured to this speed. Otherwise use always the maximum speed of 1000 Mbps. Signed-off-by: Gerhard Engleder --- drivers/net/ethernet/engleder/tsnep_main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c index 5c501e4f9e3e..45b9f5780902 100644 --- a/drivers/net/ethernet/engleder/tsnep_main.c +++ b/drivers/net/ethernet/engleder/tsnep_main.c @@ -229,8 +229,19 @@ static void tsnep_phy_link_status_change(struct net_device *netdev) static int tsnep_phy_loopback(struct tsnep_adapter *adapter, bool enable) { int retval; + int speed; - retval = phy_loopback(adapter->phydev, enable, 0); + if (enable) { + if (adapter->phydev->autoneg == AUTONEG_DISABLE && + adapter->phydev->speed == SPEED_100) + speed = SPEED_100; + else + speed = SPEED_1000; + } else { + speed = 0; + } + + retval = phy_loopback(adapter->phydev, enable, speed); /* PHY link state change is not signaled if loopback is enabled, it * would delay a working loopback anyway, let's ensure that loopback