diff mbox series

[RFC,net-next,9/9] net: sparx5: switch PCS driver to use phylink_pcs_neg_mode()

Message ID E1q1UMY-007FTP-SG@rmk-PC.armlinux.org.uk (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series Add and use helper for PCS negotiation modes | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Russell King (Oracle) May 23, 2023, 3:55 p.m. UTC
Use the newly introduced phylink_pcs_neg_mode() to configure whether
inband-AN should be used.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Daniel Machon May 30, 2023, 12:49 p.m. UTC | #1
> Use the newly introduced phylink_pcs_neg_mode() to configure whether
> inband-AN should be used.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
> index bb97d27a1da4..87bdec185383 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
> @@ -99,13 +99,17 @@ static int sparx5_pcs_config(struct phylink_pcs *pcs,
>  {
>         struct sparx5_port *port = sparx5_pcs_to_port(pcs);
>         struct sparx5_port_config conf;
> +       unsigned int neg_mode;
>         int ret = 0;
> 
> +       neg_mode = phylink_pcs_neg_mode(mode, interface, advertising);
> +
>         conf = port->conf;
>         conf.power_down = false;
>         conf.portmode = interface;
> -       conf.inband = phylink_autoneg_inband(mode);
> -       conf.autoneg = phylink_test(advertising, Autoneg);
> +       conf.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_DISABLED ||
> +                     neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
> +       conf.autoneg = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
>         conf.pause_adv = 0;
>         if (phylink_test(advertising, Pause))
>                 conf.pause_adv |= ADVERTISE_1000XPAUSE;
> --
> 2.30.2
> 
>

Hi Russel,

This looks good to me. Tested on sparx5 pcb134 and pcb135.

/Daniel
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
index bb97d27a1da4..87bdec185383 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_phylink.c
@@ -99,13 +99,17 @@  static int sparx5_pcs_config(struct phylink_pcs *pcs,
 {
 	struct sparx5_port *port = sparx5_pcs_to_port(pcs);
 	struct sparx5_port_config conf;
+	unsigned int neg_mode;
 	int ret = 0;
 
+	neg_mode = phylink_pcs_neg_mode(mode, interface, advertising);
+
 	conf = port->conf;
 	conf.power_down = false;
 	conf.portmode = interface;
-	conf.inband = phylink_autoneg_inband(mode);
-	conf.autoneg = phylink_test(advertising, Autoneg);
+	conf.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_DISABLED ||
+		      neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
+	conf.autoneg = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
 	conf.pause_adv = 0;
 	if (phylink_test(advertising, Pause))
 		conf.pause_adv |= ADVERTISE_1000XPAUSE;