Message ID | E1q1UMO-007FTD-Kv@rmk-PC.armlinux.org.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add and use helper for PCS negotiation modes | expand |
> -----Original Message----- > From: Russell King <rmk@armlinux.org.uk> On Behalf Of Russell King (Oracle) > Sent: Tuesday, May 23, 2023 6:56 PM > To: Andrew Lunn <andrew@lunn.ch>; Heiner Kallweit > <hkallweit1@gmail.com> > Cc: Daniel Machon <daniel.machon@microchip.com>; David S. Miller > <davem@davemloft.net>; 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>; Lars Povlsen > <lars.povlsen@microchip.com>; linux-arm-kernel@lists.infradead.org; > Madalin Bucur <madalin.bucur@nxp.com>; Marcin Wojtas > <mw@semihalf.com>; Michal Simek <michal.simek@amd.com>; > netdev@vger.kernel.org; Paolo Abeni <pabeni@redhat.com>; Radhey Shyam > Pandey <radhey.shyam.pandey@xilinx.com>; Sean Anderson > <sean.anderson@seco.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 7/9] net: prestera: switch PCS driver to > use phylink_pcs_neg_mode() > > External Email > > ---------------------------------------------------------------------- > 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/marvell/prestera/prestera_main.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c > b/drivers/net/ethernet/marvell/prestera/prestera_main.c > index 9d504142e51a..2a26f96fbed2 100644 > --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c > +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c > @@ -308,38 +308,36 @@ static int prestera_pcs_config(struct phylink_pcs > *pcs, { > struct prestera_port *port = prestera_pcs_to_port(pcs); > struct prestera_port_mac_config cfg_mac; > + unsigned int neg_mode; > int err; > > + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); > + > err = prestera_port_cfg_mac_read(port, &cfg_mac); > if (err) > return err; > > 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; > } > -- > 2.30.2 > Acked-by: Elad Nachman <enachman@marvell.com>
diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c index 9d504142e51a..2a26f96fbed2 100644 --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c @@ -308,38 +308,36 @@ static int prestera_pcs_config(struct phylink_pcs *pcs, { struct prestera_port *port = prestera_pcs_to_port(pcs); struct prestera_port_mac_config cfg_mac; + unsigned int neg_mode; int err; + neg_mode = phylink_pcs_neg_mode(mode, interface, advertising); + err = prestera_port_cfg_mac_read(port, &cfg_mac); if (err) return err; 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; }
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/marvell/prestera/prestera_main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)