diff --git a/Makefile b/Makefile index 301f4f0..2a3f01f 100644 --- a/Makefile +++ b/Makefile @@ -139,7 +139,7 @@ $(BUILDDIR)/rtlplayground-$(FILENAME_EXTENSION).bin: $(BUILDDIR)/rtlplayground.i machine_check: @mkdir -p $(BUILDDIR)/tmp @set -eo pipefail; \ - for MACHINE in `grep -e ' MACHINE_' machine.c | sed -e 's%^.* MACHINE_%%' -e 's%[ ]*//.*$$%%' | sort -u`; \ + for MACHINE in `grep -E '^[[:space:]]*(//[[:space:]]*)?#define MACHINE_' machine.h | sed -E 's%^[[:space:]]*(//[[:space:]]*)?#define MACHINE_%%' | awk '{print $$1}' | sort -u`; \ do \ echo "Checking $${MACHINE}"; \ $(CC) $(CC_FLAGS) -DMACHINE_$${MACHINE} -MMD -o $(BUILDDIR)/tmp/machine_check -c machine.c; \ diff --git a/doc/devices/2M-PCB43-V1.1.md b/doc/devices/2M-PCB43-V1.1.md index 28673e8..97343f0 100644 --- a/doc/devices/2M-PCB43-V1.1.md +++ b/doc/devices/2M-PCB43-V1.1.md @@ -15,7 +15,7 @@ and sold by Mokerlink. The device is fully supported: - All 4 2.5GBASE-T RJ45 ports work at 10/100/1000/2500 Mbps - The SFP+ port supports 1G, 2.5G and 10G modules -- LEDs work with the same indiciations as the OEM firmware (use KP_9000_6XHML_X2 in machine.h if building yourself or the corresponding pre-compiled binary) +- LEDs work with the same indiciations as the OEM firmware (use KP_9000_6XHML_X2_V1_1 in machine.h if building yourself or the corresponding pre-compiled binary) - untested due to missing Hardware: SFP+ ports equipped with 1G or 2.5G SFPs. ### Hardware overview diff --git a/doc/devices/KP-9000-6XH-X2.md b/doc/devices/KP-9000-6XH-X2.md index 4cc21d7..d0f19b9 100644 --- a/doc/devices/KP-9000-6XH-X2.md +++ b/doc/devices/KP-9000-6XH-X2.md @@ -1,17 +1,36 @@ -# Keeplink KP-9000-6XH-X2 +# Keeplink KP-9000-6XH-X2 / KP-9000-6XHML-X2 -Following is documentation for unmanaged switch marked as `KP-9000-6XH-X2`. +Following is documentation for switches marked as `KP-9000-6XH-X2` or +`KP-9000-6XHML-X2`. Using SPI clamp in-board is the only method for initial installation. ### Label specifications - **Name**: 4X 2.5G RJ45 Port + 2 X 10G SFP+ Port -- **Model**: KP-9000-6XH-X2 +- **Model**: KP-9000-6XH-X2 / KP-9000-6XHML-X2 - **Ports**: - 4 × RJ45: 10/100/1000/2500 Mbps - 2 × SFP+: 1000 / 2500 / 10000 Mbps +### Machine target + +These devices exist with different PCB revisions. Select the machine target by +the PCB silkscreen, not by the label on the case. The `6XH` / `6XHML` +distinction appears to be a stock firmware, SKU or label difference, not a +reliable indicator of PCB wiring. The PCB revision defines the hardware layout. + +| PCB silkscreen | Known labels / devices | Recommended machine target | Equivalent target | Legacy target | +| --- | --- | --- | --- | --- | +| `2M-PCB43-V1.1` | Mokerlink 2G040210GSM web-managed 4+2 switch | `MACHINE_KP_9000_6XHML_X2_V1_1` | `MACHINE_KP_9000_6XH_X2_V1_1` | `MACHINE_KP_9000_6XHML_X2` | +| `2M-PCB43-V1.2` | `KP-9000-6XHML-X2` | `MACHINE_KP_9000_6XHML_X2_V1_2` | `MACHINE_KP_9000_6XH_X2_V1_2` | `MACHINE_KP_9000_6XHML_X2` | +| `2M-PCB43-V2.1` | `KP-9000-6XH-X2`, `KP-9000-6XHML-X2` | `MACHINE_KP_9000_6XH_X2_V2_1` or `MACHINE_KP_9000_6XHML_X2_V2_1` | same V2.1 layout | `MACHINE_KP_9000_6XH_X2` | + +The V1.1 and V1.2 boards currently use the same V1.x GPIO, SFP, port and LED +layout. The V2.1 board uses a different V2.1 layout with custom LED muxing. +Legacy targets are preserved for compatibility with already-tested devices, but +new builds should prefer the explicit PCB-revision targets. + ### What works - All four 2.5GBASE-T RJ45 ports at 10/100/1000/2500 Mbps @@ -19,7 +38,7 @@ Using SPI clamp in-board is the only method for initial installation. - LEDs - untested due to missing Hardware: SFP+ ports equipped with 1G or 2.5G SFPs. -### Hardware overview +### Hardware overview: 2M-PCB43-V2.1 Front side: @@ -44,6 +63,24 @@ Bottom +### Hardware overview: 2M-PCB43-V1.1 / V1.2 + +The V1.1 board has been reported in the Mokerlink 2G040210GSM web-managed 4+2 +switch. The V1.2 board has been seen in managed `KP-9000-6XHML-X2` devices. +Both use the same V1.x layout. + +Label: + + + +Top side: + + + +Bottom: + + + ## Reset Button There's an unpopulated Reset button on the front left side of the PCB. @@ -54,4 +91,3 @@ The front case has already the hole in the metal case, you just have to punch a ## Power supply Input power is delivered via barell plug, `12V 1A` adapter was provided. - diff --git a/doc/supported_devices.md b/doc/supported_devices.md index bb187bf..3a8c462 100644 --- a/doc/supported_devices.md +++ b/doc/supported_devices.md @@ -15,11 +15,12 @@ The following devices have been tested and are fully working: | Horaco | ZX310S-4T2XT | Yes | [PCB-SL310S-4T2XT-V1.0.0-22273](devices/ZX310S-4T2XT.md) | 2M | 6 | | Horaco | ZX-SG4T2 | No | [SWTG024AS-A-V2.0.1_19650_4C_2SFP](devices/SWTG024AS-A-V2.0.1_4C_2SFP.md) | 0.5M | 4 + 2 | | Horaco | ZX-SWTG124AS | Yes | [SWTG024AS-v2.0](devices/SWTG024AS.md) | | 4 + 2 | -| Keeplink | KP-9000-6XH-X2 | No | [2M-PCB43-V2.1](devices/KP-9000-6XH-X2.md) | | 4 + 2 | +| Keeplink | KP-9000-6XH-X2 / KP-9000-6XHML-X2 | No/Yes | [2M-PCB43-V1.2 / V2.1](devices/KP-9000-6XH-X2.md) | | 4 + 2 | | keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V2.2](devices/2M-PCB23-V2_2.md) | 2M | 8 + 1 | | keepLINK | KP-9000-9XHML-X | Yes | [2M-PCB23-V3.1](devices/2M-PCB23-V3_1.md) | 2M | 8 + 1 | | LIANGUO | SWTG024AS | No | [SWTG024AS-v2.0-17452](devices/SWTG024AS.md) | 0.5M | 4 + 2 | | Lianguo | ZX-SWTGW215AS | Yes | [PCB-SWTG115AS-V2.0](devices/SWTGW215AS.md) | 2M | 5 + 1 | +| Mokerlink| 2G040210GSM | Yes | [2M-PCB43-V1.1](devices/2M-PCB43-V1.1.md) | | 4 + 2 | | Mokerlink| ZX-SWTGW218AS | Yes | [SWTG118AS-V2.0-16029](devices/SWTGW218AS.md) | 2M | 8 + 1 | | Ruiying | RY-4GT-2SX | No | [FG-4GT-2SX_V2.0](devices/FG-4GT-2SX_V2.0.md) | 4M | 4 + 2 | | Sodola | SL-SWTG124AS-D | Yes | [SWTG024AS-v2.0-17452](devices/SWTG024AS.md) | 2M | 4 + 2 | @@ -29,6 +30,10 @@ The following devices have been tested and are fully working: | XikeStor | SKS3200-8E1X | Yes | [SWTG118AS-V2.1-17462](devices/SWTGW218AS.md) | 2M | 8 + 1 | | Ztyuav | Z-QWYT0402 | No | [PCB-K0402WS-V3.0](devices/PCB-K0402WS-V3.0.md) | | 4 + 2 | +For KP-9000-6XH-X2 / KP-9000-6XHML-X2 / Mokerlink 2G040210GSM devices, select +the machine target by PCB revision. The ML/non-ML or managed/unmanaged label +alone does not identify the wiring. + Other device based on RTL8272/3 that may work are described here: [Up-N-Atoms 2.5 GBit RTL Switch hacking guide](https://github.com/up-n-atom/SWTG118AS) Many of the RTL8272/3 devices come in versions with PoE support. The RTLPlayground usually also diff --git a/machine.c b/machine.c index fcdb007..7f4a512 100644 --- a/machine.c +++ b/machine.c @@ -5,9 +5,23 @@ #include "rtl837x_regs.h" #include "rtl837x_common.h" -#ifdef MACHINE_KP_9000_6XHML_X2 +#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, @@ -70,9 +84,15 @@ __code const struct machine machine = { }, }; -#elif defined MACHINE_KP_9000_6XH_X2 +#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, diff --git a/machine.h b/machine.h index ae467cb..9efa675 100644 --- a/machine.h +++ b/machine.h @@ -6,9 +6,19 @@ /* * 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_X // #define MACHINE_KP_9000_6XH_X2 + +// 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 diff --git a/machine_init.c b/machine_init.c index 215c21d..e11e7f2 100644 --- a/machine_init.c +++ b/machine_init.c @@ -13,7 +13,9 @@ #pragma codeseg BANK2 #pragma constseg BANK2 -#if defined MACHINE_KP_9000_6XH_X2 +#if defined(MACHINE_KP_9000_6XH_X2) || \ + defined(MACHINE_KP_9000_6XH_X2_V2_1) || \ + defined(MACHINE_KP_9000_6XHML_X2_V2_1) void machine_custom_init(void) __banked { reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6);