From: Vladimir Oltean <olteanv@gmail.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, andrew@lunn.ch, vivien.didelot@gmail.com,
f.fainelli@gmail.com, antoine.tenart@bootlin.com,
alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com,
alexandru.marginean@nxp.com, claudiu.manoil@nxp.com,
madalin.bucur@oss.nxp.com, radu-andrei.bulie@nxp.com,
fido_max@inbox.ru, broonie@kernel.org
Subject: [PATCH v3 net-next 11/13] net: dsa: felix: support half-duplex link modes
Date: Sun, 31 May 2020 15:26:38 +0300 [thread overview]
Message-ID: <20200531122640.1375715-12-olteanv@gmail.com> (raw)
In-Reply-To: <20200531122640.1375715-1-olteanv@gmail.com>
From: Vladimir Oltean <vladimir.oltean@nxp.com>
Ping tested:
[ 11.808455] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 11.816497] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
[root@LS1028ARDB ~] # ethtool -s swp0 advertise 0x4
[ 18.844591] mscc_felix 0000:00:00.5 swp0: Link is Down
[ 22.048337] mscc_felix 0000:00:00.5 swp0: Link is Up - 100Mbps/Half - flow control off
[root@LS1028ARDB ~] # ip addr add 192.168.1.1/24 dev swp0
[root@LS1028ARDB ~] # ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
(...)
^C--- 192.168.1.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.383/0.611/1.051 ms
[root@LS1028ARDB ~] # ethtool -s swp0 advertise 0x10
[ 355.637747] mscc_felix 0000:00:00.5 swp0: Link is Down
[ 358.788034] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Half - flow control off
[root@LS1028ARDB ~] # ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
(...)
^C
--- 192.168.1.2 ping statistics ---
16 packets transmitted, 16 packets received, 0% packet loss
round-trip min/avg/max = 0.301/0.384/1.138 ms
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Patch resent from:
https://patchwork.ozlabs.org/project/netdev/patch/20200528094410.2658306-1-olteanv@gmail.com/
Changes in v3:
None.
Changes in v2:
Added spaces before the ping output in the commit message.
drivers/net/dsa/ocelot/felix.c | 4 +++-
drivers/net/dsa/ocelot/felix_vsc9959.c | 13 ++++++++-----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 0346697bed3f..88b64faa8b25 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -167,14 +167,16 @@ static void felix_phylink_validate(struct dsa_switch *ds, int port,
return;
}
- /* No half-duplex. */
phylink_set_port_modes(mask);
phylink_set(mask, Autoneg);
phylink_set(mask, Pause);
phylink_set(mask, Asym_Pause);
phylink_set(mask, 10baseT_Full);
+ phylink_set(mask, 10baseT_Half);
phylink_set(mask, 100baseT_Full);
+ phylink_set(mask, 100baseT_Half);
phylink_set(mask, 1000baseT_Full);
+ phylink_set(mask, 1000baseT_Half);
if (state->interface == PHY_INTERFACE_MODE_INTERNAL ||
state->interface == PHY_INTERFACE_MODE_2500BASEX ||
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index e722b58a714f..61c91248a802 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -875,12 +875,12 @@ static void vsc9959_pcs_init_sgmii(struct phy_device *pcs,
phy_write(pcs, MII_BMCR, BMCR_ANRESTART | BMCR_ANENABLE);
} else {
+ u16 duplex = 0;
int speed;
- if (state->duplex == DUPLEX_HALF) {
- phydev_err(pcs, "Half duplex not supported\n");
- return;
- }
+ if (state->duplex == DUPLEX_FULL)
+ duplex = BMCR_FULLDPLX;
+
switch (state->speed) {
case SPEED_1000:
speed = ENETC_PCS_SPEED_1000;
@@ -906,7 +906,7 @@ static void vsc9959_pcs_init_sgmii(struct phy_device *pcs,
/* Yes, not a mistake: speed is given by IF_MODE. */
phy_write(pcs, MII_BMCR, BMCR_RESET |
BMCR_SPEED1000 |
- BMCR_FULLDPLX);
+ duplex);
}
}
@@ -983,8 +983,11 @@ static void vsc9959_pcs_init(struct ocelot *ocelot, int port,
ARRAY_SIZE(phy_basic_ports_array),
pcs->supported);
linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Full_BIT, pcs->supported);
+ linkmode_set_bit(ETHTOOL_LINK_MODE_10baseT_Half_BIT, pcs->supported);
linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, pcs->supported);
+ linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Half_BIT, pcs->supported);
linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, pcs->supported);
+ linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT, pcs->supported);
if (pcs->interface == PHY_INTERFACE_MODE_2500BASEX ||
pcs->interface == PHY_INTERFACE_MODE_USXGMII)
linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT,
--
2.25.1
next prev parent reply other threads:[~2020-05-31 12:27 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-31 12:26 [PATCH v3 net-next 00/13] New DSA driver for VSC9953 Seville switch Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 01/13] regmap: add helper for per-port regfield initialization Vladimir Oltean
2020-06-01 10:54 ` Mark Brown
2020-06-01 11:12 ` Vladimir Oltean
2020-06-01 11:51 ` Alexandre Belloni
2020-06-01 12:50 ` Mark Brown
2020-05-31 12:26 ` [PATCH v3 net-next 02/13] net: dsa: felix: set proper link speed in felix_phylink_mac_config Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 03/13] net: mscc: ocelot: convert port registers to regmap Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 04/13] soc/mscc: ocelot: add MII registers description Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 05/13] net: mscc: ocelot: convert QSYS_SWITCH_PORT_MODE and SYS_PORT_MODE to regfields Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 06/13] net: dsa: felix: create a template for the DSA tags on xmit Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 07/13] net: mscc: ocelot: split writes to pause frame enable bit and to thresholds Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 08/13] net: mscc: ocelot: disable flow control on NPI interface Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 09/13] net: mscc: ocelot: convert SYS_PAUSE_CFG register access to regfield Vladimir Oltean
2020-05-31 12:26 ` [PATCH v3 net-next 10/13] net: mscc: ocelot: extend watermark encoding function Vladimir Oltean
2020-05-31 12:26 ` Vladimir Oltean [this message]
2020-05-31 12:26 ` [PATCH v3 net-next 12/13] net: dsa: felix: move probing to felix_vsc9959.c Vladimir Oltean
2020-06-01 21:14 ` Jakub Kicinski
2020-05-31 12:26 ` [PATCH v3 net-next 13/13] net: dsa: felix: introduce support for Seville VSC9953 switch Vladimir Oltean
2020-06-01 21:14 ` Jakub Kicinski
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=20200531122640.1375715-12-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandru.marginean@nxp.com \
--cc=andrew@lunn.ch \
--cc=antoine.tenart@bootlin.com \
--cc=broonie@kernel.org \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=fido_max@inbox.ru \
--cc=madalin.bucur@oss.nxp.com \
--cc=netdev@vger.kernel.org \
--cc=radu-andrei.bulie@nxp.com \
--cc=vivien.didelot@gmail.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).