imx: add writebcb command
Subsystems (2)
RFC PATCH 1/1 imx: add writebcb command
From: Stefan Agner <[email protected]>
Add writebcb command which creates a NAND Boot Configuration Block (BCB) at the beginning of the active flash device. The BCB stores the information for the SoC internal boot ROM where the application with a valid IVT header can be found on the NAND device. The first two argument of the command need an offset of the NAND device where the primary and secondary application can be found.
Typically, U-Boot is the application which gets loaded by the boot ROM. Hence, the offset address need to be the address where U-Boot (u-boot.imx along with a 0x400 long prefix) is stored on the device. At least one location is mandatory.
Currently only the FCB (Firmware Configuration Block) is written to the device. The DBBT (Discovered Bad Block Table) is optional and not created by writebcb currently.
---
Hi,
I send this a s a discussion base for "i.MX6: nand: add nandbcb update command"
https://www.mail-archive.com/u-boot at lists.denx.de/msg277500.html
This is the implementation for Vybrid which has a different NAND flash controller IP than i.MX 6. It was based on do_nand_boot_update from the downstream U-Boot for Vybrid:
http://git.toradex.com/cgit/u-boot-toradex.git/tree/drivers/mtd/nand/fsl_nfc.c?h=2011.12-colibri_vf#n1048
We used this as a base for a very similar implementation for i.MX 7 and i.MX 6ULL support. Those SoCs use the GPMI NAND IP like i.MX 6.
Compared to Jagan's proposal this command only does a minimal thing, especially it does not write the firmware length (sectors_in_firmware1/2, which is fw1/2_pages in Jagans patchset). It seems not to be strictly required by any NXP boot ROMs so far. This allows to update the firmware (SPL/U-Boot) independently of the boot block, which is nice since boot block is usually written to the first erease block which is often only has a limited erase cycle guaranteed by the NAND flash manufacturer.
Furthermore, it does not mandates a particular spacing between the boot loaders. One can simply pass the offset for each instance.
Note that I think the final patch should be based on Jagans proposal since the implemenation is more advanced and clear. It is just that aspect which I like more in this implementation.
--
Stefam
arch/arm/imx-common/Makefile | 1 + arch/arm/imx-common/cmd_writebcb.c | 187 +++++++++++++++++++++++++++++ include/configs/colibri_vf.h | 1 + scripts/config_whitelist.txt | 1 + 4 files changed, 190 insertions(+) create mode 100644 arch/arm/imx-common/cmd_writebcb.c
arch/arm/imx-common/Makefile +1 -0
@@ -37,6 +37,7 @@ endif obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o +obj-$(CONFIG_CMD_WRITEBCB) += cmd_writebcb.o PLUGIN = board/$(BOARDDIR)/plugin
arch/arm/imx-common/cmd_writebcb.c new file +187 -0
187 lines not on this page · raw message
include/configs/colibri_vf.h +1 -0
@@ -43,6 +43,7 @@/* NAND support */ #define CONFIG_CMD_NAND +#define CONFIG_CMD_WRITEBCB #define CONFIG_SYS_NAND_ONFI_DETECTION #define CONFIG_SYS_MAX_NAND_DEVICE 1#define CONFIG_SYS_NAND_BASE NFC_BASE_ADDR
scripts/config_whitelist.txt +1 -0
@@ -649,6 +649,7 @@ CONFIG_CMD_UNIVERSE CONFIG_CMD_UNZIP CONFIG_CMD_USB_STORAGE CONFIG_CMD_UUID +CONFIG_CMD_WRITEBCB CONFIG_CMD_ZBOOT CONFIG_CMD_ZFS CONFIG_CM_INIT
Signature · 1 line
2.17.0
RFC PATCH 1/1 cmd_writebcb_mx7: add command to write FCB and DBBT for i.MX 7
From: Max Krummenacher <[email protected]>
Code mostly ported from imx-kobs-5.3.
MTD partitioning is set accordingly.
writebcb: Write Boot Control Block (FCB and DBBT)
--- arch/arm/imx-common/Makefile | 1 + arch/arm/imx-common/cmd_writebcb_mx7.c | 443 + cmd/nand.c | 4 +- include/configs/colibri_imx7.h | 2 + include/rand.h | 16415 +++++++++++++++++++++++ scripts/config_whitelist.txt | 1 + 6 files changed, 16864 insertions(+), 2 deletions(-) create mode 100644 arch/arm/imx-common/cmd_writebcb_mx7.c create mode 100644 include/rand.h
arch/arm/imx-common/Makefile +1 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o obj-$(CONFIG_CMD_DEKBLOB) += cmd_dek.o obj-$(CONFIG_CMD_WRITEBCB) += cmd_writebcb.o +obj-$(CONFIG_CMD_WRITEBCB_MX7) += cmd_writebcb_mx7.o PLUGIN = board/$(BOARDDIR)/plugin
arch/arm/imx-common/cmd_writebcb_mx7.c new file +443 -0
443 lines not on this page · raw message
cmd/nand.c +2 -2
@@ -304,8 +304,8 @@ static void nand_print_and_set_info(int idx)setenv_hex ("nand_erasesize" , mtd->erasesize); } -static int raw_access (struct mtd_info *mtd,ulong addr,loff_t off, -ulong count,int read,int no_verify) +int raw_access (struct mtd_info *mtd,ulong addr,loff_t off, +ulong count,int read,int no_verify) {int ret =0 ;
include/configs/colibri_imx7.h +2 -0
@@ -175,6 +175,8 @@#endif #define CONFIG_NAND_MXS +#define CONFIG_BCH +#define CONFIG_CMD_WRITEBCB_MX7 #define CONFIG_CMD_NAND_TRIMFFS /* NAND stuff */
include/rand.h new file +16415 -0
2,532 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.17.0
Part of the diff is not shown here. View the raw message.