[net-next,v6,5/6] dsa: lan9303: Port 0 is xMII port

Message ID 20230109211849.32530-6-jerry.ray@microchip.com
State New
Headers
Series dsa: lan9303: Move to PHYLINK |

Commit Message

Jerry Ray Jan. 9, 2023, 9:18 p.m. UTC
  In preparing to move the adjust_link logic into the phylink_mac_link_up
api, change the macro used to check for the cpu port. In
phylink_mac_link_up, the phydev pointer passed in for the CPU port is
NULL, so we can't keep using phy_is_pseudo_fixed_link(phydev).

Signed-off-by: Jerry Ray <jerry.ray@microchip.com>
---
v5->v6:
  Using port 0 to identify the xMII port on the LAN9303.
---
 drivers/net/dsa/lan9303-core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Vladimir Oltean Jan. 14, 2023, 8:53 p.m. UTC | #1
On Mon, Jan 09, 2023 at 03:18:48PM -0600, Jerry Ray wrote:
> In preparing to move the adjust_link logic into the phylink_mac_link_up
> api, change the macro used to check for the cpu port. In
> phylink_mac_link_up, the phydev pointer passed in for the CPU port is
> NULL, so we can't keep using phy_is_pseudo_fixed_link(phydev).
> 
> Signed-off-by: Jerry Ray <jerry.ray@microchip.com>
> ---
> v5->v6:
>   Using port 0 to identify the xMII port on the LAN9303.
> ---
>  drivers/net/dsa/lan9303-core.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
> index 792ce6a26a6a..7be4c491e5d9 100644
> --- a/drivers/net/dsa/lan9303-core.c
> +++ b/drivers/net/dsa/lan9303-core.c
> @@ -1063,7 +1063,11 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port,
>  {
>  	int ctl;
>  
> -	if (!phy_is_pseudo_fixed_link(phydev))
> +	/* On this device, we are only interested in doing something here if
> +	 * this is an xMII port. All other ports are 10/100 phys using MDIO
> +	 * to control there link settings.
> +	 */
> +	if (port != 0)

Maybe a macro LAN9303_XMII_PORT would be good, if it was also
consistently used in lan9303_setup()?

>  		return;
>  
>  	ctl = lan9303_phy_read(ds, port, MII_BMCR);
> -- 
> 2.17.1
>
  
Jerry Ray Jan. 16, 2023, 6:05 p.m. UTC | #2
> > In preparing to move the adjust_link logic into the phylink_mac_link_up
> > api, change the macro used to check for the cpu port. In
> > phylink_mac_link_up, the phydev pointer passed in for the CPU port is
> > NULL, so we can't keep using phy_is_pseudo_fixed_link(phydev).
> >
> > Signed-off-by: Jerry Ray <jerry.ray@microchip.com>
> > ---
> > v5->v6:
> >   Using port 0 to identify the xMII port on the LAN9303.
> > ---
> >  drivers/net/dsa/lan9303-core.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
> > index 792ce6a26a6a..7be4c491e5d9 100644
> > --- a/drivers/net/dsa/lan9303-core.c
> > +++ b/drivers/net/dsa/lan9303-core.c
> > @@ -1063,7 +1063,11 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port,
> >  {
> >       int ctl;
> >
> > -     if (!phy_is_pseudo_fixed_link(phydev))
> > +     /* On this device, we are only interested in doing something here if
> > +      * this is an xMII port. All other ports are 10/100 phys using MDIO
> > +      * to control there link settings.
> > +      */
> > +     if (port != 0)
> 
> Maybe a macro LAN9303_XMII_PORT would be good, if it was also
> consistently used in lan9303_setup()?
> 

Agreed.  As I add more devices that have different capabilities, this will
change. I was hesitant to add this logic now as it is uncalled for until
multiple device types are supported by the driver.

> >               return;
> >
> >       ctl = lan9303_phy_read(ds, port, MII_BMCR);
> > --
> > 2.17.1
> >
  

Patch

diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 792ce6a26a6a..7be4c491e5d9 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -1063,7 +1063,11 @@  static void lan9303_adjust_link(struct dsa_switch *ds, int port,
 {
 	int ctl;
 
-	if (!phy_is_pseudo_fixed_link(phydev))
+	/* On this device, we are only interested in doing something here if
+	 * this is an xMII port. All other ports are 10/100 phys using MDIO
+	 * to control there link settings.
+	 */
+	if (port != 0)
 		return;
 
 	ctl = lan9303_phy_read(ds, port, MII_BMCR);