From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Alexander Couzens <lynxis@fe80.eu>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Cc: 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: [PATCH net-next 06/15] net: pcs: lynx: update PCS driver to use neg_mode
Date: Fri, 16 Jun 2023 13:06:48 +0100 [thread overview]
Message-ID: <E1qA8E4-00EaFf-Bf@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <ZIxQIBfO9dH5xFlg@shell.armlinux.org.uk>
Update the Lynx PCS driver to use neg_mode rather than the mode
argument. This ensures that the link_up() method will always program
the speed and duplex when negotiation is disabled.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/pcs/pcs-lynx.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c
index 25bd4b45eb7b..9021b96d4f9d 100644
--- a/drivers/net/pcs/pcs-lynx.c
+++ b/drivers/net/pcs/pcs-lynx.c
@@ -149,13 +149,14 @@ static int lynx_pcs_config_giga(struct mdio_device *pcs,
neg_mode);
}
-static int lynx_pcs_config_usxgmii(struct mdio_device *pcs, unsigned int mode,
- const unsigned long *advertising)
+static int lynx_pcs_config_usxgmii(struct mdio_device *pcs,
+ const unsigned long *advertising,
+ unsigned int neg_mode)
{
struct mii_bus *bus = pcs->bus;
int addr = pcs->addr;
- if (!phylink_autoneg_inband(mode)) {
+ if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED) {
dev_err(&pcs->dev, "USXGMII only supports in-band AN for now\n");
return -EOPNOTSUPP;
}
@@ -167,15 +168,11 @@ static int lynx_pcs_config_usxgmii(struct mdio_device *pcs, unsigned int mode,
ADVERTISE_SGMII | ADVERTISE_LPACK);
}
-static int lynx_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
+static int lynx_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t ifmode,
- const unsigned long *advertising,
- bool permit)
+ const unsigned long *advertising, bool permit)
{
struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs);
- unsigned int neg_mode;
-
- neg_mode = phylink_pcs_neg_mode(mode, ifmode, advertising);
switch (ifmode) {
case PHY_INTERFACE_MODE_1000BASEX:
@@ -184,14 +181,15 @@ static int lynx_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
return lynx_pcs_config_giga(lynx->mdio, ifmode, advertising,
neg_mode);
case PHY_INTERFACE_MODE_2500BASEX:
- if (phylink_autoneg_inband(mode)) {
+ if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
dev_err(&lynx->mdio->dev,
"AN not supported on 3.125GHz SerDes lane\n");
return -EOPNOTSUPP;
}
break;
case PHY_INTERFACE_MODE_USXGMII:
- return lynx_pcs_config_usxgmii(lynx->mdio, mode, advertising);
+ return lynx_pcs_config_usxgmii(lynx->mdio, advertising,
+ neg_mode);
case PHY_INTERFACE_MODE_10GBASER:
/* Nothing to do here for 10GBASER */
break;
@@ -209,7 +207,8 @@ static void lynx_pcs_an_restart(struct phylink_pcs *pcs)
phylink_mii_c22_pcs_an_restart(lynx->mdio);
}
-static void lynx_pcs_link_up_sgmii(struct mdio_device *pcs, unsigned int mode,
+static void lynx_pcs_link_up_sgmii(struct mdio_device *pcs,
+ unsigned int neg_mode,
int speed, int duplex)
{
u16 if_mode = 0, sgmii_speed;
@@ -217,7 +216,7 @@ static void lynx_pcs_link_up_sgmii(struct mdio_device *pcs, unsigned int mode,
/* The PCS needs to be configured manually only
* when not operating on in-band mode
*/
- if (mode == MLO_AN_INBAND)
+ if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED)
return;
if (duplex == DUPLEX_HALF)
@@ -264,12 +263,12 @@ static void lynx_pcs_link_up_sgmii(struct mdio_device *pcs, unsigned int mode,
* 2500 Mbps and we do rate adaptation through pause frames.
*/
static void lynx_pcs_link_up_2500basex(struct mdio_device *pcs,
- unsigned int mode,
+ unsigned int neg_mode,
int speed, int duplex)
{
u16 if_mode = 0;
- if (mode == MLO_AN_INBAND) {
+ if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
dev_err(&pcs->dev, "AN not supported for 2500BaseX\n");
return;
}
@@ -283,7 +282,7 @@ static void lynx_pcs_link_up_2500basex(struct mdio_device *pcs,
if_mode);
}
-static void lynx_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
+static void lynx_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
phy_interface_t interface,
int speed, int duplex)
{
@@ -292,10 +291,10 @@ static void lynx_pcs_link_up(struct phylink_pcs *pcs, unsigned int mode,
switch (interface) {
case PHY_INTERFACE_MODE_SGMII:
case PHY_INTERFACE_MODE_QSGMII:
- lynx_pcs_link_up_sgmii(lynx->mdio, mode, speed, duplex);
+ lynx_pcs_link_up_sgmii(lynx->mdio, neg_mode, speed, duplex);
break;
case PHY_INTERFACE_MODE_2500BASEX:
- lynx_pcs_link_up_2500basex(lynx->mdio, mode, speed, duplex);
+ lynx_pcs_link_up_2500basex(lynx->mdio, neg_mode, speed, duplex);
break;
case PHY_INTERFACE_MODE_USXGMII:
/* At the moment, only in-band AN is supported for USXGMII
@@ -325,6 +324,7 @@ static struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio)
mdio_device_get(mdio);
lynx->mdio = mdio;
lynx->pcs.ops = &lynx_pcs_phylink_ops;
+ lynx->pcs.neg_mode = true;
lynx->pcs.poll = true;
return lynx_to_phylink_pcs(lynx);
--
2.30.2
next prev parent reply other threads:[~2023-06-16 12:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 12:05 [PATCH net-next 0/15] Add and use helper for PCS negotiation modes Russell King (Oracle)
2023-06-16 12:06 ` [PATCH net-next 01/15] net: phylink: add PCS negotiation mode Russell King (Oracle)
2023-06-16 15:51 ` Simon Horman
2023-06-20 11:34 ` Vladimir Oltean
2023-06-20 15:42 ` Russell King (Oracle)
2023-06-20 11:37 ` Vladimir Oltean
2023-06-20 15:51 ` Russell King (Oracle)
2023-06-16 12:06 ` [PATCH net-next 02/15] net: phylink: convert phylink_mii_c22_pcs_config() to neg_mode Russell King (Oracle)
2023-06-16 12:06 ` [PATCH net-next 03/15] net: phylink: pass neg_mode into phylink_mii_c22_pcs_config() Russell King (Oracle)
2023-06-16 12:06 ` [PATCH net-next 04/15] net: pcs: xpcs: update PCS driver to use neg_mode Russell King (Oracle)
2023-06-16 12:06 ` [PATCH net-next 05/15] net: pcs: lynxi: " Russell King (Oracle)
2023-06-16 12:06 ` Russell King (Oracle) [this message]
2023-06-16 12:06 ` [PATCH net-next 07/15] net: lan966x: " Russell King (Oracle)
2023-06-16 12:06 ` [PATCH net-next 08/15] net: mvneta: " Russell King (Oracle)
2023-06-16 12:07 ` [PATCH net-next 09/15] net: mvpp2: " Russell King (Oracle)
2023-06-16 12:07 ` [PATCH net-next 10/15] net: prestera: " Russell King (Oracle)
2023-06-16 12:07 ` [PATCH net-next 11/15] net: qca8k: " Russell King (Oracle)
2023-06-20 9:18 ` Russell King (Oracle)
2023-06-20 11:28 ` Vladimir Oltean
2023-06-20 16:22 ` Jakub Kicinski
2023-06-16 12:07 ` [PATCH net-next 12/15] net: sparx5: " Russell King (Oracle)
2023-06-16 12:07 ` [PATCH net-next 13/15] net: dsa: b53: " Russell King (Oracle)
2023-06-20 11:30 ` Florian Fainelli
2023-06-16 12:07 ` [PATCH net-next 14/15] net: dsa: mt7530: " Russell King (Oracle)
2023-06-16 12:07 ` [PATCH net-next 15/15] net: macb: " Russell King (Oracle)
2023-06-16 15:00 ` [PATCH net-next 0/15] Add and use helper for PCS negotiation modes Vladimir Oltean
2023-06-16 15:46 ` Russell King (Oracle)
2023-06-16 15:52 ` Russell King (Oracle)
2023-06-20 11:25 ` Vladimir Oltean
2023-06-20 10:54 ` Vladimir Oltean
2023-06-23 2:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1qA8E4-00EaFf-Bf@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=Jose.Abreu@synopsys.com \
--cc=Landen.Chao@mediatek.com \
--cc=Steen.Hegelund@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=claudiu.beznea@microchip.com \
--cc=daniel.machon@microchip.com \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=horatiu.vultur@microchip.com \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=lars.povlsen@microchip.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lynxis@fe80.eu \
--cc=madalin.bucur@nxp.com \
--cc=matthias.bgg@gmail.com \
--cc=michal.simek@amd.com \
--cc=mw@semihalf.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=radhey.shyam.pandey@xilinx.com \
--cc=sean.anderson@seco.com \
--cc=sean.wang@mediatek.com \
--cc=taras.chornyi@plvision.eu \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).