Skip to content

Commit 6bfdd62

Browse files
committed
realtek: add support for ZyXEL GS1920-24HPv1
The GS1920-24HPv1 is a switch with 24 copper ports and 4 combo SFP/copper ports and PoE on the first 24 ports. Specifications: --------------- * SoC: Realtek RTL8292M * Flash: 16 MiB SPI flash * RAM: 128 MiB * Ethernet: 24x 10/100/1000 Mbps * Buttons: 1x "Reset" button * UART: 1x serial header, standard DCE pinout (Tx = 2, Rx = 3, Gnd = 5); 9600 baud, 8n1, +- 5.6V logic levels * SFP: 4 combo copper/SFP ports * PoE: 24x * Fans: ADT7468 fan controller Works: ------ - (24) RJ-45 ethernet ports - Switch functions - Buttons - LEDs (partial support, the wrong LEDs light up) - Manual fan control Not yet enabled: ---------------- - PoE (requires patches to realtek-poe to support i2c) - Combo ports (link is up, but no data is transferred) Fans: ----- After boot, the fans are running in full speed mode. You can interact with the fan controller at /sys/class/hwmon/ Installation: ------------- This device uses ZyNOS instead of Linux, this makes installation a bit more cumbersome. Serial console is required! 1. Set the switch to boot from the first image. This step is crucial, it will fail to boot if this is not set properly. 2. Connect to the switch using serial and interrupt the boot process to enter debug/recovery mode. 3. Load the OpenWrt initramfs image via XMODEM. You need to obtain an unlock code, based on your MAC address, first. See the excellent write up at https://www.ixo.de/info/zyxel_uclinux/ for details. Replace unlock_code in the commands below by the code obtained. After running ATBA5, the terminal needs to be closed and re-opened with 115200 baud. This speeds up the file transfer significantly! The file length in bytes need to be given instead of file_length below. You also need an XMODEM upload utility like "lrzsz-sx -X" to transfer the file. Start the XMODEM upload after running the ATUPxxxx command: > ATEN1,unlock_code > ATBA5 > ATUP80100000,file_length > ATGO80100000 4. Wait for OpenWrt to boot. Once this is done, transfer the loader binary and the sysupgrade image to "/tmp" using scp. 5. Install OpenWrt permanently by running the following two commands: > mtd write /tmp/loader.bin loader > mtd write /tmp/sysupgrade.bin firmware 6. Reboot the switch and enjoy OpenWrt. NB: You do not need to touch the loader binary unless it's recommended. The loader t is not part of a regular sysupgrade file and will be left untouched. The boot loader only checks if the loader is valid to be able to boot. sysupgrade image. Recovery/ Return to stock: -------------------------- Just spam the "u" key during (or "z" for 9600 baud) during memory testing to trigger a recovery XMODEM upload at 115200 baud. A standard OEM upgrade image works properly. Signed-off-by: Andreas Böhler <[email protected]>
1 parent 4b907e6 commit 6bfdd62

File tree

4 files changed

+355
-0
lines changed

4 files changed

+355
-0
lines changed
Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
/dts-v1/;
2+
3+
#include "rtl839x.dtsi"
4+
5+
#include <dt-bindings/input/input.h>
6+
#include <dt-bindings/gpio/gpio.h>
7+
#include <dt-bindings/leds/common.h>
8+
9+
/ {
10+
compatible = "zyxel,gs1920-24hp", "realtek,rtl8392-soc";
11+
model = "Zyxel GS1920-24HP";
12+
13+
aliases {
14+
led-boot = &led_sys;
15+
led-failsafe = &led_sys;
16+
led-running = &led_sys;
17+
led-upgrade = &led_sys;
18+
};
19+
20+
memory@0 {
21+
device_type = "memory";
22+
reg = <0x0 0x8000000>;
23+
};
24+
25+
chosen {
26+
stdout-path = "serial0:9600n8";
27+
};
28+
29+
30+
leds {
31+
pinctrl-names = "default";
32+
pinctrl-0 = <&pinmux_disable_sys_led>;
33+
compatible = "gpio-leds";
34+
35+
led_sys: sys {
36+
label = "green:sys";
37+
gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
38+
function = LED_FUNCTION_STATUS;
39+
};
40+
41+
alarm {
42+
label = "red:alarm";
43+
gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
44+
function = LED_FUNCTION_FAULT;
45+
};
46+
47+
locator {
48+
label = "blue:locator";
49+
gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
50+
function = LED_FUNCTION_INDICATOR;
51+
};
52+
};
53+
54+
keys {
55+
compatible = "gpio-keys-polled";
56+
poll-interval = <20>;
57+
58+
mode {
59+
label = "reset";
60+
gpios = <&gpio1 32 GPIO_ACTIVE_LOW>;
61+
linux,code = <KEY_RESTART>;
62+
};
63+
};
64+
65+
/* i2c of the lower left SFP cage: port 25 */
66+
i2c0: i2c-gpio-0 {
67+
compatible = "i2c-gpio";
68+
sda-gpios = <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
69+
scl-gpios = <&gpio1 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
70+
i2c-gpio,delay-us = <2>;
71+
#address-cells = <1>;
72+
#size-cells = <0>;
73+
};
74+
75+
sfp0: sfp-p25 {
76+
compatible = "sff,sfp";
77+
i2c-bus = <&i2c0>;
78+
los-gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
79+
mod-def0-gpio = <&gpio0 23 GPIO_ACTIVE_LOW>;
80+
tx-fault-gpio = <&gpio1 0 GPIO_ACTIVE_HIGH>;
81+
};
82+
83+
/* i2c of the upper left SFP cage: port 26 */
84+
i2c1: i2c-gpio-1 {
85+
compatible = "i2c-gpio";
86+
sda-gpios = <&gpio1 10 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
87+
scl-gpios = <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
88+
i2c-gpio,delay-us = <2>;
89+
#address-cells = <1>;
90+
#size-cells = <0>;
91+
};
92+
93+
sfp1: sfp-p26 {
94+
compatible = "sff,sfp";
95+
i2c-bus = <&i2c1>;
96+
los-gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
97+
mod-def0-gpio = <&gpio0 17 GPIO_ACTIVE_LOW>;
98+
tx-fault-gpio = <&gpio1 6 GPIO_ACTIVE_HIGH>;
99+
};
100+
101+
/* i2c of the lower right SFP cage: port 27 */
102+
i2c2: i2c-gpio-2 {
103+
compatible = "i2c-gpio";
104+
sda-gpios = <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
105+
scl-gpios = <&gpio1 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
106+
i2c-gpio,delay-us = <2>;
107+
#address-cells = <1>;
108+
#size-cells = <0>;
109+
};
110+
111+
sfp2: sfp-p27 {
112+
compatible = "sff,sfp";
113+
i2c-bus = <&i2c2>;
114+
los-gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
115+
mod-def0-gpio = <&gpio0 13 GPIO_ACTIVE_LOW>;
116+
tx-fault-gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
117+
};
118+
119+
/* i2c of the upper right SFP cage: port 28 */
120+
i2c3: i2c-gpio-3 {
121+
compatible = "i2c-gpio";
122+
sda-gpios = <&gpio1 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
123+
scl-gpios = <&gpio1 21 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
124+
i2c-gpio,delay-us = <2>;
125+
#address-cells = <1>;
126+
#size-cells = <0>;
127+
};
128+
129+
sfp3: sfp-p28 {
130+
compatible = "sff,sfp";
131+
i2c-bus = <&i2c3>;
132+
los-gpio = <&gpio1 29 GPIO_ACTIVE_HIGH>;
133+
mod-def0-gpio = <&gpio0 20 GPIO_ACTIVE_LOW>;
134+
tx-fault-gpio = <&gpio1 23 GPIO_ACTIVE_HIGH>;
135+
};
136+
137+
/* i2c for hwmon/PoE */
138+
i2c4: i2c-gpio-4 {
139+
compatible = "i2c-gpio";
140+
sda-gpios = <&gpio0 18 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
141+
scl-gpios = <&gpio0 16 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
142+
i2c-gpio,delay-us = <2>;
143+
#address-cells = <1>;
144+
#size-cells = <0>;
145+
146+
adt7468: adt7468@2e {
147+
compatible = "adi,adt7468";
148+
reg = <0x2e>;
149+
};
150+
};
151+
};
152+
153+
&spi0 {
154+
status = "okay";
155+
flash@0 {
156+
compatible = "jedec,spi-nor";
157+
reg = <0>;
158+
spi-max-frequency = <10000000>;
159+
160+
partitions {
161+
compatible = "fixed-partitions";
162+
#address-cells = <1>;
163+
#size-cells = <1>;
164+
165+
partition@0 {
166+
label = "bootbase";
167+
reg = <0x0 0x20000>;
168+
read-only;
169+
170+
nvmem-layout {
171+
compatible = "fixed-layout";
172+
#address-cells = <1>;
173+
#size-cells = <1>;
174+
175+
factory_macaddr: macaddr@1fff8 {
176+
reg = <0x1fff8 0x6>;
177+
};
178+
};
179+
};
180+
181+
partition@20000 {
182+
label = "reserved";
183+
reg = <0x20000 0x90000>;
184+
read-only;
185+
};
186+
187+
partition@b0000 {
188+
reg = <0xb0000 0xf50000>;
189+
label = "factory";
190+
191+
compatible = "fixed-partitions";
192+
#address-cells = <1>;
193+
#size-cells = <1>;
194+
195+
partition@0 {
196+
label = "loader";
197+
reg = <0x0 0x10000>;
198+
};
199+
200+
partition@10000 {
201+
label = "firmware";
202+
reg = <0x10000 0xf40000>;
203+
compatible = "openwrt,uimage", "denx,uimage";
204+
};
205+
};
206+
};
207+
};
208+
};
209+
210+
&ethernet0 {
211+
nvmem-cells = <&factory_macaddr>;
212+
nvmem-cell-names = "mac-address";
213+
};
214+
215+
&mdio_bus0 {
216+
/* External phy RTL8218B #1 */
217+
EXTERNAL_PHY(0)
218+
EXTERNAL_PHY(1)
219+
EXTERNAL_PHY(2)
220+
EXTERNAL_PHY(3)
221+
EXTERNAL_PHY(4)
222+
EXTERNAL_PHY(5)
223+
EXTERNAL_PHY(6)
224+
EXTERNAL_PHY(7)
225+
226+
/* External phy RTL8218B #2 */
227+
EXTERNAL_PHY(8)
228+
EXTERNAL_PHY(9)
229+
EXTERNAL_PHY(10)
230+
EXTERNAL_PHY(11)
231+
EXTERNAL_PHY(12)
232+
EXTERNAL_PHY(13)
233+
EXTERNAL_PHY(14)
234+
EXTERNAL_PHY(15)
235+
236+
/* External phy RTL8218B #3 */
237+
EXTERNAL_PHY(16)
238+
EXTERNAL_PHY(17)
239+
EXTERNAL_PHY(18)
240+
EXTERNAL_PHY(19)
241+
EXTERNAL_PHY(20)
242+
EXTERNAL_PHY(21)
243+
EXTERNAL_PHY(22)
244+
EXTERNAL_PHY(23)
245+
246+
/* External phy RTL8214FC #1 */
247+
EXTERNAL_SFP_PHY_FULL(48, 0)
248+
EXTERNAL_SFP_PHY_FULL(49, 1)
249+
EXTERNAL_SFP_PHY_FULL(50, 2)
250+
EXTERNAL_SFP_PHY_FULL(51, 3)
251+
252+
};
253+
254+
&switch0 {
255+
ports {
256+
SWITCH_PORT_SDS(0, 1, 0, qsgmii)
257+
SWITCH_PORT_SDS(1, 2, 0, qsgmii)
258+
SWITCH_PORT_SDS(2, 3, 0, qsgmii)
259+
SWITCH_PORT_SDS(3, 4, 0, qsgmii)
260+
SWITCH_PORT_SDS(4, 5, 1, qsgmii)
261+
SWITCH_PORT_SDS(5, 6, 1, qsgmii)
262+
SWITCH_PORT_SDS(6, 7, 1, qsgmii)
263+
SWITCH_PORT_SDS(7, 8, 1, qsgmii)
264+
265+
SWITCH_PORT_SDS(8, 9, 2, qsgmii)
266+
SWITCH_PORT_SDS(9, 10, 2, qsgmii)
267+
SWITCH_PORT_SDS(10, 11, 2, qsgmii)
268+
SWITCH_PORT_SDS(11, 12, 2, qsgmii)
269+
SWITCH_PORT_SDS(12, 13, 3, qsgmii)
270+
SWITCH_PORT_SDS(13, 14, 3, qsgmii)
271+
SWITCH_PORT_SDS(14, 15, 3, qsgmii)
272+
SWITCH_PORT_SDS(15, 16, 3, qsgmii)
273+
274+
SWITCH_PORT_SDS(16, 17, 4, qsgmii)
275+
SWITCH_PORT_SDS(17, 18, 4, qsgmii)
276+
SWITCH_PORT_SDS(18, 19, 4, qsgmii)
277+
SWITCH_PORT_SDS(19, 20, 4, qsgmii)
278+
SWITCH_PORT_SDS(20, 21, 5, qsgmii)
279+
SWITCH_PORT_SDS(21, 22, 5, qsgmii)
280+
SWITCH_PORT_SDS(22, 23, 5, qsgmii)
281+
SWITCH_PORT_SDS(23, 24, 5, qsgmii)
282+
283+
SWITCH_PORT_SDS(48, 25, 12, qsgmii)
284+
SWITCH_PORT_SDS(49, 26, 12, qsgmii)
285+
SWITCH_PORT_SDS(50, 27, 12, qsgmii)
286+
SWITCH_PORT_SDS(51, 28, 12, qsgmii)
287+
288+
/* CPU-Port */
289+
port@52 {
290+
ethernet = <&ethernet0>;
291+
reg = <52>;
292+
phy-mode = "internal";
293+
fixed-link {
294+
speed = <1000>;
295+
full-duplex;
296+
};
297+
};
298+
};
299+
};
300+
301+
&mdio_aux {
302+
status = "okay";
303+
304+
gpio1: expander@3 {
305+
compatible = "realtek,rtl8231";
306+
reg = <3>;
307+
308+
gpio-controller;
309+
#gpio-cells = <2>;
310+
gpio-ranges = <&gpio1 0 0 37>;
311+
312+
led-controller {
313+
compatible = "realtek,rtl8231-leds";
314+
status = "disabled";
315+
};
316+
};
317+
};

target/linux/realtek/image/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ define Build/rt-loader
3030
mv "$@.new" "$@"
3131
endef
3232

33+
define Build/rt-loader-standalone
34+
$(MAKE) all clean -C rt-loader CROSS_COMPILE="$(TARGET_CROSS)" \
35+
FLASH_ADDR=$(FLASH_ADDR) KERNEL_IMG_OUT="$@.new" BUILD_DIR="$@.build"
36+
mv "$@.new" "$@"
37+
endef
38+
3339
define Build/zyxel-vers
3440
( echo VERS;\
3541
for hw in $(ZYXEL_VERS); do\
@@ -95,6 +101,12 @@ define Build/linksys-image
95101
mv $@.new $@
96102
endef
97103

104+
define Build/zynsig
105+
$(STAGING_DIR_HOST)/bin/zynsig -i $@ \
106+
-o $@.new
107+
mv $@.new $@
108+
endef
109+
98110
define Device/Default
99111
PROFILES = Default
100112
KERNEL := \

target/linux/realtek/image/rtl839x.mk

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,28 @@ define Device/zyxel_gs1900-48-a1
8282
SUPPORTED_DEVICES += zyxel,gs1900-48
8383
endef
8484
TARGET_DEVICES += zyxel_gs1900-48-a1
85+
86+
define Device/zyxel_gs1920-24hp
87+
FLASH_ADDR := 0xb40c0000
88+
ARTIFACTS := loader-$(1).bin
89+
ARTIFACT/loader-$(1).bin := \
90+
rt-loader-standalone | \
91+
zynsig
92+
SOC := rtl8392
93+
IMAGE_SIZE := 12144k
94+
DEVICE_VENDOR := Zyxel
95+
DEVICE_MODEL := GS1920-24HP
96+
DEVICE_PACKAGES := \
97+
kmod-hwmon-lm85
98+
KERNEL := \
99+
kernel-bin | \
100+
append-dtb | \
101+
rt-compress | \
102+
uImage lzma
103+
KERNEL_INITRAMFS := \
104+
kernel-bin | \
105+
append-dtb | \
106+
rt-compress | \
107+
rt-loader
108+
endef
109+
TARGET_DEVICES += zyxel_gs1920-24hp

target/linux/realtek/rtl839x/config-6.12

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ CONFIG_HZ_PERIODIC=y
110110
CONFIG_I2C=y
111111
CONFIG_I2C_ALGOBIT=y
112112
CONFIG_I2C_BOARDINFO=y
113+
CONFIG_I2C_CHARDEV=y
113114
CONFIG_I2C_GPIO=y
114115
CONFIG_I2C_GPIO_SHARED=y
115116
# CONFIG_I2C_MUX_RTL9300 is not set

0 commit comments

Comments
 (0)