Skip to content

Commit bc3d4fa

Browse files
stargiegjonasjelonek
authored andcommitted
realtek: support Teltonika TSW202
Add support for TSW202 PoE switch. This is an RTL8380 based switch with two SFP slots, and 8 PoE 802.3af one every RJ-45 port. The max budget is 240W. The vendor firmware configures the PSE with a per-port budget of 30.0W. Specifications: --------------- * SoC: Realtek RTL8380M * Flash: 16 MiB SPI NOR W25Q80RV, 8Mb_Serial_Flash, low_power * RAM: 128 MiB Winbond W631GG8NB 151 * Ethernet: 8x 10/100/1000 Mbps with PoE 2x SFP slots * Buttons: 1 "Reset" button on front panel * Power: 48V-54V DC barrel jack * UART: 1 serial header with terminal on the back side. With ground, rx, tx, and 3.3V * PoE: 2 XS2184 * LED: 2 i2c SL74HC164 Works: ------ - (8) RJ-45 ethernet ports - (2) SFP with ethernet or fiber - Switch functions TODO: ------ - LEDs are always on - Power-over-Ethernet are always on Install via web interface: ------------------------- The openwrt firmware will not accept and flash the sysupgrade image. It is recommended to flash with sysupgrade -n -f over ssh. Dokumantation, Bootlogs, and Fotos can be found on https://git.f2a.space/patrick/openwrt-24.10-tsw202/-/wikis/home Signed-off-by: Patrick Grimm <patrick@lunatiki.de> Link: openwrt/openwrt#21003 Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
1 parent 0bba5f3 commit bc3d4fa

2 files changed

Lines changed: 189 additions & 0 deletions

File tree

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
#include "rtl838x.dtsi"
4+
5+
#include <dt-bindings/gpio/gpio.h>
6+
#include <dt-bindings/input/input.h>
7+
8+
/ {
9+
compatible = "teltonika,tsw202", "realtek,rtl838x-soc";
10+
model = "Teltonika TSW202 Switch";
11+
12+
memory@0 {
13+
device_type = "memory";
14+
reg = <0x0 0x8000000>;
15+
};
16+
17+
/* i2c of the left SFP cage: port 9 */
18+
i2c0: i2c-gpio-0 {
19+
compatible = "i2c-gpio";
20+
sda-gpios = <&gpio0 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
21+
scl-gpios = <&gpio0 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
22+
i2c-gpio,delay-us = <2>;
23+
#address-cells = <1>;
24+
#size-cells = <0>;
25+
};
26+
27+
sfp0: sfp-p9 {
28+
compatible = "sff,sfp";
29+
i2c-bus = <&i2c0>;
30+
mod-def0-gpio = <&gpio0 13 GPIO_ACTIVE_LOW>;
31+
tx-disable-gpio = <&gpio0 10 GPIO_ACTIVE_HIGH>;
32+
};
33+
34+
/* i2c of the right SFP cage: port 10 */
35+
i2c1: i2c-gpio-1 {
36+
compatible = "i2c-gpio";
37+
sda-gpios = <&gpio0 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
38+
scl-gpios = <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
39+
i2c-gpio,delay-us = <2>;
40+
#address-cells = <1>;
41+
#size-cells = <0>;
42+
};
43+
44+
sfp1: sfp-p10 {
45+
compatible = "sff,sfp";
46+
i2c-bus = <&i2c1>;
47+
mod-def0-gpio = <&gpio0 11 GPIO_ACTIVE_LOW>;
48+
tx-disable-gpio = <&gpio0 1 GPIO_ACTIVE_HIGH>;
49+
};
50+
51+
/* i2c for poe */
52+
i2c2: i2c-gpio-2 {
53+
compatible = "i2c-gpio";
54+
sda-gpios = <&gpio0 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
55+
scl-gpios = <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
56+
i2c-gpio,delay-us = <2>;
57+
#address-cells = <1>;
58+
#size-cells = <0>;
59+
};
60+
61+
leds {
62+
compatible = "gpio-leds";
63+
pinctrl-names = "default";
64+
pinctrl-0 = <&pinmux_disable_sys_led>;
65+
};
66+
67+
keys {
68+
compatible = "gpio-keys";
69+
70+
reset {
71+
label = "reset";
72+
gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
73+
linux,code = <KEY_RESTART>;
74+
};
75+
};
76+
};
77+
78+
&spi0 {
79+
status = "okay";
80+
81+
flash@0 {
82+
compatible = "jedec,spi-nor";
83+
reg = <0>;
84+
spi-max-frequency = <10000000>;
85+
86+
partitions {
87+
compatible = "fixed-partitions";
88+
#address-cells = <1>;
89+
#size-cells = <1>;
90+
91+
partition@0 {
92+
label = "u-boot";
93+
reg = <0x0 0x80000>;
94+
read-only;
95+
};
96+
97+
partition@80000 {
98+
label = "u-boot-env";
99+
reg = <0x80000 0x10000>;
100+
read-only;
101+
};
102+
103+
partition@90000 {
104+
label = "config";
105+
reg = <0x90000 0x10000>;
106+
read-only;
107+
108+
nvmem-layout {
109+
compatible = "fixed-layout";
110+
#address-cells = <1>;
111+
#size-cells = <1>;
112+
113+
macaddr_config_0: macaddr@0 {
114+
reg = <0x0 0x6>;
115+
};
116+
};
117+
};
118+
119+
partition@a0000 {
120+
label = "firmware";
121+
reg = <0xa0000 0xf60000>;
122+
compatible = "openwrt,uimage", "denx,uimage";
123+
};
124+
};
125+
};
126+
};
127+
128+
&uart1 {
129+
status = "okay";
130+
};
131+
132+
&ethernet0 {
133+
nvmem-cells = <&macaddr_config_0 0>;
134+
nvmem-cell-names = "mac-address";
135+
};
136+
137+
&mdio_bus0 {
138+
PHY_C22(8, 8)
139+
PHY_C22(9, 9)
140+
PHY_C22(10, 10)
141+
PHY_C22(11, 11)
142+
PHY_C22(12, 12)
143+
PHY_C22(13, 13)
144+
PHY_C22(14, 14)
145+
PHY_C22(15, 15)
146+
};
147+
148+
&switch0 {
149+
ethernet-ports {
150+
151+
SWITCH_PORT(8, 1, internal)
152+
SWITCH_PORT(9, 2, internal)
153+
SWITCH_PORT(10, 3, internal)
154+
SWITCH_PORT(11, 4, internal)
155+
SWITCH_PORT(12, 5, internal)
156+
SWITCH_PORT(13, 6, internal)
157+
SWITCH_PORT(14, 7, internal)
158+
SWITCH_PORT(15, 8, internal)
159+
SWITCH_PORT_SFP(24, 9, 4, 0, 0)
160+
SWITCH_PORT_SFP(26, 10, 5, 0, 1)
161+
162+
port@28 {
163+
ethernet = <&ethernet0>;
164+
reg = <28>;
165+
phy-mode = "internal";
166+
fixed-link {
167+
speed = <1000>;
168+
full-duplex;
169+
};
170+
};
171+
172+
};
173+
};

target/linux/realtek/image/rtl838x.mk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,22 @@ define Device/panasonic_m8eg-pn28080k
326326
endef
327327
TARGET_DEVICES += panasonic_m8eg-pn28080k
328328

329+
define Device/teltonika_tsw202
330+
SOC := rtl8380
331+
IMAGE_SIZE := 15168k
332+
DEVICE_VENDOR := Teltonika
333+
DEVICE_MODEL := TSW202
334+
IMAGE/sysupgrade.bin := \
335+
append-kernel | \
336+
pad-to 64k | \
337+
append-rootfs | \
338+
pad-rootfs | \
339+
check-size | \
340+
append-metadata
341+
SUPPORTED_DEVICES := teltonika,tsw202
342+
endef
343+
TARGET_DEVICES += teltonika_tsw202
344+
329345
define Device/tplink_sg2008p-v1
330346
SOC := rtl8380
331347
KERNEL_SIZE := 6m

0 commit comments

Comments
 (0)