Hello @SinoVoip ,
Can you please release preloader to boot from SPI NAND flash ?
Flash layout may be as for MT7622-RFB1.
Thank you
1 Like
dangowrt
(Daniel Golle)
April 12, 2021, 9:56am
2
News:
OpenWrt contributor Oskari Lemmela wrapped up booting the BPi-R64 entirely from the SPI-NAND chip. SD Card will allow installing OpenWrt to SPI-NAND.
Ie. you may now download SD Card image , boot the R64 with that card and use the menu to install everything to SPI-NAND.
frank-w
(Frank W.)
April 12, 2021, 2:16pm
3
Thank you, can you point me to the atf-changes/compile options needed for binary blobs?
Thank you for the update.
dangowrt
(Daniel Golle)
April 12, 2021, 4:35pm
5
ATF BL2 build options are here:
TFA_IMAGE:=bl2.img bl31.bin
BOOT_DEVICE:=
DDR3_FLYBY:=
endef
define Trusted-Firmware-A/mt7622-nor-1ddr
NAME:=MediaTek MT7622 (SPI-NOR, 1x DDR3)
BOOT_DEVICE:=nor
endef
define Trusted-Firmware-A/mt7622-nor-2ddr
NAME:=MediaTek MT7622 (SPI-NOR, 2x DDR3)
BOOT_DEVICE:=nor
DDR3_FLYBY:=1
endef
define Trusted-Firmware-A/mt7622-snand-1ddr
NAME:=MediaTek MT7622 (SPI-NAND, 1x DDR3)
BOOT_DEVICE:=snand
endef
relevant U-Boot patches:
--- a/arch/arm/dts/mt7622-bananapi-bpi-r64.dts
+++ b/arch/arm/dts/mt7622-bananapi-bpi-r64.dts
@@ -19,7 +19,7 @@
};
aliases {
- spi0 = &snfi;
+ spi0 = &snand;
ethernet0 = ð
};
@@ -205,17 +205,11 @@
};
};
-&snfi {
- pinctrl-names = "default", "snfi";
- pinctrl-0 = <&snor_pins>;
- pinctrl-1 = <&snfi_pins>;
+&snand {
This file has been truncated. show original
+mmc_write_vol=imszb $fileaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$part_size && mmc write $fileaddr 0x$part_addr 0x$image_size
+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size
+part_default=production
+part_recovery=recovery
+reset_factory=eraseenv && reset
+_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; led bpi-r64:pio:blue on ; run _switch_to_menu ; run _init_env ; run boot_first
+_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
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m"
--- /dev/null
+++ b/configs/mt7622_bananapi_bpi-r64-snand_defconfig
@@ -0,0 +1,138 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_SYS_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_BOOTP_SEND_HOSTNAME=y
+CONFIG_NR_DRAM_BANKS=1
frank-w
(Frank W.)
April 12, 2021, 5:23pm
6
my uboot does not know MTK_SPI_NAND, i guess mtd is not needed if i want to use GPT, right?
patch found:
From f22a055a9f589f1ec614045eba3cb0c5fd887feb Mon Sep 17 00:00:00 2001
From: Weijie Gao <[email protected] >
Date: Tue, 2 Mar 2021 16:58:01 +0800
Subject: [PATCH 14/21] drivers: mtd: add support for MediaTek SPI-NAND flash
controller
Add mtd driver for MediaTek SPI-NAND flash controller
This driver is written from scratch, and uses standard mtd framework, not
the nand framework which only applies for raw parallel nand flashes so that
this driver can have a smaller size in binary.
Signed-off-by: Weijie Gao <[email protected] >
---
drivers/mtd/Kconfig | 2 +
drivers/mtd/Makefile | 2 +
drivers/mtd/mtk-snand/Kconfig | 21 +
drivers/mtd/mtk-snand/Makefile | 11 +
drivers/mtd/mtk-snand/mtk-snand-def.h | 266 ++++
drivers/mtd/mtk-snand/mtk-snand-ecc.c | 264 ++++
This file has been truncated. show original
From 0c857d4c9cd9dc8e8ebba18cf9e9b10513ccb35d Mon Sep 17 00:00:00 2001
From: Weijie Gao <[email protected] >
Date: Wed, 3 Mar 2021 08:57:29 +0800
Subject: [PATCH 15/21] mtd: mtk-snand: add support for SPL
Add support to initialize SPI-NAND in SPL.
Add implementation for SPL NAND loader.
Signed-off-by: Weijie Gao <[email protected] >
---
drivers/mtd/mtk-snand/Kconfig | 6 ++
drivers/mtd/mtk-snand/Makefile | 4 +
drivers/mtd/mtk-snand/mtk-snand-spl.c | 132 ++++++++++++++++++++++++++
3 files changed, 142 insertions(+)
create mode 100644 drivers/mtd/mtk-snand/mtk-snand-spl.c
--- a/drivers/mtd/mtk-snand/Kconfig
+++ b/drivers/mtd/mtk-snand/Kconfig
@@ -19,3 +19,9 @@ config MTK_SPI_NAND_MTD
help
This file has been truncated. show original
seems like mtd is needed for this…
frank-w
(Frank W.)
April 13, 2021, 10:21am
7
Can you tell me when is spi-nand booted? Does system check for sd/emmc first and then (if no bootable system found) boot spi-nand? Whats difference to spi-nor?
I guess it makes only sense for openwrt due to mtd depency
dangowrt
(Daniel Golle)
April 14, 2021, 3:08am
8
The physical switch on the R64 controls the NREB signal:
So you have the choice between 1 (=01b) and 3 (=11b) using the hardware switch.
As there are neither SPI-NOR nor (parallel) SLC-NAND chips present on the R64, this results in:
SW1
0: SPI-NAND → eMMC → SDXC
1: SDXC → eMMC
Many. It’s a whole different SPI command set, ie. the BootROM needs a different way to read the preloader. And NAND flash needs special treatment in software in order work reliably: ECC, bad block management, wear-leveling, scrubbing, … ECC is done in hardware on MT7622 (which is nice for performance), all the rest can be achieved by using UBI which is supported by U-Boot as well as the Linux Kernel.
2 Likes