From: Russell King <rmk+kernel@armlinux•org.uk>
To: Andrew Lunn <andrew@lunn•ch>, Florian Fainelli <f.fainelli@gmail•com>
Cc: netdev@vger•kernel.org
Subject: [PATCH net-next A 3/5] sfp: add support for 1000Base-PX and 1000Base-BX10
Date: Fri, 29 Dec 2017 12:15:23 +0000 [thread overview]
Message-ID: <E1eUtZL-0001ul-47@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20171229121451.GY10595@n2100.armlinux.org.uk>
Add support for decoding the transceiver information for 1000Base-PX and
1000Base-BX10. These use 1000BASE-X protocol.
Signed-off-by: Russell King <rmk+kernel@armlinux•org.uk>
---
drivers/net/phy/sfp-bus.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index a668a67c7eef..6c05acd5b1d4 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -165,10 +165,26 @@ EXPORT_SYMBOL_GPL(sfp_parse_interface);
void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
unsigned long *support)
{
+ unsigned int br_min, br_nom, br_max;
+
phylink_set(support, Autoneg);
phylink_set(support, Pause);
phylink_set(support, Asym_Pause);
+ /* Decode the bitrate information to MBd */
+ br_min = br_nom = br_max = 0;
+ if (id->base.br_nominal) {
+ if (id->base.br_nominal != 255) {
+ br_nom = id->base.br_nominal * 100;
+ br_min = br_nom + id->base.br_nominal * id->ext.br_min;
+ br_max = br_nom + id->base.br_nominal * id->ext.br_max;
+ } else if (id->ext.br_max) {
+ br_nom = 250 * id->ext.br_max;
+ br_max = br_nom + br_nom * id->ext.br_min / 100;
+ br_min = br_nom - br_nom * id->ext.br_min / 100;
+ }
+ }
+
/* Set ethtool support from the compliance fields. */
if (id->base.e10g_base_sr)
phylink_set(support, 10000baseSR_Full);
@@ -187,6 +203,11 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
phylink_set(support, 1000baseT_Full);
}
+ /* 1000Base-PX or 1000Base-BX10 */
+ if ((id->base.e_base_px || id->base.e_base_bx10) &&
+ br_min <= 1300 && br_max >= 1200)
+ phylink_set(support, 1000baseX_Full);
+
switch (id->base.extended_cc) {
case 0x00: /* Unspecified */
break;
--
2.7.4
next prev parent reply other threads:[~2017-12-29 12:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-29 12:14 [PATCH net-next A 0/5] further sfp/phylink updates Russell King - ARM Linux
2017-12-29 12:15 ` [PATCH net-next A 1/5] sfp: use precision to print non-null terminated strings Russell King
2017-12-29 12:15 ` [PATCH net-next A 2/5] sfp: don't guess support from connector type Russell King
2017-12-29 12:15 ` Russell King [this message]
2017-12-29 12:15 ` [PATCH net-next A 4/5] sfp: improve support for direct-attach copper cables Russell King
2017-12-29 12:15 ` [PATCH net-next A 5/5] phylink: remove 'mode' variable from phylink_sfp_module_insert() Russell King
2018-01-03 2:45 ` [PATCH net-next A 0/5] further sfp/phylink updates David Miller
-- strict thread matches above, loose matches on Subject: below --
2018-01-02 10:39 [PATCH net-next A 3/5] sfp: add support for 1000Base-PX and 1000Base-BX10 Russell King - ARM Linux
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=E1eUtZL-0001ul-47@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux$(echo .)org.uk \
--cc=andrew@lunn$(echo .)ch \
--cc=f.fainelli@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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