From 96eddf5a0cc90a9a068738bd8a466600b36d24b2 Mon Sep 17 00:00:00 2001 From: Mark Captur Date: Thu, 7 May 2026 16:06:00 +0200 Subject: [PATCH] Add hardware profile and LED fix for Hi-Source HI-k0801WS --- machine.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ machine.h | 1 + 2 files changed, 52 insertions(+) diff --git a/machine.c b/machine.c index 24fcbd3..d2d5d50 100644 --- a/machine.c +++ b/machine.c @@ -613,6 +613,57 @@ __code const struct machine machine = { }, }; + +#elif defined MACHINE_HI_K0801WS +__code const struct machine machine = { + .machine_name = "Hi-Source HI-k0801WS", + .isRTL8373 = 1, + .min_port = 0, + .max_port = 8, + .n_sfp = 1, + .log_to_phys_port = {1, 2, 3, 4, 5, 6, 7, 8, 9}, + .phys_to_log_port = {0, 1, 2, 3, 4, 5, 6, 7, 8}, + .is_sfp = {0, 0, 0, 0, 0, 0, 0, 0, 1}, + + .sfp_port[0].pin_detect = GPIO30_ACL_BIT3_EN, + .sfp_port[0].pin_los = GPIO37, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = { + .sda = GPIO39_I2C_SDA4, + .scl = GPIO40_I2C_SCL3_MDC1 + }, + + .reset_pin = GPIO_NA, + + .high_leds = { + .mux = LED_27 | LED_29, + .enable = LED_28_SYS | LED_29 + }, + + /* Ports 1-8 use set 0, port 9 SFP uses set 1 */ + .port_led_set = {0, 0, 0, 0, 0, 0, 0, 0, 1}, + + .led_sets = { + { /* Set 0: RJ45 copper ports + * Amber = 2.5G + * Green = 1G/100M/10M with activity + */ + LEDS_2G5 | LEDS_LINK | LEDS_ACT, /* Amber */ + 0, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, /* Green */ + 0 + }, + { /* Set 1: SFP port, single green LED for all valid speeds */ + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + 0 + }, + }, +}; + + void machine_custom_init(void) { } #else diff --git a/machine.h b/machine.h index d7daa96..610a757 100644 --- a/machine.h +++ b/machine.h @@ -22,6 +22,7 @@ // #define MACHINE_LIANGUO_ZX_SWTGW215AS // #define MACHINE_ZX310S_4T2XH // #define MACHINE_DEFAULT_8C_1SFP +// #define MACHINE_HI_K0801WS typedef struct { // GPIO pins for SDA/SCL