2 +++ b/configs/mt7986_xiaomi_redmi-ax6000_defconfig
5 +CONFIG_POSITION_INDEPENDENT=y
6 +CONFIG_ARCH_MEDIATEK=y
7 +CONFIG_TARGET_MT7986=y
8 +CONFIG_TEXT_BASE=0x41e00000
9 +CONFIG_SYS_MALLOC_F_LEN=0x4000
10 +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
11 +CONFIG_NR_DRAM_BANKS=1
12 +CONFIG_DEFAULT_DEVICE_TREE="mt7986a-xiaomi_redmi-ax6000"
13 +CONFIG_DEFAULT_ENV_FILE="xiaomi_redmi-ax6000_env"
14 +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-xiaomi_redmi-ax6000.dtb"
15 +CONFIG_OF_LIBFDT_OVERLAY=y
16 +CONFIG_DEBUG_UART_BASE=0x11002000
17 +CONFIG_DEBUG_UART_CLOCK=40000000
19 +CONFIG_SYS_LOAD_ADDR=0x46000000
20 +CONFIG_SMBIOS_PRODUCT_NAME=""
21 +CONFIG_AUTOBOOT_KEYED=y
23 +CONFIG_AUTOBOOT_MENU_SHOW=y
24 +CONFIG_CFB_CONSOLE_ANSI=y
25 +CONFIG_BOARD_LATE_INIT=y
29 +CONFIG_CMD_ENV_FLAGS=y
31 +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
32 +# CONFIG_LED is not set
33 +# CONFIG_LED_BLINK is not set
34 +# CONFIG_LED_GPIO is not set
37 +CONFIG_SYS_PROMPT="MT7986> "
38 +CONFIG_CMD_BOOTMENU=y
48 +CONFIG_CMD_ENV_READMEM=y
49 +CONFIG_CMD_ERASEENV=y
50 +# CONFIG_CMD_EXT4 is not set
51 +# CONFIG_CMD_FAT is not set
53 +# CONFIG_CMD_FS_GENERIC is not set
54 +# CONFIG_CMD_FS_UUID is not set
56 +# CONFIG_CMD_GPT is not set
59 +# CONFIG_CMD_LED is not set
61 +CONFIG_CMD_LINK_LOCAL=y
62 +# CONFIG_CMD_MBR is not set
64 +# CONFIG_CMD_PCI is not set
66 +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
70 +# CONFIG_CMD_PWM is not set
72 +CONFIG_CMD_TFTPBOOT=y
75 +CONFIG_CMD_UBI_RENAME=y
85 +# CONFIG_CMD_USB is not set
86 +# CONFIG_CMD_FLASH is not set
88 +CONFIG_DISPLAY_CPUINFO=y
90 +CONFIG_DM_REGULATOR=y
91 +CONFIG_DM_REGULATOR_FIXED=y
92 +CONFIG_DM_REGULATOR_GPIO=y
93 +# CONFIG_DM_USB is not set
94 +# CONFIG_DM_PWM is not set
95 +# CONFIG_PWM_MTK is not set
97 +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
98 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
99 +CONFIG_VERSION_VARIABLE=y
100 +CONFIG_PARTITION_UUIDS=y
106 +# CONFIG_DM_SCSI is not set
107 +# CONFIG_AHCI is not set
109 +# CONFIG_PHY_MTK_TPHY is not set
112 +CONFIG_MEDIATEK_ETH=y
113 +# CONFIG_PCI is not set
114 +# CONFIG_MMC is not set
115 +# CONFIG_DM_MMC is not set
117 +CONFIG_MTD_UBI_FASTMAP=y
118 +# CONFIG_DM_PCI is not set
119 +# CONFIG_PCIE_MEDIATEK is not set
122 +# CONFIG_PINCTRL_MT7622 is not set
123 +CONFIG_POWER_DOMAIN=y
124 +CONFIG_PRE_CONSOLE_BUFFER=y
125 +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
126 +CONFIG_MTK_POWER_DOMAIN=y
131 +# CONFIG_I2C is not set
133 +CONFIG_MTK_SPI_NAND=y
134 +CONFIG_MTK_SPI_NAND_MTD=y
135 +CONFIG_SYSRESET_WATCHDOG=y
140 +CONFIG_RANDOM_UUID=y
142 +# CONFIG_USB is not set
143 +# CONFIG_USB_HOST is not set
144 +# CONFIG_USB_XHCI_HCD is not set
145 +# CONFIG_USB_XHCI_MTK is not set
146 +# CONFIG_USB_STORAGE is not set
148 +CONFIG_ENV_OVERWRITE=y
149 +CONFIG_ENV_IS_IN_UBI=y
150 +CONFIG_ENV_UBI_PART="ubi"
151 +CONFIG_ENV_SIZE=0x1f000
152 +CONFIG_ENV_SIZE_REDUND=0x1f000
153 +CONFIG_ENV_UBI_VOLUME="ubootenv"
154 +CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
155 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
156 +CONFIG_NET_RANDOM_ETHADDR=y
162 +CONFIG_MEDIATEK_ETH=y
165 +CONFIG_PINCTRL_MT7986=y
166 +CONFIG_POWER_DOMAIN=y
167 +CONFIG_MTK_POWER_DOMAIN=y
168 +CONFIG_DM_REGULATOR=y
169 +CONFIG_DM_REGULATOR_FIXED=y
173 +CONFIG_USE_DEFAULT_ENV_FILE=y
174 +CONFIG_MTD_SPI_NAND=y
177 +CONFIG_CMD_NAND_TRIMFFS=y
178 +CONFIG_LMB_MAX_REGIONS=64
180 +CONFIG_IPADDR="192.168.1.1"
181 +CONFIG_USE_SERVERIP=y
182 +CONFIG_SERVERIP="192.168.1.254"
184 +++ b/arch/arm/dts/mt7986a-xiaomi_redmi-ax6000.dts
186 +// SPDX-License-Identifier: GPL-2.0
188 + * Copyright (c) 2021 MediaTek Inc.
189 + * Author: Sam Shih <sam.shih@mediatek.com>
193 +#include <dt-bindings/input/linux-event-codes.h>
194 +#include "mt7986.dtsi"
195 +#include <dt-bindings/gpio/gpio.h>
198 + #address-cells = <1>;
200 + model = "Xiaomi Redmi AX6000";
201 + compatible = "mediatek,mt7986", "mediatek,mt7986-sd-rfb";
204 + stdout-path = &uart0;
205 + tick-timer = &timer0;
209 + device_type = "memory";
210 + reg = <0x40000000 0x20000000>;
214 + compatible = "gpio-keys";
217 + gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
218 + linux,code = <KEY_RESTART>;
222 + gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
223 + linux,code = <KEY_WPS_BUTTON>;
229 + mediatek,force-highspeed;
234 + pinctrl-names = "default";
235 + pinctrl-0 = <&uart1_pins>;
236 + status = "disabled";
241 + mediatek,gmac-id = <0>;
242 + phy-mode = "sgmii";
243 + mediatek,switch = "mt7531";
244 + reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
253 + spic_pins: spi1-pins-func-1 {
260 + uart1_pins: spi1-pins-func-3 {
263 + groups = "uart1_2";
267 + spi_flash_pins: spi0-pins-func-1 {
269 + function = "flash";
270 + groups = "spi0", "spi0_wp_hold";
274 + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
275 + drive-strength = <MTK_DRIVE_8mA>;
276 + bias-pull-up = <MTK_PUPD_SET_R1R0_00>;
280 + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
281 + drive-strength = <MTK_DRIVE_8mA>;
282 + bias-pull-down = <MTK_PUPD_SET_R1R0_00>;
288 + #address-cells = <1>;
290 + pinctrl-names = "default";
291 + pinctrl-0 = <&spi_flash_pins>;
302 + compatible = "spi-nand";
304 + spi-max-frequency = <52000000>;
307 + compatible = "fixed-partitions";
308 + #address-cells = <1>;
313 + reg = <0x0 0x80000>;
318 + reg = <0x100000 0x40000>;
323 + reg = <0x140000 0x40000>;
328 + reg = <0x180000 0x200000>;
333 + reg = <0x380000 0x200000>;
338 + reg = <0x580000 0x7a80000>;
345 + status = "disabled";
348 +++ b/xiaomi_redmi-ax6000_env
350 +ethaddr_factory=mtd read factory 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x40080004 0x6 ; setenv ethaddr_factory
352 +serverip=192.168.1.254
354 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
355 +bootargs=console=ttyS0,115200n8 console_msg_format=syslog
356 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
359 +bootfile=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-initramfs-recovery.itb
360 +bootfile_bl2=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-preloader.bin
361 +bootfile_fip=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-bl31-uboot.fip
362 +bootfile_upg=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-squashfs-sysupgrade.itb
363 +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
366 +bootmenu_title=
\e[0;34m( ( (
\e[1;39mOpenWrt
\e[0;34m ) ) )
367 +bootmenu_0=Initialize environment.=run _firstboot
368 +bootmenu_0d=Run default boot command.=run boot_default
369 +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
370 +bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
371 +bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
372 +bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
373 +bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
374 +bootmenu_6=
\e[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.
\e[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
375 +bootmenu_7=
\e[31mLoad BL2 preloader via TFTP then write to NAND.
\e[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
376 +bootmenu_8=Reboot.=reset
377 +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
378 +boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
379 +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
380 +boot_production=run ubi_read_production && bootm $loadaddr#$bootconf
381 +boot_recovery=run ubi_read_recovery && bootm $loadaddr#$bootconf
382 +boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
383 +boot_tftp_forever=while true ; do run boot_tftp_recovery ; sleep 1 ; done
384 +boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
385 +boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
386 +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
387 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
388 +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
390 +reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
391 +mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
392 +mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
393 +ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1
394 +ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
395 +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
396 +ubi_read_production=ubi read $loadaddr $part_fit && iminfo $loadaddr && run ubi_prepare_rootfs
397 +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
398 +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
399 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
400 +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
401 +_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
402 +_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; run boot_first
403 +_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
404 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title
\e[33m$ver
\e[0m"