diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-02-23 15:20:56 +0200 |
---|---|---|
committer | Ramon Fried <ramon@neureality.ai> | 2022-04-10 08:44:12 +0300 |
commit | 5faf161d07099d25fcb67f203c5576f258a11fbf (patch) | |
tree | ff36b52780a329ec1e00d44a0eaae3d9543e8f26 /drivers/net/phy | |
parent | 107b14e36eaafebdc28666a9d5fecdd4044a59e3 (diff) | |
download | u-boot-5faf161d07099d25fcb67f203c5576f258a11fbf.tar.gz |
net: phy: atheros: avoid error in ar803x_of_init() when PHY has no OF node
A DM_ETH driver may use phy_connect() towards a PHY address on an MDIO
bus which is not specified in the device tree, as evidenced by:
pfe_eth_probe
-> pfe_phy_configure
-> phy_connect
When this happens, the PHY will have an invalid OF node.
When ar803x_config() runs, it silently fails at ar803x_of_init(), and
therefore, fails to run the rest of the initialization.
This makes MII_BMCR contain what it had after BMCR_RESET (0x8000) has
been written into it by phy_reset(). Since BMCR_RESET is volatile and
self-clearing, the MII_BMCR ends up having a value of 0x0. The further
configuration of this register, which is supposed to be handled by
genphy_config_aneg() lower in ar803x_config(), never gets a chance to
run due to this early error from ar803x_of_init().
As a result of having MII_BMCR as 0, the following symptom appears:
=> setenv ethact pfe_eth0
=> setenv ipaddr 10.0.0.1
=> ping 10.0.0.2
pfe_eth0 Waiting for PHY auto negotiation to complete......... TIMEOUT !
Could not initialize PHY pfe_eth0
Manually writing 0x1140 into register 0 of the PHY makes the connection
work, but it is rather desirable that the port works without any manual
intervention.
Fixes: fe6293a80959 ("phy: atheros: add device tree bindings and config")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/atheros.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c index f922fecd6b..fa1fe08518 100644 --- a/drivers/net/phy/atheros.c +++ b/drivers/net/phy/atheros.c @@ -199,7 +199,7 @@ static int ar803x_of_init(struct phy_device *phydev) node = phy_get_ofnode(phydev); if (!ofnode_valid(node)) - return -EINVAL; + return 0; priv = malloc(sizeof(*priv)); if (!priv) |