🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20850

[PATCH net v2 2/2] net: ibm: emac: read the fixed-link status before adjusting the link

#20850
From: Linkui Xiao
Date: Mon, 23 Nov 2026 09:32
51 lines
10479 bytes
From: Linkui Xiao <xiaolinkui@kylinos.cn>

For a fixed link emac_init_phy() calls emac_adjust_link() once to copy
the link parameters from the phy_device into dev->phy, and never starts
the PHY state machine.

That worked while fixed_phy_register() copied the device tree status into
the phy_device itself.  Commit d99b408ed8e5 ("net: phy: fixed_phy: remove
not needed initialization of phy_device members") dropped that, expecting
the state machine to fill the members in once the PHY is started.  EMAC
does not start it, so emac_adjust_link() now copies SPEED_UNKNOWN and
DUPLEX_UNKNOWN, and emac_configure() programs the MAC for 10 Mbit/s half
duplex with flow control off, whatever the fixed-link property says.

Read the status once after attaching, as emac_mdio_read_link() already
does for the phy-handle path.  The PHY is emulated, so genphy_read_status()
resolves speed, duplex and pause from the registers swphy generates out of
the device tree status.

Fixes: d99b408ed8e5 ("net: phy: fixed_phy: remove not needed initialization of phy_device members")
Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
---
 drivers/net/ethernet/ibm/emac/core.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index ba02cf878a12..8b9ffbcd2ff4 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2677,9 +2677,16 @@ static int emac_init_phy(struct emac_instance *dev)
 				return res;
 
 			if (!of_phy_connect(ndev, np, &emac_adjust_link, 0,
-					    dev->phy_mode)) {
+					    dev->phy_mode))
+				res = -EINVAL;
+			else
+				res = phy_read_status(ndev->phydev);
+
+			if (res) {
+				if (ndev->phydev)
+					phy_disconnect(ndev->phydev);
 				of_phy_deregister_fixed_link(np);
-				return -EINVAL;
+				return res;
 			}
 
 			emac_adjust_link(ndev);
-- 
2.25.1
Technical Details
Message-ID: <20261123093201.770552-3-xiaolinkui@126.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369188-linux-kernel-netdev=dewy.ru
References: <20261123093201.770552-1-xiaolinkui@126.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369188-linux-kernel-netdev=dewy.ru
From: xiaolinkui@126.com (Linkui Xiao)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 2/2] net: ibm: emac: read the fixed-link status before adjusting the link
Date: Mon, 23 Nov 2026 17:32:01 +0800
Organization: Usenet Network
Message-ID: <20261123093201.770552-3-xiaolinkui@126.com>
References: <20261123093201.770552-1-xiaolinkui@126.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3839201"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+MXZIgJ6mJvs9rKZAEWIPGsDdBU= sha256:Sy22ZUVyTVo0dnYmw8CouKS1zzfAQ1N/z8jMVpp5CFs=
	sha1:678XaAHy7KM8+5grxqX/OZVZRVg= sha256:6Lna+agkQyyIF919Sc9+ltgUTIZlF0b5tWIe19kgbB4=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id E6BE7125D98; Mon, 23 Nov 2026 12:33:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=126.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id i9CAo7ZQU_Nc;
	Mon, 23 Nov 2026 12:33:36 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369188-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=126.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 92437125D96; Mon, 23 Nov 2026 12:33:27 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7E48831AFF; Mon, 23 Nov 2026 09:33:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795426397;
	b=UoeEbdQEvNWErsZ1iCUz9hYmM9NjA8gMqpHIEnsrYWY11hyL6gDuVEmJqpRRbSn6aU0l
	 Ei33ZqqgU77mv6HHdOpvhYTf0eiNofPcHeOjKWEWxmbZVDX8kWdy9OBXBs9DGLAT2G0Ku
	 IEP1qwE5uf7hhB4PsL1yCBKx9TjPYR8FATXPdduB5QU/rY9q4HGUIn+HIJTZMxMh7XWKR
	 jEXgH7+B632HJF3iUb+vQ/ILCLhN4p4rDyaKPVJrn3JOBDniF8NaDunpI4jiM3TUS1a2J
	 e9tbz2okejKu2g/jiU29jnVhkablVI9i66hmMp9QC4zngi3ohXdkDSap7mABeoRVTAQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795426397;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To:
	 Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-CM-TRANSID:X-Coremail-Antispam:
	 X-CM-SenderInfo;
	bh=qJHe16AAk+KmWy7GWmm4YsRuo6Hqr72WzJ5jnLonod8=;
	b=tNYTeVbsonLWE9DZ1IlCAR+rXgFlOwhFcITGkjEIOXl+VrV8VmbgcNPm2Hv1mMj3RrDh
	 LbGiONe0/4gLwKgtEC6A2vHlRJuLqusp8eW+bawqHMc1Z2eKf2VxTav/FEGKPzjovF1PH
	 5zGqZIydw4QzTg/qG6L0J1UbF4Wn02YDMcVIjyBNx21JVM4mahmF/n5sgOLxyWaHHxkKH
	 tUNoK0EC6331Ui9TfR1bVj1qp1PNJgj1npPlsXqm1urNBAQVbhLQ0Y1+RC4V0ClarzDmZ
	 gBlnGxrhNJSX20QF61xFlenlLXJjaUbdeOMZ7nnrh1cMWPql5YDR5Fs20HwiKDcGx4Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=VzrDHnCR;
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E137606A685;
	Mon, 23 Nov 2026 09:33:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=VzrDHnCR
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=117.135.210.7
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795426391;
	b=fgGOUJHfBjsVGSl6jk7wssaL7MbWMtHAKTL0Z7Xnw/P3kn2+KuX+v3AZRVSIaIJautgO
	 mSeQL/pvYsOOaKB4PeR5b5mfxoyuRc6WXyvlMIpKfndHuL7uBY/4YRb/8kermERPIy4rK
	 n7516QIqM4LwAXWqCAQ2sA1CEZ7KuQheLMOh5PcxKEwEidJhepbA/CKZHavK5Hw9MwJQx
	 gOQB1+x+IIcFBTS6srywsiluiBoKAQEd6tbJkjyjh8kXt0W25yHo2GRNvJenNsWk39LRn
	 Pt4ZNfY/SK1Eee6+PGFbNpxKsDZQx62MJdX0Kn5GWF5zydbW1eimseWN85Dnu7Uhm4w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795426391;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-CM-TRANSID:X-Coremail-Antispam:
	 X-CM-SenderInfo;
	bh=qJHe16AAk+KmWy7GWmm4YsRuo6Hqr72WzJ5jnLonod8=;
	b=oI/z0hrbMv35sFZrgMp4+nfd5CSR+2BvkM1tYTDSxSUUa2crEOsWRch/nJLG0R65BBxH
	 09CKVc+xGsoXm0OI0alBCHheH3igB+7i2LUt/3Pt5QS7b9aZhEDewWkkgAr4fADBTw3U5
	 2u4idODiVPo5C28hPjKEBR3DD7wWsTPanog1oXjRJ3Qc4w2kMfOIxQTropRvvfWg3IV0W
	 ZrV/u6+4GC1qX+hu2kNu8i1oh9k0qbLBwa6chpMPehU3ZUO4pr8uhhjs0Y4UeNReV03Vi
	 eQr4QzgR/IO16SYf1GEbMrRUS3Qd80HlfxbP8mP4jOLy8b4YDLIJkyBSjFoiFEpK+lQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.com;
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=VzrDHnCR;
	arc=none smtp.remote-ip=117.135.210.7
X-Received: from m16.mail.126.com (m16.mail.126.com [117.135.210.7])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77487606A321;
	Mon, 23 Nov 2026 09:33:09 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 77487606A321
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com;
	s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=qJ
	He16AAk+KmWy7GWmm4YsRuo6Hqr72WzJ5jnLonod8=; b=VzrDHnCRtsSb6YjZsq
	UUEQ2d/rCI9GQ5rbiNNRkdGVG4+qX98ohXegL8E1AzN3l7tkM9qK9LRi3zNTbjFD
	MmzOxc7DozYNS+vf1mn/zSaJsAjbc3IKa8umkSmBjD4Hl/Ob9jmvVnEdHE7fZt/Y
	/Z2Jgr42em7Wr9Q2uG3zXI84g=
X-Received: from localhost.localdomain (unknown [])
	by gzsmtp4 (Coremail) with SMTP id PykvCgD3l7UTCARrlp7DDw--.2488S4;
	Mon, 23 Nov 2026 17:32:07 +0800 (CST)
X-Cc: andrew+netdev@lunn.ch,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	rosenp@gmail.com,
	jacob.e.keller@intel.com,
	daniel.machon@microchip.com,
	chunkeey@gmail.com,
	kees+treewide@kernel.org,
	netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	xiaolinkui@kylinos.cn
X-Mailer: git-send-email 2.25.1
X-In-Reply-To: <20261123093201.770552-1-xiaolinkui@126.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-CM-TRANSID: PykvCgD3l7UTCARrlp7DDw--.2488S4
X-Coremail-Antispam: 1Uf129KBjvJXoW7Aw4DuFW5CFy7JFyxKw17Jrb_yoW8Zr4Up3
	yUXa4fZrykJ3WfWF45AFWUJrW5uayxKayxKF1Iyws3Wan8JrykJry5tFWUJr1YyrWvyFy5
	ZF18Ca9xuFs8Jw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j0zuAUUUUU=
X-CM-SenderInfo: p0ld0z5lqn3xa6rslhhfrp/xtbBlBfiuWsECBfLsQAA3S