From 511d35f63d961d2f48d8e29fdd20e68cacac0d2e Mon Sep 17 00:00:00 2001 From: diijkstra <16804536+diijkstra@users.noreply.github.com> Date: Fri, 13 Mar 2026 18:34:28 +0100 Subject: [PATCH 1/3] TEG-S562: Port LEDs Added support for all leds on the device. Stock port sets are slightly differently configured, where additional LED0 on SET_0 and LED1&LED2 where configured for link/collisions/duplex. This has not been reproduced as those lines are probably not connected anywhere. --- doc/devices/TEG-S562.md | 7 +++---- machine.c | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doc/devices/TEG-S562.md b/doc/devices/TEG-S562.md index 5122f4e..6a49427 100644 --- a/doc/devices/TEG-S562.md +++ b/doc/devices/TEG-S562.md @@ -14,10 +14,11 @@ The memory chip is `Winbond W25Q16JV` with 16M-bit size. 1. 2.5G ports on all advertised speeds. 2. SFP+ communication. 3. Serial, Web UI. +4. All LEDs ## Known issues -1. LEDs are not initialized properly. +None. ## PCB @@ -136,8 +137,6 @@ GPIO mapping unknown. ## LEDs -Leds are not yet working as in stock firmware. This will be handled later. - Ports 1-4 are amber for 100M/1G links, Green for 2.5G. Port 5-6 are green for 10G/1G link. Both should flash on activity. @@ -166,7 +165,7 @@ Voltage is made by a `APW8713` (U3). ### `3.3` Voltage -Voltage is crated regulated by chip marke as `GoIAT` (U2). +Voltage is crated regulated by chip marked as `GoIAT` (U2). ## SFP SPI diff --git a/machine.c b/machine.c index 8b8fdbf..14f2579 100644 --- a/machine.c +++ b/machine.c @@ -339,6 +339,22 @@ __code const struct machine machine = { .sfp_port[1].sds = 1, .sfp_port[1].i2c = { .sda = GPIO49_I2C_SDA1, .scl = GPIO48_I2C_SCL1 }, .reset_pin = GPIO_NA, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + .led_sets = { + { + 0, // Unused + LEDS_2G5 | LEDS_LINK | LEDS_ACT, // Green + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Amber + 0 // Unused + }, + { + 0, // Unused + 0, // Unused + LEDS_10G | LEDS_1G | LEDS_LINK | LEDS_ACT, // Green + 0, // Unused + }, + }, + }; void machine_custom_init(void) { } From d5fdaf28e827853eb99b9bc990fa3b424a903aa4 Mon Sep 17 00:00:00 2001 From: diijkstra <16804536+diijkstra@users.noreply.github.com> Date: Fri, 13 Mar 2026 21:43:22 +0100 Subject: [PATCH 2/3] Light description for led-set Very light description for port_led_set and led_sets, which was helpfull when bringing up the trendnet device. --- machine.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/machine.h b/machine.h index 1c894df..a5f1952 100644 --- a/machine.h +++ b/machine.h @@ -49,7 +49,9 @@ struct sfp_port typedef struct machine { char machine_name[30]; uint8_t isRTL8373; + // Lowest logical port number uint8_t min_port; + // Highest logical port number uint8_t max_port; uint8_t n_sfp; uint8_t log_to_phys_port[9]; @@ -59,7 +61,12 @@ typedef struct machine { struct sfp_port sfp_port[2]; uint8_t reset_pin; struct high_leds high_leds; + // Defines which led-set (0-3) will be used for given logical port + // led-set is physical group of LEDs that can be configured to show different port status combinations (see port_led_set below) uint8_t port_led_set[9]; + // Defines led-set configuration, applied to all ports using particular led-set + // Each led-set can have 4 different hardware LED configurations. Which one should be used, depends how LED is wired on the board + // See stock RTL837X_REG_LED3_2_SETx and RTL837X_REG_LED1_0_SETx registers for reference configuration uint32_t led_sets[4][4]; uint8_t led_mux_custom; uint8_t led_mux[28]; From 95cbc1a2e0b15e262774fee78e78f4684f088bd9 Mon Sep 17 00:00:00 2001 From: diijkstra <16804536+diijkstra@users.noreply.github.com> Date: Fri, 13 Mar 2026 22:43:36 +0100 Subject: [PATCH 3/3] TEG-S562: Correctly assign SFP Looks like the SFP numbers are reversed, since GPIOs were mapped to SFP numbers, the need to be reversed too. This fixes swapped display of SFP stats on the webpage. --- doc/devices/TEG-S562.md | 18 +++++++++--------- machine.c | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/devices/TEG-S562.md b/doc/devices/TEG-S562.md index 6a49427..8eab4e9 100644 --- a/doc/devices/TEG-S562.md +++ b/doc/devices/TEG-S562.md @@ -39,10 +39,10 @@ Bottom ``` ┌─────────────────────────────────────────────────────────────────────────────┐ │ ┌──────────┐ ┌──────────┐ │ -│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ SFP │ │ SFP │ │ +│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ SFP 2 │ │ SFP 1 │ │ │ │ RJ45 │ │ RJ45 │ │ RJ45 │ │ RJ45 │ │ PORT 5 │ │ PORT 6 │ │ -│ │ PORT 1 │ │ PORT 2 │ │ PORT 3 │ │ PORT 4 │ │ MAC ? │ │ MAC ? │ │ -│ │ MAC 4 │ │ MAC 5 │ │ MAC 6 │ │ MAC 7 │ │ SerDes ? │ │ SerDes ? │ │ +│ │ PORT 1 │ │ PORT 2 │ │ PORT 3 │ │ PORT 4 │ │ MAC 8 │ │ MAC 3 │ │ +│ │ MAC 4 │ │ MAC 5 │ │ MAC 6 │ │ MAC 7 │ │ SerDes 0 │ │ SerDes 1 │ │ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └──────────┘ └──────────┘ │ └─────────────────────────────────────────────────────────────────────────────┘ ``` @@ -106,9 +106,9 @@ GPIO mapping unknown. | 00000002 | GPIO01 | | GPIO33 | | | 00000004 | GPIO02 | | GPIO34 | Random changes | | 00000008 | GPIO03 | | GPIO35 | | -| 00000010 | GPIO04 | | GPIO36 | SFP1 Present | -| 00000020 | GPIO05 | | GPIO37 | SFP1 RX Los | -| 00000040 | GPIO06 | | GPIO38 | SFP2 Present | +| 00000010 | GPIO04 | | GPIO36 | SFP2 Present | +| 00000020 | GPIO05 | | GPIO37 | SFP2 RX Los | +| 00000040 | GPIO06 | | GPIO38 | SFP1 Present | | 00000080 | GPIO07 | | GPIO39 | | | 00000100 | GPIO08 | | GPIO40 | | | 00000200 | GPIO09 | | GPIO41 | | @@ -120,11 +120,11 @@ GPIO mapping unknown. | 00008000 | GPIO15 | PORT2 Link | GPIO47 | SFP1 I2C SDA | | 00010000 | GPIO16 | PORT2-LED-GREEN | GPIO48 | SFP2 I2C CLK | | 00020000 | GPIO17 | PORT2-LED-AMBER | GPIO49 | SFP2 I2C SDA | -| 00040000 | GPIO18 | PORT3 Link | GPIO50 | SFP2 Rx LOS | -| 00080000 | GPIO19 | PORT3-LED-GREEN | GPIO51 | SFP1 TX Disable | +| 00040000 | GPIO18 | PORT3 Link | GPIO50 | SFP1 Rx LOS | +| 00080000 | GPIO19 | PORT3-LED-GREEN | GPIO51 | SFP2 TX Disable | | 00100000 | GPIO20 | PORT4-LED-AMBER | GPIO52 | | | 00200000 | GPIO21 | PORT4 Link | GPIO53 | | -| 00400000 | GPIO22 | PORT4-LED-GREEN | GPIO54 | SFP2 TX Disable | +| 00400000 | GPIO22 | PORT4-LED-GREEN | GPIO54 | SFP1 TX Disable | | 00800000 | GPIO23 | PORT4-LED-AMBER | GPIO55 | | | 01000000 | GPIO24 | | GPIO56 | | | 02000000 | GPIO25 | | GPIO57 | | diff --git a/machine.c b/machine.c index 14f2579..7c924b1 100644 --- a/machine.c +++ b/machine.c @@ -327,15 +327,15 @@ __code const struct machine machine = { .n_sfp = 2, .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, .phys_to_log_port = {4, 5, 6, 7, 3, 8, 0, 0, 0}, - .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, - .sfp_port[0].pin_detect = GPIO36_PWM_OUT, - .sfp_port[0].pin_los = GPIO37, - .sfp_port[0].pin_tx_disable = GPIO51_I2C_SDA2_UART1_RX, + .is_sfp = {0, 0, 0, 1, 0, 0, 0, 0, 2}, + .sfp_port[0].pin_detect = GPIO38, + .sfp_port[0].pin_los = GPIO50_I2C_SCL2_UART1_TX, + .sfp_port[0].pin_tx_disable = GPIO54_ACL_BIT2_EN, .sfp_port[0].sds = 0, .sfp_port[0].i2c = { .sda = GPIO47_I2C_SDA0, .scl = GPIO46_I2C_SCL0 }, - .sfp_port[1].pin_detect = GPIO38, - .sfp_port[1].pin_los = GPIO50_I2C_SCL2_UART1_TX, - .sfp_port[1].pin_tx_disable = GPIO54_ACL_BIT2_EN, + .sfp_port[1].pin_detect = GPIO36_PWM_OUT, + .sfp_port[1].pin_los = GPIO37, + .sfp_port[1].pin_tx_disable = GPIO51_I2C_SDA2_UART1_RX, .sfp_port[1].sds = 1, .sfp_port[1].i2c = { .sda = GPIO49_I2C_SDA1, .scl = GPIO48_I2C_SCL1 }, .reset_pin = GPIO_NA,