Skip to content

Commit 1fa4a26

Browse files
committed
mediatek: add support Livinet Li320
This commit adds support for Livinet Li320 wireless router. Specification ------------- - SoC : MediaTek MT7981B dual-core ARM Cortex-A53 - RAM : 512MB - Flash : SPI-NAND Fudan Micro FM25S01BI3 - WLAN : MediaTek MT7976 dual-band Wi-Fi 6 - Ethernet : MediaTek MT7531 switch, 1x WAN + 3x LAN (2.5GbE uplink via gmac0) - Buttons : WPS, Reset - LEDs : 8xGreen, 1xRed - Power : Barrel DC 12v Installation ------------ The factory firmware is a compatible OpenWrt-based fork, allowing direct installation via the LuCI upgrade page using the sysupgrade image. MAC addresses ------------- | Interface | MAC source | |-----------|--------------------------| | LAN | Factory 0x4 (mac-base -1)| | WAN | Factory 0x4 (mac-base -2)| | WLAN 2.4G | Factory 0x4 (mac-base) | | WLAN 5G | Factory 0x4 (mac-base +1)| Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
1 parent 7edb29d commit 1fa4a26

4 files changed

Lines changed: 347 additions & 0 deletions

File tree

Lines changed: 326 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,326 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2+
3+
/dts-v1/;
4+
5+
#include <dt-bindings/gpio/gpio.h>
6+
#include <dt-bindings/input/input.h>
7+
#include <dt-bindings/leds/common.h>
8+
9+
#include "mt7981b.dtsi"
10+
11+
/ {
12+
model = "Livinet Li320";
13+
compatible = "livinet,li320", "mediatek,mt7981";
14+
15+
aliases {
16+
label-mac-device = &wan;
17+
18+
led-boot = &led_power_green;
19+
led-failsafe = &led_wan_red;
20+
led-running = &led_power_green;
21+
led-upgrade = &led_wan_red;
22+
23+
serial0 = &uart0;
24+
};
25+
26+
chosen {
27+
stdout-path = "serial0:115200n8";
28+
};
29+
30+
memory@40000000 {
31+
reg = <0 0x40000000 0 0x20000000>;
32+
device_type = "memory";
33+
};
34+
35+
gpio-keys {
36+
compatible = "gpio-keys";
37+
38+
button-0 {
39+
label = "wps";
40+
/* Reassigned to RF_KILL */
41+
linux,code = <KEY_RFKILL>;
42+
gpios = <&pio 0 GPIO_ACTIVE_LOW>;
43+
debounce-interval = <60>;
44+
};
45+
46+
button-1 {
47+
label = "reset";
48+
gpios = <&pio 1 GPIO_ACTIVE_LOW>;
49+
linux,code = <KEY_RESTART>;
50+
debounce-interval = <60>;
51+
};
52+
};
53+
54+
leds {
55+
compatible = "gpio-leds";
56+
57+
led-0 {
58+
color = <LED_COLOR_ID_GREEN>;
59+
function = LED_FUNCTION_WLAN_5GHZ;
60+
gpios = <&pio 2 GPIO_ACTIVE_LOW>;
61+
linux,default-trigger = "phy1tpt";
62+
};
63+
64+
led_wan_red: led-1 {
65+
color = <LED_COLOR_ID_RED>;
66+
function = LED_FUNCTION_WAN;
67+
gpios = <&pio 27 GPIO_ACTIVE_HIGH>;
68+
};
69+
70+
led_power_green: led-2 {
71+
color = <LED_COLOR_ID_GREEN>;
72+
function = LED_FUNCTION_POWER;
73+
gpios = <&pio 28 GPIO_ACTIVE_LOW>;
74+
};
75+
76+
led-3 {
77+
color = <LED_COLOR_ID_GREEN>;
78+
function = LED_FUNCTION_LAN;
79+
function-enumerator = <1>;
80+
gpios = <&pio 9 GPIO_ACTIVE_LOW>;
81+
};
82+
83+
led-4 {
84+
color = <LED_COLOR_ID_GREEN>;
85+
function = LED_FUNCTION_LAN;
86+
function-enumerator = <2>;
87+
gpios = <&pio 10 GPIO_ACTIVE_LOW>;
88+
};
89+
90+
led-5 {
91+
color = <LED_COLOR_ID_GREEN>;
92+
function = LED_FUNCTION_LAN;
93+
function-enumerator = <3>;
94+
gpios = <&pio 11 GPIO_ACTIVE_LOW>;
95+
};
96+
97+
led-6 {
98+
color = <LED_COLOR_ID_GREEN>;
99+
function = LED_FUNCTION_WAN;
100+
gpios = <&pio 29 GPIO_ACTIVE_LOW>;
101+
};
102+
103+
led-7 {
104+
color = <LED_COLOR_ID_GREEN>;
105+
function = LED_FUNCTION_WLAN_2GHZ;
106+
gpios = <&pio 13 GPIO_ACTIVE_LOW>;
107+
linux,default-trigger = "phy0tpt";
108+
};
109+
110+
led-8 {
111+
color = <LED_COLOR_ID_GREEN>;
112+
function = LED_FUNCTION_USB;
113+
gpios = <&pio 31 GPIO_ACTIVE_LOW>;
114+
};
115+
};
116+
};
117+
118+
&eth {
119+
status = "okay";
120+
121+
gmac0: mac@0 {
122+
compatible = "mediatek,eth-mac";
123+
reg = <0>;
124+
phy-mode = "2500base-x";
125+
126+
nvmem-cell-names = "mac-address";
127+
nvmem-cells = <&macaddr_factory_4 (-1)>;
128+
129+
fixed-link {
130+
speed = <2500>;
131+
full-duplex;
132+
pause;
133+
};
134+
};
135+
};
136+
137+
&mdio_bus {
138+
switch: switch@1f {
139+
compatible = "mediatek,mt7531";
140+
reg = <0x1f>;
141+
reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
142+
interrupt-controller;
143+
#interrupt-cells = <1>;
144+
interrupt-parent = <&pio>;
145+
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
146+
};
147+
};
148+
149+
&spi0 {
150+
pinctrl-names = "default";
151+
pinctrl-0 = <&spi0_flash_pins>;
152+
status = "okay";
153+
154+
spi_nand: flash@0 {
155+
compatible = "spi-nand";
156+
reg = <0>;
157+
158+
spi-max-frequency = <52000000>;
159+
spi-tx-buswidth = <4>;
160+
spi-rx-buswidth = <4>;
161+
162+
spi-cal-enable;
163+
spi-cal-mode = "read-data";
164+
spi-cal-datalen = <7>;
165+
spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4e 0x41 0x4e 0x44>;
166+
spi-cal-addrlen = <5>;
167+
spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
168+
169+
mediatek,nmbm;
170+
mediatek,bmt-max-ratio = <1>;
171+
mediatek,bmt-max-reserved-blocks = <64>;
172+
173+
partitions: partitions {
174+
compatible = "fixed-partitions";
175+
#address-cells = <1>;
176+
#size-cells = <1>;
177+
178+
partition@0 {
179+
label = "BL2";
180+
reg = <0x00000 0x100000>;
181+
read-only;
182+
};
183+
184+
partition@100000 {
185+
label = "u-boot-env";
186+
reg = <0x100000 0x80000>;
187+
};
188+
189+
factory: partition@180000 {
190+
label = "Factory";
191+
reg = <0x180000 0x200000>;
192+
read-only;
193+
194+
nvmem-layout {
195+
compatible = "fixed-layout";
196+
#address-cells = <1>;
197+
#size-cells = <1>;
198+
199+
eeprom_factory_0: eeprom@0 {
200+
reg = <0x0 0x1000>;
201+
};
202+
203+
macaddr_factory_4: macaddr@4 {
204+
compatible = "mac-base";
205+
reg = <0x4 0x6>;
206+
#nvmem-cell-cells = <1>;
207+
};
208+
};
209+
};
210+
211+
partition@380000 {
212+
label = "FIP";
213+
reg = <0x380000 0x200000>;
214+
read-only;
215+
};
216+
217+
ubi: partition@580000 {
218+
label = "ubi";
219+
reg = <0x580000 0x6000000>;
220+
};
221+
222+
partition@6580000 {
223+
label = "zrsave";
224+
reg = <0x6580000 0x100000>;
225+
};
226+
227+
partition@6680000 {
228+
label = "config2";
229+
reg = <0x6680000 0x100000>;
230+
read-only;
231+
};
232+
};
233+
};
234+
};
235+
236+
&switch {
237+
ports {
238+
#address-cells = <1>;
239+
#size-cells = <0>;
240+
241+
port@0 {
242+
reg = <0>;
243+
label = "lan1";
244+
};
245+
246+
port@2 {
247+
reg = <2>;
248+
label = "lan2";
249+
};
250+
251+
port@3 {
252+
reg = <3>;
253+
label = "lan3";
254+
};
255+
256+
wan: port@4 {
257+
reg = <4>;
258+
label = "wan";
259+
260+
nvmem-cell-names = "mac-address";
261+
nvmem-cells = <&macaddr_factory_4 (-2)>;
262+
};
263+
264+
port@6 {
265+
reg = <6>;
266+
ethernet = <&gmac0>;
267+
phy-mode = "2500base-x";
268+
269+
fixed-link {
270+
speed = <2500>;
271+
full-duplex;
272+
pause;
273+
};
274+
};
275+
};
276+
};
277+
278+
&pio {
279+
spi0_flash_pins: spi0-pins {
280+
mux {
281+
function = "spi";
282+
groups = "spi0", "spi0_wp_hold";
283+
};
284+
285+
conf-pu {
286+
pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
287+
drive-strength = <MTK_DRIVE_8mA>;
288+
bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
289+
};
290+
291+
conf-pd {
292+
pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
293+
drive-strength = <MTK_DRIVE_8mA>;
294+
bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
295+
};
296+
};
297+
};
298+
299+
&uart0 {
300+
status = "okay";
301+
};
302+
303+
&watchdog {
304+
status = "okay";
305+
};
306+
307+
&wifi {
308+
status = "okay";
309+
#address-cells = <1>;
310+
#size-cells = <0>;
311+
312+
nvmem-cells = <&eeprom_factory_0>;
313+
nvmem-cell-names = "eeprom";
314+
315+
band@0 {
316+
reg = <0>;
317+
nvmem-cells = <&macaddr_factory_4 (0)>;
318+
nvmem-cell-names = "mac-address";
319+
};
320+
321+
band@1 {
322+
reg = <1>;
323+
nvmem-cells = <&macaddr_factory_4 (1)>;
324+
nvmem-cell-names = "mac-address";
325+
};
326+
};

target/linux/mediatek/filogic/base-files/etc/board.d/01_leds

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ keenetic,kn-3711|\
148148
keenetic,kn-3811)
149149
ucidef_set_led_netdev "internet" "internet" "green:wan" "wan" "link"
150150
;;
151+
livinet,li320)
152+
ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan-2ghz" "phy0-ap0"
153+
ucidef_set_led_netdev "wlan5g" "WLAN5G" "green:wlan-5ghz" "phy1-ap0"
154+
ucidef_set_led_netdev "lan-1" "lan-1" "green:lan-1" "lan1" "link tx rx"
155+
ucidef_set_led_netdev "lan-2" "lan-2" "green:lan-2" "lan2" "link tx rx"
156+
ucidef_set_led_netdev "lan-3" "lan-3" "green:lan-3" "lan3" "link tx rx"
157+
ucidef_set_led_netdev "wan-off" "wan-off" "red:wan" "wan" "link"
158+
ucidef_set_led_netdev "wan" "wan" "green:wan" "wan" "link"
159+
;;
151160
mercusys,mr80x-v3)
152161
ucidef_set_led_netdev "lan1" "lan-1" "green:lan-1" "lan1" "link tx rx"
153162
ucidef_set_led_netdev "lan2" "lan-2" "green:lan-2" "lan2" "link tx rx"

target/linux/mediatek/filogic/base-files/etc/board.d/02_network

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ mediatek_setup_interfaces()
6363
jcg,q30-pro|\
6464
keenetic,kn-3711|\
6565
keenetic,kn-3811|\
66+
livinet,li320|\
6667
netis,nx32u|\
6768
qihoo,360t7|\
6869
qihoo,360t7-ubi|\

target/linux/mediatek/image/filogic.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,6 +2216,17 @@ define Device/konka_komi-a31
22162216
endef
22172217
TARGET_DEVICES += konka_komi-a31
22182218

2219+
define Device/livinet_li320
2220+
DEVICE_VENDOR := Livinet
2221+
DEVICE_MODEL := Li320
2222+
DEVICE_DTS := mt7981b-livinet-li320
2223+
DEVICE_DTS_DIR := ../dts
2224+
DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
2225+
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
2226+
SUPPORTED_DEVICES += mediatek,mt7981-spim-snand-gsw-rfb
2227+
endef
2228+
TARGET_DEVICES += livinet_li320
2229+
22192230
define Device/mediatek_mt7981-rfb
22202231
DEVICE_VENDOR := MediaTek
22212232
DEVICE_MODEL := MT7981 rfb

0 commit comments

Comments
 (0)