mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Add support for 100FX modules and forcing 100FX
This commit is contained in:
@@ -791,6 +791,9 @@ void parse_sfp(void)
|
|||||||
} else if (cmd_compare(2, "1g")) {
|
} else if (cmd_compare(2, "1g")) {
|
||||||
print_string(" 1G\n");
|
print_string(" 1G\n");
|
||||||
sfp_speed[slot] = SFP_SPEED_1G;
|
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")) {
|
} else if (cmd_compare(2, "auto")) {
|
||||||
print_string(" AUTO\n");
|
print_string(" AUTO\n");
|
||||||
sfp_speed[slot] = SFP_SPEED_AUTO;
|
sfp_speed[slot] = SFP_SPEED_AUTO;
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ struct vlan_tag {
|
|||||||
|
|
||||||
enum sfp_speeds {
|
enum sfp_speeds {
|
||||||
SFP_SPEED_AUTO = 0,
|
SFP_SPEED_AUTO = 0,
|
||||||
|
SFP_SPEED_100M,
|
||||||
SFP_SPEED_1G,
|
SFP_SPEED_1G,
|
||||||
SFP_SPEED_2G5,
|
SFP_SPEED_2G5,
|
||||||
SFP_SPEED_5G,
|
SFP_SPEED_5G,
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
*/
|
*/
|
||||||
#define SDS_SGMII 0x02
|
#define SDS_SGMII 0x02
|
||||||
#define SDS_1000BX_FIBER 0x04
|
#define SDS_1000BX_FIBER 0x04
|
||||||
|
#define SDS_100FX 0x05
|
||||||
#define SDS_QXGMII 0x0d
|
#define SDS_QXGMII 0x0d
|
||||||
#define SDS_HISGMII 0x12
|
#define SDS_HISGMII 0x12
|
||||||
#define SDS_HSG 0x16
|
#define SDS_HSG 0x16
|
||||||
|
|||||||
+9
-1
@@ -927,6 +927,10 @@ void sds_config(uint8_t sds, uint8_t mode)
|
|||||||
v = 0x0200;
|
v = 0x0200;
|
||||||
page = 0x2e;
|
page = 0x2e;
|
||||||
break;
|
break;
|
||||||
|
case SDS_100FX:
|
||||||
|
v = 0x0200;
|
||||||
|
page = 0x26;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print_string("Error in SDS Mode\n");
|
print_string("Error in SDS Mode\n");
|
||||||
return;
|
return;
|
||||||
@@ -1170,6 +1174,8 @@ void handle_tx(void)
|
|||||||
|
|
||||||
static inline uint8_t sfp_rate_to_sds_config(register uint8_t rate)
|
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)
|
if (rate == 0xc || rate == 0xd)
|
||||||
return SDS_1000BX_FIBER;
|
return SDS_1000BX_FIBER;
|
||||||
if (rate >= 0x19 && rate <= 0x20) // Ethernet 2.5 GBit
|
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
|
// Read Reg 12: Signalling rate (including overhead) in 100Mbit: 0xd: 1Gbit, 0x67:10Gbit
|
||||||
delay(100); // Delay, because some modules need time to wake up
|
delay(100); // Delay, because some modules need time to wake up
|
||||||
uint8_t rate = sfp_read_reg(sfp, 12);
|
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;
|
rate = 0xc;
|
||||||
else if (sfp_speed[sfp] == SFP_SPEED_2G5)
|
else if (sfp_speed[sfp] == SFP_SPEED_2G5)
|
||||||
rate = 0x19;
|
rate = 0x19;
|
||||||
|
|||||||
Reference in New Issue
Block a user