From 64a1d252cd4cb199b2f7b1227fcddadb0c60bdc4 Mon Sep 17 00:00:00 2001
From: donbernhardo <87759236+donbernhardo@users.noreply.github.com>
Date: Mon, 29 Jun 2026 13:54:47 +0200
Subject: [PATCH] Split KP-9000 6XH targets by PCB revision
---
Makefile | 2 +-
doc/devices/KP-9000-6XH-X2.md | 40 ++++++++++++++++++++++++++++++-----
doc/supported_devices.md | 4 ++--
machine.c | 14 ++++++++++--
machine.h | 3 +++
5 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 3b8027b..ada70cf 100644
--- a/Makefile
+++ b/Makefile
@@ -96,7 +96,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/KP-9000-6XH-X2.md b/doc/devices/KP-9000-6XH-X2.md
index 4cc21d7..b1c8fdc 100644
--- a/doc/devices/KP-9000-6XH-X2.md
+++ b/doc/devices/KP-9000-6XH-X2.md
@@ -1,17 +1,32 @@
-# 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 only by the label on the case.
+
+| PCB silkscreen | Known labels | Recommended machine target | Legacy target |
+| --- | --- | --- | --- |
+| `2M-PCB43-V1.2` | `KP-9000-6XHML-X2` | `MACHINE_KP_9000_6XHML_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` | `MACHINE_KP_9000_6XH_X2` |
+
+The V1.2 and V2.1 boards use different GPIO, SFP, port and LED mappings.
+The unmanaged and managed labels are firmware/SKU differences and do not by
+themselves identify the PCB wiring.
+
### What works
- All four 2.5GBASE-T RJ45 ports at 10/100/1000/2500 Mbps
@@ -19,7 +34,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 +59,22 @@ Bottom
+### Hardware overview: 2M-PCB43-V1.2
+
+The V1.2 board has been seen in managed `KP-9000-6XHML-X2` devices.
+
+Label:
+
+
+
+Top side:
+
+
+
+Bottom:
+
+
+
## Reset Button
There's an unpopulated Reset button on the front left side of the PCB.
@@ -54,4 +85,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 59e54d8..c1b3f9a 100644
--- a/doc/supported_devices.md
+++ b/doc/supported_devices.md
@@ -1,8 +1,8 @@
# Supported Hardware
The following devices have been tested and are fully working:
- Horaco ZX_SG4T2
-- keepLINK kp-9000-6hx-x2 (RTL8372: 4x 2.5GBit + 2x 10GBit SFP+)
-- keepLINK KP-9000-6XHML-X2, same as above, but Managed
+- keepLINK KP-9000-6XH-X2 / KP-9000-6XHML-X2 (RTL8372: 4x 2.5GBit + 2x 10GBit SFP+);
+ select the machine target by PCB revision, see [KP-9000-6XH-X2](devices/KP-9000-6XH-X2.md)
- keepLINK kp-9000-6hx-x (RTL8372 + RTL8221B 2.5GBit PHY: 5 x 2.5GBit + 1x 10GBit SFP+)
- keepLINK kp-9000-9xh-x-eu (1 x RTL8373 + RTL8224: 8x 2.5GBit + 1x 10GBit SFP+)
- Lianguo LG-SWTGW218AS (RTL8373 + RTL8224 PHY: 8x 2.5GBit + 1x 10GBit SFP+)
diff --git a/machine.c b/machine.c
index b735167..96c6f0b 100644
--- a/machine.c
+++ b/machine.c
@@ -5,9 +5,13 @@
#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_6XHML_X2_V1_2)
__code const struct machine machine = {
+#if 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,
@@ -85,9 +89,15 @@ __code const struct machine machine = {
void machine_custom_init(void) { }
-#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 931a17e..3483f2e 100644
--- a/machine.h
+++ b/machine.h
@@ -7,8 +7,11 @@
* Select your machine type below
*/
// #define MACHINE_KP_9000_6XHML_X2
+// #define MACHINE_KP_9000_6XHML_X2_V1_2
+// #define MACHINE_KP_9000_6XHML_X2_V2_1
// #define MACHINE_KP_9000_6XH_X
// #define MACHINE_KP_9000_6XH_X2
+// #define MACHINE_KP_9000_6XH_X2_V2_1
// #define MACHINE_KP_9000_9XH_X_EU
// #define MACHINE_KP_9000_9XHML_X_V2_2
// #define MACHINE_KP_9000_9XHML_X_V3_1