aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2017-12-29 07:15:23 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-02 21:45:32 -0500
commit9962acf7fb8c5c5a28e137d2102ee81b51b4111b (patch)
treed651dd16ee621202d92f17a5bbaf01cdb44e4035
parent3fa7d19abecf5e38f980f37f606bb1bc81360cd6 (diff)
sfp: add support for 1000Base-PX and 1000Base-BX10
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/sfp-bus.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
index 9d7a010edf23..ba42e39bd112 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);
165void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id, 165void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
166 unsigned long *support) 166 unsigned long *support)
167{ 167{
168 unsigned int br_min, br_nom, br_max;
169
168 phylink_set(support, Autoneg); 170 phylink_set(support, Autoneg);
169 phylink_set(support, Pause); 171 phylink_set(support, Pause);
170 phylink_set(support, Asym_Pause); 172 phylink_set(support, Asym_Pause);
171 173
174 /* Decode the bitrate information to MBd */
175 br_min = br_nom = br_max = 0;
176 if (id->base.br_nominal) {
177 if (id->base.br_nominal != 255) {
178 br_nom = id->base.br_nominal * 100;
179 br_min = br_nom + id->base.br_nominal * id->ext.br_min;
180 br_max = br_nom + id->base.br_nominal * id->ext.br_max;
181 } else if (id->ext.br_max) {
182 br_nom = 250 * id->ext.br_max;
183 br_max = br_nom + br_nom * id->ext.br_min / 100;
184 br_min = br_nom - br_nom * id->ext.br_min / 100;
185 }
186 }
187
172 /* Set ethtool support from the compliance fields. */ 188 /* Set ethtool support from the compliance fields. */
173 if (id->base.e10g_base_sr) 189 if (id->base.e10g_base_sr)
174 phylink_set(support, 10000baseSR_Full); 190 phylink_set(support, 10000baseSR_Full);
@@ -187,6 +203,11 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
187 phylink_set(support, 1000baseT_Full); 203 phylink_set(support, 1000baseT_Full);
188 } 204 }
189 205
206 /* 1000Base-PX or 1000Base-BX10 */
207 if ((id->base.e_base_px || id->base.e_base_bx10) &&
208 br_min <= 1300 && br_max >= 1200)
209 phylink_set(support, 1000baseX_Full);
210
190 switch (id->base.extended_cc) { 211 switch (id->base.extended_cc) {
191 case 0x00: /* Unspecified */ 212 case 0x00: /* Unspecified */
192 break; 213 break;