diff mbox series

[RFC,net-next,10/15] net: prestera: update PCS driver to use neg_mode

Message ID E1q95A3-00EBwQ-1y@rmk-PC.armlinux.org.uk (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Add and use helper for PCS negotiation modes | expand

Checks

Context Check Description
netdev/series_format warning Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 47 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Russell King (Oracle) June 13, 2023, 2:38 p.m. UTC
Update prestera's embedded PCS driver to use neg_mode rather than the
mode argument. As there is no pcs_link_up() method, this only affects
the pcs_config() method.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/marvell/prestera/prestera_main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Elad Nachman June 13, 2023, 4:17 p.m. UTC | #1
> -----Original Message-----
> From: Russell King <rmk@armlinux.org.uk> On Behalf Of Russell King (Oracle)
> Sent: Tuesday, June 13, 2023 5:38 PM
> To: Andrew Lunn <andrew@lunn.ch>; Heiner Kallweit
> <hkallweit1@gmail.com>
> Cc: Alexander Couzens <lynxis@fe80.eu>; AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com>; Alexander Couzens
> <lynxis@fe80.eu>; Claudiu Beznea <claudiu.beznea@microchip.com>; Daniel
> Golle <daniel@makrotopia.org>; Daniel Machon
> <daniel.machon@microchip.com>; David S. Miller <davem@davemloft.net>;
> DENG Qingfang <dqfext@gmail.com>; Eric Dumazet
> <edumazet@google.com>; Florian Fainelli <f.fainelli@gmail.com>; Horatiu
> Vultur <horatiu.vultur@microchip.com>; Ioana Ciornei
> <ioana.ciornei@nxp.com>; Jakub Kicinski <kuba@kernel.org>; Jose Abreu
> <Jose.Abreu@synopsys.com>; Landen Chao <Landen.Chao@mediatek.com>;
> Lars Povlsen <lars.povlsen@microchip.com>; linux-arm-
> kernel@lists.infradead.org; linux-mediatek@lists.infradead.org; Madalin
> Bucur <madalin.bucur@nxp.com>; Marcin Wojtas <mw@semihalf.com>;
> Matthias Brugger <matthias.bgg@gmail.com>; Michal Simek
> <michal.simek@amd.com>; netdev@vger.kernel.org; Nicolas Ferre
> <nicolas.ferre@microchip.com>; Paolo Abeni <pabeni@redhat.com>;
> Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>; Sean Anderson
> <sean.anderson@seco.com>; Sean Wang <sean.wang@mediatek.com>;
> Steen Hegelund <Steen.Hegelund@microchip.com>; Taras Chornyi
> <taras.chornyi@plvision.eu>; Thomas Petazzoni
> <thomas.petazzoni@bootlin.com>; UNGLinuxDriver@microchip.com;
> Vladimir Oltean <olteanv@gmail.com>
> Subject: [EXT] [PATCH RFC net-next 10/15] net: prestera: update PCS driver to
> use neg_mode
> 
> External Email
> 
> ----------------------------------------------------------------------
> Update prestera's embedded PCS driver to use neg_mode rather than the
> mode argument. As there is no pcs_link_up() method, this only affects the
> pcs_config() method.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/ethernet/marvell/prestera/prestera_main.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c
> b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> index 9d504142e51a..4fb886c57cd7 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> @@ -300,8 +300,7 @@ static void prestera_pcs_get_state(struct phylink_pcs
> *pcs,
>  	}
>  }
> 
> -static int prestera_pcs_config(struct phylink_pcs *pcs,
> -			       unsigned int mode,
> +static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int
> +neg_mode,
>  			       phy_interface_t interface,
>  			       const unsigned long *advertising,
>  			       bool permit_pause_to_mac)
> @@ -316,30 +315,25 @@ static int prestera_pcs_config(struct phylink_pcs
> *pcs,
> 
>  	cfg_mac.admin = true;
>  	cfg_mac.fec = PRESTERA_PORT_FEC_OFF;
> +	cfg_mac.inband = neg_mode ==
> PHYLINK_PCS_NEG_INBAND_ENABLED;
> 
>  	switch (interface) {
>  	case PHY_INTERFACE_MODE_10GBASER:
>  		cfg_mac.speed = SPEED_10000;
> -		cfg_mac.inband = 0;
>  		cfg_mac.mode = PRESTERA_MAC_MODE_SR_LR;
>  		break;
>  	case PHY_INTERFACE_MODE_2500BASEX:
>  		cfg_mac.speed = SPEED_2500;
>  		cfg_mac.duplex = DUPLEX_FULL;
> -		cfg_mac.inband =
> test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
> -					  advertising);
>  		cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
>  		break;
>  	case PHY_INTERFACE_MODE_SGMII:
> -		cfg_mac.inband = 1;
>  		cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
>  		break;
>  	case PHY_INTERFACE_MODE_1000BASEX:
>  	default:
>  		cfg_mac.speed = SPEED_1000;
>  		cfg_mac.duplex = DUPLEX_FULL;
> -		cfg_mac.inband =
> test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
> -					  advertising);
>  		cfg_mac.mode = PRESTERA_MAC_MODE_1000BASE_X;
>  		break;
>  	}
> @@ -401,6 +395,7 @@ static int prestera_port_sfp_bind(struct
> prestera_port *port)
>  			continue;
> 
>  		port->phylink_pcs.ops = &prestera_pcs_ops;
> +		port->phylink_pcs.neg_mode = true;
> 
>  		port->phy_config.dev = &port->dev->dev;
>  		port->phy_config.type = PHYLINK_NETDEV;
> --
> 2.30.2
> 

Acked-by: Elad Nachman <enachman@marvell.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index 9d504142e51a..4fb886c57cd7 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -300,8 +300,7 @@  static void prestera_pcs_get_state(struct phylink_pcs *pcs,
 	}
 }
 
-static int prestera_pcs_config(struct phylink_pcs *pcs,
-			       unsigned int mode,
+static int prestera_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
 			       phy_interface_t interface,
 			       const unsigned long *advertising,
 			       bool permit_pause_to_mac)
@@ -316,30 +315,25 @@  static int prestera_pcs_config(struct phylink_pcs *pcs,
 
 	cfg_mac.admin = true;
 	cfg_mac.fec = PRESTERA_PORT_FEC_OFF;
+	cfg_mac.inband = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
 
 	switch (interface) {
 	case PHY_INTERFACE_MODE_10GBASER:
 		cfg_mac.speed = SPEED_10000;
-		cfg_mac.inband = 0;
 		cfg_mac.mode = PRESTERA_MAC_MODE_SR_LR;
 		break;
 	case PHY_INTERFACE_MODE_2500BASEX:
 		cfg_mac.speed = SPEED_2500;
 		cfg_mac.duplex = DUPLEX_FULL;
-		cfg_mac.inband = test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
-					  advertising);
 		cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
 		break;
 	case PHY_INTERFACE_MODE_SGMII:
-		cfg_mac.inband = 1;
 		cfg_mac.mode = PRESTERA_MAC_MODE_SGMII;
 		break;
 	case PHY_INTERFACE_MODE_1000BASEX:
 	default:
 		cfg_mac.speed = SPEED_1000;
 		cfg_mac.duplex = DUPLEX_FULL;
-		cfg_mac.inband = test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
-					  advertising);
 		cfg_mac.mode = PRESTERA_MAC_MODE_1000BASE_X;
 		break;
 	}
@@ -401,6 +395,7 @@  static int prestera_port_sfp_bind(struct prestera_port *port)
 			continue;
 
 		port->phylink_pcs.ops = &prestera_pcs_ops;
+		port->phylink_pcs.neg_mode = true;
 
 		port->phy_config.dev = &port->dev->dev;
 		port->phy_config.type = PHYLINK_NETDEV;