Add support for 100FX modules and forcing 100FX

This commit is contained in:
logicog
2026-05-30 23:08:44 +02:00
parent 8c61010a84
commit 1a457c29ac
4 changed files with 14 additions and 1 deletions
+3
View File
@@ -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;
+1
View File
@@ -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,
+1
View File
@@ -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
+9 -1
View File
@@ -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;