target/ramips: sync with recently changes from Lean

This commit is contained in:
CN_SZTL 2020-07-19 20:08:03 +08:00
parent 030785fa60
commit f2c53c3f81
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
10 changed files with 377 additions and 197 deletions

View File

@ -0,0 +1,40 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621_dlink_dir-8xx-a1.dtsi"
/ {
compatible = "dlink,dir-867-a1", "mediatek,mt7621-soc";
model = "D-Link DIR-867 A1";
aliases {
led-boot = &led_power_orange;
led-failsafe = &led_power_green;
led-running = &led_power_green;
led-upgrade = &led_net_orange;
};
leds {
compatible = "gpio-leds";
led_power_orange: power_orange {
label = "dir-867-a1:orange:power";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
led_power_green: power_green {
label = "dir-867-a1:green:power";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
led_net_orange: net_orange {
label = "dir-867-a1:orange:net";
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
};
net_green {
label = "dir-867-a1:green:net";
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
};
};

View File

@ -1,10 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7621_dlink_dir-8xx-a1.dtsi"
/ {
compatible = "dlink,dir-878-a1", "mediatek,mt7621-soc";
@ -15,11 +12,6 @@
led-failsafe = &led_power_green;
led-running = &led_power_green;
led-upgrade = &led_net_orange;
label-mac-device = &gmac0;
};
chosen {
bootargs = "console=ttyS0,57600";
};
leds {
@ -45,137 +37,4 @@
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
wifi {
label = "wifi";
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RFKILL>;
};
};
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x20000>;
read-only;
};
partition@60000 {
compatible = "ubootpad96,uimage";
label = "firmware";
reg = <0x60000 0xfa0000>;
};
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>;
ieee80211-freq-limit = <2400000 2500000>;
led {
led-active-low;
};
};
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
led {
led-active-low;
};
};
};
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "lan4";
};
port@1 {
status = "okay";
label = "lan3";
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 {
status = "okay";
label = "lan1";
};
port@4 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0xe006>;
};
};
};
&state_default {
gpio {
groups = "uart3", "jtag", "wdt";
function = "gpio";
};
};

View File

@ -0,0 +1,53 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621_dlink_dir-8xx-a1.dtsi"
/ {
compatible = "dlink,dir-882-a1", "mediatek,mt7621-soc";
model = "D-Link DIR-882 A1";
aliases {
led-boot = &led_power_orange;
led-failsafe = &led_power_green;
led-running = &led_power_green;
led-upgrade = &led_net_orange;
};
leds {
compatible = "gpio-leds";
led_power_orange: power_orange {
label = "dir-882-a1:orange:power";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
led_power_green: power_green {
label = "dir-882-a1:green:power";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
led_net_orange: net_orange {
label = "dir-882-a1:orange:net";
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
};
net_green {
label = "dir-882-a1:green:net";
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
usb2 {
label = "dir-882-a1:green:usb2";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
trigger-sources = <&ehci_port2>;
linux,default-trigger = "usbport";
};
usb3 {
label = "dir-882-a1:green:usb3";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
trigger-sources = <&xhci_ehci_port1>;
linux,default-trigger = "usbport";
};
};
};

View File

@ -0,0 +1,149 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
aliases {
label-mac-device = &gmac0;
};
chosen {
bootargs = "console=ttyS0,57600";
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
wifi {
label = "wifi";
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RFKILL>;
};
};
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "u-boot-env";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x50000 0xfb0000>;
};
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>;
ieee80211-freq-limit = <2400000 2500000>;
led {
led-active-low;
};
};
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
led {
led-active-low;
};
};
};
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "lan4";
};
port@1 {
status = "okay";
label = "lan3";
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 {
status = "okay";
label = "lan1";
};
port@4 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0xe006>;
};
};
};
&state_default {
gpio {
groups = "i2c", "uart3", "jtag", "wdt";
function = "gpio";
};
};

View File

@ -0,0 +1,47 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621_dlink_dir-8xx-a1.dtsi"
/ {
compatible = "motorola,motorola-mr2600", "mediatek,mt7621-soc";
model = "Motorola MR2600";
aliases {
led-boot = &led_power_orange;
led-failsafe = &led_power_green;
led-running = &led_power_green;
led-upgrade = &led_net_orange;
};
leds {
compatible = "gpio-leds";
led_power_orange: power_orange {
label = "mr2600:orange:power";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
led_power_green: power_green {
label = "mr2600:green:power";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
led_net_orange: net_orange {
label = "mr2600:orange:net";
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
};
net_green {
label = "mr2600:green:net";
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
usb {
label = "mr2600:green:usb";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
trigger-sources = <&xhci_ehci_port1>, <&ehci_port2>;
linux,default-trigger = "usbport";
};
};
};

View File

@ -14,7 +14,7 @@
led-failsafe = &led_status_red;
led-running = &led_status_blue;
led-upgrade = &led_status_yellow;
label-mac-device = &gmac0;
label-mac-device = &ethernet;
};
chosen {
@ -190,28 +190,19 @@
};
};
&gmac0 {
&ethernet {
compatible = "mediatek,ralink-mt7621-eth";
mediatek,switch = <&gsw>;
mtd-mac-address = <&factory 0xe006>;
};
&switch0 {
ports {
port@1 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0xe000>;
};
/delete-property/ compatible;
phy-mode = "rgmii";
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 {
status = "okay";
label = "lan1";
};
};
&gsw {
compatible = "mediatek,ralink-mt7621-gsw";
};
&state_default {

View File

@ -6,7 +6,6 @@
#include <dt-bindings/input/input.h>
/ {
chosen {
bootargs = "console=ttyS0,115200n8";
};

View File

@ -206,6 +206,12 @@ define Device/buffalo_wsr-2533dhpl
endef
TARGET_DEVICES += buffalo_wsr-2533dhpl
define Device/dlink_dir-8xx-a1
IMAGE_SIZE := 16000k
DEVICE_VENDOR := D-Link
DEVICE_PACKAGES := kmod-mt7615d luci-app-mtwifi uboot-envtools
endef
define Device/buffalo_wsr-600dhp
IMAGE_SIZE := 16064k
DEVICE_VENDOR := Buffalo
@ -231,21 +237,27 @@ define Device/dlink_dir-860l-b1
endef
TARGET_DEVICES += dlink_dir-860l-b1
define Device/dlink_dir-878-a1
BLOCKSIZE := 64k
IMAGE_SIZE := 16000k
DEVICE_VENDOR := D-Link
define Device/dlink_dir-867-a1
$(Device/dlink_dir-8xx-a1)
DEVICE_MODEL := DIR-867
DEVICE_VARIANT := A1
endef
TARGET_DEVICES += dlink_dir-867-a1
define Device/dlink_dir_878_a1
$(Device/dlink_dir-8xx-a1)
DEVICE_MODEL := DIR-878
DEVICE_VARIANT := A1
DEVICE_PACKAGES := kmod-mt7615e wpad-openssl
KERNEL_INITRAMFS := $$(KERNEL) | ubootpad96
IMAGES += factory.bin
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | ubootpad96 |\
pad-rootfs | check-size $$$$(IMAGE_SIZE) | append-metadata
IMAGE/factory.bin := append-kernel | append-rootfs | ubootpad96 |\
check-size $$$$(IMAGE_SIZE)
endef
TARGET_DEVICES += dlink_dir-878-a1
TARGET_DEVICES += dlink_dir_878_a1
define Device/dlink_dir-882-a1
$(Device/dlink_dir-8xx-a1)
DEVICE_MODEL := DIR-882
DEVICE_VARIANT := A1
DEVICE_PACKAGES += kmod-usb3 kmod-usb-ledtrig-usbport
endef
TARGET_DEVICES += dlink_dir_882_a1
define Device/d-team_newifi-d2
$(Device/uimage-lzma-loader)
@ -578,6 +590,15 @@ define Device/mikrotik_routerboard-m33g
endef
TARGET_DEVICES += mikrotik_routerboard-m33g
define Device/motorola_mr2600
IMAGE_SIZE := 16064k
DEVICE_VENDOR := Motorola
DEVICE_MODEL := MR2600
DEVICE_PACKAGES := kmod-mt7615d kmod-usb3 kmod-usb-ledtrig-usbport \
luci-app-mtwifi uboot-envtools
endef
TARGET_DEVICES += motorola_mr2600
define Device/mqmaker_witi
IMAGE_SIZE := 16064k
DEVICE_VENDOR := MQmaker
@ -989,23 +1010,8 @@ define Device/xiaomi_mir4
endef
TARGET_DEVICES += xiaomi_mir4
define Device/xiaomi_mi-router-ac2100
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL_SIZE := 4096k
IMAGE_SIZE := 120320k
UBINIZE_OPTS := -E 5
IMAGES += kernel1.bin rootfs0.bin
IMAGE/kernel1.bin := append-kernel
IMAGE/rootfs0.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := Mi Router AC2100
DEVICE_PACKAGES := kmod-mt7603e kmod-mt7615d luci-app-mtwifi uboot-envtools
endef
TARGET_DEVICES += xiaomi_mi-router-ac2100
define Device/xiaomi_redmi-router-ac2100
define Device/xiaomi-ac2100
$(Device/uimage-lzma-loader)
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL_SIZE := 4096k
@ -1015,11 +1021,21 @@ define Device/xiaomi_redmi-router-ac2100
IMAGE/kernel1.bin := append-kernel
IMAGE/rootfs0.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size
DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := Redmi Router AC2100
DEVICE_PACKAGES := kmod-mt7603e kmod-mt7615d luci-app-mtwifi uboot-envtools
endef
define Device/xiaomi_mi-router-ac2100
$(Device/xiaomi-ac2100)
DEVICE_MODEL := Mi Router AC2100
endef
TARGET_DEVICES += xiaomi_mi-router-ac2100
define Device/xiaomi_redmi-router-ac2100
$(Device/xiaomi-ac2100)
DEVICE_MODEL := Redmi Router AC2100
endef
TARGET_DEVICES += xiaomi_redmi-router-ac2100
define Device/xiaoyu_xy-c5

View File

@ -25,10 +25,17 @@ d-team,newifi-d2)
d-team,pbr-m1)
ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan"
;;
dlink,dir-860l-b1|\
dlink,dir-878-a1)
dlink,dir-860l-b1)
ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "wan"
;;
dlink,dir-867-a1|\
dlink,dir-878-a1|\
dlink,dir-882-a1|\
motorola,mr2600)
ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "wan"
ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "ra0"
ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "$boardname:green:wlan5g" "rai0"
;;
gehua,ghl-r-001)
ucidef_set_led_switch "internet" "internet" "$boardname:blue:internet" "switch0" "0x10"
;;
@ -77,8 +84,10 @@ tplink,re650-v1)
ucidef_set_led_netdev "eth_act" "LAN act" "$boardname:green:eth_act" "lan" "tx rx"
ucidef_set_led_netdev "eth_link" "LAN link" "$boardname:green:eth_link" "lan" "link"
;;
xzwifi,creativebox-v1)
ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan"
xiaomi,mir3g)
ucidef_set_led_switch "wan-amber" "WAN (amber)" "$boardname:amber:wan" "switch0" "0x02" "0x08"
ucidef_set_led_switch "lan1-amber" "LAN1 (amber)" "$boardname:amber:lan1" "switch0" "0x08" "0x08"
ucidef_set_led_switch "lan2-amber" "LAN2 (amber)" "$boardname:amber:lan2" "switch0" "0x04" "0x08"
;;
xiaomi,mi-router-ac2100)
ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x1"
@ -86,6 +95,9 @@ xiaomi,mi-router-ac2100)
xiaomi,redmi-router-ac2100)
ucidef_set_led_switch "wan" "wan" "$boardname:white:wan" "switch0" "0x1"
;;
xzwifi,creativebox-v1)
ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan"
;;
youhua,wr1200js)
ucidef_set_led_netdev "internet" "INTERNET" "$boardname:green:wan" "wan"
;;

View File

@ -52,6 +52,12 @@ ramips_setup_interfaces()
mikrotik,routerboard-750gr3)
ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan"
;;
dlink,dir-867-a1|\
dlink,dir-878-a1|\
dlink,dir-882-a1|\
motorola,mr2600)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 ra0 rai0" "wan"
;;
phicomm,k2p)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
@ -63,11 +69,15 @@ ramips_setup_interfaces()
ubnt,edgerouter-x-sfp)
ucidef_set_interface_lan "eth0 eth1 eth2 eth3 eth4 eth5"
;;
xiaomi,mir3g)
ucidef_add_switch "switch0" \
"2:lan:2" "3:lan:1" "1:wan" "6t@eth0"
;;
xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
ucidef_add_switch "switch0" \
"0:wan" "2:lan:1" "3:lan:2" "4:lan:3" "6@eth0"
ucidef_set_interface_lan "eth0.1 ra0 rai0 apcli0 apclii0"
ucidef_set_interface_lan "eth0.2 ra0 rai0 apcli0 apclii0"
;;
*)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
@ -132,6 +142,10 @@ ramips_setup_macs()
wan_mac=$label_mac
lan_mac=$(macaddr_add $label_mac 1)
;;
phicomm,k2p)
wan_mac=$(mtd_get_mac_binary factory 0xe006)
;;
xiaomi,mir3g|\
xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
lan_mac=$(cat /sys/class/net/eth0/address)