i.MX6: nand: add nandbcb command for imx
authorShyam Saini <shyam.saini@amarulasolutions.com>
Wed, 10 Jul 2019 19:19:45 +0000 (14:19 -0500)
committerHan Xu <han.xu@nxp.com>
Tue, 16 Jul 2019 03:25:28 +0000 (22:25 -0500)
commit49538a2593b27c38dcfff4d2bebb3c319e97fa1e
treeb3b1ef442d329714a5c61ed3fb9eb95b078b1ad3
parentbdb832ae21d6a034327f8197dc2f547c53402b33
i.MX6: nand: add nandbcb command for imx

Writing/updating boot image in nand device is not
straight forward in i.MX6 platform and it requires
boot control block(BCB) to be configured.

It becomes difficult to use uboot 'nand' command to
write BCB since it requires platform specific attributes
need to be taken care of.

It is even difficult to use existing msx-nand.c driver by
incorporating BCB attributes like mxs_dma_desc does
because it requires change in mtd and nand command.

So, cmd_nandbcb implemented in arch/arm/mach-imx

BCB contains two data structures, Firmware Configuration Block(FCB)
and Discovered Bad Block Table(DBBT). FCB has nand timings,
DBBT search area, page address of firmware.

On summary, nandbcb update will
- erase the entire partition
- create BCB by creating 2 FCB/DBBT block followed by
  1 FW block based on partition size and erasesize.
- fill FCB/DBBT structures
- write FW/SPL on FW1
- write FCB/DBBT in first 2 blocks

for nand boot, up on reset bootrom look for FCB structure in
first block's if FCB found the nand timings are loaded for
further reads. once FCB read done, DTTB will load and finally
firmware will be loaded which is boot image.

Refer section "NAND Boot" from doc/imx/common/imx6.txt for more usage
information.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Sergey Kubushyn <ksi@koi8.net>
Signed-off-by: Shyam Saini <shyam.saini@amarulasolutions.com>
Signed-off-by: Han Xu <han.xu@nxp.com>
arch/arm/include/asm/mach-imx/imx-nandbcb.h [new file with mode: 0644]
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/cmd_nandbcb.c [new file with mode: 0644]
doc/imx/common/imx6.txt
drivers/mtd/nand/raw/mxs_nand.c
drivers/mtd/nand/raw/mxs_nand.h [deleted file]
drivers/mtd/nand/raw/mxs_nand_dt.c
drivers/mtd/nand/raw/mxs_nand_spl.c
include/mxs_nand.h [new file with mode: 0644]