Commit b21ee342590aa41e21aa0196bff5af592cc349d0

Authored by Florian Fainelli
Committed by Greg Kroah-Hartman
1 parent 0c1122ae61

net: dsa: Do not override PHY interface if already configured

[ Upstream commit 211c504a444710b1d8ce3431ac19f2578602ca27 ]

In case we need to divert reads/writes using the slave MII bus, we may have
already fetched a valid PHY interface property from Device Tree, and that
mode is used by the PHY driver to make configuration decisions.

If we could not fetch the "phy-mode" property, we will assign p->phy_interface
to PHY_INTERFACE_MODE_NA, such that we can actually check for that condition as
to whether or not we should override the interface value.

Fixes: 19334920eaf7 ("net: dsa: Set valid phy interface type")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -732,7 +732,8 @@
732 732 return -ENODEV;
733 733  
734 734 /* Use already configured phy mode */
735   - p->phy_interface = p->phy->interface;
  735 + if (p->phy_interface == PHY_INTERFACE_MODE_NA)
  736 + p->phy_interface = p->phy->interface;
736 737 phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
737 738 p->phy_interface);
738 739