On the BPI-R3, there is a small side affect when only switching switch D down (and leaving the rest up).
In this combination, it is possible to load the bl2 from sector 34 an up on the EMMC, from /dev/mmcblk0. The difference is that mmcblk0boot0 is not being used. bl2 gets written together with the rest of the image.
This way the entire image needs only written to 1 device (similar to SDMMC).
In the makefile, change all declarations:
BROM_HEADER_TYPE :=
to
BROM_HEADER_TYPE ?=
and then build an emmc atf image, passing BOOT_DEVICE=emmc and BROM_HEADER_TYPE=sdmmc on the make command line.
On the BPI-R3, add new spi nand Flash(QE bit set 0 off default). but NMBM don’t support, all block be sacnned bad block, also i add spim driver .C file’s .init struct setting, not work again. Could you take me how to fix it?
startup err log:
…
spi nand driver file’s init struct:
NMBM LA data(By Acute logic analyzer): (That show nmbm set ecc off, and not set QE bit =1)
make clean
make CROSS_COMPILE="~/BPI-R3-OPENWRT-V21.02.3-main/staging_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl/bin/aarch64-openwrt-linux-" -f Makefile PLAT=“mt7986” BOOT_DEVICE=“snand” BL33="~/mt7986av_dir_home/uboot_files/u-boot-snfi-xtxtect-"$(date +’%Y%m%d’)".bin" NAND_TYPE=“hsm:2k+128” NMBM=“1” DRAM_USE_DDR4=“1” all fip
for UBOOT:
make clean
make mt7986_snfi_nand_rfb_defconfig
make CROSS_COMPILE="~/BPI-R3-OPhttps://forum.banana-pi.org/t/tutorial-build-customize-and-use-mediatek-open-source-u-boot-and-atf/13785/38ENWRT-V21.02.3-main/staging_dir/toolchain-aarch64_cortex-a53_gcc-8.4.0_musl/bin/aarch64-openwrt-linux-"
Thx. I’m confusing SNFI and NFI, and boot be supperted NFI for spi-nand? (If be supperted NFI, How to config?)
I use openwrt-v21.02.3 to built image, but startup log not show any ‘mtk-snand’ 's infomation,also “MediaTek SPI NAND flash controller driver” be selected.
NFI stands for NAND Flash Interface.
NFI controller can support Parallel NAND, SPI-NAND or both.
When NFI controller is interfacing with SPI-NAND, it’s called Serial NAND Flash Interface, i.e. SNFI.
The NFI controller uses its own HW ECC engine, for both Parallel NAND and SPI-NAND.
The On-die ECC engine of SPI-NAND will not be used by SNFI.
In kernel, driver named NFI only interfaces with Parallel NAND:
drivers/mtd/nand/raw/mtk_nand.c
There’s no driver for SNFI in mainline kernel.
The official driver is mtk-snand.
Starting from filogc MT7986, a new SPI master controller was added and it supports spi-mem type QSPI (called SPIM).
When connecting SPI-NAND to this interface, it will be driven by kernel’s standard spi-nand framework.
Since the kernel’s standard spi-nand framework is used, it will enable the On-die ECC, and nothing to do with SNFI.
This boot option is called SPIM-NAND.
BPI-R3 supports booting from SD/eMMC/SPI-NOR/SPIM-NAND, but no SNFI.
SD/eMMC share with one MMC controller, and SPI-NOR/SPIM-NAND/SNFI have their own controller interface.
When the bootstrap switch is set to boot from SPIM-NAND, the bootrom will initialize the SPIM controller and corresponding spi-nand driver using on-die ECC.
Since the page layout of SNFI is different from which of on-die ECC, you can’t connect a SPI-NAND with SNFI page layout to the SPIM-NAND interface. The bootrom won’t recognize it.
please do not use current ATF-code as i identified a memory-issue (only seen while booting linux, boot till uboot seems fine) with the new ATF-code (common BL2 code for different SoC).
branches from last year should work, but not from (at least july) this year
the issue causes SIGFAULT/SIGSEV in linux userspace at different positions while bootup…mostly before loginprompt.
if using code in my uboot-repo mtk-atf is good (but not support mt7988/bpi-r4),mtk-atf-r4 is broken
Oh, that’s sad. But on MT7981 and MT7988 it is still present, right?
I liked the approach of having the bare SLC NAND cells on an SPI connected IC, and have BCH (which is usually better and faster than any on-die ECC) carried out by the SoC…
Yes. And SNFI may still exists in future platform, but no actual reference design released.
One of the major reason that we retire SNFI is the fact that it increases the difficulty for factory production. The original rom image must be converted by a dedicated BCH tool to add parity code before it can be programmed into flash. Not all manufacturers can handle this correctly.