All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: Do not override PHY interface if already configured
@ 2015-08-08 19:58 Florian Fainelli
  2015-08-12 21:30 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2015-08-08 19:58 UTC (permalink / raw)
  To: netdev; +Cc: davem, andrew, linux, Florian Fainelli

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>
---
Hi Guenter,

Could you verify this does not break what you were trying to fix with your change?
I am fairly confident this will not because for "PHYs" built-into the switch port
we will not be able to fetch a "phy-mode" property from DT, so we will use
PHY_INTERFACE_MODE_NA, but here, we will re-assign them to PHY_INTERFACE_MODE_GMII
as before.

Thanks!

 net/dsa/slave.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 0917123790ea..35c47ddd04f0 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -756,7 +756,8 @@ static int dsa_slave_phy_connect(struct dsa_slave_priv *p,
 		return -ENODEV;
 
 	/* Use already configured phy mode */
-	p->phy_interface = p->phy->interface;
+	if (p->phy_interface == PHY_INTERFACE_MODE_NA)
+		p->phy_interface = p->phy->interface;
 	phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link,
 			   p->phy_interface);
 
-- 
2.1.0

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

* Re: [PATCH net] net: dsa: Do not override PHY interface if already configured
  2015-08-08 19:58 [PATCH net] net: dsa: Do not override PHY interface if already configured Florian Fainelli
@ 2015-08-12 21:30 ` David Miller
  2015-08-12 21:34   ` Florian Fainelli
  2015-08-12 21:35   ` Guenter Roeck
  0 siblings, 2 replies; 5+ messages in thread
From: David Miller @ 2015-08-12 21:30 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, linux

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sat,  8 Aug 2015 12:58:57 -0700

> 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>
> ---
> Hi Guenter,
> 
> Could you verify this does not break what you were trying to fix with your change?
> I am fairly confident this will not because for "PHYs" built-into the switch port
> we will not be able to fetch a "phy-mode" property from DT, so we will use
> PHY_INTERFACE_MODE_NA, but here, we will re-assign them to PHY_INTERFACE_MODE_GMII
> as before.

I was trying to wait for Guenter's testing before applying this, but it's been some
time already and it makes no sense to wait any longer.

Applied to 'net', thanks Florian.

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

* Re: [PATCH net] net: dsa: Do not override PHY interface if already configured
  2015-08-12 21:30 ` David Miller
@ 2015-08-12 21:34   ` Florian Fainelli
  2015-08-12 21:41     ` David Miller
  2015-08-12 21:35   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2015-08-12 21:34 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, andrew, linux

On 12/08/15 14:30, David Miller wrote:
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Sat,  8 Aug 2015 12:58:57 -0700
> 
>> 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>
>> ---
>> Hi Guenter,
>>
>> Could you verify this does not break what you were trying to fix with your change?
>> I am fairly confident this will not because for "PHYs" built-into the switch port
>> we will not be able to fetch a "phy-mode" property from DT, so we will use
>> PHY_INTERFACE_MODE_NA, but here, we will re-assign them to PHY_INTERFACE_MODE_GMII
>> as before.
> 
> I was trying to wait for Guenter's testing before applying this, but it's been some
> time already and it makes no sense to wait any longer.

I should be able to verify this myself in the future since I just setup
a Marvell/DSA switch device here for testing.

> 
> Applied to 'net', thanks Florian.

Could you also schedule this for -stable, at least 4.1 is affected by
this change, thank you!
-- 
Florian

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

* Re: [PATCH net] net: dsa: Do not override PHY interface if already configured
  2015-08-12 21:30 ` David Miller
  2015-08-12 21:34   ` Florian Fainelli
@ 2015-08-12 21:35   ` Guenter Roeck
  1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2015-08-12 21:35 UTC (permalink / raw)
  To: David Miller; +Cc: f.fainelli, netdev, andrew

On Wed, Aug 12, 2015 at 02:30:35PM -0700, David Miller wrote:
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Sat,  8 Aug 2015 12:58:57 -0700
> 
> > 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>
> > ---
> > Hi Guenter,
> > 
> > Could you verify this does not break what you were trying to fix with your change?
> > I am fairly confident this will not because for "PHYs" built-into the switch port
> > we will not be able to fetch a "phy-mode" property from DT, so we will use
> > PHY_INTERFACE_MODE_NA, but here, we will re-assign them to PHY_INTERFACE_MODE_GMII
> > as before.
> 
> I was trying to wait for Guenter's testing before applying this, but it's been some
> time already and it makes no sense to wait any longer.
> 
No problem. I am overloaded, and my test system is currently down, so it will
take a while. If I find a problem I'll discuss with Florian and send a follow-up
patch if needed.

Guenter

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

* Re: [PATCH net] net: dsa: Do not override PHY interface if already configured
  2015-08-12 21:34   ` Florian Fainelli
@ 2015-08-12 21:41     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-08-12 21:41 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, andrew, linux

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 12 Aug 2015 14:34:12 -0700

> On 12/08/15 14:30, David Miller wrote:
>> Applied to 'net', thanks Florian.
> 
> Could you also schedule this for -stable, at least 4.1 is affected by
> this change, thank you!

Done, thanks.

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

end of thread, other threads:[~2015-08-12 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-08 19:58 [PATCH net] net: dsa: Do not override PHY interface if already configured Florian Fainelli
2015-08-12 21:30 ` David Miller
2015-08-12 21:34   ` Florian Fainelli
2015-08-12 21:41     ` David Miller
2015-08-12 21:35   ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.