ramips: add support for Xiaomi Mi Router CR660x series

This commit is contained in:
lean 2021-04-27 22:58:52 +08:00
parent f3efbf91f4
commit 87f0b29a20
6 changed files with 222 additions and 0 deletions

View File

@ -51,6 +51,9 @@ xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
;;
xiaomi,mi-router-cr6606)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000"
;;
esac
config_load ubootenv

View File

@ -0,0 +1,187 @@
// 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>
/ {
compatible = "xiaomi,mi-router-cr6606", "mediatek,mt7621-soc";
model = "Xiaomi Mi Router CR6606";
aliases {
led-boot = &led_sys_yellow;
led-failsafe = &led_sys_yellow;
led-running = &led_sys_blue;
led-upgrade = &led_sys_yellow;
label-mac-device = &gmac0;
};
chosen {
bootargs = "console=ttyS0,115200n8";
};
leds {
compatible = "gpio-leds";
led_sys_yellow: sys_yellow {
label = "yellow:sys";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
led_sys_blue: sys_blue {
label = "blue:sys";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
net_yellow {
label = "yellow:net";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
net_blue {
label = "blue:net";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
};
keys: keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
linux,code = <KEY_WPS_BUTTON>;
};
};
};
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Bootloader";
reg = <0x0 0x80000>;
read-only;
};
partition@80000 {
label = "Nvram";
reg = <0x80000 0x40000>;
read-only;
};
partition@c0000 {
label = "Bdata";
reg = <0xc0000 0x40000>;
read-only;
};
factory: partition@100000 {
label = "Factory";
reg = <0x100000 0x80000>;
read-only;
};
partition@180000 {
label = "crash";
reg = <0x180000 0x40000>;
read-only;
};
partition@1c0000 {
label = "crash_log";
reg = <0x1c0000 0x40000>;
read-only;
};
partition@200000 {
label = "firmware";
compatible = "denx,uimage";
reg = <0x200000 0x1e00000>;
};
partition@2000000 {
label = "firmware1";
reg = <0x2000000 0x1e00000>;
};
partition@3e00000 {
label = "ubi";
reg = <0x3e00000 0x3200000>;
};
partition@7000000 {
label = "obr";
reg = <0x7000000 0x1000000>;
read-only;
};
};
};
&pcie {
status = "okay";
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0>;
};
};
&pcie2 {
wifi@0,0 {
reg = <0x0 0 0 0 0>;
};
};
&gmac0 {
mtd-mac-address = <&factory 0x3fff4>;
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "lan1";
};
port@1 {
status = "okay";
label = "lan2";
};
port@2 {
status = "okay";
label = "lan3";
};
port@4 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0x3fffa>;
};
};
};
&state_default {
gpio {
groups = "jtag", "uart3", "wdt";
function = "gpio";
};
};

View File

@ -1093,6 +1093,33 @@ define Device/xiaomi_mi-router-ac2100
endef
TARGET_DEVICES += xiaomi_mi-router-ac2100
define Device/xiaomi_mi-router-cr6606
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
DEVICE_VENDOR := Xiaomi
DEVICE_MODEL := Mi Router CR6606
DEVICE_ALT0_VENDOR := Xiaomi
DEVICE_ALT0_MODEL := Mi Router CR6606
DEVICE_ALT0_VARIANT := China Unicom
DEVICE_ALT1_VENDOR := Xiaomi
DEVICE_ALT1_MODEL := Mi Router CR6608
DEVICE_ALT1_VARIANT := China Mobile
DEVICE_ALT2_VENDOR := Xiaomi
DEVICE_ALT2_MODEL := Mi Router CR6609
DEVICE_ALT2_VARIANT := China Telecom
BLOCKSIZE := 128k
PAGESIZE := 2048
UBINIZE_OPTS := -E 5
IMAGE_SIZE := 51200k
IMAGES += firmware.bin overlay.bin
IMAGE/firmware.bin := append-kernel | pad-to 128k | append-rootfs | \
pad-rootfs
IMAGE/overlay.bin := append-ubi | check-size
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
DEVICE_PACKAGES += uboot-envtools kmod-mt7915e
endef
TARGET_DEVICES += xiaomi_mi-router-cr6606
define Device/xiaomi_redmi-router-ac2100
$(Device/xiaomi-ac2100)
DEVICE_MODEL := Redmi Router AC2100

View File

@ -94,6 +94,9 @@ xiaomi,mir3g)
xiaomi,mi-router-ac2100)
ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x1"
;;
xiaomi,mi-router-cr6606)
ucidef_set_led_netdev "internet" "internet" "blue:net" "wan"
;;
xiaomi,redmi-router-ac2100)
ucidef_set_led_switch "wan" "wan" "$boardname:white:wan" "switch0" "0x1"
;;

View File

@ -90,6 +90,7 @@ ramips_setup_interfaces()
ucidef_set_interface_lan "eth0.1 ra0 rai0"
;;
xiaomi,mi-router-ac2100|\
xiaomi,mi-router-cr6606|\
xiaomi,redmi-router-ac2100)
ucidef_add_switch "switch0" \
"0:wan" "2:lan:1" "3:lan:2" "4:lan:3" "6@eth0"

View File

@ -59,6 +59,7 @@ platform_do_upgrade() {
xiaomi,mir3p|\
xiaomi,mir4|\
xiaomi,mi-router-ac2100|\
xiaomi,mi-router-cr6606|\
xiaomi,redmi-router-ac2100)
nand_do_upgrade "$1"
;;