diff --git a/doc/devices/SWTGW218AS.md b/doc/devices/SWTGW218AS.md
new file mode 100644
index 0000000..c8777f2
--- /dev/null
+++ b/doc/devices/SWTGW218AS.md
@@ -0,0 +1,24 @@
+### ZX-SWTGW218AS
+
+## Brands
+|Brand|Type|Managed|PCB|Flash|Chip RTL|
+|---|---|---|---|---|---|
+| Mokerlink | ZX-SWTGW218AS | Yes| SWTG118AS-V2.0-16029 | 2MB (FM25Q16A)| 8273N + 8224N |
+| Sodola | | | | | |
+| Horaco | | | | | |
+
+
+## Photos
+
+
+
+
+
+## PCB
+
+See up'n'atom's Repo:
+
+https://github.com/up-n-atom/SWTG118AS/blob/main/photos/SWTG118AS-v2.0/SWTG118AS-v2.0-pcb-top.JPG
+
+https://github.com/up-n-atom/SWTG118AS/blob/main/photos/SWTG118AS-v2.0/SWTG118AS-v2.0-pcb-bottom.JPG
+
diff --git a/doc/devices/photos/SWTGW218AS-managed/front.png b/doc/devices/photos/SWTGW218AS-managed/front.png
new file mode 100644
index 0000000..7b65678
Binary files /dev/null and b/doc/devices/photos/SWTGW218AS-managed/front.png differ
diff --git a/doc/devices/photos/SWTGW218AS-managed/label.jpg b/doc/devices/photos/SWTGW218AS-managed/label.jpg
new file mode 100644
index 0000000..6615dab
Binary files /dev/null and b/doc/devices/photos/SWTGW218AS-managed/label.jpg differ
diff --git a/machine.c b/machine.c
index 60a2e49..73a0c7b 100644
--- a/machine.c
+++ b/machine.c
@@ -213,6 +213,40 @@ __code const struct machine machine = {
void machine_custom_init(void) { }
+#elif defined MACHINE_SWTGW218AS
+
+__code const struct machine machine = {
+ .machine_name = "SWTGW218AS 8+1 Managed 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 = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
+ .reset_pin = GPIO54_ACL_BIT2_EN,
+ .high_leds = { .mux = LED_27 | LED_28 | LED_29, .enable = LED_28 | 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 },
+ },
+};
+
+void machine_custom_init(void) { }
+
#elif defined DEFAULT_8C_1SFP
__code const struct machine machine = {
.machine_name = "8+1 SFP Port Switch",
@@ -314,4 +348,6 @@ __code const struct machine machine = {
void machine_custom_init(void) {
reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6);
}
+#else
+ #error "Please select a machine type in machine.h"
#endif
diff --git a/machine.h b/machine.h
index 1d4cf76..06a2475 100644
--- a/machine.h
+++ b/machine.h
@@ -6,18 +6,17 @@
/*
* Select your machine type below
*/
-#define MACHINE_KP_9000_6XHML_X2
+// #define MACHINE_KP_9000_6XHML_X2
// #define MACHINE_KP_9000_6XH_X
// #define MACHINE_KP_9000_9XH_X_EU
// #define MACHINE_SWGT024_V2_0
// #define MACHINE_HORACO_ZX_SG4T2
// #define MACHINE_TRENDNET_TEG_S562
// #define MACHINE_HG0402XG_V1_1
+// #define MACHINE_SWTGW218AS
// #define MACHINE_HI_K0402WS
// #define DEFAULT_8C_1SFP
-// #define DEFAULT_5C_1SFP
-
typedef struct {
// GPIO pins for SDA/SCL
uint8_t sda;
diff --git a/rtlplayground.c b/rtlplayground.c
index a694958..fdaae9c 100644
--- a/rtlplayground.c
+++ b/rtlplayground.c
@@ -1902,6 +1902,8 @@ void bootloader(void)
leds_dump();
+ set_sys_led_state(SYS_LED_SLOW);
+
if (machine_detected.isRTL8373)
rtl8373_init();
else
@@ -1982,7 +1984,6 @@ void bootloader(void)
dest += 0x1000;
}
}
- set_sys_led_state(SYS_LED_SLOW);
#ifdef DEBUG
// This register seems to work on the RTL8373 only if also the SDS