From a6b09188852a37d747794a851c720ff0e54f20a6 Mon Sep 17 00:00:00 2001 From: HL Yi Date: Thu, 8 Oct 2026 18:43:05 -0500 Subject: [PATCH] refactoring machine.c, two files per device --- .github/workflows/build.yml | 2 +- Makefile | 47 +- machine.c | 1469 --------------------------- machine.h | 58 +- machine/DEFAULT_8C_1SFP.c | 25 + machine/DEFAULT_8C_1SFP.h | 6 + machine/F7008_2_5.c | 41 + machine/F7008_2_5.h | 6 + machine/FG_4GT_2SX_V2_0.c | 66 ++ machine/FG_4GT_2SX_V2_0.h | 6 + machine/FG_8GT_1SX.c | 45 + machine/FG_8GT_1SX.h | 6 + machine/FNS1200P.c | 55 + machine/FNS1200P.h | 6 + machine/HASIVO_S1100WP_8GT_1SX_SE.c | 32 + machine/HASIVO_S1100WP_8GT_1SX_SE.h | 6 + machine/HASIVO_S600W_4GT_2XGT_SE.c | 43 + machine/HASIVO_S600W_4GT_2XGT_SE.h | 6 + machine/HG0402XG_V1_1.c | 38 + machine/HG0402XG_V1_1.h | 6 + machine/HI_K0402WS.c | 46 + machine/HI_K0402WS.h | 6 + machine/HI_K0801WS.c | 45 + machine/HI_K0801WS.h | 6 + machine/K0501W_V2_0.c | 34 + machine/K0501W_V2_0.h | 6 + machine/KP_9000_6XHML_X2.c | 37 + machine/KP_9000_6XHML_X2.h | 6 + machine/KP_9000_6XHML_X2_V1_1.c | 1 + machine/KP_9000_6XHML_X2_V1_1.h | 6 + machine/KP_9000_6XHML_X2_V1_2.c | 1 + machine/KP_9000_6XHML_X2_V1_2.h | 6 + machine/KP_9000_6XHML_X2_V2_1.c | 1 + machine/KP_9000_6XHML_X2_V2_1.h | 6 + machine/KP_9000_6XH_X.c | 28 + machine/KP_9000_6XH_X.h | 6 + machine/KP_9000_6XH_X2.c | 48 + machine/KP_9000_6XH_X2.h | 6 + machine/KP_9000_6XH_X2_V1_1.c | 1 + machine/KP_9000_6XH_X2_V1_1.h | 6 + machine/KP_9000_6XH_X2_V1_2.c | 1 + machine/KP_9000_6XH_X2_V1_2.h | 6 + machine/KP_9000_6XH_X2_V2_1.c | 1 + machine/KP_9000_6XH_X2_V2_1.h | 6 + machine/KP_9000_9XHML_X_V2_2.c | 51 + machine/KP_9000_9XHML_X_V2_2.h | 6 + machine/KP_9000_9XHML_X_V3_1.c | 37 + machine/KP_9000_9XHML_X_V3_1.h | 6 + machine/KP_9000_9XHML_X_V3_2.c | 1 + machine/KP_9000_9XHML_X_V3_2.h | 6 + machine/KP_9000_9XH_X_EU.c | 25 + machine/KP_9000_9XH_X_EU.h | 6 + machine/LIANGUO_HYWS_SGT0108S.c | 36 + machine/LIANGUO_HYWS_SGT0108S.h | 6 + machine/LIANGUO_ZX_SWTGW215AS.c | 33 + machine/LIANGUO_ZX_SWTGW215AS.h | 6 + machine/ONT_S207CW_62TS_SE.c | 61 ++ machine/ONT_S207CW_62TS_SE.h | 6 + machine/PB_2132.c | 41 + machine/PB_2132.h | 6 + machine/PCB_K0402WS_V2.c | 55 + machine/PCB_K0402WS_V2.h | 6 + machine/PCB_K0402WS_V3.c | 1 + machine/PCB_K0402WS_V3.h | 6 + machine/PCB_SWTG018AS_V2_1_0.c | 42 + machine/PCB_SWTG018AS_V2_1_0.h | 6 + machine/PCB_SWTG024AS_A_2_0_1.c | 48 + machine/PCB_SWTG024AS_A_2_0_1.h | 6 + machine/POE_2G080110GS.c | 44 + machine/POE_2G080110GS.h | 6 + machine/STEAMEMO_IG204_V1.c | 50 + machine/STEAMEMO_IG204_V1.h | 6 + machine/SWGT024_V2_0_MANAGED.c | 41 + machine/SWGT024_V2_0_MANAGED.h | 6 + machine/SWGT024_V2_0_UNMANAGED.c | 41 + machine/SWGT024_V2_0_UNMANAGED.h | 6 + machine/SWTG018AS_A_V_2_0.c | 39 + machine/SWTG018AS_A_V_2_0.h | 6 + machine/SWTG024AS_A_2_0_1_5C_1SFP.c | 43 + machine/SWTG024AS_A_2_0_1_5C_1SFP.h | 6 + machine/SWTG024AS_V2_0.c | 43 + machine/SWTG024AS_V2_0.h | 6 + machine/SWTGW218AS.c | 33 + machine/SWTGW218AS.h | 6 + machine/TRENDNET_TEG_S562.c | 39 + machine/TRENDNET_TEG_S562.h | 6 + machine/ZX310S_4T2XH.c | 43 + machine/ZX310S_4T2XH.h | 6 + machine/ZX310S_4T2XT.c | 37 + machine/ZX310S_4T2XT.h | 6 + machine/default_machine.h | 17 + machine/machine_defs.h | 44 + 92 files changed, 1841 insertions(+), 1527 deletions(-) delete mode 100644 machine.c create mode 100644 machine/DEFAULT_8C_1SFP.c create mode 100644 machine/DEFAULT_8C_1SFP.h create mode 100644 machine/F7008_2_5.c create mode 100644 machine/F7008_2_5.h create mode 100644 machine/FG_4GT_2SX_V2_0.c create mode 100644 machine/FG_4GT_2SX_V2_0.h create mode 100644 machine/FG_8GT_1SX.c create mode 100644 machine/FG_8GT_1SX.h create mode 100644 machine/FNS1200P.c create mode 100644 machine/FNS1200P.h create mode 100644 machine/HASIVO_S1100WP_8GT_1SX_SE.c create mode 100644 machine/HASIVO_S1100WP_8GT_1SX_SE.h create mode 100644 machine/HASIVO_S600W_4GT_2XGT_SE.c create mode 100644 machine/HASIVO_S600W_4GT_2XGT_SE.h create mode 100644 machine/HG0402XG_V1_1.c create mode 100644 machine/HG0402XG_V1_1.h create mode 100644 machine/HI_K0402WS.c create mode 100644 machine/HI_K0402WS.h create mode 100644 machine/HI_K0801WS.c create mode 100644 machine/HI_K0801WS.h create mode 100644 machine/K0501W_V2_0.c create mode 100644 machine/K0501W_V2_0.h create mode 100644 machine/KP_9000_6XHML_X2.c create mode 100644 machine/KP_9000_6XHML_X2.h create mode 120000 machine/KP_9000_6XHML_X2_V1_1.c create mode 100644 machine/KP_9000_6XHML_X2_V1_1.h create mode 120000 machine/KP_9000_6XHML_X2_V1_2.c create mode 100644 machine/KP_9000_6XHML_X2_V1_2.h create mode 120000 machine/KP_9000_6XHML_X2_V2_1.c create mode 100644 machine/KP_9000_6XHML_X2_V2_1.h create mode 100644 machine/KP_9000_6XH_X.c create mode 100644 machine/KP_9000_6XH_X.h create mode 100644 machine/KP_9000_6XH_X2.c create mode 100644 machine/KP_9000_6XH_X2.h create mode 120000 machine/KP_9000_6XH_X2_V1_1.c create mode 100644 machine/KP_9000_6XH_X2_V1_1.h create mode 120000 machine/KP_9000_6XH_X2_V1_2.c create mode 100644 machine/KP_9000_6XH_X2_V1_2.h create mode 120000 machine/KP_9000_6XH_X2_V2_1.c create mode 100644 machine/KP_9000_6XH_X2_V2_1.h create mode 100644 machine/KP_9000_9XHML_X_V2_2.c create mode 100644 machine/KP_9000_9XHML_X_V2_2.h create mode 100644 machine/KP_9000_9XHML_X_V3_1.c create mode 100644 machine/KP_9000_9XHML_X_V3_1.h create mode 120000 machine/KP_9000_9XHML_X_V3_2.c create mode 100644 machine/KP_9000_9XHML_X_V3_2.h create mode 100644 machine/KP_9000_9XH_X_EU.c create mode 100644 machine/KP_9000_9XH_X_EU.h create mode 100644 machine/LIANGUO_HYWS_SGT0108S.c create mode 100644 machine/LIANGUO_HYWS_SGT0108S.h create mode 100644 machine/LIANGUO_ZX_SWTGW215AS.c create mode 100644 machine/LIANGUO_ZX_SWTGW215AS.h create mode 100644 machine/ONT_S207CW_62TS_SE.c create mode 100644 machine/ONT_S207CW_62TS_SE.h create mode 100644 machine/PB_2132.c create mode 100644 machine/PB_2132.h create mode 100644 machine/PCB_K0402WS_V2.c create mode 100644 machine/PCB_K0402WS_V2.h create mode 120000 machine/PCB_K0402WS_V3.c create mode 100644 machine/PCB_K0402WS_V3.h create mode 100644 machine/PCB_SWTG018AS_V2_1_0.c create mode 100644 machine/PCB_SWTG018AS_V2_1_0.h create mode 100644 machine/PCB_SWTG024AS_A_2_0_1.c create mode 100644 machine/PCB_SWTG024AS_A_2_0_1.h create mode 100644 machine/POE_2G080110GS.c create mode 100644 machine/POE_2G080110GS.h create mode 100644 machine/STEAMEMO_IG204_V1.c create mode 100644 machine/STEAMEMO_IG204_V1.h create mode 100644 machine/SWGT024_V2_0_MANAGED.c create mode 100644 machine/SWGT024_V2_0_MANAGED.h create mode 100644 machine/SWGT024_V2_0_UNMANAGED.c create mode 100644 machine/SWGT024_V2_0_UNMANAGED.h create mode 100644 machine/SWTG018AS_A_V_2_0.c create mode 100644 machine/SWTG018AS_A_V_2_0.h create mode 100644 machine/SWTG024AS_A_2_0_1_5C_1SFP.c create mode 100644 machine/SWTG024AS_A_2_0_1_5C_1SFP.h create mode 100644 machine/SWTG024AS_V2_0.c create mode 100644 machine/SWTG024AS_V2_0.h create mode 100644 machine/SWTGW218AS.c create mode 100644 machine/SWTGW218AS.h create mode 100644 machine/TRENDNET_TEG_S562.c create mode 100644 machine/TRENDNET_TEG_S562.h create mode 100644 machine/ZX310S_4T2XH.c create mode 100644 machine/ZX310S_4T2XH.h create mode 100644 machine/ZX310S_4T2XT.c create mode 100644 machine/ZX310S_4T2XT.h create mode 100644 machine/default_machine.h create mode 100644 machine/machine_defs.h diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 77b37312..31a94891 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: apt install make gcc sdcc xxd python-is-python3 libjson-c-dev zlib1g-dev -y - name: Run the host-side unit tests run: make -C test - - name: Check if machine.c can be compiled for all machines + - name: Check that every machine definition can be compiled run: make machine_check - name: Make project (4x2/RTL8372) run: make CI=1 MACHINE="KP_9000_6XHML_X2" diff --git a/Makefile b/Makefile index 24b9e793..0cd467f1 100644 --- a/Makefile +++ b/Makefile @@ -7,17 +7,20 @@ HTML_LOCATION = 262144 ifeq ($(origin CC),default) CC = sdcc endif -CC_FLAGS = -mmcs51 -I. -Ihttpd -Iuip +CC_FLAGS = -mmcs51 -I. -Imachine -Ihttpd -Iuip ASM ?= sdas8051 AFLAGS= -plosgff SUBDIRS := tools SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS)) -ifeq ($(MACHINE),) - MACHINE:= $(shell grep "^\s*#define MACHINE_" machine.h | sed "s/^\s*#define MACHINE_//") -else +# $MACHINE selects machine/$(MACHINE).c as the board definition and is passed +# on as -DMACHINE_$(MACHINE), which the rest of the firmware tests with +# #if defined(MACHINE_...), and as -DMACHINE_NAME, which machine.h uses to +# include machine/$(MACHINE).h. Both take the same value, so they cannot drift. +ifneq ($(MACHINE),) CC_FLAGS += -DMACHINE_$(MACHINE) + CC_FLAGS += -DMACHINE_NAME=$(MACHINE) endif # Health instrumentation and the "health" console command: HEALTH=1 gmake ... ifneq ($(HEALTH),) @@ -28,6 +31,9 @@ ifeq ($(CI),1) CC_FLAGS += --Werror endif +# The board definition being built: one file per MACHINE_* symbol in machine.h. +MACHINE_SRC = machine/$(MACHINE).c + BUILDDIR = output/$(MACHINE) VERSION_HEADER := version.h @@ -51,16 +57,30 @@ BUILD_DATE := $(shell date -u -d @$(SOURCE_DATE_EPOCH) +"%Y-%m-%d %H:%M:%S" 2>/d || date -u -r $(SOURCE_DATE_EPOCH) +"%Y-%m-%d %H:%M:%S") endif -all: create_build_dir $(VERSION_HEADER) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin +# $(MACHINE_SRC) is listed here so an unknown $MACHINE fails before anything else +# is built, including the tools/ subdirectory. +all: create_build_dir $(VERSION_HEADER) $(MACHINE_SRC) $(SUBDIRS) $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin create_build_dir: mkdir -p "$(BUILDDIR)" mkdir -p "$(BUILDDIR)/uip" mkdir -p "$(BUILDDIR)/httpd" + mkdir -p "$(BUILDDIR)/machine" -# Keep machine.c in first position to fail immediately on invalid $MACHINE value +# Every machine is a pair machine/.c + machine/.h. Selecting +# them by name means no #if/#elif chain, so an unknown or empty $MACHINE is +# caught here instead of by a #error further down the build. +$(MACHINE_SRC): + @echo "ERROR: MACHINE='$(MACHINE)' has no definition (expected $(MACHINE_SRC))." >&2 + @echo " Every machine is one file pair under machine/, named after the" >&2 + @echo " MACHINE_* symbol it defines; see machine/*.c for the full list." >&2 + @echo " Example: make MACHINE=KP_9000_6XHML_X2" >&2 + @false + +# Keep the per-machine definition in first position to fail immediately on an +# invalid $MACHINE value SRCS = \ - machine.c \ + $(MACHINE_SRC) \ machine_init.c \ cmd_editor.c \ cmd_parser.c \ @@ -173,15 +193,22 @@ $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.i .PHONY: clean distclean all $(SUBDIRS) $(SUBDIRSCLEAN) create_build_dir +# Every machine/ definition is compiled, so a machine added to machine/ is +# covered without registering it anywhere. The machine-specific defines are +# filtered out of $(CC_FLAGS) and supplied per iteration instead, so this also +# works as "make machine_check MACHINE=...". +MACHINE_DEFS := $(sort $(patsubst machine/%.c,%,$(wildcard machine/*.c))) +MACHINE_LESS_CC_FLAGS = $(filter-out -DMACHINE_%,$(CC_FLAGS)) + .PHONY: machine_check: @mkdir -p $(BUILDDIR)/tmp @set -eo pipefail; \ - for MACHINE in `grep -E '^[[:space:]]*(//[[:space:]]*)?#define MACHINE_' machine.h | sed -E 's%^[[:space:]]*(//[[:space:]]*)?#define MACHINE_%%' | awk '{print $$1}' | sort -u`; \ + for MACHINE in $(MACHINE_DEFS); \ do \ echo "Checking $${MACHINE}"; \ - $(CC) $(CC_FLAGS) -DMACHINE_$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine.c; \ - $(CC) $(CC_FLAGS) -DMACHINE_$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine_init.c; \ + $(CC) $(MACHINE_LESS_CC_FLAGS) -DMACHINE_$${MACHINE} -DMACHINE_NAME=$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine/$${MACHINE}.c; \ + $(CC) $(MACHINE_LESS_CC_FLAGS) -DMACHINE_$${MACHINE} -DMACHINE_NAME=$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine_init.c; \ done @rm -rf $(BUILDDIR)/tmp diff --git a/machine.c b/machine.c deleted file mode 100644 index af79d920..00000000 --- a/machine.c +++ /dev/null @@ -1,1469 +0,0 @@ -#include "machine.h" -#include "rtl837x_pins.h" -#include "rtl837x_leds.h" -#include "rtl837x_sfr.h" -#include "rtl837x_regs.h" -#include "rtl837x_common.h" - -#define I2CBUS_INVALID (7) -// This is a MACRO to check if I2C_BUS_FROM_SDA_PIN or I2C_BUS_FROM_SCL_PIN don't return I2CBUS_INVALID. -// When I2CBUS_INVALID is returned, compiler stops with "machine.c:: error 176: sizeof applied to an incomplete type" -#define I2CBUS_VALID(bus) (0 * sizeof(char[(bus) != I2CBUS_INVALID ? 1 : 0])) -#define I2CBUS(sda, scl) \ - ((uint8_t)((I2C_BUS_FROM_SCL_PIN(scl) << RTL837X_REG_I2C_SCL_SHIFT) | \ - (I2C_BUS_FROM_SDA_PIN(sda) << RTL837X_REG_I2C_SDA_SHIFT) | \ - I2CBUS_VALID(I2C_BUS_FROM_SCL_PIN(scl)) | \ - I2CBUS_VALID(I2C_BUS_FROM_SDA_PIN(sda)))) - -#define I2C_BUS_FROM_SDA_PIN(sda_pin) \ - ((sda_pin) == GPIO47_I2C_SDA0 ? 0 : \ - (sda_pin) == GPIO49_I2C_SDA1 ? 1 : \ - (sda_pin) == GPIO51_I2C_SDA2_UART1_RX ? 2 : \ - (sda_pin) == GPIO41_I2C_SDA3_MDIO1 ? 3 : \ - (sda_pin) == GPIO39_I2C_SDA4 ? 4 : I2CBUS_INVALID) - -#define I2C_BUS_FROM_SCL_PIN(scl_pin) \ - ((scl_pin) == GPIO46_I2C_SCL0 ? 0 : \ - (scl_pin) == GPIO48_I2C_SCL1 ? 1 : \ - (scl_pin) == GPIO50_I2C_SCL2_UART1_TX ? 2 : \ - (scl_pin) == GPIO40_I2C_SCL3_MDC1 ? 3 : I2CBUS_INVALID) - -#if defined(MACHINE_KP_9000_6XHML_X2) || \ - defined(MACHINE_KP_9000_6XH_X2_V1_1) || \ - defined(MACHINE_KP_9000_6XHML_X2_V1_1) || \ - defined(MACHINE_KP_9000_6XH_X2_V1_2) || \ - defined(MACHINE_KP_9000_6XHML_X2_V1_2) -__code const struct machine machine = { -#if defined(MACHINE_KP_9000_6XH_X2_V1_1) - .machine_name = "keepLink KP-9000-6XH V1.1", -#elif defined(MACHINE_KP_9000_6XHML_X2_V1_1) - .machine_name = "keepLink KP-9000-6XHML V1.1", -#elif defined(MACHINE_KP_9000_6XH_X2_V1_2) - .machine_name = "keepLink KP-9000-6XH V1.2", -#elif defined(MACHINE_KP_9000_6XHML_X2_V1_2) - .machine_name = "keepLink KP-9000-6XHML V1.2", -#else - .machine_name = "keepLink KP-9000-6XHML-X2", -#endif - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 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, 1, 0, 0, 0, 0, 2}, - // Left SFP port (5) - .sfp_port[0].pin_detect = GPIO50_I2C_SCL2_UART1_TX, - .sfp_port[0].pin_los = GPIO10_LED10, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 0, - .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - // Right SFP port (6) - .sfp_port[1].pin_detect = GPIO30_ACL_BIT3_EN, - .sfp_port[1].pin_los = GPIO37, - .sfp_port[1].pin_tx_disable = GPIO_NA, - .sfp_port[1].sds = 1, - .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 0}, - /* Conditions for LED on: - * dual led orange: ledset_0 & ledset_2 - * dual led green: ledset_2 & !ledset_0 - * single right led green: ledset_0 & !ledset_1 - */ - .led_sets = { { LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - LEDS_2G5 | LEDS_LINK | LEDS_10G, - LEDS_1G | LEDS_LINK, - 0 }, - }, -}; - -#elif defined MACHINE_KP_9000_6XH_X -__code const struct machine machine = { - .machine_name = "keepLink KP-9000-6XH-X", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 1, - .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - /* Conditions for LED on: - * dual led orange: ledset_0 & ledset_2 - * dual led green: ledset_2 & !ledset_0 - * single right led green: ledset_0 & !ledset_1 - */ - .led_sets = { { LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - LEDS_2G5 | LEDS_LINK | LEDS_10G, - LEDS_1G | LEDS_LINK, - 0 }, - }, -}; - -#elif defined(MACHINE_KP_9000_6XH_X2) || defined(MACHINE_KP_9000_6XH_X2_V2_1) || defined(MACHINE_KP_9000_6XHML_X2_V2_1) -__code const struct machine machine = { -#if defined(MACHINE_KP_9000_6XHML_X2_V2_1) - .machine_name = "keepLink KP-9000-6XHML V2.1", -#elif defined(MACHINE_KP_9000_6XH_X2_V2_1) - .machine_name = "keepLink KP-9000-6XH-X2 V2.1", -#else - .machine_name = "keepLink KP-9000-6XH-X2", -#endif - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, - - // Left SFP port - .sfp_port[0].pin_detect = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - // Right SFP port - .sfp_port[1].pin_detect = GPIO37, - .sfp_port[1].pin_los = GPIO_NA, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO48_I2C_SCL1, // Button-Switch is unpopulated on PCB, but can be added manually (hole in case is already there) - .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - .led_sets = { - { - LEDS_2G5 | LEDS_LINK, // Left LED (Amber) - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Right LED (Green) - 0, - 0 - }, - { - LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - 0 - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10, - 0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19, - 0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 - }, - }; - -#elif defined MACHINE_KP_9000_9XH_X_EU -__code const struct machine machine = { - .machine_name = "keepLink KP-9000-9XH-X-EU", - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .led_sets = { { LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, - LEDS_2G5 | LEDS_LINK, - LEDS_1G | LEDS_LINK, - LEDS_2G5 | LEDS_LINK | LEDS_ACT }, - }, -}; - -#elif defined MACHINE_KP_9000_9XHML_X_V2_2 -__code const struct machine machine = { - .machine_name = "keepLink KP-9000-9XHML-X V2.2", - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }, - .led_sets = { - { /* Set 0 for RJ45 connectors */ - /* LED0: Right Green */ - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - /* LED1: Left Orange */ - LEDS_2G5 | LEDS_LINK, - /* LED2: Left Green */ - LEDS_1G | LEDS_LINK, - /* LED3: None */ - 0, - }, { /* Set 1 for SFP port */ - /* LED0: Single Green "9" LED */ - LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, - /* LED1: D23 LED on PCB */ - LEDS_1G | LEDS_LINK, - /* LED2: D22 LED on PCB */ - LEDS_2G5 | LEDS_LINK, - /* LED3: Unused */ - LEDS_COL | LEDS_DUPLEX, - }, { /* Set 2: Unused, but set to same things as stock firmware for consistency */ - LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - LEDS_1G | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_LINK | LEDS_ACT | LEDS_5G, - LEDS_10G | LEDS_ACT | LEDS_LINK, - }, { /* Set 3: Unused, but set to same things as stock firmware for consistency */ - LEDS_TX, - LEDS_RX, - LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, - LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, - }, - }, -}; - -#elif defined(MACHINE_KP_9000_9XHML_X_V3_1) || defined(MACHINE_KP_9000_9XHML_X_V3_2) -// 2M-PCB23-V3.2 is wired like V3.1 (SFP detection, LEDs, factory MAC location) -__code const struct machine machine = { -#if defined(MACHINE_KP_9000_9XHML_X_V3_2) - .machine_name = "keepLink KP-9000-9XHML-X V3.2", -#else - .machine_name = "keepLink KP-9000-9XHML-X V3.1", -#endif - .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 = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO48_I2C_SCL1, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { - { /* RJ45: First LED, yellow, second LED: green */ - LEDS_2G5 | LEDS_LINK, - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - }, { /* SFP PORT, SINGLE GREEN LED */ - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - 0, - 0, - 0, - }}, - .led_mux_custom = 1, - .led_mux = {0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x09, 0x0d, 0x10, - 0x11, 0x0e, 0x14, 0x11, 0x12, 0x15, 0x15, 0x16, 0x18, 0x19, - 0x1a, 0x19, 0x1d, 0x1e, 0x1c, 0x1d, 0x20, 0x21}, - .mac_flash_offset = 0x1FC000, -}; - -#elif defined MACHINE_SWGT024_V2_0_MANAGED -__code const struct machine machine = { - .machine_name = "SWGT024 V2.0 Managed", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .is_sfp= {0, 0, 0, 2, 0, 0, 0, 0, 1}, - // Left SFP port (J4) - .sfp_port[0].pin_detect = GPIO30_ACL_BIT3_EN, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 39 */ - // Right SFP port (J2) - .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, - .sfp_port[1].pin_los = GPIO_NA, - .sfp_port[1].pin_tx_disable = GPIO_NA, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 40 */ - .reset_pin = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - .led_sets = { - { /* RJ45: Green LED */ - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - 0, - /* Amber LED */ - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - 0 - }, { /* SFP PORT: SINGLE GREEN LED */ - LEDS_10M | LEDS_100M | LEDS_1G | LEDS_2G5 | LEDS_10G | LEDS_LINK | LEDS_ACT, - 0, - 0, - 0, - }, - }, -}; - -#elif defined MACHINE_SWGT024_V2_0_UNMANAGED -__code const struct machine machine = { - .machine_name = "SWGT024 V2.0 Unmanaged", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .is_sfp= {0, 0, 0, 2, 0, 0, 0, 0, 1}, - // Left SFP port (J4) - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 39 */ - // Right SFP port (J2) - .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, - .sfp_port[1].pin_los = GPIO51_I2C_SDA2_UART1_RX, - .sfp_port[1].pin_tx_disable = GPIO_NA, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 40 */ - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - .led_sets = { - { /* RJ45: Green LED */ - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - 0, - /* Amber LED */ - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - 0 - }, { /* SFP PORT: SINGLE GREEN LED */ - LEDS_10M | LEDS_100M | LEDS_1G | LEDS_2G5 | LEDS_10G | LEDS_LINK | LEDS_ACT, - 0, - 0, - 0, - }, - }, -}; - -#elif defined MACHINE_SWTG018AS_A_V_2_0 -__code const struct machine machine = { - .machine_name = "SWTG018AS-A V2.0", - .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 = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO48_I2C_SCL1, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { - { /* RJ45: First LED, yellow, second LED: green */ - LEDS_2G5 | LEDS_LINK, - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - }, { /* SFP PORT, SINGLE GREEN LED */ - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - 0, - 0, - 0, - }}, - .led_mux_custom = 1, - .led_mux = { 0x00, 0x01, 0x04, 0x05, 0x08, // 65e0 - 0x09, 0x0c, 0x09, 0x0d, 0x10, // 65e4 - 0x11, 0x0e, 0x14, 0x11, 0x12, // 65e8 - 0x15, 0x15, 0x16, 0x18, 0x19, // 65ec - 0x1a, 0x19, 0x1d, 0x1e, 0x1c, // 65f0 - 0x1d, 0x20, 0x21 }, -}; - -#elif defined MACHINE_HG0402XG_V1_1 -__code const struct machine machine = { - .machine_name = "HG0402XG V1.1", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 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, 2, 0, 0, 0, 0, 1}, - .sfp_port[0].pin_detect = 50, - .sfp_port[0].pin_los = 10, - .sfp_port[0].pin_tx_disable = 0xFF, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - .sfp_port[1].pin_detect = 30, - .sfp_port[1].pin_los = 51, - .sfp_port[1].pin_tx_disable = 0xFF, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 , .enable = LED_27 | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - /* The Ethernet ports have 1 amber LED (left) and 1 green LED (right) - * The SFP ports have also 1 amber LED and 1 green LED - * Ethernet ports use LED-set 0, SFP ports use LED-set 1 - */ - .led_sets = { { LEDS_10M | LEDS_LINK | LEDS_ACT, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_2G5 | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - 0 }, - { LEDS_100M | LEDS_10M | LEDS_LINK, - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - LEDS_10G | LEDS_LINK, - 0 }, - }, -}; - -#elif defined MACHINE_SWTGW218AS - -__code const struct machine machine = { - .machine_name = "SWTGW218AS 8+1 Managed Switch", - .isRTL8373 = 1, - .mac_flash_offset = 0x1FC000, - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { { LEDS_2G5 | LEDS_LINK | LEDS_ACT, // Green LED (right) - 0, // unused - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Amber LED (left) - 0 - }, // unused - { LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, // SFP LED - 0, // unused - 0, // unused - 0 - }, // unused }, - }, -}; - -#elif defined MACHINE_PCB_SWTG018AS_V2_1_0 // Sold as Sodola SL902 / Horaco "SWTGW218AS"; the SWTGW218AS label also covers other PCBs with different SFP and LED wiring (see MACHINE_SWTGW218AS) - -__code const struct machine machine = { - .machine_name = "SWTGW218AS (SWTG018AS-V2.1.0)", - .isRTL8373 = 1, - .mac_flash_offset = 0x1FC000, - .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 = GPIO38, // pulled low on module insert - .sfp_port[0].pin_los = GPIO_NA, // no LOS pin wired - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - // LED wiring matches the SWTG018AS-A V2.0 (same PCB family) - .led_sets = { - { /* RJ45: First LED, yellow, second LED: green */ - LEDS_2G5 | LEDS_LINK, - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - }, { /* SFP set (superseded by the raw register override in machine_custom_init) */ - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - 0, - 0, - 0, - }}, - .led_mux_custom = 1, - .led_mux = { 0x00, 0x01, 0x04, 0x05, 0x08, // 65e0 - 0x09, 0x0c, 0x09, 0x0d, 0x10, // 65e4 - 0x11, 0x0e, 0x14, 0x11, 0x12, // 65e8 - 0x15, 0x15, 0x16, 0x18, 0x19, // 65ec - 0x1a, 0x19, 0x1d, 0x1e, 0x1c, // 65f0 - 0x1d, 0x20, 0x21 }, -}; - -#elif defined MACHINE_LIANGUO_ZX_SWTGW215AS // Has PCB branded PCB-SWTG115AS-V2.0 but is labeled and reports as a ZX-SWTGW215AS, seems to be identical to the "real" ZX-SWTGW215AS except for the LEDs -__code const struct machine machine = { - .machine_name = "Lianguo ZX-SWTGW215AS", - .isRTL8373 = 0, - .mac_flash_offset = 0x1FC000, - .min_port = 3, - .max_port = 8, - .n_sfp = 1, - .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { { LEDS_2G5 | LEDS_LINK | LEDS_ACT, // Green LED (right) - 0, // unused - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Amber LED (left) - 0 - }, // unused - { LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, // SFP LED - 0, // unused - 0, // unused - 0 - }, // unused }, - }, - .led_mux_custom = 0, -}; - -#elif defined MACHINE_DEFAULT_8C_1SFP -__code const struct machine machine = { - .machine_name = "8+1 SFP Port Switch", - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .led_sets = { { LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, - LEDS_2G5 | LEDS_LINK, - LEDS_1G | LEDS_LINK, - LEDS_2G5 | LEDS_LINK | LEDS_ACT }, - }, -}; - -#elif defined MACHINE_TRENDNET_TEG_S562 -__code const struct machine machine = { - .machine_name = "Trendnet TEG-S562", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .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 = I2CBUS( GPIO47_I2C_SDA0, GPIO46_I2C_SCL0 ), - .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 = I2CBUS( GPIO49_I2C_SDA1, 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 - }, - }, - -}; - -#elif defined(MACHINE_PCB_K0402WS_V3) || defined(MACHINE_HI_K0402WS) // Sold as a variety of devices, see doc/ -__code const struct machine machine = { - .machine_name = "PCB-K0402WS-V3.0", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, - - // Left SFP port - .sfp_port[0].pin_detect = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - // Right SFP port - .sfp_port[1].pin_detect = GPIO37, - .sfp_port[1].pin_los = GPIO_NA, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - .led_sets = { - { - LEDS_2G5 | LEDS_LINK | LEDS_10M | LEDS_ACT, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, - LEDS_1G | LEDS_LINK, - 0 - }, - { - LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK, - LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_ACT, - 0, - 0 - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 - }, - }; - -#elif defined MACHINE_K0501W_V2_0 -__code const struct machine machine = { - .machine_name = "K0501W V2.0", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 1, - .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { - { - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - 0, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0 - }, - { - LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - 0 - }, - }, -}; - -#elif defined MACHINE_ZX310S_4T2XH -__code const struct machine machine = { - .machine_name = "ZX310S-4T2XH", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 1, - .n_10g = 1, - .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, 1}, - .sfp_port[0].pin_detect = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO48_I2C_SCL1, - .high_leds = { .mux = LED_28_SYS, .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: Orange: 2.5GBit, Green: 10/100/1000MBit - * Port 5: Blue: 10GBit, Green: 10Mbit-5GBit - * SFP-port: Blue: 10GBit, Green 100MBit-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_5G, - LEDS_LINK | LEDS_ACT | LEDS_10G, - LEDS_2G5 | LEDS_LINK, - LEDS_COL | LEDS_DUPLEX - } - }, -}; - -#elif defined MACHINE_STEAMEMO_IG204_V1 -__code const struct machine machine = { - .machine_name = "Steamemo IG204 V1", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, - // Left SFP port (5) - // LED pin 9 - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - // Right SFP port (6) - // LED pin 24 - .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, - .sfp_port[1].pin_los = GPIO51_I2C_SDA2_UART1_RX, - .sfp_port[1].pin_tx_disable = GPIO_NA, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - .led_sets = { - { - // RJ45 Amber LED (left) - LEDS_2G5 | LEDS_LINK, - // RJ45 Green LED (Right) - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - }, - { - // SFP LED - LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, - 0, // unused - 0, // unused - 0 - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x0f, 0x20, 0x0d, 0x0e, 0x10, 0x11, 0x12, 0x14, 0x15, 0x16, 0x18, 0x19, 0x1a, 0x1c, 0x1d, 0x1e, 0x0c, 0x21, 0x22, 0x23 - }, -}; - -#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 = I2CBUS( GPIO39_I2C_SDA4, 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 - }, - }, -}; - -#elif defined(MACHINE_PCB_K0402WS_V2) || defined(MACHINE_FNS1200P) -__code const struct machine machine = { -#if defined(MACHINE_PCB_K0402WS_V2) - .machine_name = "PCB-K0402WS-V2.0", -#else - .machine_name = "FNS-1200P", -#endif - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, - - /* Left SFP (logical 8, SDS1): GPIO30=ModAbs, GPIO37=RX_LOS */ - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - /* Right SFP (logical 3, SDS0): GPIO50=ModAbs, GPIO51=RX_LOS */ - .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, - .sfp_port[1].pin_los = GPIO51_I2C_SDA2_UART1_RX, - .sfp_port[1].pin_tx_disable = GPIO_NA, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - - /* Copper ports use SET0; SFP ports use SET1 */ - .port_led_set = {0, 0, 0, 1, 0, 0, 0, 0, 1}, - - .led_sets = { - { /* SET0: copper — LED0=amber (2.5G), LED2=green (1G/100M/10M) */ - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - 0, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0 - }, - { /* SET1: SFP — all speeds link/act */ - LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, 0 - }, - }, - - .led_mux_custom = 1, - .led_mux = { - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* GPIO0-7: unused */ - 0x0f, 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x12, /* GPIO8-14 */ - 0x14, 0x15, 0x16, 0x18, 0x19, 0x1a, /* GPIO15-20 */ - 0x1c, 0x1d, 0x1e, 0x20, 0x21, 0x22, 0x23 /* GPIO21-27 */ - }, -}; - - -#elif defined MACHINE_PCB_SWTG024AS_A_2_0_1 -__code const struct machine machine = { - .machine_name = "PCB-SWTG024AS-A-2.0.1", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 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, 1, 0, 0, 0, 0, 2}, - - // SFP port on SDS0 / logical port 3 - .sfp_port[0].pin_detect = GPIO37, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 0, - .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - - // SFP port on SDS1 / logical port 8 - .sfp_port[1].pin_detect = GPIO38, - .sfp_port[1].pin_los = GPIO_NA, - .sfp_port[1].pin_tx_disable = GPIO_NA, - .sfp_port[1].sds = 1, - .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - .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_10G | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_LINK, - LEDS_COL | LEDS_DUPLEX - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 - }, - }; - -#elif defined MACHINE_ONT_S207CW_62TS_SE - -__code const struct machine machine = { - .machine_name = "ONT-S207CW-62TS-SE / Binardat 2G06-04210GSM / Binardat 2G06-04210GS", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 5, 4, 3, 2, 1, 6}, - .phys_to_log_port = {7, 6, 5, 4, 3, 8, 0, 0, 0}, - .is_sfp = {0, 0, 0, 1, 0, 0, 0, 0, 2}, - - // SFP port on SDS0 / logical port 3 - .sfp_port[0].pin_detect = GPIO37, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 0, - .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - - // SFP port on SDS1 / logical port 8 - .sfp_port[1].pin_detect = GPIO38, - .sfp_port[1].pin_los = GPIO_NA, - .sfp_port[1].pin_tx_disable = GPIO_NA, - .sfp_port[1].sds = 1, - .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 3, 0, 0, 2, 2, 3}, - .mac_flash_offset = 0x1FC000, - .led_sets = { - { // RJ45 Ports 3-4 (normal wiring) - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - 0, - 0 - }, - { // Unused - 0, - 0, - 0, - 0 - }, - { // RJ45 Ports 1-2 (reversed wiring) - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0 - }, - { // SFP Ports 5-6 - LEDS_10G | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_1G | LEDS_LINK | LEDS_ACT, - 0, - 0 - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 - }, -}; - -#elif defined MACHINE_SWTG024AS_A_2_0_1_5C_1SFP -__code const struct machine machine = { - .machine_name = "SWTG024AS-A-V2.0.1-5C-1SFP", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 1, - .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, 1}, - .sfp_port[0].pin_detect = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - /* Ports 1-5 RJ45 use set 0, port 9 SFP uses set 1 - * Ports 1-5: Green: 2.5GBit, Amber: 10/100/1000MBit - * SFP-port: Blue: 10GBit, Green: 100MBit-2.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_10G | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_LINK, - LEDS_COL | LEDS_DUPLEX - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 - }, - }; - -#elif defined MACHINE_SWTG024AS_V2_0 -__code const struct machine machine = { - .machine_name = "SWTG024AS-V2.0", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 1, - .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - /* Ports 1-5 RJ45 use set 0, port 9 SFP uses set 1 - * Ports 1-5: Green: 2.5GBit, Amber: 10/100/1000MBit - * SFP-port: Blue: 10GBit, Amber: 100MBit-2.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_10G | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_LINK, - LEDS_COL | LEDS_DUPLEX - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 - }, - }; - -#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 - } - }, -}; - -#elif defined MACHINE_FG_4GT_2SX_V2_0 -__code const struct machine machine = { - .machine_name = "FG-4GT-2SX_V2.0", - .isRTL8373 = 0, - .min_port = 3, - .max_port = 8, - .n_sfp = 2, - .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, - .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, - .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, - - // Left SFP port - .sfp_port[0].pin_detect = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - // Right SFP port - .sfp_port[1].pin_detect = GPIO37, - .sfp_port[1].pin_los = GPIO_NA, - .sfp_port[1].sds = 0, - .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, - /* Ports 1-4 RJ45 use set 0, port 5-6 SFP uses set 1 - * Ports 1-4: Green: 2.5GBit, Amber: 10/100/1000MBit - * Ports 5-6: Green: 100MBit-10GBit - */ - .led_sets = { - { - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - LEDS_2G5 | LEDS_LINK | LEDS_ACT - }, - { - LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - LEDS_10G | LEDS_LINK, - 0, - LEDS_COL | LEDS_DUPLEX - }, - { - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - LEDS_2G5 | LEDS_1G | LEDS_LINK, - LEDS_5G | LEDS_2G5 | LEDS_LINK | LEDS_ACT, - LEDS_10G | LEDS_LINK | LEDS_ACT - }, - { - LEDS_TX, - LEDS_RX, - LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5 | - LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_ACT, - LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5 | - LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x12, 0x14, 0x3f, 0x15, 0x16, - 0x18, 0x0e, 0x19, 0x11, 0x12, 0x1a, 0x15, 0x16, 0x1c, 0x19, - 0x1a, 0x1d, 0x1d, 0x1e, 0x1e, 0x20, 0x21, 0x22 - }, - }; - -#elif defined MACHINE_FG_8GT_1SX -__code const struct machine machine = { - .machine_name = "FG-8GT-1SX", - .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 = GPIO38, - .sfp_port[0].pin_los = GPIO_NA, - .sfp_port[0].pin_tx_disable = GPIO_NA, - .sfp_port[0].sds = 1, - .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = {0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { - /* - Ports 1-8: Left Amber 10/100/1000MBit (Vendor no 10M, but we add it) - Right Green 2.5GBit - SFP-port: Any speed - */ - { - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - }, - { - LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0, - 0, - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x09, 0x0d, 0x10, - 0x11, 0x0e, 0x14, 0x11, 0x12, 0x15, 0x15, 0x16, 0x18, 0x19, - 0x1a, 0x19, 0x1d, 0x1e, 0x1c, 0x1d, 0x20, 0x21, - }, -}; - -#elif defined MACHINE_LIANGUO_HYWS_SGT0108S -__code const struct machine machine = { - .machine_name = "Lianguo HYWS-SGT0108S", - .isRTL8373 = 1, - .min_port = 0, - .max_port = 8, - .n_sfp = 1, - .log_to_phys_port = {2, 1, 4, 3, 5, 6, 7, 8, 9}, - .phys_to_log_port = {1, 0, 3, 2, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - .high_leds = { .mux = 0, .enable = 0 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }, - .led_sets = { - { - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // RJ45 Blue LEDs - LEDS_2G5 | LEDS_LINK, // RJ45 White LEDs - 0, - 0 - }, - { - LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // SFP blue LED? - 0, - 0, - 0 - }, - }, -}; -#elif defined MACHINE_POE_2G080110GS -__code const struct machine machine = { - .machine_name = "MokerLink POE-2G080110GS", - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { - { - /* SET0: RJ45 2.5G = amber, 1G/100M/10M = green */ - LEDS_2G5 | LEDS_LINK | LEDS_ACT, /* amber */ - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, /* green */ - 0, - 0 - }, - { - /* SET1: SFP+ port = green */ - LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | - LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, - 0, - 0, - 0 - } - }, - .led_mux_custom = 1, - .led_mux = { 0x00, 0x01, 0x04, 0x05, 0x08, - 0x09, 0x0c, 0x09, 0x0d, 0x10, - 0x11, 0x0e, 0x14, 0x11, 0x12, - 0x15, 0x15, 0x16, 0x18, 0x19, - 0x1a, 0x19, 0x1d, 0x1e, 0x1c, - 0x1d, 0x20, 0x21 }, -}; -#elif defined MACHINE_PB_2132 -__code const struct machine machine = { - .machine_name = "PB-2132", - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - - .reset_pin = GPIO_NA, - - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - - .led_sets = { - { - /* LED0 = RJ45: Amber LED: 2.5G */ - LEDS_2G5 | LEDS_LINK | LEDS_ACT, - /* LED1 = RJ45: Green LED: 10M / 100M / 1000M */ - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, - 0, - 0 - }, - { - /* SFP+ single Green LED. */ - LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, - 0, - 0, - 0 - }, - }, - }; - -#elif defined MACHINE_HASIVO_S600W_4GT_2XGT_SE -__code const struct machine machine = { - .machine_name = "Hasivo S600W-4GT-2XGT-SE", - .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 = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .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: 5/2.5GBit, None: 10/100/1000MBit - */ - .led_sets = { - { - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Yellow - LEDS_2G5 | LEDS_LINK, // Green - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK, // Orange - 0, // Unused - }, - { - LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Yellow - LEDS_10G | LEDS_LINK, // Green - LEDS_5G | LEDS_2G5 | LEDS_LINK, // Orange - 0, // Unused - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, - 0x3f, 0x3f, 0x3f, 0x0f, 0x20, - 0x21, 0x22, 0x10, 0x11, 0x12, - 0x14, 0x15, 0x16, 0x18, 0x19, - 0x1a, 0x1c, 0x1d, 0x1e, 0x0c, - 0x0d, 0x0e, 0x23 - }, - -}; -#elif defined MACHINE_HASIVO_S1100WP_8GT_1SX_SE -__code const struct machine machine = { - .machine_name = "Hasivo S1100WP-8GT-1SX-SE", - .isRTL8373 = 1, - .mac_flash_offset = 0x1FC000, - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO54_ACL_BIT2_EN, - .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { { LEDS_2G5 | LEDS_LINK | LEDS_ACT, // Green LED (right) - 0, - LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Amber LED (left) - 0 - }, - { LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, // SFP LED - 0, - 0, - 0 - }, - }, -}; -#elif defined MACHINE_F7008_2_5 -__code const struct machine machine = { - .machine_name = "F7008-2.5 8+1 SFP Port Switch", - .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), - .reset_pin = GPIO_NA, - .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, - .port_led_set = {0, 0, 0, 0, 0, 0, 0, 0, 1}, - .led_sets = { - { /* SET0 */ - LEDS_2G5 | LEDS_LINK, /* LEDID0 - green: 2.5G link */ - LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, /* LEDID1 - yellow: traffic */ - 0, - 0, - }, - { /* SET1 - SFP+ */ - LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_LINK, - LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_LINK | LEDS_ACT, - 0, - 0, - }, - }, - .led_mux_custom = 1, - .led_mux = { - 0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x02, - 0x0d, 0x10, 0x11, 0x02, 0x14, 0x02, 0x02, 0x15, - 0x02, 0x02, 0x18, 0x02, 0x02, 0x19, 0x02, 0x02, - 0x1c, 0x1d, 0x02, 0x02, - }, -}; - -#else - #error "Please select a machine type in machine.h" -#endif diff --git a/machine.h b/machine.h index 30575781..d0b85fc1 100644 --- a/machine.h +++ b/machine.h @@ -3,55 +3,19 @@ #include -/* - * Select your machine type below - */ -// Legacy KP-9000 4+2 targets. Prefer the PCB-revision-specific targets below. -// #define MACHINE_KP_9000_6XHML_X2 -// #define MACHINE_KP_9000_6XH_X2 +#define MACHINE_STR_HELPER(x) #x +#define MACHINE_STR(x) MACHINE_STR_HELPER(x) -// KP-9000 4+2 targets by PCB silkscreen revision. -// #define MACHINE_KP_9000_6XH_X2_V1_1 -// #define MACHINE_KP_9000_6XHML_X2_V1_1 -// #define MACHINE_KP_9000_6XH_X2_V1_2 -// #define MACHINE_KP_9000_6XHML_X2_V1_2 -// #define MACHINE_KP_9000_6XH_X2_V2_1 -// #define MACHINE_KP_9000_6XHML_X2_V2_1 -// #define MACHINE_KP_9000_6XH_X -// #define MACHINE_KP_9000_9XH_X_EU -// #define MACHINE_KP_9000_9XHML_X_V2_2 -// #define MACHINE_KP_9000_9XHML_X_V3_1 -// #define MACHINE_KP_9000_9XHML_X_V3_2 -// #define MACHINE_SWGT024_V2_0_MANAGED -// #define MACHINE_SWGT024_V2_0_UNMANAGED -// #define MACHINE_TRENDNET_TEG_S562 -// #define MACHINE_HG0402XG_V1_1 -// #define MACHINE_SWTG018AS_A_V_2_0 -// #define MACHINE_SWTGW218AS -// #define MACHINE_PCB_SWTG018AS_V2_1_0 -// #define MACHINE_PCB_K0402WS_V3 -// #define MACHINE_PCB_K0402WS_V2 -// #define MACHINE_K0501W_V2_0 -// #define MACHINE_LIANGUO_ZX_SWTGW215AS -// #define MACHINE_ZX310S_4T2XH -// #define MACHINE_ZX310S_4T2XT -// #define MACHINE_STEAMEMO_IG204_V1 -// #define MACHINE_DEFAULT_8C_1SFP -// #define MACHINE_HI_K0801WS -// #define MACHINE_FNS1200P -// #define MACHINE_PCB_SWTG024AS_A_2_0_1 -// #define MACHINE_ONT_S207CW_62TS_SE -// #define MACHINE_SWTG024AS_A_2_0_1_5C_1SFP -// #define MACHINE_SWTG024AS_V2_0 -// #define MACHINE_FG_4GT_2SX_V2_0 -// #define MACHINE_FG_8GT_1SX -// #define MACHINE_LIANGUO_HYWS_SGT0108S -// #define MACHINE_POE_2G080110GS -// #define MACHINE_PB_2132 -// #define MACHINE_HASIVO_S600W_4GT_2XGT_SE -// #define MACHINE_HASIVO_S1100WP_8GT_1SX_SE -// #define MACHINE_F7008_2_5 +#define MACHINE_DEF_DIR machine + +#ifndef MACHINE_NAME + #define MACHINE_NAME default_machine +#endif + +#define MACHINE_INC(dir,file) MACHINE_STR(dir/file) + +#include MACHINE_INC(MACHINE_DEF_DIR,MACHINE_NAME.h) #define LED_27 1 // SYSTEM LED diff --git a/machine/DEFAULT_8C_1SFP.c b/machine/DEFAULT_8C_1SFP.c new file mode 100644 index 00000000..2a923596 --- /dev/null +++ b/machine/DEFAULT_8C_1SFP.c @@ -0,0 +1,25 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 0}, + .led_sets = { { LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, + LEDS_2G5 | LEDS_LINK, + LEDS_1G | LEDS_LINK, + LEDS_2G5 | LEDS_LINK | LEDS_ACT }, + }, +}; diff --git a/machine/DEFAULT_8C_1SFP.h b/machine/DEFAULT_8C_1SFP.h new file mode 100644 index 00000000..2b802a30 --- /dev/null +++ b/machine/DEFAULT_8C_1SFP.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_DEFAULT_8C_1SFP_H_ +#define _MACHINE_DEFAULT_8C_1SFP_H_ + +#define MACHINE_MODEL "8+1 SFP Port Switch" + +#endif diff --git a/machine/F7008_2_5.c b/machine/F7008_2_5.c new file mode 100644 index 00000000..e2d08e61 --- /dev/null +++ b/machine/F7008_2_5.c @@ -0,0 +1,41 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = {0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { + { /* SET0 */ + LEDS_2G5 | LEDS_LINK, /* LEDID0 - green: 2.5G link */ + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, /* LEDID1 - yellow: traffic */ + 0, + 0, + }, + { /* SET1 - SFP+ */ + LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_LINK, + LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_LINK | LEDS_ACT, + 0, + 0, + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x02, + 0x0d, 0x10, 0x11, 0x02, 0x14, 0x02, 0x02, 0x15, + 0x02, 0x02, 0x18, 0x02, 0x02, 0x19, 0x02, 0x02, + 0x1c, 0x1d, 0x02, 0x02, + }, +}; diff --git a/machine/F7008_2_5.h b/machine/F7008_2_5.h new file mode 100644 index 00000000..c3b0cbbf --- /dev/null +++ b/machine/F7008_2_5.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_F7008_2_5_H_ +#define _MACHINE_F7008_2_5_H_ + +#define MACHINE_MODEL "F7008-2.5 8+1 SFP Port Switch" + +#endif diff --git a/machine/FG_4GT_2SX_V2_0.c b/machine/FG_4GT_2SX_V2_0.c new file mode 100644 index 00000000..9590c6f0 --- /dev/null +++ b/machine/FG_4GT_2SX_V2_0.c @@ -0,0 +1,66 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, + + // Left SFP port + .sfp_port[0].pin_detect = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + // Right SFP port + .sfp_port[1].pin_detect = GPIO37, + .sfp_port[1].pin_los = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + /* Ports 1-4 RJ45 use set 0, port 5-6 SFP uses set 1 + * Ports 1-4: Green: 2.5GBit, Amber: 10/100/1000MBit + * Ports 5-6: Green: 100MBit-10GBit + */ + .led_sets = { + { + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + LEDS_2G5 | LEDS_LINK | LEDS_ACT + }, + { + LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + LEDS_10G | LEDS_LINK, + 0, + LEDS_COL | LEDS_DUPLEX + }, + { + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_1G | LEDS_LINK, + LEDS_5G | LEDS_2G5 | LEDS_LINK | LEDS_ACT, + LEDS_10G | LEDS_LINK | LEDS_ACT + }, + { + LEDS_TX, + LEDS_RX, + LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5 | + LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_ACT, + LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5 | + LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x12, 0x14, 0x3f, 0x15, 0x16, + 0x18, 0x0e, 0x19, 0x11, 0x12, 0x1a, 0x15, 0x16, 0x1c, 0x19, + 0x1a, 0x1d, 0x1d, 0x1e, 0x1e, 0x20, 0x21, 0x22 + }, + }; diff --git a/machine/FG_4GT_2SX_V2_0.h b/machine/FG_4GT_2SX_V2_0.h new file mode 100644 index 00000000..8f9697e7 --- /dev/null +++ b/machine/FG_4GT_2SX_V2_0.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_FG_4GT_2SX_V2_0_H_ +#define _MACHINE_FG_4GT_2SX_V2_0_H_ + +#define MACHINE_MODEL "FG-4GT-2SX_V2.0" + +#endif diff --git a/machine/FG_8GT_1SX.c b/machine/FG_8GT_1SX.c new file mode 100644 index 00000000..0fd3dee0 --- /dev/null +++ b/machine/FG_8GT_1SX.c @@ -0,0 +1,45 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = {0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { + /* + Ports 1-8: Left Amber 10/100/1000MBit (Vendor no 10M, but we add it) + Right Green 2.5GBit + SFP-port: Any speed + */ + { + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + }, + { + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + 0, + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x09, 0x0d, 0x10, + 0x11, 0x0e, 0x14, 0x11, 0x12, 0x15, 0x15, 0x16, 0x18, 0x19, + 0x1a, 0x19, 0x1d, 0x1e, 0x1c, 0x1d, 0x20, 0x21, + }, +}; diff --git a/machine/FG_8GT_1SX.h b/machine/FG_8GT_1SX.h new file mode 100644 index 00000000..e75a9946 --- /dev/null +++ b/machine/FG_8GT_1SX.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_FG_8GT_1SX_H_ +#define _MACHINE_FG_8GT_1SX_H_ + +#define MACHINE_MODEL "FG-8GT-1SX" + +#endif diff --git a/machine/FNS1200P.c b/machine/FNS1200P.c new file mode 100644 index 00000000..71334029 --- /dev/null +++ b/machine/FNS1200P.c @@ -0,0 +1,55 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, + + /* Left SFP (logical 8, SDS1): GPIO30=ModAbs, GPIO37=RX_LOS */ + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + /* Right SFP (logical 3, SDS0): GPIO50=ModAbs, GPIO51=RX_LOS */ + .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, + .sfp_port[1].pin_los = GPIO51_I2C_SDA2_UART1_RX, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + + /* Copper ports use SET0; SFP ports use SET1 */ + .port_led_set = {0, 0, 0, 1, 0, 0, 0, 0, 1}, + + .led_sets = { + { /* SET0: copper — LED0=amber (2.5G), LED2=green (1G/100M/10M) */ + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + 0, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0 + }, + { /* SET1: SFP — all speeds link/act */ + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, 0 + }, + }, + + .led_mux_custom = 1, + .led_mux = { + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* GPIO0-7: unused */ + 0x0f, 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x12, /* GPIO8-14 */ + 0x14, 0x15, 0x16, 0x18, 0x19, 0x1a, /* GPIO15-20 */ + 0x1c, 0x1d, 0x1e, 0x20, 0x21, 0x22, 0x23 /* GPIO21-27 */ + }, +}; diff --git a/machine/FNS1200P.h b/machine/FNS1200P.h new file mode 100644 index 00000000..e5691b48 --- /dev/null +++ b/machine/FNS1200P.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_FNS1200P_H_ +#define _MACHINE_FNS1200P_H_ + +#define MACHINE_MODEL "FNS-1200P" + +#endif diff --git a/machine/HASIVO_S1100WP_8GT_1SX_SE.c b/machine/HASIVO_S1100WP_8GT_1SX_SE.c new file mode 100644 index 00000000..7500ba94 --- /dev/null +++ b/machine/HASIVO_S1100WP_8GT_1SX_SE.c @@ -0,0 +1,32 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 1, + .mac_flash_offset = 0x1FC000, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { { LEDS_2G5 | LEDS_LINK | LEDS_ACT, // Green LED (right) + 0, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Amber LED (left) + 0 + }, + { LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, // SFP LED + 0, + 0, + 0 + }, + }, +}; diff --git a/machine/HASIVO_S1100WP_8GT_1SX_SE.h b/machine/HASIVO_S1100WP_8GT_1SX_SE.h new file mode 100644 index 00000000..d50dfc22 --- /dev/null +++ b/machine/HASIVO_S1100WP_8GT_1SX_SE.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_HASIVO_S1100WP_8GT_1SX_SE_H_ +#define _MACHINE_HASIVO_S1100WP_8GT_1SX_SE_H_ + +#define MACHINE_MODEL "Hasivo S1100WP-8GT-1SX-SE" + +#endif diff --git a/machine/HASIVO_S600W_4GT_2XGT_SE.c b/machine/HASIVO_S600W_4GT_2XGT_SE.c new file mode 100644 index 00000000..e43477d8 --- /dev/null +++ b/machine/HASIVO_S600W_4GT_2XGT_SE.c @@ -0,0 +1,43 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .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: 5/2.5GBit, None: 10/100/1000MBit + */ + .led_sets = { + { + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Yellow + LEDS_2G5 | LEDS_LINK, // Green + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK, // Orange + 0, // Unused + }, + { + LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Yellow + LEDS_10G | LEDS_LINK, // Green + LEDS_5G | LEDS_2G5 | LEDS_LINK, // Orange + 0, // Unused + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, + 0x3f, 0x3f, 0x3f, 0x0f, 0x20, + 0x21, 0x22, 0x10, 0x11, 0x12, + 0x14, 0x15, 0x16, 0x18, 0x19, + 0x1a, 0x1c, 0x1d, 0x1e, 0x0c, + 0x0d, 0x0e, 0x23 + }, + +}; diff --git a/machine/HASIVO_S600W_4GT_2XGT_SE.h b/machine/HASIVO_S600W_4GT_2XGT_SE.h new file mode 100644 index 00000000..97beb686 --- /dev/null +++ b/machine/HASIVO_S600W_4GT_2XGT_SE.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_HASIVO_S600W_4GT_2XGT_SE_H_ +#define _MACHINE_HASIVO_S600W_4GT_2XGT_SE_H_ + +#define MACHINE_MODEL "Hasivo S600W-4GT-2XGT-SE" + +#endif diff --git a/machine/HG0402XG_V1_1.c b/machine/HG0402XG_V1_1.c new file mode 100644 index 00000000..6a420daa --- /dev/null +++ b/machine/HG0402XG_V1_1.c @@ -0,0 +1,38 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 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, 2, 0, 0, 0, 0, 1}, + .sfp_port[0].pin_detect = 50, + .sfp_port[0].pin_los = 10, + .sfp_port[0].pin_tx_disable = 0xFF, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + .sfp_port[1].pin_detect = 30, + .sfp_port[1].pin_los = 51, + .sfp_port[1].pin_tx_disable = 0xFF, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 , .enable = LED_27 | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + /* The Ethernet ports have 1 amber LED (left) and 1 green LED (right) + * The SFP ports have also 1 amber LED and 1 green LED + * Ethernet ports use LED-set 0, SFP ports use LED-set 1 + */ + .led_sets = { { LEDS_10M | LEDS_LINK | LEDS_ACT, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_2G5 | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + 0 }, + { LEDS_100M | LEDS_10M | LEDS_LINK, + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + LEDS_10G | LEDS_LINK, + 0 }, + }, +}; diff --git a/machine/HG0402XG_V1_1.h b/machine/HG0402XG_V1_1.h new file mode 100644 index 00000000..628dc168 --- /dev/null +++ b/machine/HG0402XG_V1_1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_HG0402XG_V1_1_H_ +#define _MACHINE_HG0402XG_V1_1_H_ + +#define MACHINE_MODEL "HG0402XG V1.1" + +#endif diff --git a/machine/HI_K0402WS.c b/machine/HI_K0402WS.c new file mode 100644 index 00000000..3ad7b241 --- /dev/null +++ b/machine/HI_K0402WS.c @@ -0,0 +1,46 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, + + // Left SFP port + .sfp_port[0].pin_detect = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + // Right SFP port + .sfp_port[1].pin_detect = GPIO37, + .sfp_port[1].pin_los = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + .led_sets = { + { + LEDS_2G5 | LEDS_LINK | LEDS_10M | LEDS_ACT, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + LEDS_1G | LEDS_LINK, + 0 + }, + { + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK, + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_ACT, + 0, + 0 + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 + }, + }; diff --git a/machine/HI_K0402WS.h b/machine/HI_K0402WS.h new file mode 100644 index 00000000..d930fce9 --- /dev/null +++ b/machine/HI_K0402WS.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_HI_K0402WS_H_ +#define _MACHINE_HI_K0402WS_H_ + +#define MACHINE_MODEL "PCB-K0402WS-V3.0" + +#endif diff --git a/machine/HI_K0801WS.c b/machine/HI_K0801WS.c new file mode 100644 index 00000000..8fba5e82 --- /dev/null +++ b/machine/HI_K0801WS.c @@ -0,0 +1,45 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = I2CBUS( GPIO39_I2C_SDA4, 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 + }, + }, +}; diff --git a/machine/HI_K0801WS.h b/machine/HI_K0801WS.h new file mode 100644 index 00000000..4321d0fe --- /dev/null +++ b/machine/HI_K0801WS.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_HI_K0801WS_H_ +#define _MACHINE_HI_K0801WS_H_ + +#define MACHINE_MODEL "Hi-Source HI-k0801WS" + +#endif diff --git a/machine/K0501W_V2_0.c b/machine/K0501W_V2_0.c new file mode 100644 index 00000000..75f36c6b --- /dev/null +++ b/machine/K0501W_V2_0.c @@ -0,0 +1,34 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 1, + .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { + { + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + 0, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0 + }, + { + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + 0 + }, + }, +}; diff --git a/machine/K0501W_V2_0.h b/machine/K0501W_V2_0.h new file mode 100644 index 00000000..dbe10df6 --- /dev/null +++ b/machine/K0501W_V2_0.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_K0501W_V2_0_H_ +#define _MACHINE_K0501W_V2_0_H_ + +#define MACHINE_MODEL "K0501W V2.0" + +#endif diff --git a/machine/KP_9000_6XHML_X2.c b/machine/KP_9000_6XHML_X2.c new file mode 100644 index 00000000..a6520f01 --- /dev/null +++ b/machine/KP_9000_6XHML_X2.c @@ -0,0 +1,37 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 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, 1, 0, 0, 0, 0, 2}, + // Left SFP port (5) + .sfp_port[0].pin_detect = GPIO50_I2C_SCL2_UART1_TX, + .sfp_port[0].pin_los = GPIO10_LED10, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 0, + .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + // Right SFP port (6) + .sfp_port[1].pin_detect = GPIO30_ACL_BIT3_EN, + .sfp_port[1].pin_los = GPIO37, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 1, + .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 0}, + /* Conditions for LED on: + * dual led orange: ledset_0 & ledset_2 + * dual led green: ledset_2 & !ledset_0 + * single right led green: ledset_0 & !ledset_1 + */ + .led_sets = { { LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + LEDS_2G5 | LEDS_LINK | LEDS_10G, + LEDS_1G | LEDS_LINK, + 0 }, + }, +}; diff --git a/machine/KP_9000_6XHML_X2.h b/machine/KP_9000_6XHML_X2.h new file mode 100644 index 00000000..da850ae4 --- /dev/null +++ b/machine/KP_9000_6XHML_X2.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XHML_X2_H_ +#define _MACHINE_KP_9000_6XHML_X2_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XHML-X2" + +#endif diff --git a/machine/KP_9000_6XHML_X2_V1_1.c b/machine/KP_9000_6XHML_X2_V1_1.c new file mode 120000 index 00000000..f9ce2cc7 --- /dev/null +++ b/machine/KP_9000_6XHML_X2_V1_1.c @@ -0,0 +1 @@ +KP_9000_6XHML_X2.c \ No newline at end of file diff --git a/machine/KP_9000_6XHML_X2_V1_1.h b/machine/KP_9000_6XHML_X2_V1_1.h new file mode 100644 index 00000000..1e8b2c49 --- /dev/null +++ b/machine/KP_9000_6XHML_X2_V1_1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XHML_X2_V1_1_H_ +#define _MACHINE_KP_9000_6XHML_X2_V1_1_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XHML V1.1" + +#endif diff --git a/machine/KP_9000_6XHML_X2_V1_2.c b/machine/KP_9000_6XHML_X2_V1_2.c new file mode 120000 index 00000000..f9ce2cc7 --- /dev/null +++ b/machine/KP_9000_6XHML_X2_V1_2.c @@ -0,0 +1 @@ +KP_9000_6XHML_X2.c \ No newline at end of file diff --git a/machine/KP_9000_6XHML_X2_V1_2.h b/machine/KP_9000_6XHML_X2_V1_2.h new file mode 100644 index 00000000..484ff3e2 --- /dev/null +++ b/machine/KP_9000_6XHML_X2_V1_2.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XHML_X2_V1_2_H_ +#define _MACHINE_KP_9000_6XHML_X2_V1_2_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XHML V1.2" + +#endif diff --git a/machine/KP_9000_6XHML_X2_V2_1.c b/machine/KP_9000_6XHML_X2_V2_1.c new file mode 120000 index 00000000..5ebcb090 --- /dev/null +++ b/machine/KP_9000_6XHML_X2_V2_1.c @@ -0,0 +1 @@ +KP_9000_6XH_X2.c \ No newline at end of file diff --git a/machine/KP_9000_6XHML_X2_V2_1.h b/machine/KP_9000_6XHML_X2_V2_1.h new file mode 100644 index 00000000..4cea1de7 --- /dev/null +++ b/machine/KP_9000_6XHML_X2_V2_1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XHML_X2_V2_1_H_ +#define _MACHINE_KP_9000_6XHML_X2_V2_1_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XHML V2.1" + +#endif diff --git a/machine/KP_9000_6XH_X.c b/machine/KP_9000_6XH_X.c new file mode 100644 index 00000000..50dcc10b --- /dev/null +++ b/machine/KP_9000_6XH_X.c @@ -0,0 +1,28 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 1, + .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + /* Conditions for LED on: + * dual led orange: ledset_0 & ledset_2 + * dual led green: ledset_2 & !ledset_0 + * single right led green: ledset_0 & !ledset_1 + */ + .led_sets = { { LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + LEDS_2G5 | LEDS_LINK | LEDS_10G, + LEDS_1G | LEDS_LINK, + 0 }, + }, +}; diff --git a/machine/KP_9000_6XH_X.h b/machine/KP_9000_6XH_X.h new file mode 100644 index 00000000..f52d0ad6 --- /dev/null +++ b/machine/KP_9000_6XH_X.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XH_X_H_ +#define _MACHINE_KP_9000_6XH_X_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XH-X" + +#endif diff --git a/machine/KP_9000_6XH_X2.c b/machine/KP_9000_6XH_X2.c new file mode 100644 index 00000000..aa6a2655 --- /dev/null +++ b/machine/KP_9000_6XH_X2.c @@ -0,0 +1,48 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, + + // Left SFP port + .sfp_port[0].pin_detect = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + // Right SFP port + .sfp_port[1].pin_detect = GPIO37, + .sfp_port[1].pin_los = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO48_I2C_SCL1, // Button-Switch is unpopulated on PCB, but can be added manually (hole in case is already there) + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + .led_sets = { + { + LEDS_2G5 | LEDS_LINK, // Left LED (Amber) + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Right LED (Green) + 0, + 0 + }, + { + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + 0 + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10, + 0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19, + 0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 + }, + }; diff --git a/machine/KP_9000_6XH_X2.h b/machine/KP_9000_6XH_X2.h new file mode 100644 index 00000000..5493dc79 --- /dev/null +++ b/machine/KP_9000_6XH_X2.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XH_X2_H_ +#define _MACHINE_KP_9000_6XH_X2_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XH-X2" + +#endif diff --git a/machine/KP_9000_6XH_X2_V1_1.c b/machine/KP_9000_6XH_X2_V1_1.c new file mode 120000 index 00000000..f9ce2cc7 --- /dev/null +++ b/machine/KP_9000_6XH_X2_V1_1.c @@ -0,0 +1 @@ +KP_9000_6XHML_X2.c \ No newline at end of file diff --git a/machine/KP_9000_6XH_X2_V1_1.h b/machine/KP_9000_6XH_X2_V1_1.h new file mode 100644 index 00000000..183cc276 --- /dev/null +++ b/machine/KP_9000_6XH_X2_V1_1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XH_X2_V1_1_H_ +#define _MACHINE_KP_9000_6XH_X2_V1_1_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XH V1.1" + +#endif diff --git a/machine/KP_9000_6XH_X2_V1_2.c b/machine/KP_9000_6XH_X2_V1_2.c new file mode 120000 index 00000000..f9ce2cc7 --- /dev/null +++ b/machine/KP_9000_6XH_X2_V1_2.c @@ -0,0 +1 @@ +KP_9000_6XHML_X2.c \ No newline at end of file diff --git a/machine/KP_9000_6XH_X2_V1_2.h b/machine/KP_9000_6XH_X2_V1_2.h new file mode 100644 index 00000000..4fcd94af --- /dev/null +++ b/machine/KP_9000_6XH_X2_V1_2.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XH_X2_V1_2_H_ +#define _MACHINE_KP_9000_6XH_X2_V1_2_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XH V1.2" + +#endif diff --git a/machine/KP_9000_6XH_X2_V2_1.c b/machine/KP_9000_6XH_X2_V2_1.c new file mode 120000 index 00000000..5ebcb090 --- /dev/null +++ b/machine/KP_9000_6XH_X2_V2_1.c @@ -0,0 +1 @@ +KP_9000_6XH_X2.c \ No newline at end of file diff --git a/machine/KP_9000_6XH_X2_V2_1.h b/machine/KP_9000_6XH_X2_V2_1.h new file mode 100644 index 00000000..a144dc96 --- /dev/null +++ b/machine/KP_9000_6XH_X2_V2_1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_6XH_X2_V2_1_H_ +#define _MACHINE_KP_9000_6XH_X2_V2_1_H_ + +#define MACHINE_MODEL "keepLink KP-9000-6XH-X2 V2.1" + +#endif diff --git a/machine/KP_9000_9XHML_X_V2_2.c b/machine/KP_9000_9XHML_X_V2_2.c new file mode 100644 index 00000000..e73a7514 --- /dev/null +++ b/machine/KP_9000_9XHML_X_V2_2.c @@ -0,0 +1,51 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }, + .led_sets = { + { /* Set 0 for RJ45 connectors */ + /* LED0: Right Green */ + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + /* LED1: Left Orange */ + LEDS_2G5 | LEDS_LINK, + /* LED2: Left Green */ + LEDS_1G | LEDS_LINK, + /* LED3: None */ + 0, + }, { /* Set 1 for SFP port */ + /* LED0: Single Green "9" LED */ + LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, + /* LED1: D23 LED on PCB */ + LEDS_1G | LEDS_LINK, + /* LED2: D22 LED on PCB */ + LEDS_2G5 | LEDS_LINK, + /* LED3: Unused */ + LEDS_COL | LEDS_DUPLEX, + }, { /* Set 2: Unused, but set to same things as stock firmware for consistency */ + LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + LEDS_1G | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_LINK | LEDS_ACT | LEDS_5G, + LEDS_10G | LEDS_ACT | LEDS_LINK, + }, { /* Set 3: Unused, but set to same things as stock firmware for consistency */ + LEDS_TX, + LEDS_RX, + LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, + LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, + }, + }, +}; diff --git a/machine/KP_9000_9XHML_X_V2_2.h b/machine/KP_9000_9XHML_X_V2_2.h new file mode 100644 index 00000000..2d6d0a7f --- /dev/null +++ b/machine/KP_9000_9XHML_X_V2_2.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_9XHML_X_V2_2_H_ +#define _MACHINE_KP_9000_9XHML_X_V2_2_H_ + +#define MACHINE_MODEL "keepLink KP-9000-9XHML-X V2.2" + +#endif diff --git a/machine/KP_9000_9XHML_X_V3_1.c b/machine/KP_9000_9XHML_X_V3_1.c new file mode 100644 index 00000000..26ea751f --- /dev/null +++ b/machine/KP_9000_9XHML_X_V3_1.c @@ -0,0 +1,37 @@ +#include "machine_defs.h" + +// 2M-PCB23-V3.2 is wired like V3.1 (SFP detection, LEDs, factory MAC location) +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO48_I2C_SCL1, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { + { /* RJ45: First LED, yellow, second LED: green */ + LEDS_2G5 | LEDS_LINK, + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + }, { /* SFP PORT, SINGLE GREEN LED */ + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + 0, + 0, + 0, + }}, + .led_mux_custom = 1, + .led_mux = {0x00, 0x01, 0x04, 0x05, 0x08, 0x09, 0x0c, 0x09, 0x0d, 0x10, + 0x11, 0x0e, 0x14, 0x11, 0x12, 0x15, 0x15, 0x16, 0x18, 0x19, + 0x1a, 0x19, 0x1d, 0x1e, 0x1c, 0x1d, 0x20, 0x21}, + .mac_flash_offset = 0x1FC000, +}; diff --git a/machine/KP_9000_9XHML_X_V3_1.h b/machine/KP_9000_9XHML_X_V3_1.h new file mode 100644 index 00000000..c100b5f8 --- /dev/null +++ b/machine/KP_9000_9XHML_X_V3_1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_9XHML_X_V3_1_H_ +#define _MACHINE_KP_9000_9XHML_X_V3_1_H_ + +#define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.1" + +#endif diff --git a/machine/KP_9000_9XHML_X_V3_2.c b/machine/KP_9000_9XHML_X_V3_2.c new file mode 120000 index 00000000..3e9156ac --- /dev/null +++ b/machine/KP_9000_9XHML_X_V3_2.c @@ -0,0 +1 @@ +KP_9000_9XHML_X_V3_1.c \ No newline at end of file diff --git a/machine/KP_9000_9XHML_X_V3_2.h b/machine/KP_9000_9XHML_X_V3_2.h new file mode 100644 index 00000000..e3b4eec2 --- /dev/null +++ b/machine/KP_9000_9XHML_X_V3_2.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_9XHML_X_V3_2_H_ +#define _MACHINE_KP_9000_9XHML_X_V3_2_H_ + +#define MACHINE_MODEL "keepLink KP-9000-9XHML-X V3.2" + +#endif diff --git a/machine/KP_9000_9XH_X_EU.c b/machine/KP_9000_9XH_X_EU.c new file mode 100644 index 00000000..7209e82b --- /dev/null +++ b/machine/KP_9000_9XH_X_EU.c @@ -0,0 +1,25 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 0}, + .led_sets = { { LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, + LEDS_2G5 | LEDS_LINK, + LEDS_1G | LEDS_LINK, + LEDS_2G5 | LEDS_LINK | LEDS_ACT }, + }, +}; diff --git a/machine/KP_9000_9XH_X_EU.h b/machine/KP_9000_9XH_X_EU.h new file mode 100644 index 00000000..2269b8fb --- /dev/null +++ b/machine/KP_9000_9XH_X_EU.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_KP_9000_9XH_X_EU_H_ +#define _MACHINE_KP_9000_9XH_X_EU_H_ + +#define MACHINE_MODEL "keepLink KP-9000-9XH-X-EU" + +#endif diff --git a/machine/LIANGUO_HYWS_SGT0108S.c b/machine/LIANGUO_HYWS_SGT0108S.c new file mode 100644 index 00000000..aff1713c --- /dev/null +++ b/machine/LIANGUO_HYWS_SGT0108S.c @@ -0,0 +1,36 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 1, + .min_port = 0, + .max_port = 8, + .n_sfp = 1, + .log_to_phys_port = {2, 1, 4, 3, 5, 6, 7, 8, 9}, + .phys_to_log_port = {1, 0, 3, 2, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .high_leds = { .mux = 0, .enable = 0 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1 }, + .led_sets = { + { + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // RJ45 Blue LEDs + LEDS_2G5 | LEDS_LINK, // RJ45 White LEDs + 0, + 0 + }, + { + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // SFP blue LED? + 0, + 0, + 0 + }, + }, +}; diff --git a/machine/LIANGUO_HYWS_SGT0108S.h b/machine/LIANGUO_HYWS_SGT0108S.h new file mode 100644 index 00000000..f82bd128 --- /dev/null +++ b/machine/LIANGUO_HYWS_SGT0108S.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_LIANGUO_HYWS_SGT0108S_H_ +#define _MACHINE_LIANGUO_HYWS_SGT0108S_H_ + +#define MACHINE_MODEL "Lianguo HYWS-SGT0108S" + +#endif diff --git a/machine/LIANGUO_ZX_SWTGW215AS.c b/machine/LIANGUO_ZX_SWTGW215AS.c new file mode 100644 index 00000000..70414eca --- /dev/null +++ b/machine/LIANGUO_ZX_SWTGW215AS.c @@ -0,0 +1,33 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .mac_flash_offset = 0x1FC000, + .min_port = 3, + .max_port = 8, + .n_sfp = 1, + .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { { LEDS_2G5 | LEDS_LINK | LEDS_ACT, // Green LED (right) + 0, // unused + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Amber LED (left) + 0 + }, // unused + { LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, // SFP LED + 0, // unused + 0, // unused + 0 + }, // unused }, + }, + .led_mux_custom = 0, +}; diff --git a/machine/LIANGUO_ZX_SWTGW215AS.h b/machine/LIANGUO_ZX_SWTGW215AS.h new file mode 100644 index 00000000..6c4e2210 --- /dev/null +++ b/machine/LIANGUO_ZX_SWTGW215AS.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_LIANGUO_ZX_SWTGW215AS_H_ +#define _MACHINE_LIANGUO_ZX_SWTGW215AS_H_ + +#define MACHINE_MODEL "Lianguo ZX-SWTGW215AS" + +#endif diff --git a/machine/ONT_S207CW_62TS_SE.c b/machine/ONT_S207CW_62TS_SE.c new file mode 100644 index 00000000..6ba60778 --- /dev/null +++ b/machine/ONT_S207CW_62TS_SE.c @@ -0,0 +1,61 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 5, 4, 3, 2, 1, 6}, + .phys_to_log_port = {7, 6, 5, 4, 3, 8, 0, 0, 0}, + .is_sfp = {0, 0, 0, 1, 0, 0, 0, 0, 2}, + + // SFP port on SDS0 / logical port 3 + .sfp_port[0].pin_detect = GPIO37, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 0, + .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + + // SFP port on SDS1 / logical port 8 + .sfp_port[1].pin_detect = GPIO38, + .sfp_port[1].pin_los = GPIO_NA, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 1, + .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 3, 0, 0, 2, 2, 3}, + .mac_flash_offset = 0x1FC000, + .led_sets = { + { // RJ45 Ports 3-4 (normal wiring) + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + 0, + 0 + }, + { // Unused + 0, + 0, + 0, + 0 + }, + { // RJ45 Ports 1-2 (reversed wiring) + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0 + }, + { // SFP Ports 5-6 + LEDS_10G | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_1G | LEDS_LINK | LEDS_ACT, + 0, + 0 + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 + }, +}; diff --git a/machine/ONT_S207CW_62TS_SE.h b/machine/ONT_S207CW_62TS_SE.h new file mode 100644 index 00000000..9938b004 --- /dev/null +++ b/machine/ONT_S207CW_62TS_SE.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_ONT_S207CW_62TS_SE_H_ +#define _MACHINE_ONT_S207CW_62TS_SE_H_ + +#define MACHINE_MODEL "ONT-S207CW-62TS-SE / Binardat 2G06-04210GSM / Binardat 2G06-04210GS" + +#endif diff --git a/machine/PB_2132.c b/machine/PB_2132.c new file mode 100644 index 00000000..8822c066 --- /dev/null +++ b/machine/PB_2132.c @@ -0,0 +1,41 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + + .led_sets = { + { + /* LED0 = RJ45: Amber LED: 2.5G */ + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + /* LED1 = RJ45: Green LED: 10M / 100M / 1000M */ + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0 + }, + { + /* SFP+ single Green LED. */ + LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, + 0, + 0, + 0 + }, + }, + }; diff --git a/machine/PB_2132.h b/machine/PB_2132.h new file mode 100644 index 00000000..a3668767 --- /dev/null +++ b/machine/PB_2132.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_PB_2132_H_ +#define _MACHINE_PB_2132_H_ + +#define MACHINE_MODEL "PB-2132" + +#endif diff --git a/machine/PCB_K0402WS_V2.c b/machine/PCB_K0402WS_V2.c new file mode 100644 index 00000000..c37e6201 --- /dev/null +++ b/machine/PCB_K0402WS_V2.c @@ -0,0 +1,55 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, + + /* Left SFP (logical 8, SDS1): GPIO30=ModAbs, GPIO37=RX_LOS */ + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + /* Right SFP (logical 3, SDS0): GPIO50=ModAbs, GPIO51=RX_LOS */ + .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, + .sfp_port[1].pin_los = GPIO51_I2C_SDA2_UART1_RX, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + + /* Copper ports use SET0; SFP ports use SET1 */ + .port_led_set = {0, 0, 0, 1, 0, 0, 0, 0, 1}, + + .led_sets = { + { /* SET0: copper — LED0=amber (2.5G), LED2=green (1G/100M/10M) */ + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + 0, + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0 + }, + { /* SET1: SFP — all speeds link/act */ + LEDS_10G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, 0 + }, + }, + + .led_mux_custom = 1, + .led_mux = { + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, /* GPIO0-7: unused */ + 0x0f, 0x0c, 0x0d, 0x0e, 0x10, 0x11, 0x12, /* GPIO8-14 */ + 0x14, 0x15, 0x16, 0x18, 0x19, 0x1a, /* GPIO15-20 */ + 0x1c, 0x1d, 0x1e, 0x20, 0x21, 0x22, 0x23 /* GPIO21-27 */ + }, +}; diff --git a/machine/PCB_K0402WS_V2.h b/machine/PCB_K0402WS_V2.h new file mode 100644 index 00000000..eb5337ab --- /dev/null +++ b/machine/PCB_K0402WS_V2.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_PCB_K0402WS_V2_H_ +#define _MACHINE_PCB_K0402WS_V2_H_ + +#define MACHINE_MODEL "PCB-K0402WS-V2.0" + +#endif diff --git a/machine/PCB_K0402WS_V3.c b/machine/PCB_K0402WS_V3.c new file mode 120000 index 00000000..1e9dcd82 --- /dev/null +++ b/machine/PCB_K0402WS_V3.c @@ -0,0 +1 @@ +HI_K0402WS.c \ No newline at end of file diff --git a/machine/PCB_K0402WS_V3.h b/machine/PCB_K0402WS_V3.h new file mode 100644 index 00000000..f206079d --- /dev/null +++ b/machine/PCB_K0402WS_V3.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_PCB_K0402WS_V3_H_ +#define _MACHINE_PCB_K0402WS_V3_H_ + +#define MACHINE_MODEL "PCB-K0402WS-V3.0" + +#endif diff --git a/machine/PCB_SWTG018AS_V2_1_0.c b/machine/PCB_SWTG018AS_V2_1_0.c new file mode 100644 index 00000000..1501de45 --- /dev/null +++ b/machine/PCB_SWTG018AS_V2_1_0.c @@ -0,0 +1,42 @@ +#include "machine_defs.h" + + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 1, + .mac_flash_offset = 0x1FC000, + .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 = GPIO38, // pulled low on module insert + .sfp_port[0].pin_los = GPIO_NA, // no LOS pin wired + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + // LED wiring matches the SWTG018AS-A V2.0 (same PCB family) + .led_sets = { + { /* RJ45: First LED, yellow, second LED: green */ + LEDS_2G5 | LEDS_LINK, + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + }, { /* SFP set (superseded by the raw register override in machine_custom_init) */ + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + 0, + 0, + 0, + }}, + .led_mux_custom = 1, + .led_mux = { 0x00, 0x01, 0x04, 0x05, 0x08, // 65e0 + 0x09, 0x0c, 0x09, 0x0d, 0x10, // 65e4 + 0x11, 0x0e, 0x14, 0x11, 0x12, // 65e8 + 0x15, 0x15, 0x16, 0x18, 0x19, // 65ec + 0x1a, 0x19, 0x1d, 0x1e, 0x1c, // 65f0 + 0x1d, 0x20, 0x21 }, +}; diff --git a/machine/PCB_SWTG018AS_V2_1_0.h b/machine/PCB_SWTG018AS_V2_1_0.h new file mode 100644 index 00000000..fce78470 --- /dev/null +++ b/machine/PCB_SWTG018AS_V2_1_0.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_PCB_SWTG018AS_V2_1_0_H_ +#define _MACHINE_PCB_SWTG018AS_V2_1_0_H_ + +#define MACHINE_MODEL "SWTGW218AS (SWTG018AS-V2.1.0)" + +#endif diff --git a/machine/PCB_SWTG024AS_A_2_0_1.c b/machine/PCB_SWTG024AS_A_2_0_1.c new file mode 100644 index 00000000..169e479a --- /dev/null +++ b/machine/PCB_SWTG024AS_A_2_0_1.c @@ -0,0 +1,48 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 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, 1, 0, 0, 0, 0, 2}, + + // SFP port on SDS0 / logical port 3 + .sfp_port[0].pin_detect = GPIO37, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 0, + .sfp_port[0].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + + // SFP port on SDS1 / logical port 8 + .sfp_port[1].pin_detect = GPIO38, + .sfp_port[1].pin_los = GPIO_NA, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 1, + .sfp_port[1].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + .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_10G | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_LINK, + LEDS_COL | LEDS_DUPLEX + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 + }, + }; diff --git a/machine/PCB_SWTG024AS_A_2_0_1.h b/machine/PCB_SWTG024AS_A_2_0_1.h new file mode 100644 index 00000000..2d3b5c22 --- /dev/null +++ b/machine/PCB_SWTG024AS_A_2_0_1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_PCB_SWTG024AS_A_2_0_1_H_ +#define _MACHINE_PCB_SWTG024AS_A_2_0_1_H_ + +#define MACHINE_MODEL "PCB-SWTG024AS-A-2.0.1" + +#endif diff --git a/machine/POE_2G080110GS.c b/machine/POE_2G080110GS.c new file mode 100644 index 00000000..73f6dc8c --- /dev/null +++ b/machine/POE_2G080110GS.c @@ -0,0 +1,44 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { + { + /* SET0: RJ45 2.5G = amber, 1G/100M/10M = green */ + LEDS_2G5 | LEDS_LINK | LEDS_ACT, /* amber */ + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, /* green */ + 0, + 0 + }, + { + /* SET1: SFP+ port = green */ + LEDS_2G5 | LEDS_TWO_PAIR_1G | LEDS_1G | LEDS_500M | LEDS_100M | LEDS_10M | + LEDS_LINK | LEDS_ACT | LEDS_10G | LEDS_TWO_PAIR_5G | LEDS_5G | LEDS_TWO_PAIR_2G5, + 0, + 0, + 0 + } + }, + .led_mux_custom = 1, + .led_mux = { 0x00, 0x01, 0x04, 0x05, 0x08, + 0x09, 0x0c, 0x09, 0x0d, 0x10, + 0x11, 0x0e, 0x14, 0x11, 0x12, + 0x15, 0x15, 0x16, 0x18, 0x19, + 0x1a, 0x19, 0x1d, 0x1e, 0x1c, + 0x1d, 0x20, 0x21 }, +}; diff --git a/machine/POE_2G080110GS.h b/machine/POE_2G080110GS.h new file mode 100644 index 00000000..40ce3415 --- /dev/null +++ b/machine/POE_2G080110GS.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_POE_2G080110GS_H_ +#define _MACHINE_POE_2G080110GS_H_ + +#define MACHINE_MODEL "MokerLink POE-2G080110GS" + +#endif diff --git a/machine/STEAMEMO_IG204_V1.c b/machine/STEAMEMO_IG204_V1.c new file mode 100644 index 00000000..23d876a7 --- /dev/null +++ b/machine/STEAMEMO_IG204_V1.c @@ -0,0 +1,50 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp = {0, 0, 0, 2, 0, 0, 0, 0, 1}, + // Left SFP port (5) + // LED pin 9 + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + // Right SFP port (6) + // LED pin 24 + .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, + .sfp_port[1].pin_los = GPIO51_I2C_SDA2_UART1_RX, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + .led_sets = { + { + // RJ45 Amber LED (left) + LEDS_2G5 | LEDS_LINK, + // RJ45 Green LED (Right) + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + }, + { + // SFP LED + LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, + 0, // unused + 0, // unused + 0 + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x0f, 0x20, 0x0d, 0x0e, 0x10, 0x11, 0x12, 0x14, 0x15, 0x16, 0x18, 0x19, 0x1a, 0x1c, 0x1d, 0x1e, 0x0c, 0x21, 0x22, 0x23 + }, +}; diff --git a/machine/STEAMEMO_IG204_V1.h b/machine/STEAMEMO_IG204_V1.h new file mode 100644 index 00000000..170840d7 --- /dev/null +++ b/machine/STEAMEMO_IG204_V1.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_STEAMEMO_IG204_V1_H_ +#define _MACHINE_STEAMEMO_IG204_V1_H_ + +#define MACHINE_MODEL "Steamemo IG204 V1" + +#endif diff --git a/machine/SWGT024_V2_0_MANAGED.c b/machine/SWGT024_V2_0_MANAGED.c new file mode 100644 index 00000000..c2a5d6ab --- /dev/null +++ b/machine/SWGT024_V2_0_MANAGED.c @@ -0,0 +1,41 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp= {0, 0, 0, 2, 0, 0, 0, 0, 1}, + // Left SFP port (J4) + .sfp_port[0].pin_detect = GPIO30_ACL_BIT3_EN, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 39 */ + // Right SFP port (J2) + .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, + .sfp_port[1].pin_los = GPIO_NA, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 40 */ + .reset_pin = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + .led_sets = { + { /* RJ45: Green LED */ + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + 0, + /* Amber LED */ + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + 0 + }, { /* SFP PORT: SINGLE GREEN LED */ + LEDS_10M | LEDS_100M | LEDS_1G | LEDS_2G5 | LEDS_10G | LEDS_LINK | LEDS_ACT, + 0, + 0, + 0, + }, + }, +}; diff --git a/machine/SWGT024_V2_0_MANAGED.h b/machine/SWGT024_V2_0_MANAGED.h new file mode 100644 index 00000000..c5f95a04 --- /dev/null +++ b/machine/SWGT024_V2_0_MANAGED.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_SWGT024_V2_0_MANAGED_H_ +#define _MACHINE_SWGT024_V2_0_MANAGED_H_ + +#define MACHINE_MODEL "SWGT024 V2.0 Managed" + +#endif diff --git a/machine/SWGT024_V2_0_UNMANAGED.c b/machine/SWGT024_V2_0_UNMANAGED.c new file mode 100644 index 00000000..9008bb4b --- /dev/null +++ b/machine/SWGT024_V2_0_UNMANAGED.c @@ -0,0 +1,41 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .is_sfp= {0, 0, 0, 2, 0, 0, 0, 0, 1}, + // Left SFP port (J4) + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 39 */ + // Right SFP port (J2) + .sfp_port[1].pin_detect = GPIO50_I2C_SCL2_UART1_TX, + .sfp_port[1].pin_los = GPIO51_I2C_SDA2_UART1_RX, + .sfp_port[1].pin_tx_disable = GPIO_NA, + .sfp_port[1].sds = 0, + .sfp_port[1].i2c = I2CBUS( GPIO41_I2C_SDA3_MDIO1, GPIO40_I2C_SCL3_MDC1 ), /* GPIO 40 */ + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 1, 0, 0, 0, 0, 1}, + .led_sets = { + { /* RJ45: Green LED */ + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + 0, + /* Amber LED */ + LEDS_2G5 | LEDS_LINK | LEDS_ACT, + 0 + }, { /* SFP PORT: SINGLE GREEN LED */ + LEDS_10M | LEDS_100M | LEDS_1G | LEDS_2G5 | LEDS_10G | LEDS_LINK | LEDS_ACT, + 0, + 0, + 0, + }, + }, +}; diff --git a/machine/SWGT024_V2_0_UNMANAGED.h b/machine/SWGT024_V2_0_UNMANAGED.h new file mode 100644 index 00000000..8391b42a --- /dev/null +++ b/machine/SWGT024_V2_0_UNMANAGED.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_SWGT024_V2_0_UNMANAGED_H_ +#define _MACHINE_SWGT024_V2_0_UNMANAGED_H_ + +#define MACHINE_MODEL "SWGT024 V2.0 Unmanaged" + +#endif diff --git a/machine/SWTG018AS_A_V_2_0.c b/machine/SWTG018AS_A_V_2_0.c new file mode 100644 index 00000000..8304bf7e --- /dev/null +++ b/machine/SWTG018AS_A_V_2_0.c @@ -0,0 +1,39 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO48_I2C_SCL1, + .high_leds = { .mux = LED_27 | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { + { /* RJ45: First LED, yellow, second LED: green */ + LEDS_2G5 | LEDS_LINK, + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, + 0, + 0, + }, { /* SFP PORT, SINGLE GREEN LED */ + LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT | LEDS_10G, + 0, + 0, + 0, + }}, + .led_mux_custom = 1, + .led_mux = { 0x00, 0x01, 0x04, 0x05, 0x08, // 65e0 + 0x09, 0x0c, 0x09, 0x0d, 0x10, // 65e4 + 0x11, 0x0e, 0x14, 0x11, 0x12, // 65e8 + 0x15, 0x15, 0x16, 0x18, 0x19, // 65ec + 0x1a, 0x19, 0x1d, 0x1e, 0x1c, // 65f0 + 0x1d, 0x20, 0x21 }, +}; diff --git a/machine/SWTG018AS_A_V_2_0.h b/machine/SWTG018AS_A_V_2_0.h new file mode 100644 index 00000000..82b7f632 --- /dev/null +++ b/machine/SWTG018AS_A_V_2_0.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_SWTG018AS_A_V_2_0_H_ +#define _MACHINE_SWTG018AS_A_V_2_0_H_ + +#define MACHINE_MODEL "SWTG018AS-A V2.0" + +#endif diff --git a/machine/SWTG024AS_A_2_0_1_5C_1SFP.c b/machine/SWTG024AS_A_2_0_1_5C_1SFP.c new file mode 100644 index 00000000..2a3ad97b --- /dev/null +++ b/machine/SWTG024AS_A_2_0_1_5C_1SFP.c @@ -0,0 +1,43 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 1, + .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, 1}, + .sfp_port[0].pin_detect = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + /* Ports 1-5 RJ45 use set 0, port 9 SFP uses set 1 + * Ports 1-5: Green: 2.5GBit, Amber: 10/100/1000MBit + * SFP-port: Blue: 10GBit, Green: 100MBit-2.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_10G | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_LINK, + LEDS_COL | LEDS_DUPLEX + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 + }, + }; diff --git a/machine/SWTG024AS_A_2_0_1_5C_1SFP.h b/machine/SWTG024AS_A_2_0_1_5C_1SFP.h new file mode 100644 index 00000000..f492765f --- /dev/null +++ b/machine/SWTG024AS_A_2_0_1_5C_1SFP.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_SWTG024AS_A_2_0_1_5C_1SFP_H_ +#define _MACHINE_SWTG024AS_A_2_0_1_5C_1SFP_H_ + +#define MACHINE_MODEL "SWTG024AS-A-V2.0.1-5C-1SFP" + +#endif diff --git a/machine/SWTG024AS_V2_0.c b/machine/SWTG024AS_V2_0.c new file mode 100644 index 00000000..eb0652e2 --- /dev/null +++ b/machine/SWTG024AS_V2_0.c @@ -0,0 +1,43 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 1, + .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, 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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + + .reset_pin = GPIO_NA, + .high_leds = { .mux = LED_28_SYS | LED_29, .enable = LED_27 | LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + /* Ports 1-5 RJ45 use set 0, port 9 SFP uses set 1 + * Ports 1-5: Green: 2.5GBit, Amber: 10/100/1000MBit + * SFP-port: Blue: 10GBit, Amber: 100MBit-2.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_10G | LEDS_LINK | LEDS_ACT, + LEDS_2G5 | LEDS_LINK, + LEDS_COL | LEDS_DUPLEX + }, + }, + .led_mux_custom = 1, + .led_mux = { + 0x00,0x01,0x04,0x05,0x08,0x09,0x0c,0x3f,0x0d,0x10,0x11,0x0e,0x14,0x11,0x12,0x15,0x15,0x16,0x18,0x19,0x1a,0x19,0x1d,0x1e,0x1c,0x1d,0x20,0x21 + }, + }; diff --git a/machine/SWTG024AS_V2_0.h b/machine/SWTG024AS_V2_0.h new file mode 100644 index 00000000..bd37eece --- /dev/null +++ b/machine/SWTG024AS_V2_0.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_SWTG024AS_V2_0_H_ +#define _MACHINE_SWTG024AS_V2_0_H_ + +#define MACHINE_MODEL "SWTG024AS-V2.0" + +#endif diff --git a/machine/SWTGW218AS.c b/machine/SWTGW218AS.c new file mode 100644 index 00000000..cbb2a2f0 --- /dev/null +++ b/machine/SWTGW218AS.c @@ -0,0 +1,33 @@ +#include "machine_defs.h" + + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 1, + .mac_flash_offset = 0x1FC000, + .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 = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO54_ACL_BIT2_EN, + .high_leds = { .mux = LED_27 | LED_28_SYS | LED_29, .enable = LED_28_SYS | LED_29 }, + .port_led_set = { 0, 0, 0, 0, 0, 0, 0, 0, 1}, + .led_sets = { { LEDS_2G5 | LEDS_LINK | LEDS_ACT, // Green LED (right) + 0, // unused + LEDS_1G | LEDS_100M | LEDS_10M | LEDS_LINK | LEDS_ACT, // Amber LED (left) + 0 + }, // unused + { LEDS_10G | LEDS_5G | LEDS_2G5 | LEDS_1G | LEDS_100M | LEDS_LINK | LEDS_ACT, // SFP LED + 0, // unused + 0, // unused + 0 + }, // unused }, + }, +}; diff --git a/machine/SWTGW218AS.h b/machine/SWTGW218AS.h new file mode 100644 index 00000000..ed9c9e54 --- /dev/null +++ b/machine/SWTGW218AS.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_SWTGW218AS_H_ +#define _MACHINE_SWTGW218AS_H_ + +#define MACHINE_MODEL "SWTGW218AS 8+1 Managed Switch" + +#endif diff --git a/machine/TRENDNET_TEG_S562.c b/machine/TRENDNET_TEG_S562.c new file mode 100644 index 00000000..3cfc12c5 --- /dev/null +++ b/machine/TRENDNET_TEG_S562.c @@ -0,0 +1,39 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 2, + .log_to_phys_port = {0, 0, 0, 6, 1, 2, 3, 4, 5}, + .phys_to_log_port = {4, 5, 6, 7, 8, 3, 0, 0, 0}, + .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 = I2CBUS( GPIO47_I2C_SDA0, GPIO46_I2C_SCL0 ), + .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 = I2CBUS( GPIO49_I2C_SDA1, 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 + }, + }, + +}; diff --git a/machine/TRENDNET_TEG_S562.h b/machine/TRENDNET_TEG_S562.h new file mode 100644 index 00000000..c08ae7a9 --- /dev/null +++ b/machine/TRENDNET_TEG_S562.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_TRENDNET_TEG_S562_H_ +#define _MACHINE_TRENDNET_TEG_S562_H_ + +#define MACHINE_MODEL "Trendnet TEG-S562" + +#endif diff --git a/machine/ZX310S_4T2XH.c b/machine/ZX310S_4T2XH.c new file mode 100644 index 00000000..f5313e02 --- /dev/null +++ b/machine/ZX310S_4T2XH.c @@ -0,0 +1,43 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .isRTL8373 = 0, + .min_port = 3, + .max_port = 8, + .n_sfp = 1, + .n_10g = 1, + .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, 1}, + .sfp_port[0].pin_detect = GPIO38, + .sfp_port[0].pin_los = GPIO_NA, + .sfp_port[0].pin_tx_disable = GPIO_NA, + .sfp_port[0].sds = 1, + .sfp_port[0].i2c = I2CBUS( GPIO39_I2C_SDA4, GPIO40_I2C_SCL3_MDC1 ), + .reset_pin = GPIO48_I2C_SCL1, + .high_leds = { .mux = LED_28_SYS, .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: Orange: 2.5GBit, Green: 10/100/1000MBit + * Port 5: Blue: 10GBit, Green: 10Mbit-5GBit + * SFP-port: Blue: 10GBit, Green 100MBit-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_5G, + LEDS_LINK | LEDS_ACT | LEDS_10G, + LEDS_2G5 | LEDS_LINK, + LEDS_COL | LEDS_DUPLEX + } + }, +}; diff --git a/machine/ZX310S_4T2XH.h b/machine/ZX310S_4T2XH.h new file mode 100644 index 00000000..f0873be3 --- /dev/null +++ b/machine/ZX310S_4T2XH.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_ZX310S_4T2XH_H_ +#define _MACHINE_ZX310S_4T2XH_H_ + +#define MACHINE_MODEL "ZX310S-4T2XH" + +#endif diff --git a/machine/ZX310S_4T2XT.c b/machine/ZX310S_4T2XT.c new file mode 100644 index 00000000..c7ec95b9 --- /dev/null +++ b/machine/ZX310S_4T2XT.c @@ -0,0 +1,37 @@ +#include "machine_defs.h" + +__code const struct machine machine = { + .machine_name = MACHINE_MODEL, + .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 + } + }, +}; diff --git a/machine/ZX310S_4T2XT.h b/machine/ZX310S_4T2XT.h new file mode 100644 index 00000000..15b76217 --- /dev/null +++ b/machine/ZX310S_4T2XT.h @@ -0,0 +1,6 @@ +#ifndef _MACHINE_ZX310S_4T2XT_H_ +#define _MACHINE_ZX310S_4T2XT_H_ + +#define MACHINE_MODEL "ZX310S_4T2XT" + +#endif diff --git a/machine/default_machine.h b/machine/default_machine.h new file mode 100644 index 00000000..0919674f --- /dev/null +++ b/machine/default_machine.h @@ -0,0 +1,17 @@ +#ifndef _MACHINE_DEFAULT_H_ +#define _MACHINE_DEFAULT_H_ + +/* + * Fallback selected by machine.h when MACHINE_NAME is not defined on the + * command line. Firmware builds always pass -DMACHINE_NAME=, so this + * is used by translation units that only need the machine.h declarations -- + * notably the host-side tests under test/, which define their own `machine` + * object. + * + * MACHINE_MODEL is deliberately not defined here: a build that reaches this + * header must not silently pick up some default model string. Any code that + * needs MACHINE_MODEL therefore fails to compile unless a real machine is + * selected. + */ + +#endif diff --git a/machine/machine_defs.h b/machine/machine_defs.h new file mode 100644 index 00000000..94b989c4 --- /dev/null +++ b/machine/machine_defs.h @@ -0,0 +1,44 @@ +#ifndef _MACHINE_DEFS_H_ +#define _MACHINE_DEFS_H_ + +/* + * Shared prelude for the per-machine board definitions in this directory. + * + * Each .c file in this directory defines exactly one board's + * `__code const struct machine machine`, and is named after the MACHINE_* symbol + * it belongs to. The Makefile picks the file matching $(MACHINE), so no #if/#elif + * selection happens here. + */ + +#include "machine.h" +#include "rtl837x_pins.h" +#include "rtl837x_leds.h" +#include "rtl837x_sfr.h" +#include "rtl837x_regs.h" +#include "rtl837x_common.h" + +#define I2CBUS_INVALID (7) +// This is a MACRO to check if I2C_BUS_FROM_SDA_PIN or I2C_BUS_FROM_SCL_PIN don't return I2CBUS_INVALID. +// When I2CBUS_INVALID is returned, the compiler stops with +// "error 176: sizeof applied to an incomplete type" pointing at the offending .i2c line. +#define I2CBUS_VALID(bus) (0 * sizeof(char[(bus) != I2CBUS_INVALID ? 1 : 0])) +#define I2CBUS(sda, scl) \ + ((uint8_t)((I2C_BUS_FROM_SCL_PIN(scl) << RTL837X_REG_I2C_SCL_SHIFT) | \ + (I2C_BUS_FROM_SDA_PIN(sda) << RTL837X_REG_I2C_SDA_SHIFT) | \ + I2CBUS_VALID(I2C_BUS_FROM_SCL_PIN(scl)) | \ + I2CBUS_VALID(I2C_BUS_FROM_SDA_PIN(sda)))) + +#define I2C_BUS_FROM_SDA_PIN(sda_pin) \ + ((sda_pin) == GPIO47_I2C_SDA0 ? 0 : \ + (sda_pin) == GPIO49_I2C_SDA1 ? 1 : \ + (sda_pin) == GPIO51_I2C_SDA2_UART1_RX ? 2 : \ + (sda_pin) == GPIO41_I2C_SDA3_MDIO1 ? 3 : \ + (sda_pin) == GPIO39_I2C_SDA4 ? 4 : I2CBUS_INVALID) + +#define I2C_BUS_FROM_SCL_PIN(scl_pin) \ + ((scl_pin) == GPIO46_I2C_SCL0 ? 0 : \ + (scl_pin) == GPIO48_I2C_SCL1 ? 1 : \ + (scl_pin) == GPIO50_I2C_SCL2_UART1_TX ? 2 : \ + (scl_pin) == GPIO40_I2C_SCL3_MDC1 ? 3 : I2CBUS_INVALID) + +#endif