未验证 提交 1e8536f1 编写于 作者: A AmadeusGhost 提交者: GitHub

ramips: improve ac2100/dir882 support (#5136)

上级 fb7752d1
// 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>;
};
};
};
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/; /dts-v1/;
#include "mt7621_dlink_dir.dtsi" #include "mt7621_dlink_dir-8xx-a1.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ { / {
compatible = "dlink,dlink-dir878-a1", "mediatek,mt7621-soc"; compatible = "dlink,dir-878-a1", "mediatek,mt7621-soc";
model = "D-Link DIR878 A1"; model = "D-Link DIR-878 A1";
aliases {
led-boot = &led_power_orange;
led-failsafe = &led_power_green;
led-running = &led_power_green;
led-upgrade = &led_net_orange;
};
leds { leds {
compatible = "gpio-leds"; compatible = "gpio-leds";
......
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/; /dts-v1/;
#include "mt7621_dlink_dir.dtsi" #include "mt7621_dlink_dir-8xx-a1.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ { / {
compatible = "dlink,dlink-dir882-a1", "mediatek,mt7621-soc"; compatible = "dlink,dir-882-a1", "mediatek,mt7621-soc";
model = "D-Link DIR882 A1"; 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 { leds {
compatible = "gpio-leds"; compatible = "gpio-leds";
...@@ -33,10 +37,17 @@ ...@@ -33,10 +37,17 @@
gpios = <&gpio 3 GPIO_ACTIVE_LOW>; gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
}; };
usb { usb2 {
label = "dir-882-a1:green:usb"; 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>; gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
trigger-sources = <&xhci_ehci_port1>, <&ehci_port2>; trigger-sources = <&xhci_ehci_port1>;
linux,default-trigger = "usbport"; linux,default-trigger = "usbport";
}; };
}; };
......
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621.dtsi" #include "mt7621.dtsi"
...@@ -8,10 +7,6 @@ ...@@ -8,10 +7,6 @@
/ { / {
aliases { aliases {
led-boot = &led_power_orange;
led-failsafe = &led_power_orange;
led-running = &led_power_green;
led-upgrade = &led_power_green;
label-mac-device = &gmac0; label-mac-device = &gmac0;
}; };
...@@ -48,7 +43,7 @@ ...@@ -48,7 +43,7 @@
flash@0 { flash@0 {
compatible = "jedec,spi-nor"; compatible = "jedec,spi-nor";
reg = <0>; reg = <0>;
spi-max-frequency = <10000000>; spi-max-frequency = <50000000>;
partitions { partitions {
compatible = "fixed-partitions"; compatible = "fixed-partitions";
......
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/; /dts-v1/;
#include "mt7621_dlink_dir.dtsi" #include "mt7621_dlink_dir-8xx-a1.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ { / {
compatible = "motorola,motorola-mr2600", "mediatek,mt7621-soc"; compatible = "motorola,motorola-mr2600", "mediatek,mt7621-soc";
model = "Motorola MR2600"; 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 { leds {
compatible = "gpio-leds"; compatible = "gpio-leds";
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
led-failsafe = &led_status_red; led-failsafe = &led_status_red;
led-running = &led_status_blue; led-running = &led_status_blue;
led-upgrade = &led_status_yellow; led-upgrade = &led_status_yellow;
label-mac-device = &gmac0; label-mac-device = &ethernet;
}; };
chosen { chosen {
...@@ -190,28 +190,19 @@ ...@@ -190,28 +190,19 @@
}; };
}; };
&gmac0 { &ethernet {
compatible = "mediatek,ralink-mt7621-eth";
mediatek,switch = <&gsw>;
mtd-mac-address = <&factory 0xe006>; mtd-mac-address = <&factory 0xe006>;
}; };
&switch0 { &switch0 {
ports { /delete-property/ compatible;
port@1 { phy-mode = "rgmii";
status = "okay"; };
label = "wan";
mtd-mac-address = <&factory 0xe000>;
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 { &gsw {
status = "okay"; compatible = "mediatek,ralink-mt7621-gsw";
label = "lan1";
};
};
}; };
&state_default { &state_default {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <dt-bindings/input/input.h> #include <dt-bindings/input/input.h>
/ { / {
chosen { chosen {
bootargs = "console=ttyS0,115200n8"; bootargs = "console=ttyS0,115200n8";
}; };
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
partition@0 { partition@0 {
label = "Bootloader"; label = "Bootloader";
reg = <0x0 0x80000>; reg = <0x0 0x80000>;
read-only;
}; };
partition@80000 { partition@80000 {
......
...@@ -212,6 +212,12 @@ define Device/buffalo_wsr-600dhp ...@@ -212,6 +212,12 @@ define Device/buffalo_wsr-600dhp
endef endef
TARGET_DEVICES += buffalo_wsr-600dhp TARGET_DEVICES += buffalo_wsr-600dhp
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/dlink_dir-860l-b1 define Device/dlink_dir-860l-b1
$(Device/seama) $(Device/seama)
BLOCKSIZE := 64k BLOCKSIZE := 64k
...@@ -228,22 +234,25 @@ define Device/dlink_dir-860l-b1 ...@@ -228,22 +234,25 @@ define Device/dlink_dir-860l-b1
endef endef
TARGET_DEVICES += dlink_dir-860l-b1 TARGET_DEVICES += dlink_dir-860l-b1
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 define Device/dlink_dir-878-a1
IMAGE_SIZE := 16064k $(Device/dlink_dir-8xx-a1)
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-878 DEVICE_MODEL := DIR-878
DEVICE_VARIANT := A1 DEVICE_VARIANT := A1
DEVICE_PACKAGES := kmod-mt7615d luci-app-mtwifi uboot-envtools
endef endef
TARGET_DEVICES += dlink_dir-878-a1 TARGET_DEVICES += dlink_dir-878-a1
define Device/dlink_dir-882-a1 define Device/dlink_dir-882-a1
IMAGE_SIZE := 16064k $(Device/dlink_dir-8xx-a1)
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DIR-882 DEVICE_MODEL := DIR-882
DEVICE_VARIANT := A1 DEVICE_VARIANT := A1
DEVICE_PACKAGES := kmod-mt7615d kmod-usb3 kmod-usb-ledtrig-usbport \ DEVICE_PACKAGES += kmod-usb3 kmod-usb-ledtrig-usbport
luci-app-mtwifi uboot-envtools
endef endef
TARGET_DEVICES += dlink_dir-882-a1 TARGET_DEVICES += dlink_dir-882-a1
...@@ -1032,36 +1041,31 @@ define Device/xiaomi_mir4 ...@@ -1032,36 +1041,31 @@ define Device/xiaomi_mir4
endef endef
TARGET_DEVICES += xiaomi_mir4 TARGET_DEVICES += xiaomi_mir4
define Device/xiaomi_mi-router-ac2100 define Device/xiaomi-ac2100
$(Device/uimage-lzma-loader)
BLOCKSIZE := 128k BLOCKSIZE := 128k
PAGESIZE := 2048 PAGESIZE := 2048
KERNEL_SIZE := 4096k KERNEL_SIZE := 4096k
IMAGE_SIZE := 120320k IMAGE_SIZE := 120320k
UBINIZE_OPTS := -E 5 UBINIZE_OPTS := -E 5
IMAGES += kernel1.bin rootfs0.bin IMAGES += kernel1.bin rootfs0.bin factory.bin
IMAGE/kernel1.bin := append-kernel IMAGE/kernel1.bin := append-kernel
IMAGE/rootfs0.bin := append-ubi | check-size IMAGE/rootfs0.bin := append-ubi | check-size
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size
DEVICE_VENDOR := Xiaomi DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := Mi Router AC2100
DEVICE_PACKAGES := kmod-mt7603e kmod-mt7615d luci-app-mtwifi uboot-envtools DEVICE_PACKAGES := kmod-mt7603e kmod-mt7615d luci-app-mtwifi uboot-envtools
endef endef
define Device/xiaomi_mi-router-ac2100
$(Device/xiaomi-ac2100)
DEVICE_MODEL := Mi Router AC2100
endef
TARGET_DEVICES += xiaomi_mi-router-ac2100 TARGET_DEVICES += xiaomi_mi-router-ac2100
define Device/xiaomi_redmi-router-ac2100 define Device/xiaomi_redmi-router-ac2100
BLOCKSIZE := 128k $(Device/xiaomi-ac2100)
PAGESIZE := 2048
KERNEL_SIZE := 4096k
IMAGE_SIZE := 120320k
UBINIZE_OPTS := -E 5
IMAGES += kernel1.bin rootfs0.bin factory.bin
IMAGE/kernel1.bin := append-kernel
IMAGE/rootfs0.bin := append-ubi | check-size
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := Redmi Router AC2100 DEVICE_MODEL := Redmi Router AC2100
DEVICE_PACKAGES := kmod-mt7603e kmod-mt7615d luci-app-mtwifi uboot-envtools
endef endef
TARGET_DEVICES += xiaomi_redmi-router-ac2100 TARGET_DEVICES += xiaomi_redmi-router-ac2100
......
...@@ -28,6 +28,7 @@ d-team,pbr-m1) ...@@ -28,6 +28,7 @@ d-team,pbr-m1)
dlink,dir-860l-b1) dlink,dir-860l-b1)
ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "wan" ucidef_set_led_netdev "wan" "wan" "$boardname:green:net" "wan"
;; ;;
dlink,dir-867-a1|\
dlink,dir-878-a1|\ dlink,dir-878-a1|\
dlink,dir-882-a1|\ dlink,dir-882-a1|\
motorola,mr2600) motorola,mr2600)
...@@ -84,8 +85,10 @@ tplink,re650-v1) ...@@ -84,8 +85,10 @@ tplink,re650-v1)
ucidef_set_led_netdev "eth_act" "LAN act" "$boardname:green:eth_act" "lan" "tx rx" 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" ucidef_set_led_netdev "eth_link" "LAN link" "$boardname:green:eth_link" "lan" "link"
;; ;;
xzwifi,creativebox-v1) xiaomi,mir3g)
ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan" 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) xiaomi,mi-router-ac2100)
ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x1" ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x1"
...@@ -93,6 +96,9 @@ xiaomi,mi-router-ac2100) ...@@ -93,6 +96,9 @@ xiaomi,mi-router-ac2100)
xiaomi,redmi-router-ac2100) xiaomi,redmi-router-ac2100)
ucidef_set_led_switch "wan" "wan" "$boardname:white:wan" "switch0" "0x1" 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) youhua,wr1200js)
ucidef_set_led_netdev "internet" "INTERNET" "$boardname:green:wan" "wan" ucidef_set_led_netdev "internet" "INTERNET" "$boardname:green:wan" "wan"
;; ;;
......
...@@ -54,6 +54,7 @@ ramips_setup_interfaces() ...@@ -54,6 +54,7 @@ ramips_setup_interfaces()
ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan" ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan"
;; ;;
netgear,r6850|\ netgear,r6850|\
dlink,dir-867-a1|\
dlink,dir-878-a1|\ dlink,dir-878-a1|\
dlink,dir-882-a1|\ dlink,dir-882-a1|\
motorola,mr2600) motorola,mr2600)
...@@ -70,11 +71,15 @@ ramips_setup_interfaces() ...@@ -70,11 +71,15 @@ ramips_setup_interfaces()
ubnt,edgerouter-x-sfp) ubnt,edgerouter-x-sfp)
ucidef_set_interface_lan_wan "eth1 eth2 eth3 eth4 eth5" "eth0" ucidef_set_interface_lan_wan "eth1 eth2 eth3 eth4 eth5" "eth0"
;; ;;
xiaomi,mir3g)
ucidef_add_switch "switch0" \
"2:lan:2" "3:lan:1" "1:wan" "6t@eth0"
;;
xiaomi,mi-router-ac2100|\ xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100) xiaomi,redmi-router-ac2100)
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:wan" "2:lan:1" "3:lan:2" "4:lan:3" "6@eth0" "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" ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
...@@ -139,6 +144,10 @@ ramips_setup_macs() ...@@ -139,6 +144,10 @@ ramips_setup_macs()
wan_mac=$label_mac wan_mac=$label_mac
lan_mac=$(macaddr_add $label_mac 1) lan_mac=$(macaddr_add $label_mac 1)
;; ;;
phicomm,k2p)
wan_mac=$(mtd_get_mac_binary factory 0xe006)
;;
xiaomi,mir3g|\
xiaomi,mi-router-ac2100|\ xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100) xiaomi,redmi-router-ac2100)
lan_mac=$(cat /sys/class/net/eth0/address) lan_mac=$(cat /sys/class/net/eth0/address)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册