From: "Marek Behún" <marek.behun@nic.cz>
To: netdev@vger.kernel.org
Cc: "Andrew Lunn" <andrew@lunn.ch>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Marek Behún" <marek.behun@nic.cz>
Subject: [PATCH net-next 01/10] net: dsa: mv88e6xxx: support 2500base-x in SGMII IRQ handler
Date: Thu, 22 Aug 2019 01:27:15 +0200 [thread overview]
Message-ID: <20190821232724.1544-2-marek.behun@nic.cz> (raw)
In-Reply-To: <20190821232724.1544-1-marek.behun@nic.cz>
The mv88e6390_serdes_irq_link_sgmii IRQ handler reads the SERDES PHY
status register to determine speed, among other things. If cmode of the
port is set to 2500base-x, though, the PHY still reports 1000 Mbps (the
PHY register itself does not differentiate between 1000 Mbps and 2500
Mbps - it thinks it is running at 1000 Mbps, although clock is 2.5x
faster).
Look at the cmode and set SPEED_2500 if cmode is set to 2500base-x.
Also tell mv88e6xxx_port_setup_mac the PHY interface mode corresponding
to current cmode in terms of phy_interface_t.
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Vladimir Oltean <olteanv@gmail.com>
Cc: Vivien Didelot <vivien.didelot@gmail.com>
---
drivers/net/dsa/mv88e6xxx/serdes.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
index 20c526c2a9ee..0f3d7cbb696b 100644
--- a/drivers/net/dsa/mv88e6xxx/serdes.c
+++ b/drivers/net/dsa/mv88e6xxx/serdes.c
@@ -506,9 +506,11 @@ static void mv88e6390_serdes_irq_link_sgmii(struct mv88e6xxx_chip *chip,
int port, int lane)
{
struct dsa_switch *ds = chip->ds;
+ u8 cmode = chip->ports[port].cmode;
int duplex = DUPLEX_UNKNOWN;
int speed = SPEED_UNKNOWN;
int link, err;
+ phy_interface_t mode;
u16 status;
err = mv88e6390_serdes_read(chip, lane, MDIO_MMD_PHYXS,
@@ -527,7 +529,10 @@ static void mv88e6390_serdes_irq_link_sgmii(struct mv88e6xxx_chip *chip,
switch (status & MV88E6390_SGMII_PHY_STATUS_SPEED_MASK) {
case MV88E6390_SGMII_PHY_STATUS_SPEED_1000:
- speed = SPEED_1000;
+ if (cmode == MV88E6XXX_PORT_STS_CMODE_2500BASEX)
+ speed = SPEED_2500;
+ else
+ speed = SPEED_1000;
break;
case MV88E6390_SGMII_PHY_STATUS_SPEED_100:
speed = SPEED_100;
@@ -541,8 +546,22 @@ static void mv88e6390_serdes_irq_link_sgmii(struct mv88e6xxx_chip *chip,
}
}
+ switch (cmode) {
+ case MV88E6XXX_PORT_STS_CMODE_SGMII:
+ mode = PHY_INTERFACE_MODE_SGMII;
+ break;
+ case MV88E6XXX_PORT_STS_CMODE_1000BASE_X:
+ mode = PHY_INTERFACE_MODE_1000BASEX;
+ break;
+ case MV88E6XXX_PORT_STS_CMODE_2500BASEX:
+ mode = PHY_INTERFACE_MODE_2500BASEX;
+ break;
+ default:
+ mode = PHY_INTERFACE_MODE_NA;
+ }
+
err = mv88e6xxx_port_setup_mac(chip, port, link, speed, duplex,
- PAUSE_OFF, PHY_INTERFACE_MODE_NA);
+ PAUSE_OFF, mode);
if (err)
dev_err(chip->dev, "can't propagate PHY settings to MAC: %d\n",
err);
--
2.21.0
next prev parent reply other threads:[~2019-08-21 23:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 23:27 [PATCH net-next 00/10] net: dsa: mv88e6xxx: Peridot/Topaz SERDES changes Marek Behún
2019-08-21 23:27 ` Marek Behún [this message]
2019-08-22 3:25 ` [PATCH net-next 01/10] net: dsa: mv88e6xxx: support 2500base-x in SGMII IRQ handler David Miller
2019-08-22 3:33 ` Marek Behún
2019-08-21 23:27 ` [PATCH net-next 02/10] net: dsa: mv88e6xxx: remove extra newline Marek Behún
2019-08-22 12:55 ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 03/10] net: dsa: mv88e6xxx: move hidden registers operations in own file Marek Behún
2019-08-22 13:04 ` Andrew Lunn
2019-08-22 13:10 ` Andrew Lunn
2019-08-22 17:21 ` Vivien Didelot
2019-08-21 23:27 ` [PATCH net-next 04/10] net: dsa: mv88e6xxx: prefix hidden register macro names with MV88E6XXX_ Marek Behún
2019-08-22 13:12 ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 05/10] net: dsa: mv88e6xxx: create chip->info->ops->serdes_get_lane method Marek Behún
2019-08-23 1:39 ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 06/10] net: dsa: mv88e6xxx: add serdes_get_lane method for Topaz family Marek Behún
2019-08-23 1:40 ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 07/10] net: dsa: mv88e6xxx: rename port cmode macro Marek Behún
2019-08-23 1:41 ` Andrew Lunn
2019-08-21 23:27 ` [PATCH net-next 08/10] net: dsa: mv88e6xxx: simplify SERDES code for Topaz and Peridot Marek Behún
2019-08-22 3:26 ` David Miller
2019-08-21 23:27 ` [PATCH net-next 09/10] net: dsa: mv88e6xxx: support Block Address setting in hidden registers Marek Behún
2019-08-21 23:27 ` [PATCH net-next 10/10] net: dsa: mv88e6xxx: fully support SERDES on Topaz family Marek Behún
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=20190821232724.1544-2-marek.behun@nic.cz \
--to=marek.behun@nic.cz \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.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).