diff --git a/doc/devices/ZX310S-4T2XT.md b/doc/devices/ZX310S-4T2XT.md new file mode 100644 index 0000000..956627f --- /dev/null +++ b/doc/devices/ZX310S-4T2XT.md @@ -0,0 +1,53 @@ +# ZX310S-4T2XT + +The following is a documentation for the managed switch marked as +`ZX310S-4T2XT` and sold by Horaco. + +The original software is running UART on 57600 baud rate 8N1. + +CPU: RTL8372 +Flash: 2MByte Winbond W25Q16DV (U3) +PHY 2x RTL8261BE + +### Label specifications + +- **Name**: +- **Ports**: + - 4 × RJ45: 10/100/1000/2500 Mbps + - 2 x RJ45: 10/100/1000/2500/5000/10000 Mbps +- **Power**: 12V DC, 2A barrel connector + + + +### What works +The device is fully supported: +- All 4 2.5GBASE-T RJ45 ports work at 10/100/1000/2500 Mbps, including EEE +- The 10GBit ports works, including EEE. +- LEDs work with the same indiciations as the OEM firmware + +### PCB overview + +**Board markings** +- Top silkscreen: PCB-SL310S-4T2XT-V1.0.0-22273 + +Top side + + + +Bottom + + + +### J1, serial console + +| `J1` pin | Signal | +| -------- | ----------- | +| 1 | TX (Output) | +| 2 | RX (Input) | +| 3 | GND | +| 4 | 3V3 | + + +## Power supply + +Input power is delivered via barell plug, `12V 2A` adapter was provided. diff --git a/machine.c b/machine.c index c7d369a..7d9f59c 100644 --- a/machine.c +++ b/machine.c @@ -1,6 +1,7 @@ #include "machine.h" #include "rtl837x_pins.h" #include "rtl837x_leds.h" +#include "rtl837x_sfr.h" #include "rtl837x_regs.h" #include "rtl837x_common.h" @@ -843,7 +844,48 @@ void machine_custom_init(void) reg_bit_clear(RTL837X_REG_LED_MODE, 7); } +#elif defined MACHINE_ZX310S_4T2XT +__code const struct machine machine = { + .machine_name = "ZX310S_4T2XT", + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 0, + .n_10g = 2, + .log_to_phys_port = {0, 0, 0, 5, 1, 2, 3, 4, 6}, + .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, + .is_sfp = {0, 0, 0, 0, 0, 0, 0, 0, 0}, + .reset_pin = GPIO48_I2C_SCL1, + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, + .led_mux_custom = 1, + .led_mux = { 0x00, 0x01, 0x04, 0x05, 0x08, // 65e0 + 0x09, 0x0c, 0x3f, 0x0d, 0x10, // 65e4 + 0x11, 0x0e, 0x14, 0x11, 0x12, // 65e8 + 0x15, 0x15, 0x16, 0x18, 0x19, // 65ec + 0x1a, 0x19, 0x1d, 0x1e, 0x1c, // 65f0 + 0x1d, 0x20, 0x21 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + /* Ports 1-4: Green: 2.5GBit, Orange: 10/100/1000MBit + * Ports 5-6: Green: 10GBit, Orange: <= 5GBit + */ + .led_sets = { { LEDS_2G5 | LEDS_LINK | LEDS_ACT, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + LEDS_DUPLEX, + LEDS_2G5 | LEDS_LINK | LEDS_ACT }, + { + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, + LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_5G, + LEDS_2G5 | LEDS_LINK, + LEDS_COL | LEDS_DUPLEX + } + }, +}; +void machine_custom_init(void) { + // For this device, the reset value of RTL837X_PIN_MUX_0 is 0x30000000, + // which would disables all LEDS, enable them manually: + REG_SET(RTL837X_PIN_MUX_0, 0x30db68bf); +} #else #error "Please select a machine type in machine.h" diff --git a/machine.h b/machine.h index 1e4f574..584c488 100644 --- a/machine.h +++ b/machine.h @@ -22,6 +22,7 @@ // #define MACHINE_K0501W_V2_0 // #define MACHINE_LIANGUO_ZX_SWTGW215AS // #define MACHINE_ZX310S_4T2XH +// #define MACHINE_ZX310S_4T2XT // #define MACHINE_DEFAULT_8C_1SFP // #define MACHINE_HI_K0801WS // #define MACHINE_FNS1200P