mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
ramips: add xiaomi_miwifi-r3 support (#3839)
* ramips: add xiaomi_miwifi-r3 support Specification: - CPU: 580 MHz - Flash size: 128 MiB NAND - RAM size: 128 MiB DDR2 - Wireless No1: SoC-integrated: MT7620A 2x2 MIMO 802.11b/g/n (2.4 GHz) - Wireless No2: On-board chip: MT7612E 2x2 MIMO 802.11a/n/ac (5 GHz) - Switch: MT7620 built-in 10/100 switch w/ vlan support - USB: 2.0 x1 Flash instructions: 1. access ssh via https://wiki.openwrt.org/toh/xiaomi/mir3 2. in ssh: nvram set flag_last_success=1 nvram set boot_wait=on nvram set uart_en=1 nvram commit mtd write lede-ramips-mt7620-miwifi-r3-squashfs-kernel1.bin kernel1 mtd write lede-ramips-mt7620-miwifi-r3-squashfs-rootfs0.bin rootfs0 reboot If you want to revert back to stock fw while on LEDE: insert usb stick (FAT/FAT32) with stock fw renamed to miwifi.bin fw_setenv flag_last_success 0 power off the device hold the reset button and power on the device, keep holding the reset button until yellow led starts blinking. Signed-off-by: Chen Minqiang <ptpt52@gmail.com> * ramips: add mt7620-nand driver for NAND flash This add the mt7620-nand driver and enable nand ubifs for subtarget mt7620 Signed-off-by: Chen Minqiang <ptpt52@gmail.com> Co-authored-by: Chen Minqiang <ptpt52@gmail.com>
This commit is contained in:
parent
742415490e
commit
a1807936af
@ -34,7 +34,8 @@ zbtlink,zbt-wg2626)
|
|||||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
|
||||||
;;
|
;;
|
||||||
xiaomi,mir3p|\
|
xiaomi,mir3p|\
|
||||||
xiaomi,mir3g)
|
xiaomi,mir3g|\
|
||||||
|
xiaomi,miwifi-r3)
|
||||||
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
|
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
169
target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts
Normal file
169
target/linux/ramips/dts/mt7620a_xiaomi_miwifi-r3.dts
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
/dts-v1/;
|
||||||
|
|
||||||
|
#include "mt7620a.dtsi"
|
||||||
|
|
||||||
|
#include <dt-bindings/gpio/gpio.h>
|
||||||
|
#include <dt-bindings/input/input.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
compatible = "xiaomi,miwifi-r3", "ralink,mt7620a-soc";
|
||||||
|
model = "Xiaomi Mi Router R3";
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
led-status = &led_status_blue;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
bootargs = "console=ttyS0,115200";
|
||||||
|
};
|
||||||
|
|
||||||
|
keys {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
|
||||||
|
reset {
|
||||||
|
label = "reset";
|
||||||
|
gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
|
||||||
|
linux,code = <KEY_RESTART>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
|
||||||
|
led_status_blue: blue {
|
||||||
|
label = "miwifi-r3:blue:status";
|
||||||
|
gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
|
||||||
|
default-state = "on";
|
||||||
|
};
|
||||||
|
|
||||||
|
yellow {
|
||||||
|
label = "miwifi-r3:yellow:status";
|
||||||
|
gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
|
||||||
|
red {
|
||||||
|
label = "miwifi-r3:red:status";
|
||||||
|
gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nand {
|
||||||
|
status = "okay";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
compatible = "mtk,mt7620-nand";
|
||||||
|
|
||||||
|
partition@0 {
|
||||||
|
label = "Bootloader";
|
||||||
|
reg = <0x0 0x40000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@40000 {
|
||||||
|
label = "Config";
|
||||||
|
reg = <0x40000 0x40000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@80000 {
|
||||||
|
label = "Bdata";
|
||||||
|
reg = <0x80000 0x40000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
factory: partition@0xc0000 {
|
||||||
|
label = "factory";
|
||||||
|
reg = <0xc0000 0x40000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@100000 {
|
||||||
|
label = "crash";
|
||||||
|
reg = <0x100000 0x40000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@140000 {
|
||||||
|
label = "crash_syslog";
|
||||||
|
reg = <0x140000 0x40000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@180000 {
|
||||||
|
label = "reserved0";
|
||||||
|
reg = <0x180000 0x80000>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@200000 {
|
||||||
|
label = "kernel_stock";
|
||||||
|
reg = <0x200000 0x400000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
partition@600000 {
|
||||||
|
label = "kernel";
|
||||||
|
reg = <0x600000 0x400000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ubi partition is the result of squashing
|
||||||
|
* next consequent stock partitions:
|
||||||
|
* - rootfs0 (rootfs partition for stock kernel0),
|
||||||
|
* - rootfs1 (rootfs partition for stock failsafe kernel1),
|
||||||
|
* - overlay (used as ubi overlay in stock fw)
|
||||||
|
* resulting 117,5MiB space for packages.
|
||||||
|
*/
|
||||||
|
partition@a00000 {
|
||||||
|
label = "ubi";
|
||||||
|
reg = <0xa00000 0x7600000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&gpio1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&ehci {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&ohci {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
ðernet {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&ephy_pins>;
|
||||||
|
mtd-mac-address = <&factory 0x28>;
|
||||||
|
mediatek,portmap = "llllw";
|
||||||
|
};
|
||||||
|
|
||||||
|
&wmac {
|
||||||
|
ralink,mtd-eeprom = <&factory 0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&pcie0 {
|
||||||
|
wifi@0,0 {
|
||||||
|
compatible = "pci14c3,7662";
|
||||||
|
reg = <0x0000 0 0 0 0>;
|
||||||
|
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||||
|
ieee80211-freq-limit = <5000000 6000000>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&pinctrl {
|
||||||
|
state_default: pinctrl0 {
|
||||||
|
gpio {
|
||||||
|
ralink,group = "rgmii1";
|
||||||
|
ralink,function = "gpio";
|
||||||
|
};
|
||||||
|
|
||||||
|
pa {
|
||||||
|
ralink,group = "pa";
|
||||||
|
ralink,function = "pa";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
@ -984,6 +984,23 @@ define Device/xiaomi_miwifi-mini
|
|||||||
endef
|
endef
|
||||||
TARGET_DEVICES += xiaomi_miwifi-mini
|
TARGET_DEVICES += xiaomi_miwifi-mini
|
||||||
|
|
||||||
|
define Device/xiaomi_miwifi-r3
|
||||||
|
SOC := mt7620a
|
||||||
|
BLOCKSIZE := 128k
|
||||||
|
PAGESIZE := 2048
|
||||||
|
KERNEL_SIZE := 4096k
|
||||||
|
IMAGE_SIZE := 32768k
|
||||||
|
UBINIZE_OPTS := -E 5
|
||||||
|
IMAGES += kernel1.bin rootfs0.bin
|
||||||
|
IMAGE/kernel1.bin := append-kernel | check-size $$$$(KERNEL_SIZE)
|
||||||
|
IMAGE/rootfs0.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
|
||||||
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||||
|
DEVICE_VENDOR := Xiaomi
|
||||||
|
DEVICE_MODEL := Mi Router R3
|
||||||
|
DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci uboot-envtools
|
||||||
|
endef
|
||||||
|
TARGET_DEVICES += xiaomi_miwifi-r3
|
||||||
|
|
||||||
define Device/youku_yk1
|
define Device/youku_yk1
|
||||||
SOC := mt7620a
|
SOC := mt7620a
|
||||||
IMAGE_SIZE := 32448k
|
IMAGE_SIZE := 32448k
|
||||||
|
@ -197,6 +197,10 @@ ramips_setup_interfaces()
|
|||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"0:lan" "4:wan" "6@eth0"
|
"0:lan" "4:wan" "6@eth0"
|
||||||
;;
|
;;
|
||||||
|
xiaomi,miwifi-r3)
|
||||||
|
ucidef_add_switch "switch0" \
|
||||||
|
"1:lan" "4:lan" "0:wan" "6@eth0"
|
||||||
|
;;
|
||||||
zbtlink,zbt-we1026-5g-16m)
|
zbtlink,zbt-we1026-5g-16m)
|
||||||
ucidef_add_switch "switch0" \
|
ucidef_add_switch "switch0" \
|
||||||
"0:lan" "6t@eth0"
|
"0:lan" "6t@eth0"
|
||||||
@ -326,6 +330,10 @@ ramips_setup_macs()
|
|||||||
tplink,archer-mr200)
|
tplink,archer-mr200)
|
||||||
wan_mac=$(macaddr_add "$(mtd_get_mac_binary rom 0xf100)" 1)
|
wan_mac=$(macaddr_add "$(mtd_get_mac_binary rom 0xf100)" 1)
|
||||||
;;
|
;;
|
||||||
|
xiaomi,miwifi-r3)
|
||||||
|
wan_mac=$(mtd_get_mac_binary factory 0x28)
|
||||||
|
lan_mac=$(macaddr_setbit_la "$wan_mac")
|
||||||
|
;;
|
||||||
zbtlink,zbt-we1026-5g-16m)
|
zbtlink,zbt-we1026-5g-16m)
|
||||||
label_mac=$(mtd_get_mac_binary factory 0x4)
|
label_mac=$(mtd_get_mac_binary factory 0x4)
|
||||||
;;
|
;;
|
||||||
|
@ -30,6 +30,13 @@ platform_do_upgrade() {
|
|||||||
}
|
}
|
||||||
default_do_upgrade "$1"
|
default_do_upgrade "$1"
|
||||||
;;
|
;;
|
||||||
|
xiaomi,miwifi-r3)
|
||||||
|
# this make it compatible with breed
|
||||||
|
dd if=/dev/mtd0 bs=64 count=1 2>/dev/null | grep -qi breed && CI_KERNPART_EXT="kernel_stock"
|
||||||
|
dd if=/dev/mtd7 bs=64 count=1 2>/dev/null | grep -o MIPS.*Linux | grep -qi X-WRT && CI_KERNPART_EXT="kernel_stock"
|
||||||
|
dd if=/dev/mtd7 bs=64 count=1 2>/dev/null | grep -o MIPS.*Linux | grep -qi NATCAP && CI_KERNPART_EXT="kernel0_rsvd"
|
||||||
|
nand_do_upgrade "$1"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
default_do_upgrade "$1"
|
default_do_upgrade "$1"
|
||||||
;;
|
;;
|
||||||
|
@ -47,6 +47,10 @@ CONFIG_CPU_R4K_FPU=y
|
|||||||
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
|
||||||
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
CONFIG_CPU_SUPPORTS_HIGHMEM=y
|
||||||
CONFIG_CPU_SUPPORTS_MSA=y
|
CONFIG_CPU_SUPPORTS_MSA=y
|
||||||
|
CONFIG_CRC16=y
|
||||||
|
CONFIG_CRYPTO_ACOMP2=y
|
||||||
|
CONFIG_CRYPTO_DEFLATE=y
|
||||||
|
CONFIG_CRYPTO_LZO=y
|
||||||
CONFIG_CRYPTO_RNG2=y
|
CONFIG_CRYPTO_RNG2=y
|
||||||
CONFIG_CRYPTO_WORKQUEUE=y
|
CONFIG_CRYPTO_WORKQUEUE=y
|
||||||
CONFIG_CSRC_R4K=y
|
CONFIG_CSRC_R4K=y
|
||||||
@ -130,6 +134,8 @@ CONFIG_IRQ_INTC=y
|
|||||||
CONFIG_IRQ_MIPS_CPU=y
|
CONFIG_IRQ_MIPS_CPU=y
|
||||||
CONFIG_IRQ_WORK=y
|
CONFIG_IRQ_WORK=y
|
||||||
CONFIG_LIBFDT=y
|
CONFIG_LIBFDT=y
|
||||||
|
CONFIG_LZO_COMPRESS=y
|
||||||
|
CONFIG_LZO_DECOMPRESS=y
|
||||||
CONFIG_MARVELL_PHY=y
|
CONFIG_MARVELL_PHY=y
|
||||||
CONFIG_MDIO_BUS=y
|
CONFIG_MDIO_BUS=y
|
||||||
CONFIG_MDIO_DEVICE=y
|
CONFIG_MDIO_DEVICE=y
|
||||||
@ -154,6 +160,7 @@ CONFIG_MODULES_USE_ELF_REL=y
|
|||||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||||
CONFIG_MTD_CMDLINE_PARTS=y
|
CONFIG_MTD_CMDLINE_PARTS=y
|
||||||
CONFIG_MTD_M25P80=y
|
CONFIG_MTD_M25P80=y
|
||||||
|
CONFIG_MTD_NAND_MT7620=y
|
||||||
CONFIG_MTD_PHYSMAP=y
|
CONFIG_MTD_PHYSMAP=y
|
||||||
CONFIG_MTD_SPI_NOR=y
|
CONFIG_MTD_SPI_NOR=y
|
||||||
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
|
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
|
||||||
@ -162,6 +169,12 @@ CONFIG_MTD_SPLIT_JIMAGE_FW=y
|
|||||||
CONFIG_MTD_SPLIT_SEAMA_FW=y
|
CONFIG_MTD_SPLIT_SEAMA_FW=y
|
||||||
CONFIG_MTD_SPLIT_TPLINK_FW=y
|
CONFIG_MTD_SPLIT_TPLINK_FW=y
|
||||||
CONFIG_MTD_SPLIT_UIMAGE_FW=y
|
CONFIG_MTD_SPLIT_UIMAGE_FW=y
|
||||||
|
CONFIG_MTD_UBI=y
|
||||||
|
CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||||
|
CONFIG_MTD_UBI_BLOCK=y
|
||||||
|
# CONFIG_MTD_UBI_FASTMAP is not set
|
||||||
|
# CONFIG_MTD_UBI_GLUEBI is not set
|
||||||
|
CONFIG_MTD_UBI_WL_THRESHOLD=4096
|
||||||
CONFIG_NEED_DMA_MAP_STATE=y
|
CONFIG_NEED_DMA_MAP_STATE=y
|
||||||
CONFIG_NEED_PER_CPU_KM=y
|
CONFIG_NEED_PER_CPU_KM=y
|
||||||
CONFIG_NET_MEDIATEK_GSW_MT7620=y
|
CONFIG_NET_MEDIATEK_GSW_MT7620=y
|
||||||
@ -231,6 +244,13 @@ CONFIG_TICK_CPU_ACCOUNTING=y
|
|||||||
CONFIG_TIMER_OF=y
|
CONFIG_TIMER_OF=y
|
||||||
CONFIG_TIMER_PROBE=y
|
CONFIG_TIMER_PROBE=y
|
||||||
CONFIG_TINY_SRCU=y
|
CONFIG_TINY_SRCU=y
|
||||||
|
CONFIG_UBIFS_ATIME_SUPPORT=y
|
||||||
|
CONFIG_UBIFS_FS=y
|
||||||
|
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
|
||||||
|
CONFIG_UBIFS_FS_LZO=y
|
||||||
|
CONFIG_UBIFS_FS_ZLIB=y
|
||||||
CONFIG_USB_SUPPORT=y
|
CONFIG_USB_SUPPORT=y
|
||||||
CONFIG_USE_OF=y
|
CONFIG_USE_OF=y
|
||||||
CONFIG_WATCHDOG_CORE=y
|
CONFIG_WATCHDOG_CORE=y
|
||||||
|
CONFIG_ZLIB_DEFLATE=y
|
||||||
|
CONFIG_ZLIB_INFLATE=y
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
SUBTARGET:=mt7620
|
SUBTARGET:=mt7620
|
||||||
BOARDNAME:=MT7620 based boards
|
BOARDNAME:=MT7620 based boards
|
||||||
FEATURES+=usb ramdisk
|
FEATURES+=usb nand ramdisk
|
||||||
CPU_TYPE:=24kc
|
CPU_TYPE:=24kc
|
||||||
|
|
||||||
DEFAULT_PACKAGES += kmod-rt2800-soc wpad-openssl
|
DEFAULT_PACKAGES += kmod-rt2800-soc wpad-openssl
|
||||||
|
@ -151,6 +151,7 @@ CONFIG_MT7621_WDT=y
|
|||||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||||
CONFIG_MTD_CMDLINE_PARTS=y
|
CONFIG_MTD_CMDLINE_PARTS=y
|
||||||
CONFIG_MTD_M25P80=y
|
CONFIG_MTD_M25P80=y
|
||||||
|
# CONFIG_MTD_NAND_MT7620 is not set
|
||||||
CONFIG_MTD_PHYSMAP=y
|
CONFIG_MTD_PHYSMAP=y
|
||||||
CONFIG_MTD_SPI_NOR=y
|
CONFIG_MTD_SPI_NOR=y
|
||||||
CONFIG_MTD_SPLIT_TPLINK_FW=y
|
CONFIG_MTD_SPLIT_TPLINK_FW=y
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -131,6 +131,7 @@ CONFIG_MODULES_USE_ELF_REL=y
|
|||||||
# CONFIG_MTD_CFI_INTELEXT is not set
|
# CONFIG_MTD_CFI_INTELEXT is not set
|
||||||
CONFIG_MTD_CMDLINE_PARTS=y
|
CONFIG_MTD_CMDLINE_PARTS=y
|
||||||
CONFIG_MTD_M25P80=y
|
CONFIG_MTD_M25P80=y
|
||||||
|
# CONFIG_MTD_NAND_MT7620 is not set
|
||||||
CONFIG_MTD_PHYSMAP=y
|
CONFIG_MTD_PHYSMAP=y
|
||||||
CONFIG_MTD_SPI_NOR=y
|
CONFIG_MTD_SPI_NOR=y
|
||||||
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
|
CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y
|
||||||
|
Loading…
Reference in New Issue
Block a user