From: Linkui Xiao <xiaolinkui@126.com>
To: andrew@lunn.ch
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
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 [thread overview]
Message-ID: <20261123093201.770552-3-xiaolinkui@126.com> (raw)
In-Reply-To: <20261123093201.770552-1-xiaolinkui@126.com>
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
prev parent reply other threads:[~2026-11-23 9:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 9:31 [PATCH net v2 0/2] net: ibm: emac: fix the fixed-link PHY setup Linkui Xiao
2026-11-23 9:32 ` [PATCH net v2 1/2] net: ibm: emac: attach the fixed-link PHY with of_phy_connect() Linkui Xiao
2026-11-23 9:32 ` Linkui Xiao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261123093201.770552-3-xiaolinkui@126.com \
--to=xiaolinkui@126.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=chunkeey@gmail.com \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kees+treewide@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rosenp@gmail.com \
--cc=xiaolinkui@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®