diff --git a/cmd_parser.c b/cmd_parser.c index 45308ba..b25a996 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -791,6 +791,9 @@ void parse_sfp(void) } else if (cmd_compare(2, "1g")) { print_string(" 1G\n"); sfp_speed[slot] = SFP_SPEED_1G; + } else if (cmd_compare(2, "100m")) { + print_string(" 100M\n"); + sfp_speed[slot] = SFP_SPEED_100M; } else if (cmd_compare(2, "auto")) { print_string(" AUTO\n"); sfp_speed[slot] = SFP_SPEED_AUTO; diff --git a/rtl837x_common.h b/rtl837x_common.h index 3be8c7f..6d6abb5 100644 --- a/rtl837x_common.h +++ b/rtl837x_common.h @@ -94,6 +94,7 @@ struct vlan_tag { enum sfp_speeds { SFP_SPEED_AUTO = 0, + SFP_SPEED_100M, SFP_SPEED_1G, SFP_SPEED_2G5, SFP_SPEED_5G, diff --git a/rtl837x_regs.h b/rtl837x_regs.h index c1a27bb..f5bd951 100644 --- a/rtl837x_regs.h +++ b/rtl837x_regs.h @@ -73,6 +73,7 @@ */ #define SDS_SGMII 0x02 #define SDS_1000BX_FIBER 0x04 +#define SDS_100FX 0x05 #define SDS_QXGMII 0x0d #define SDS_HISGMII 0x12 #define SDS_HSG 0x16 diff --git a/rtlplayground.c b/rtlplayground.c index 7499f45..6b56db3 100644 --- a/rtlplayground.c +++ b/rtlplayground.c @@ -927,6 +927,10 @@ void sds_config(uint8_t sds, uint8_t mode) v = 0x0200; page = 0x2e; break; + case SDS_100FX: + v = 0x0200; + page = 0x26; + break; default: print_string("Error in SDS Mode\n"); return; @@ -1170,6 +1174,8 @@ void handle_tx(void) static inline uint8_t sfp_rate_to_sds_config(register uint8_t rate) { + if (rate == 0x1 || rate == 0x2) + return SDS_100FX; if (rate == 0xc || rate == 0xd) return SDS_1000BX_FIBER; if (rate >= 0x19 && rate <= 0x20) // Ethernet 2.5 GBit @@ -1235,7 +1241,9 @@ void handle_sfp(void) // Read Reg 12: Signalling rate (including overhead) in 100Mbit: 0xd: 1Gbit, 0x67:10Gbit delay(100); // Delay, because some modules need time to wake up uint8_t rate = sfp_read_reg(sfp, 12); - if (sfp_speed[sfp] == SFP_SPEED_1G) + if (sfp_speed[sfp] == SFP_SPEED_100M) + rate = 0x1; + else if (sfp_speed[sfp] == SFP_SPEED_1G) rate = 0xc; else if (sfp_speed[sfp] == SFP_SPEED_2G5) rate = 0x19;