[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200621225451.12435-8-ioana.ciornei@nxp.com>
Date: Mon, 22 Jun 2020 01:54:49 +0300
From: Ioana Ciornei <ioana.ciornei@....com>
To: netdev@...r.kernel.org, davem@...emloft.net
Cc: vladimir.oltean@....com, claudiu.manoil@....com,
alexandru.marginean@....com, michael@...le.cc, andrew@...n.ch,
linux@...linux.org.uk, f.fainelli@...il.com, olteanv@...il.com,
Ioana Ciornei <ioana.ciornei@....com>
Subject: [PATCH net-next v3 7/9] net: dsa: felix: set proper pause frame timers based on link speed
From: Vladimir Oltean <vladimir.oltean@....com>
state->speed holds a value of 10, 100, 1000 or 2500, but
SYS_MAC_FC_CFG_FC_LINK_SPEED expects a value in the range 0, 1, 2 or 3.
So set the correct speed encoding into this register.
Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>
---
Changes in v3:
* patch added
drivers/net/dsa/ocelot/felix.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 723d4cb89fdf..98ae8421ef7f 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -225,10 +225,25 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port,
DEV_CLOCK_CFG_LINK_SPEED(OCELOT_SPEED_1000),
DEV_CLOCK_CFG);
- /* Flow control. Link speed is only used here to evaluate the time
- * specification in incoming pause frames.
- */
- mac_fc_cfg = SYS_MAC_FC_CFG_FC_LINK_SPEED(state->speed);
+ switch (state->speed) {
+ case SPEED_10:
+ mac_fc_cfg = SYS_MAC_FC_CFG_FC_LINK_SPEED(3);
+ break;
+ case SPEED_100:
+ mac_fc_cfg = SYS_MAC_FC_CFG_FC_LINK_SPEED(2);
+ break;
+ case SPEED_1000:
+ case SPEED_2500:
+ mac_fc_cfg = SYS_MAC_FC_CFG_FC_LINK_SPEED(1);
+ break;
+ case SPEED_UNKNOWN:
+ mac_fc_cfg = SYS_MAC_FC_CFG_FC_LINK_SPEED(0);
+ break;
+ default:
+ dev_err(ocelot->dev, "Unsupported speed on port %d: %d\n",
+ port, state->speed);
+ return;
+ }
/* handle Rx pause in all cases, with 2500base-X this is used for rate
* adaptation.
@@ -240,6 +255,10 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port,
SYS_MAC_FC_CFG_PAUSE_VAL_CFG(0xffff) |
SYS_MAC_FC_CFG_FC_LATENCY_CFG(0x7) |
SYS_MAC_FC_CFG_ZERO_PAUSE_ENA;
+
+ /* Flow control. Link speed is only used here to evaluate the time
+ * specification in incoming pause frames.
+ */
ocelot_write_rix(ocelot, mac_fc_cfg, SYS_MAC_FC_CFG, port);
ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port);
--
2.25.1
Powered by blists - more mailing lists