diff mbox series

[net-next] net: dsa: Simplify dsa_slave_phy_setup()

Message ID 20171026003205.13673-1-f.fainelli@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net-next] net: dsa: Simplify dsa_slave_phy_setup() | expand

Commit Message

Florian Fainelli Oct. 26, 2017, 12:32 a.m. UTC
Remove the code that tried to identify if a PHY designated by Device
Tree required diversion through the DSA-created MDIO bus. This was
created mainly for the bcm_sf2.c driver back when it did not have its
own MDIO bus driver, which it now has since 461cd1b03e32 ("net: dsa:
bcm_sf2: Register our slave MDIO bus").

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/slave.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

Comments

Vivien Didelot Oct. 26, 2017, 1:21 a.m. UTC | #1
Florian Fainelli <f.fainelli@gmail.com> writes:

> Remove the code that tried to identify if a PHY designated by Device
> Tree required diversion through the DSA-created MDIO bus. This was
> created mainly for the bcm_sf2.c driver back when it did not have its
> own MDIO bus driver, which it now has since 461cd1b03e32 ("net: dsa:
> bcm_sf2: Register our slave MDIO bus").
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Andrew Lunn Oct. 26, 2017, 7:19 a.m. UTC | #2
On Wed, Oct 25, 2017 at 05:32:05PM -0700, Florian Fainelli wrote:
> Remove the code that tried to identify if a PHY designated by Device
> Tree required diversion through the DSA-created MDIO bus. This was
> created mainly for the bcm_sf2.c driver back when it did not have its
> own MDIO bus driver, which it now has since 461cd1b03e32 ("net: dsa:
> bcm_sf2: Register our slave MDIO bus").
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks for the cleanup.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Martin Hundebøll Oct. 26, 2017, 11:07 a.m. UTC | #3
On 2017-10-26 02:32, Florian Fainelli wrote:
> Remove the code that tried to identify if a PHY designated by Device
> Tree required diversion through the DSA-created MDIO bus. This was
> created mainly for the bcm_sf2.c driver back when it did not have its
> own MDIO bus driver, which it now has since 461cd1b03e32 ("net: dsa:
> bcm_sf2: Register our slave MDIO bus").
> 
> Signed-off-by: Florian Fainelli<f.fainelli@gmail.com>

Tested-by: Martin Hundebøll <mnhu@prevas.dk>


Thanks,
Martin
Florian Fainelli Oct. 26, 2017, 4:45 p.m. UTC | #4
On 10/26/2017 04:07 AM, Martin Hundebøll wrote:
> On 2017-10-26 02:32, Florian Fainelli wrote:
>> Remove the code that tried to identify if a PHY designated by Device
>> Tree required diversion through the DSA-created MDIO bus. This was
>> created mainly for the bcm_sf2.c driver back when it did not have its
>> own MDIO bus driver, which it now has since 461cd1b03e32 ("net: dsa:
>> bcm_sf2: Register our slave MDIO bus").
>>
>> Signed-off-by: Florian Fainelli<f.fainelli@gmail.com>
> 
> Tested-by: Martin Hundebøll <mnhu@prevas.dk>

Thanks Martin, does that correctly fix the problem you reported a week
ago on 639X?
Martin Hundebøll Oct. 27, 2017, 5:02 a.m. UTC | #5
On 2017-10-26 18:45, Florian Fainelli wrote:
> On 10/26/2017 04:07 AM, Martin Hundebøll wrote:
>> On 2017-10-26 02:32, Florian Fainelli wrote:
>>> Remove the code that tried to identify if a PHY designated by Device
>>> Tree required diversion through the DSA-created MDIO bus. This was
>>> created mainly for the bcm_sf2.c driver back when it did not have its
>>> own MDIO bus driver, which it now has since 461cd1b03e32 ("net: dsa:
>>> bcm_sf2: Register our slave MDIO bus").
>>>
>>> Signed-off-by: Florian Fainelli<f.fainelli@gmail.com>
>> Tested-by: Martin Hundebøll<mnhu@prevas.dk>
> Thanks Martin, does that correctly fix the problem you reported a week
> ago on 639X?

It does indeed. Thanks for the work on this.

// Martin
David Miller Oct. 27, 2017, 1:11 p.m. UTC | #6
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 25 Oct 2017 17:32:05 -0700

> Remove the code that tried to identify if a PHY designated by Device
> Tree required diversion through the DSA-created MDIO bus. This was
> created mainly for the bcm_sf2.c driver back when it did not have its
> own MDIO bus driver, which it now has since 461cd1b03e32 ("net: dsa:
> bcm_sf2: Register our slave MDIO bus").
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied.
diff mbox series

Patch

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index d0ae7010ea45..808e205227c3 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1060,28 +1060,10 @@  static int dsa_slave_phy_setup(struct net_device *slave_dev)
 		phy_flags = ds->ops->get_phy_flags(ds, dp->index);
 
 	if (phy_dn) {
-		int phy_id = of_mdio_parse_addr(&slave_dev->dev, phy_dn);
-
-		/* If this PHY address is part of phys_mii_mask, which means
-		 * that we need to divert reads and writes to/from it, then we
-		 * want to bind this device using the slave MII bus created by
-		 * DSA to make that happen.
-		 */
-		if (!phy_is_fixed && phy_id >= 0 &&
-		    (ds->phys_mii_mask & (1 << phy_id))) {
-			ret = dsa_slave_phy_connect(slave_dev, phy_id);
-			if (ret) {
-				netdev_err(slave_dev, "failed to connect to phy%d: %d\n", phy_id, ret);
-				of_node_put(phy_dn);
-				return ret;
-			}
-		} else {
-			slave_dev->phydev = of_phy_connect(slave_dev, phy_dn,
-							   dsa_slave_adjust_link,
-							   phy_flags,
-							   p->phy_interface);
-		}
-
+		slave_dev->phydev = of_phy_connect(slave_dev, phy_dn,
+						   dsa_slave_adjust_link,
+						   phy_flags,
+						   p->phy_interface);
 		of_node_put(phy_dn);
 	}