kernel/modules/other/mlxreg: add new package
[openwrt/openwrt.git] / package / boot / uboot-mediatek / patches / 440-add-xiaomi_mi-router-ax3000t.patch
1 --- /dev/null
2 +++ b/configs/mt7981_xiaomi_mi-router-ax3000t_defconfig
3 @@ -0,0 +1,163 @@
4 +CONFIG_ARM=y
5 +CONFIG_POSITION_INDEPENDENT=y
6 +CONFIG_ARCH_MEDIATEK=y
7 +CONFIG_TARGET_MT7981=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="mt7981_xiaomi_mi-router-ax3000t"
13 +CONFIG_DEFAULT_ENV_FILE="xiaomi_mi-router-ax3000t_env"
14 +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981_xiaomi_mi-router-ax3000t.dtb"
15 +CONFIG_OF_LIBFDT_OVERLAY=y
16 +CONFIG_DEBUG_UART_BASE=0x11002000
17 +CONFIG_DEBUG_UART_CLOCK=40000000
18 +CONFIG_DEBUG_UART=y
19 +CONFIG_SYS_LOAD_ADDR=0x46000000
20 +CONFIG_SMBIOS_PRODUCT_NAME=""
21 +CONFIG_AUTOBOOT_KEYED=y
22 +CONFIG_BOOTDELAY=30
23 +CONFIG_AUTOBOOT_MENU_SHOW=y
24 +CONFIG_CFB_CONSOLE_ANSI=y
25 +CONFIG_BOARD_LATE_INIT=y
26 +CONFIG_BUTTON=y
27 +CONFIG_BUTTON_GPIO=y
28 +CONFIG_GPIO_HOG=y
29 +CONFIG_CMD_ENV_FLAGS=y
30 +CONFIG_FIT=y
31 +CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
32 +CONFIG_LED=y
33 +CONFIG_LED_BLINK=y
34 +CONFIG_LED_GPIO=y
35 +CONFIG_LOGLEVEL=7
36 +CONFIG_LOG=y
37 +CONFIG_SYS_PROMPT="MT7981> "
38 +CONFIG_CMD_BOOTMENU=y
39 +CONFIG_CMD_BOOTP=y
40 +CONFIG_CMD_BUTTON=y
41 +CONFIG_CMD_CACHE=y
42 +CONFIG_CMD_CDP=y
43 +CONFIG_CMD_CPU=y
44 +CONFIG_CMD_DHCP=y
45 +CONFIG_CMD_DM=y
46 +CONFIG_CMD_DNS=y
47 +CONFIG_CMD_ECHO=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
52 +CONFIG_CMD_FDT=y
53 +# CONFIG_CMD_FS_GENERIC is not set
54 +# CONFIG_CMD_FS_UUID is not set
55 +CONFIG_CMD_GPIO=y
56 +CONFIG_CMD_GPT=y
57 +CONFIG_CMD_HASH=y
58 +CONFIG_CMD_ITEST=y
59 +CONFIG_CMD_LED=y
60 +CONFIG_CMD_LICENSE=y
61 +CONFIG_CMD_LINK_LOCAL=y
62 +# CONFIG_CMD_MBR is not set
63 +CONFIG_CMD_MTD=y
64 +# CONFIG_CMD_PCI is not set
65 +CONFIG_CMD_PSTORE=y
66 +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
67 +CONFIG_CMD_SF_TEST=y
68 +CONFIG_CMD_PING=y
69 +CONFIG_CMD_PXE=y
70 +# CONFIG_CMD_PWM is not set
71 +CONFIG_CMD_SMC=y
72 +CONFIG_CMD_TFTPBOOT=y
73 +CONFIG_CMD_TFTPSRV=y
74 +CONFIG_CMD_UBI=y
75 +CONFIG_CMD_UBI_RENAME=y
76 +CONFIG_CMD_UBIFS=y
77 +CONFIG_CMD_ASKENV=y
78 +CONFIG_CMD_PART=y
79 +CONFIG_CMD_RARP=y
80 +CONFIG_CMD_SETEXPR=y
81 +CONFIG_CMD_SLEEP=y
82 +CONFIG_CMD_SNTP=y
83 +CONFIG_CMD_SOURCE=y
84 +CONFIG_CMD_STRINGS=y
85 +# CONFIG_CMD_USB is not set
86 +# CONFIG_CMD_FLASH is not set
87 +CONFIG_CMD_UUID=y
88 +CONFIG_DISPLAY_CPUINFO=y
89 +CONFIG_DM_MTD=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
96 +CONFIG_HUSH_PARSER=y
97 +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
98 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
99 +CONFIG_VERSION_VARIABLE=y
100 +CONFIG_PARTITION_UUIDS=y
101 +CONFIG_NETCONSOLE=y
102 +CONFIG_REGMAP=y
103 +CONFIG_SYSCON=y
104 +CONFIG_CLK=y
105 +CONFIG_DM_GPIO=y
106 +# CONFIG_DM_SCSI is not set
107 +# CONFIG_AHCI is not set
108 +CONFIG_PHY=y
109 +# CONFIG_PHY_MTK_TPHY is not set
110 +CONFIG_PHY_FIXED=y
111 +CONFIG_MTK_AHCI=y
112 +CONFIG_DM_ETH=y
113 +CONFIG_MEDIATEK_ETH=y
114 +# CONFIG_PCI is not set
115 +# CONFIG_MMC is not set
116 +# CONFIG_DM_MMC is not set
117 +CONFIG_MTD=y
118 +CONFIG_MTD_UBI_FASTMAP=y
119 +# CONFIG_DM_PCI is not set
120 +# CONFIG_PCIE_MEDIATEK is not set
121 +CONFIG_PINCTRL=y
122 +CONFIG_PINCONF=y
123 +CONFIG_PINCTRL_MT7981=y
124 +CONFIG_POWER_DOMAIN=y
125 +CONFIG_PRE_CONSOLE_BUFFER=y
126 +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
127 +CONFIG_MTK_POWER_DOMAIN=y
128 +CONFIG_RAM=y
129 +CONFIG_DM_SERIAL=y
130 +CONFIG_MTK_SERIAL=y
131 +CONFIG_SPI=y
132 +CONFIG_DM_SPI=y
133 +CONFIG_MTK_SPI_NAND=y
134 +CONFIG_MTK_SPI_NAND_MTD=y
135 +CONFIG_SYSRESET_WATCHDOG=y
136 +CONFIG_WDT_MTK=y
137 +CONFIG_LZO=y
138 +CONFIG_ZSTD=y
139 +CONFIG_HEXDUMP=y
140 +CONFIG_RANDOM_UUID=y
141 +CONFIG_REGEX=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
147 +CONFIG_OF_EMBED=y
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
157 +CONFIG_USE_DEFAULT_ENV_FILE=y
158 +CONFIG_MTD_SPI_NAND=y
159 +CONFIG_MTK_SPIM=y
160 +CONFIG_CMD_NAND=y
161 +CONFIG_CMD_NAND_TRIMFFS=y
162 +CONFIG_LMB_MAX_REGIONS=64
163 +CONFIG_USE_IPADDR=y
164 +CONFIG_IPADDR="192.168.1.1"
165 +CONFIG_USE_SERVERIP=y
166 +CONFIG_SERVERIP="192.168.1.254"
167 --- /dev/null
168 +++ b/arch/arm/dts/mt7981_xiaomi_mi-router-ax3000t.dts
169 @@ -0,0 +1,187 @@
170 +// SPDX-License-Identifier: GPL-2.0
171 +/*
172 + * Copyright (c) 2022 MediaTek Inc.
173 + * Author: Sam Shih <sam.shih@mediatek.com>
174 + */
175 +
176 +/dts-v1/;
177 +#include "mt7981.dtsi"
178 +#include <dt-bindings/gpio/gpio.h>
179 +#include <dt-bindings/input/linux-event-codes.h>
180 +
181 +/ {
182 + #address-cells = <1>;
183 + #size-cells = <1>;
184 + model = "Xiaomi Router AX3000T";
185 + compatible = "mediatek,mt7981", "mediatek,mt7981-rfb";
186 +
187 + chosen {
188 + stdout-path = &uart0;
189 + tick-timer = &timer0;
190 + };
191 +
192 + memory@40000000 {
193 + device_type = "memory";
194 + reg = <0x40000000 0x10000000>;
195 + };
196 +
197 + gpio-keys {
198 + compatible = "gpio-keys";
199 +
200 + reset {
201 + label = "reset";
202 + gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
203 + linux,code = <KEY_RESTART>;
204 + };
205 +
206 + mesh {
207 + label = "mesh";
208 + gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
209 + linux,code = <BTN_9>;
210 + linux,input-type = <EV_SW>;
211 + };
212 + };
213 +
214 + leds {
215 + compatible = "gpio-leds";
216 +
217 + led_status_blue {
218 + label = "blue:status";
219 + gpios = <&gpio 9 GPIO_ACTIVE_LOW>;
220 + };
221 +
222 + led_status_yellow {
223 + label = "yellow:status";
224 + gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
225 + };
226 + };
227 +};
228 +
229 +&uart0 {
230 + mediatek,force-highspeed;
231 + status = "okay";
232 +};
233 +
234 +&eth {
235 + status = "okay";
236 + mediatek,gmac-id = <0>;
237 + phy-mode = "2500base-x";
238 + mediatek,switch = "mt7531";
239 + reset-gpios = <&gpio 39 GPIO_ACTIVE_HIGH>;
240 +
241 + fixed-link {
242 + speed = <2500>;
243 + full-duplex;
244 + };
245 +};
246 +
247 +&pinctrl {
248 + spic_pins: spi1-pins-func-1 {
249 + mux {
250 + function = "spi";
251 + groups = "spi1_1";
252 + };
253 + };
254 +
255 + uart1_pins: spi1-pins-func-3 {
256 + mux {
257 + function = "uart";
258 + groups = "uart1_2";
259 + };
260 + };
261 +
262 + spi_flash_pins: spi0-pins-func-1 {
263 + mux {
264 + function = "flash";
265 + groups = "spi0", "spi0_wp_hold";
266 + };
267 +
268 + conf-pu {
269 + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
270 + drive-strength = <MTK_DRIVE_8mA>;
271 + bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
272 + };
273 +
274 + conf-pd {
275 + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
276 + drive-strength = <MTK_DRIVE_8mA>;
277 + bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
278 + };
279 + };
280 +};
281 +
282 +&spi0 {
283 + #address-cells = <1>;
284 + #size-cells = <0>;
285 + pinctrl-names = "default";
286 + pinctrl-0 = <&spi_flash_pins>;
287 + status = "okay";
288 + must_tx;
289 + enhance_timing;
290 + dma_ext;
291 + ipm_design;
292 + support_quad;
293 + tick_dly = <2>;
294 + sample_sel = <0>;
295 +
296 + spi_nand@0 {
297 + compatible = "spi-nand";
298 + reg = <0>;
299 + spi-max-frequency = <52000000>;
300 +
301 + partitions {
302 + compatible = "fixed-partitions";
303 + #address-cells = <1>;
304 + #size-cells = <1>;
305 +
306 + partition@0 {
307 + label = "bl2";
308 + reg = <0x00 0x100000>;
309 + };
310 +
311 + partition@100000 {
312 + label = "Nvram";
313 + reg = <0x100000 0x40000>;
314 + };
315 +
316 + partition@140000 {
317 + label = "Bdata";
318 + reg = <0x140000 0x40000>;
319 + };
320 +
321 + partition@180000 {
322 + label = "factory";
323 + reg = <0x180000 0x200000>;
324 + };
325 +
326 + partition@380000 {
327 + label = "fip";
328 + reg = <0x380000 0x200000>;
329 + };
330 +
331 + partition@580000 {
332 + label = "crash";
333 + reg = <0x580000 0x40000>;
334 + };
335 +
336 + partition@5c0000 {
337 + label = "crash_log";
338 + reg = <0x5c0000 0x40000>;
339 + };
340 +
341 + partition@600000 {
342 + label = "ubi";
343 + reg = <0x600000 0x7000000>;
344 + };
345 +
346 + partition@7600000 {
347 + label = "KF";
348 + reg = <0x7600000 0x40000>;
349 + };
350 + };
351 + };
352 +};
353 +
354 +&watchdog {
355 + status = "disabled";
356 +};
357 --- /dev/null
358 +++ b/xiaomi_mi-router-ax3000t_env
359 @@ -0,0 +1,55 @@
360 +ipaddr=192.168.1.1
361 +serverip=192.168.1.254
362 +loadaddr=0x46000000
363 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
364 +bootargs=console=ttyS0,115200n8 console_msg_format=syslog
365 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
366 +bootconf=config-1
367 +bootdelay=0
368 +bootfile=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-initramfs-recovery.itb
369 +bootfile_bl2=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-preloader.bin
370 +bootfile_fip=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-bl31-uboot.fip
371 +bootfile_upg=openwrt-mediatek-filogic-xiaomi_mi-router-ax3000t-ubootmod-squashfs-sysupgrade.itb
372 +bootled_pwr=yellow:status
373 +bootled_rec=blue:status
374 +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
375 +bootmenu_default=0
376 +bootmenu_delay=0
377 +bootmenu_title= \e[0;34m( ( ( \e[1;39mOpenWrt\e[0;34m ) ) )
378 +bootmenu_0=Initialize environment.=run _firstboot
379 +bootmenu_0d=Run default boot command.=run boot_default
380 +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
381 +bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
382 +bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
383 +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
384 +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
385 +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
386 +bootmenu_7=\e[31mLoad BL2 preloader via TFTP then write to NAND.\e[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
387 +bootmenu_8=Reboot.=reset
388 +bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
389 +boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
390 +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
391 +boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
392 +boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
393 +boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever
394 +boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
395 +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
396 +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
397 +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
398 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory
399 +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2
400 +reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800
401 +mtd_write_fip=mtd erase fip && mtd write fip $loadaddr
402 +mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr
403 +ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 || run ubi_format ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 || run ubi_format
404 +ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset
405 +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
406 +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
407 +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
408 +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
409 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize
410 +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize
411 +_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
412 +_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
413 +_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
414 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title \e[33m$ver\e[0m"