netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DSA: Attaching phy twice?
@ 2015-02-08 20:32 Andrew Lunn
  2015-02-08 22:59 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lunn @ 2015-02-08 20:32 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev

Hi Florian

Have you seen messages like this before?

[    2.495126] Distributed Switch Architecture driver version 0.1
[    2.501358] mvneta f1070000.ethernet eth0: [0]: detected a Marvell 88E6172 switch
[    2.556441] libphy: dsa slave smi: probed
[    2.638292] net lan4: PHY already attached
[    2.733285] net lan3: PHY already attached
[    2.820749] net lan2: PHY already attached
[    2.910749] net lan1: PHY already attached
[    3.000772] net internet: PHY already attached

What appears to be happening is that dsa_slave_phy_setup() is finding
the phy for the port via device tree and using of_phy_connect(), or it
uses the fall back of taking a phy from the switch internal mdio bus
and calling phy_connect_direct(). So if a phy is found,
phy_attach_direct() gets called to attach the phy to the device.

Then in dsa_slave_create(), a second call to phy_attach() is
made. This is when we get the warning "PHY already attached", and it
returns EBUSY, which is ignored.

Is this code at the end of dsa_slave_create() doing anything useful?

	if (p->phy != NULL) {
		if (ds->drv->get_phy_flags)
			p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);

		phy_attach(slave_dev, dev_name(&p->phy->dev),
			   PHY_INTERFACE_MODE_GMII);

		p->phy->autoneg = AUTONEG_ENABLE;
		p->phy->speed = 0;
		p->phy->duplex = 0;
		p->phy->advertising = p->phy->supported | ADVERTISED_Autoneg;
	}

My quick testing suggests its not useful, so if you agree, i will
submit a patch removing it. Or am i missing something?

Thanks
	Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: DSA: Attaching phy twice?
  2015-02-08 20:32 DSA: Attaching phy twice? Andrew Lunn
@ 2015-02-08 22:59 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2015-02-08 22:59 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev

Hi Andrew,

Le 08/02/2015 12:32, Andrew Lunn a écrit :
> Hi Florian
> 
> Have you seen messages like this before?

Yes :)

> 
> [    2.495126] Distributed Switch Architecture driver version 0.1
> [    2.501358] mvneta f1070000.ethernet eth0: [0]: detected a Marvell 88E6172 switch
> [    2.556441] libphy: dsa slave smi: probed
> [    2.638292] net lan4: PHY already attached
> [    2.733285] net lan3: PHY already attached
> [    2.820749] net lan2: PHY already attached
> [    2.910749] net lan1: PHY already attached
> [    3.000772] net internet: PHY already attached
> 
> What appears to be happening is that dsa_slave_phy_setup() is finding
> the phy for the port via device tree and using of_phy_connect(), or it
> uses the fall back of taking a phy from the switch internal mdio bus
> and calling phy_connect_direct(). So if a phy is found,
> phy_attach_direct() gets called to attach the phy to the device.
> 
> Then in dsa_slave_create(), a second call to phy_attach() is
> made. This is when we get the warning "PHY already attached", and it
> returns EBUSY, which is ignored.
> 
> Is this code at the end of dsa_slave_create() doing anything useful?
> 
> 	if (p->phy != NULL) {
> 		if (ds->drv->get_phy_flags)
> 			p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);
> 
> 		phy_attach(slave_dev, dev_name(&p->phy->dev),
> 			   PHY_INTERFACE_MODE_GMII);
> 
> 		p->phy->autoneg = AUTONEG_ENABLE;
> 		p->phy->speed = 0;
> 		p->phy->duplex = 0;
> 		p->phy->advertising = p->phy->supported | ADVERTISED_Autoneg;
> 	}
> 
> My quick testing suggests its not useful, so if you agree, i will
> submit a patch removing it. Or am i missing something?

Right, now that we have a call to phy_connect_direct() for the built-in
MDIO bus of the switch, we can remove that code, as it is indeed
redundant (note that it was not before, especially for !OF setups). I
would be happy to ack such a patch and give it a try here as well (with
bcm_sf2).

Thanks!
--
Florian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-08 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-08 20:32 DSA: Attaching phy twice? Andrew Lunn
2015-02-08 22:59 ` Florian Fainelli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).