ramips: mt7621: fix broken hexdump expression in iodata.sh
[openwrt/openwrt.git] / package / boot / uboot-mediatek / patches / 442-add-bpi-r3-mini.patch
1 --- /dev/null
2 +++ b/configs/mt7986a_bpi-r3-mini-emmc_defconfig
3 @@ -0,0 +1,144 @@
4 +CONFIG_ARM=y
5 +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
6 +CONFIG_POSITION_INDEPENDENT=y
7 +CONFIG_ARCH_MEDIATEK=y
8 +CONFIG_TEXT_BASE=0x41e00000
9 +CONFIG_SYS_MALLOC_F_LEN=0x4000
10 +CONFIG_NR_DRAM_BANKS=1
11 +CONFIG_ENV_SIZE=0x40000
12 +CONFIG_ENV_OFFSET=0x400000
13 +CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-mini"
14 +CONFIG_OF_LIBFDT_OVERLAY=y
15 +CONFIG_TARGET_MT7986=y
16 +CONFIG_SYS_LOAD_ADDR=0x46000000
17 +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
18 +CONFIG_DEBUG_UART_BASE=0x11002000
19 +CONFIG_DEBUG_UART_CLOCK=40000000
20 +CONFIG_ENV_OFFSET_REDUND=0x440000
21 +CONFIG_PCI=y
22 +CONFIG_DEBUG_UART=y
23 +CONFIG_AHCI=y
24 +CONFIG_FIT=y
25 +CONFIG_BOOTDELAY=30
26 +CONFIG_AUTOBOOT_KEYED=y
27 +CONFIG_AUTOBOOT_MENU_SHOW=y
28 +CONFIG_OF_SYSTEM_SETUP=y
29 +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-mini.dtb"
30 +CONFIG_LOGLEVEL=7
31 +CONFIG_PRE_CONSOLE_BUFFER=y
32 +CONFIG_LOG=y
33 +CONFIG_BOARD_LATE_INIT=y
34 +CONFIG_HUSH_PARSER=y
35 +CONFIG_SYS_PROMPT="MT7986> "
36 +CONFIG_CMD_CPU=y
37 +CONFIG_CMD_LICENSE=y
38 +# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
39 +CONFIG_CMD_BOOTMENU=y
40 +CONFIG_CMD_ASKENV=y
41 +CONFIG_CMD_ERASEENV=y
42 +CONFIG_CMD_ENV_FLAGS=y
43 +CONFIG_CMD_STRINGS=y
44 +CONFIG_CMD_DM=y
45 +CONFIG_CMD_GPIO=y
46 +CONFIG_CMD_PWM=y
47 +CONFIG_CMD_GPT=y
48 +CONFIG_CMD_MMC=y
49 +CONFIG_CMD_MTD=y
50 +CONFIG_CMD_PART=y
51 +CONFIG_CMD_PCI=y
52 +CONFIG_CMD_SF_TEST=y
53 +CONFIG_CMD_USB=y
54 +CONFIG_CMD_TFTPSRV=y
55 +CONFIG_CMD_RARP=y
56 +CONFIG_CMD_CDP=y
57 +CONFIG_CMD_SNTP=y
58 +CONFIG_CMD_LINK_LOCAL=y
59 +CONFIG_CMD_DHCP=y
60 +CONFIG_CMD_DNS=y
61 +CONFIG_CMD_MII=y
62 +CONFIG_CMD_PING=y
63 +CONFIG_CMD_PXE=y
64 +CONFIG_CMD_CACHE=y
65 +CONFIG_CMD_PSTORE=y
66 +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
67 +CONFIG_CMD_UUID=y
68 +CONFIG_CMD_HASH=y
69 +CONFIG_CMD_SMC=y
70 +CONFIG_CMD_EXT4=y
71 +CONFIG_CMD_FAT=y
72 +CONFIG_CMD_FS_GENERIC=y
73 +CONFIG_CMD_FS_UUID=y
74 +CONFIG_CMD_UBI=y
75 +CONFIG_CMD_UBI_RENAME=y
76 +CONFIG_OF_EMBED=y
77 +CONFIG_ENV_OVERWRITE=y
78 +CONFIG_ENV_IS_IN_MMC=y
79 +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
80 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
81 +CONFIG_USE_DEFAULT_ENV_FILE=y
82 +CONFIG_DEFAULT_ENV_FILE="defenvs/bananapi_bpi-r3-mini_emmc_env"
83 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
84 +CONFIG_VERSION_VARIABLE=y
85 +CONFIG_NETCONSOLE=y
86 +CONFIG_USE_IPADDR=y
87 +CONFIG_IPADDR="192.168.1.1"
88 +CONFIG_USE_SERVERIP=y
89 +CONFIG_SERVERIP="192.168.1.254"
90 +CONFIG_NET_RANDOM_ETHADDR=y
91 +CONFIG_SCSI_AHCI=y
92 +CONFIG_AHCI_PCI=y
93 +CONFIG_MTK_AHCI=y
94 +CONFIG_BUTTON=y
95 +CONFIG_BUTTON_GPIO=y
96 +CONFIG_CLK=y
97 +CONFIG_GPIO_HOG=y
98 +CONFIG_LED=y
99 +CONFIG_LED_BLINK=y
100 +CONFIG_LED_GPIO=y
101 +CONFIG_SUPPORT_EMMC_BOOT=y
102 +CONFIG_MMC_HS200_SUPPORT=y
103 +CONFIG_MMC_MTK=y
104 +CONFIG_MTD=y
105 +CONFIG_DM_MTD=y
106 +CONFIG_MTD_SPI_NAND=y
107 +CONFIG_DM_SPI_FLASH=y
108 +CONFIG_SPI_FLASH_WINBOND=y
109 +# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
110 +CONFIG_SPI_FLASH_MTD=y
111 +CONFIG_MTD_UBI_FASTMAP=y
112 +CONFIG_PHY_AIROHA=y
113 +CONFIG_PHY_AIROHA_EN8811H=y
114 +CONFIG_PHY_AIROHA_FW_IN_MMC=y
115 +CONFIG_PHY_ETHERNET_ID=y
116 +CONFIG_PHY_FIXED=y
117 +CONFIG_DM_MDIO=y
118 +CONFIG_DM_ETH_PHY=y
119 +CONFIG_MEDIATEK_ETH=y
120 +CONFIG_PCIE_MEDIATEK=y
121 +CONFIG_PHY=y
122 +CONFIG_PHY_MTK_TPHY=y
123 +CONFIG_PINCTRL=y
124 +CONFIG_PINCONF=y
125 +CONFIG_PINCTRL_MT7622=y
126 +CONFIG_PINCTRL_MT7986=y
127 +CONFIG_POWER_DOMAIN=y
128 +CONFIG_MTK_POWER_DOMAIN=y
129 +CONFIG_DM_REGULATOR=y
130 +CONFIG_DM_REGULATOR_FIXED=y
131 +CONFIG_DM_REGULATOR_GPIO=y
132 +CONFIG_DM_PWM=y
133 +CONFIG_PWM_MTK=y
134 +CONFIG_RAM=y
135 +CONFIG_SCSI=y
136 +CONFIG_DM_SERIAL=y
137 +CONFIG_SERIAL_RX_BUFFER=y
138 +CONFIG_MTK_SERIAL=y
139 +CONFIG_SPI=y
140 +CONFIG_DM_SPI=y
141 +CONFIG_MTK_SPIM=y
142 +CONFIG_USB=y
143 +CONFIG_USB_XHCI_HCD=y
144 +CONFIG_USB_XHCI_MTK=y
145 +CONFIG_USB_STORAGE=y
146 +CONFIG_ZSTD=y
147 +CONFIG_HEXDUMP=y
148 --- /dev/null
149 +++ b/configs/mt7986a_bpi-r3-mini-snand_defconfig
150 @@ -0,0 +1,137 @@
151 +CONFIG_ARM=y
152 +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
153 +CONFIG_POSITION_INDEPENDENT=y
154 +CONFIG_ARCH_MEDIATEK=y
155 +CONFIG_TEXT_BASE=0x41e00000
156 +CONFIG_SYS_MALLOC_F_LEN=0x4000
157 +CONFIG_NR_DRAM_BANKS=1
158 +CONFIG_DEFAULT_DEVICE_TREE="mt7986a-bpi-r3-mini"
159 +CONFIG_OF_LIBFDT_OVERLAY=y
160 +CONFIG_TARGET_MT7986=y
161 +CONFIG_SYS_LOAD_ADDR=0x46000000
162 +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
163 +CONFIG_DEBUG_UART_BASE=0x11002000
164 +CONFIG_DEBUG_UART_CLOCK=40000000
165 +CONFIG_PCI=y
166 +CONFIG_DEBUG_UART=y
167 +CONFIG_AHCI=y
168 +CONFIG_FIT=y
169 +CONFIG_BOOTDELAY=30
170 +CONFIG_AUTOBOOT_KEYED=y
171 +CONFIG_AUTOBOOT_MENU_SHOW=y
172 +CONFIG_OF_SYSTEM_SETUP=y
173 +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bpi-r3-mini.dtb"
174 +CONFIG_LOGLEVEL=7
175 +CONFIG_PRE_CONSOLE_BUFFER=y
176 +CONFIG_LOG=y
177 +CONFIG_BOARD_LATE_INIT=y
178 +CONFIG_HUSH_PARSER=y
179 +CONFIG_SYS_PROMPT="MT7986> "
180 +CONFIG_CMD_CPU=y
181 +CONFIG_CMD_LICENSE=y
182 +# CONFIG_CMD_BOOTEFI_BOOTMGR is not set
183 +CONFIG_CMD_BOOTMENU=y
184 +CONFIG_CMD_ASKENV=y
185 +CONFIG_CMD_ERASEENV=y
186 +CONFIG_CMD_ENV_FLAGS=y
187 +CONFIG_CMD_STRINGS=y
188 +CONFIG_CMD_DM=y
189 +CONFIG_CMD_GPIO=y
190 +CONFIG_CMD_PWM=y
191 +CONFIG_CMD_GPT=y
192 +CONFIG_CMD_MMC=y
193 +CONFIG_CMD_MTD=y
194 +CONFIG_CMD_PART=y
195 +CONFIG_CMD_PCI=y
196 +CONFIG_CMD_USB=y
197 +CONFIG_CMD_TFTPSRV=y
198 +CONFIG_CMD_RARP=y
199 +CONFIG_CMD_CDP=y
200 +CONFIG_CMD_SNTP=y
201 +CONFIG_CMD_LINK_LOCAL=y
202 +CONFIG_CMD_DHCP=y
203 +CONFIG_CMD_DNS=y
204 +CONFIG_CMD_MII=y
205 +CONFIG_CMD_PING=y
206 +CONFIG_CMD_PXE=y
207 +CONFIG_CMD_CACHE=y
208 +CONFIG_CMD_PSTORE=y
209 +CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000
210 +CONFIG_CMD_UUID=y
211 +CONFIG_CMD_HASH=y
212 +CONFIG_CMD_SMC=y
213 +CONFIG_CMD_EXT4=y
214 +CONFIG_CMD_FAT=y
215 +CONFIG_CMD_FS_GENERIC=y
216 +CONFIG_CMD_FS_UUID=y
217 +CONFIG_CMD_UBI=y
218 +CONFIG_CMD_UBI_RENAME=y
219 +CONFIG_OF_EMBED=y
220 +CONFIG_ENV_OVERWRITE=y
221 +CONFIG_ENV_IS_IN_UBI=y
222 +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
223 +CONFIG_ENV_UBI_PART="ubi"
224 +CONFIG_ENV_UBI_VOLUME="ubootenv"
225 +CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2"
226 +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
227 +CONFIG_USE_DEFAULT_ENV_FILE=y
228 +CONFIG_DEFAULT_ENV_FILE="defenvs/bananapi_bpi-r3-mini_snand_env"
229 +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
230 +CONFIG_VERSION_VARIABLE=y
231 +CONFIG_NETCONSOLE=y
232 +CONFIG_USE_IPADDR=y
233 +CONFIG_IPADDR="192.168.1.1"
234 +CONFIG_USE_SERVERIP=y
235 +CONFIG_NET_RANDOM_ETHADDR=y
236 +CONFIG_SCSI_AHCI=y
237 +CONFIG_AHCI_PCI=y
238 +CONFIG_MTK_AHCI=y
239 +CONFIG_BUTTON=y
240 +CONFIG_BUTTON_GPIO=y
241 +CONFIG_CLK=y
242 +CONFIG_GPIO_HOG=y
243 +CONFIG_LED=y
244 +CONFIG_LED_BLINK=y
245 +CONFIG_LED_GPIO=y
246 +CONFIG_SUPPORT_EMMC_BOOT=y
247 +CONFIG_MMC_HS200_SUPPORT=y
248 +CONFIG_MMC_MTK=y
249 +CONFIG_MTD=y
250 +CONFIG_DM_MTD=y
251 +CONFIG_MTD_SPI_NAND=y
252 +CONFIG_MTD_UBI_FASTMAP=y
253 +CONFIG_PHY_AIROHA=y
254 +CONFIG_PHY_AIROHA_EN8811H=y
255 +CONFIG_PHY_ETHERNET_ID=y
256 +CONFIG_PHY_FIXED=y
257 +CONFIG_DM_MDIO=y
258 +CONFIG_DM_ETH_PHY=y
259 +CONFIG_MEDIATEK_ETH=y
260 +CONFIG_PCIE_MEDIATEK=y
261 +CONFIG_PHY=y
262 +CONFIG_PHY_MTK_TPHY=y
263 +CONFIG_PINCTRL=y
264 +CONFIG_PINCONF=y
265 +CONFIG_PINCTRL_MT7622=y
266 +CONFIG_PINCTRL_MT7986=y
267 +CONFIG_POWER_DOMAIN=y
268 +CONFIG_MTK_POWER_DOMAIN=y
269 +CONFIG_DM_REGULATOR=y
270 +CONFIG_DM_REGULATOR_FIXED=y
271 +CONFIG_DM_REGULATOR_GPIO=y
272 +CONFIG_DM_PWM=y
273 +CONFIG_PWM_MTK=y
274 +CONFIG_RAM=y
275 +CONFIG_SCSI=y
276 +CONFIG_DM_SERIAL=y
277 +CONFIG_SERIAL_RX_BUFFER=y
278 +CONFIG_MTK_SERIAL=y
279 +CONFIG_SPI=y
280 +CONFIG_DM_SPI=y
281 +CONFIG_MTK_SPIM=y
282 +CONFIG_USB=y
283 +CONFIG_USB_XHCI_HCD=y
284 +CONFIG_USB_XHCI_MTK=y
285 +CONFIG_USB_STORAGE=y
286 +CONFIG_ZSTD=y
287 +CONFIG_HEXDUMP=y
288 --- /dev/null
289 +++ b/defenvs/bananapi_bpi-r3-mini_snand_env
290 @@ -0,0 +1,61 @@
291 +ipaddr=192.168.1.1
292 +serverip=192.168.1.254
293 +loadaddr=0x46000000
294 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
295 +bootargs=root=ubi.block=0,fit root=/dev/fit0 rootwait
296 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi
297 +bootconf=config-mt7986a-bananapi-bpi-r3-mini
298 +bootdelay=0
299 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb
300 +bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-preloader.bin
301 +bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-snand-bl31-uboot.fip
302 +bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb
303 +bootfile_en8811h_fw=EthMD32.bin
304 +bootled_pwr=green:status
305 +bootled_rec=blue:status
306 +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
307 +bootmenu_default=0
308 +bootmenu_delay=0
309 +bootmenu_title= \e[0;34m( ( ( \e[1;39mOpenWrt\e[0;34m ) ) ) \e[0;36m[SPI-NAND]\e[0m
310 +bootmenu_0=Initialize environment.=run _firstboot
311 +bootmenu_0d=Run default boot command.=run boot_default
312 +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
313 +bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return
314 +bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return
315 +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
316 +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
317 +bootmenu_6=\e[31mLoad Airoha EN8811H firmware via TFTP then write to NAND.\e[0m=run boot_tftp_write_en8811h_fw ; run bootmenu_confirm_return
318 +bootmenu_7=\e[31mLoad BL31+U-Boot FIP via TFTP then write to NAND.\e[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
319 +bootmenu_8=\e[31mLoad BL2 preloader via TFTP then write to NAND.\e[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
320 +bootmenu_9=Reboot.=reset
321 +bootmenu_10=Reset all settings to factory defaults.=run reset_factory ; reset
322 +boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
323 +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
324 +boot_production=led $bootled_pwr on ; run ubi_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
325 +boot_recovery=led $bootled_rec on ; run ubi_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
326 +boot_ubi=run boot_production ; run boot_recovery
327 +boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
328 +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
329 +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
330 +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
331 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run ubi_write_fip && run reset_factory
332 +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run snand_write_bl2
333 +boot_tftp_write_en8811h_fw=tftpboot $loadaddr $bootfile_en8811h_fw && run ubi_write_en8811h_fw
334 +part_default=production
335 +part_recovery=recovery
336 +reset_factory=mw $loadaddr 0xff 0x1f000 ; ubi write $loadaddr ubootenv 0x1f000 ; ubi write $loadaddr ubootenv2 0x1f000 ; ubi remove rootfs_data
337 +snand_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr 0x0 0x40000 && mtd write bl2 $loadaddr 0x40000 0x40000 && mtd write bl2 $loadaddr 0x80000 0x40000 && mtd write bl2 $loadaddr 0xc0000 0x40000
338 +ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x1f000 dynamic ; ubi check ubootenv2 || ubi create ubootenv2 0x1f000 dynamic
339 +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
340 +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
341 +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
342 +ubi_read_emmc_install=ubi check emmc_install && ubi read $loadaddr emmc_install
343 +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
344 +ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000
345 +ubi_write_en8811h_fw=ubi check en8811h-fw && ubi remove en8811h-fw ; ubi create en8811h-fw 0x24000 static ; ubi write $loadaddr en8811h-fw 0x24000
346 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
347 +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
348 +_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv
349 +_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
350 +_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
351 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title \e[33m$ver\e[0m"
352 --- /dev/null
353 +++ b/defenvs/bananapi_bpi-r3-mini_emmc_env
354 @@ -0,0 +1,59 @@
355 +ipaddr=192.168.1.1
356 +serverip=192.168.1.254
357 +loadaddr=0x46000000
358 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
359 +bootargs=root=/dev/fit0 rootwait
360 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi
361 +bootconf=config-mt7986a-bananapi-bpi-r3-mini
362 +bootdelay=0
363 +bootfile=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-initramfs-recovery.itb
364 +bootfile_bl2=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-preloader.bin
365 +bootfile_fip=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-emmc-bl31-uboot.fip
366 +bootfile_upg=openwrt-mediatek-filogic-bananapi_bpi-r3-mini-squashfs-sysupgrade.itb
367 +bootfile_en8811h_fw=EthMD32.bin
368 +bootled_pwr=green:status
369 +bootled_rec=blue:status
370 +bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
371 +bootmenu_default=0
372 +bootmenu_delay=0
373 +bootmenu_title= \e[0;34m( ( ( \e[1;39mOpenWrt\e[0;34m ) ) ) \e[0;36m[eMMC]\e[0m
374 +bootmenu_0=Initialize environment.=run _firstboot
375 +bootmenu_0d=Run default boot command.=run boot_default
376 +bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
377 +bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
378 +bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
379 +bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
380 +bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
381 +bootmenu_6=\e[31mLoad Airoha EN8811H firmware via TFTP then write to eMMC.\e[0m=run boot_tftp_write_en8811h_fw ; run bootmenu_confirm_return
382 +bootmenu_7=\e[31mLoad BL31+U-Boot FIP via TFTP then write to eMMC.\e[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
383 +bootmenu_8=\e[31mLoad BL2 preloader via TFTP then write to eMMC.\e[0m=run boot_tftp_write_bl2 ; run bootmenu_confirm_return
384 +bootmenu_9=Reboot.=reset
385 +bootmenu_10=Reset all settings to factory defaults.=run reset_factory ; reset
386 +boot_first=if button reset ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
387 +boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
388 +boot_production=led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr#$bootconf ; led $bootled_pwr off
389 +boot_recovery=led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr#$bootconf ; led $bootled_rec off
390 +boot_emmc=run boot_production ; run boot_recovery
391 +boot_tftp_forever=led $bootled_rec on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
392 +boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
393 +boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi
394 +boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip
395 +boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2
396 +boot_tftp_write_en8811h_fw=tftpboot $loadaddr $bootfile_en8811h_fw && run emmc_write_en8811h_fw
397 +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
398 +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size
399 +mmc_read_vol=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
400 +part_default=production
401 +part_recovery=recovery
402 +reset_factory=eraseenv && reset
403 +emmc_read_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
404 +emmc_read_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
405 +emmc_write_en8811h_fw=mmc partconf 0 1 2 2 && mmc erase 0x0 0x120 && mmc write $fileaddr 0x0 0x120 ; mmc partconf 0 1 1 0
406 +emmc_write_bl2=mmc partconf 0 1 1 1 && mmc erase 0x0 0x400 && mmc write $fileaddr 0x0 0x400 ; mmc partconf 0 1 1 0
407 +emmc_write_fip=mmc erase 0x3400 0x2000 && mmc write $fileaddr 0x3400 0x2000 && mmc erase 0x2000 0x800
408 +emmc_write_production=part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
409 +emmc_write_recovery=part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
410 +_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
411 +_firstboot=setenv _firstboot ; run _switch_to_menu ; run _init_env ; run boot_first
412 +_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
413 +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title \e[33m$ver\e[0m"
414 --- /dev/null
415 +++ b/arch/arm/dts/mt7986a-bpi-r3-mini.dts
416 @@ -0,0 +1,238 @@
417 +// SPDX-License-Identifier: GPL-2.0-or-later
418 +
419 +/dts-v1/;
420 +#include "mt7986.dtsi"
421 +#include <dt-bindings/gpio/gpio.h>
422 +#include <dt-bindings/input/linux-event-codes.h>
423 +
424 +/ {
425 + #address-cells = <1>;
426 + #size-cells = <1>;
427 + model = "Bananapi BPi-R3 Mini";
428 + compatible = "mediatek,mt7986", "mediatek,mt7986-rfb";
429 +
430 + chosen {
431 + stdout-path = &uart0;
432 + tick-timer = &timer0;
433 + };
434 +
435 + memory@40000000 {
436 + device_type = "memory";
437 + reg = <0x40000000 0x80000000>;
438 + };
439 +
440 + gpio-keys {
441 + compatible = "gpio-keys";
442 +
443 + button-reset {
444 + label = "reset";
445 + linux,code = <KEY_RESTART>;
446 + gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
447 + };
448 + };
449 +
450 + leds {
451 + compatible = "gpio-leds";
452 +
453 + status_led: led-0 {
454 + label = "green:status";
455 + gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
456 + };
457 +
458 + led-1 {
459 + label = "blue:wlan2g";
460 + gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
461 + };
462 +
463 + led-2 {
464 + label = "blue:wlan5g";
465 + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
466 + };
467 + };
468 +
469 + reg_1p8v: regulator-1p8v {
470 + compatible = "regulator-fixed";
471 + regulator-name = "fixed-1.8V";
472 + regulator-min-microvolt = <1800000>;
473 + regulator-max-microvolt = <1800000>;
474 + regulator-boot-on;
475 + regulator-always-on;
476 + };
477 +
478 + reg_3p3v: regulator-3p3v {
479 + compatible = "regulator-fixed";
480 + regulator-name = "fixed-3.3V";
481 + regulator-min-microvolt = <3300000>;
482 + regulator-max-microvolt = <3300000>;
483 + regulator-boot-on;
484 + regulator-always-on;
485 + };
486 +};
487 +
488 +&eth {
489 + status = "okay";
490 + pinctrl-names = "default";
491 + pinctrl-0 = <&mdio_pins>;
492 +
493 + mediatek,gmac-id = <0>;
494 + phy-mode = "2500base-x";
495 + phy-handle = <&phy14>;
496 +
497 + phy14: eth-phy@e {
498 + compatible = "ethernet-phy-id03a2.a411";
499 + reg = <14>;
500 +
501 + airoha,rx-pol-reverse;
502 +
503 + reset-gpios = <&gpio 49 GPIO_ACTIVE_LOW>;
504 + reset-assert-us = <10000>;
505 + reset-deassert-us = <20000>;
506 + };
507 +};
508 +
509 +&mmc0 {
510 + pinctrl-names = "default";
511 + pinctrl-0 = <&mmc0_pins_default>;
512 + bus-width = <8>;
513 + max-frequency = <200000000>;
514 + cap-mmc-highspeed;
515 + cap-mmc-hw-reset;
516 + vmmc-supply = <&reg_3p3v>;
517 + vqmmc-supply = <&reg_1p8v>;
518 + non-removable;
519 + status = "okay";
520 +};
521 +
522 +&pinctrl {
523 + mdio_pins: mdio-pins {
524 + mux {
525 + function = "eth";
526 + groups = "mdc_mdio";
527 + };
528 +
529 + conf-en8811-pwr-a {
530 + pins = "GPIO_11";
531 + drive-strength = <MTK_DRIVE_8mA>;
532 + bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
533 + output-low;
534 + };
535 +
536 + conf-en8811-pwr-b {
537 + pins = "GPIO_12";
538 + drive-strength = <MTK_DRIVE_8mA>;
539 + bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
540 + output-low;
541 + };
542 + };
543 +
544 + mmc0_pins_default: mmc0default {
545 + mux {
546 + function = "flash";
547 + groups = "emmc_51";
548 + };
549 +
550 + conf-cmd-dat {
551 + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2",
552 + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5",
553 + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD";
554 + input-enable;
555 + drive-strength = <MTK_DRIVE_4mA>;
556 + bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
557 + };
558 +
559 + conf-clk {
560 + pins = "EMMC_CK";
561 + drive-strength = <MTK_DRIVE_6mA>;
562 + bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
563 + };
564 +
565 + conf-dsl {
566 + pins = "EMMC_DSL";
567 + bias-pull-down = <MTK_PUPD_SET_R1R0_10>;
568 + };
569 +
570 + conf-rst {
571 + pins = "EMMC_RSTB";
572 + drive-strength = <MTK_DRIVE_4mA>;
573 + bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
574 + };
575 + };
576 +
577 + spi_flash_pins: spi0-pins-func-1 {
578 + mux {
579 + function = "flash";
580 + groups = "spi0", "spi0_wp_hold";
581 + };
582 +
583 + conf-pu {
584 + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP";
585 + drive-strength = <MTK_DRIVE_8mA>;
586 + bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
587 + };
588 +
589 + conf-pd {
590 + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO";
591 + drive-strength = <MTK_DRIVE_8mA>;
592 + bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
593 + };
594 + };
595 +
596 + pwm_pins: pwm0-pins-func-1 {
597 + mux {
598 + function = "pwm";
599 + groups = "pwm0";
600 + };
601 + };
602 +};
603 +
604 +&pwm {
605 + pinctrl-names = "default";
606 + pinctrl-0 = <&pwm_pins>;
607 + status = "okay";
608 +};
609 +
610 +&spi0 {
611 + #address-cells = <1>;
612 + #size-cells = <0>;
613 + pinctrl-names = "default";
614 + pinctrl-0 = <&spi_flash_pins>;
615 + status = "okay";
616 + must_tx;
617 + enhance_timing;
618 + dma_ext;
619 + ipm_design;
620 + support_quad;
621 + tick_dly = <1>;
622 + sample_sel = <0>;
623 +
624 + spi_nand@0 {
625 + compatible = "spi-nand";
626 + reg = <0>;
627 + spi-max-frequency = <20000000>;
628 +
629 + partitions {
630 + compatible = "fixed-partitions";
631 + #address-cells = <1>;
632 + #size-cells = <1>;
633 +
634 + partition@0 {
635 + label = "bl2";
636 + reg = <0x0 0x200000>;
637 + };
638 +
639 + partition@200000 {
640 + label = "ubi";
641 + reg = <0x200000 0x7e00000>;
642 + };
643 + };
644 + };
645 +
646 +};
647 +
648 +&uart0 {
649 + status = "okay";
650 +};
651 +
652 +&watchdog {
653 + status = "disabled";
654 +};