Repository navigation
novatek: SPI NAND images for the NT98560, NT98562, NT98566 and NT98525 - #101
Conversation
The same flash controller as NA51090's. Set its clock, reset, pins,
pads and PHY delay up as the camera SDKs' spinand.c drv_nand_reset()
("52x, 560") and nand_phy_config() do: CLKEN0/RSTN0 bit 0, the pins in
TOP+0x04 bit 13, the divider in CG+0x40, the controller's SRAM on, at
the tree's /nand clock (40 MHz); NA51089's sampling delay of 5, none on
NA51055 up to 96 MHz.
build.sh <soc>-nand builds u-boot-<soc>-nand.bin in the SDKs' NAND layout (cfg_*_IPCAM1_EVB), 128 KiB blocks: the loader, built with STORAGEINT=NandSpi, at 0; the tree at 0x40000 and its copy at 0x80000; U-Boot at 0xC0000. The environment follows at 0x2C0000 and UBI from 0x300000, spi_nand.0:2816k(boot),256k(env),-(ubi), as on openipc-hisilicon. The NAND trees are the boards' plus nvt-nand.dtsi: the loader takes its partitions from /nand. The NT98525's NAND loader is 34.5 KiB with its SD card update and goes without it (STORAGEEXT=NONE), as the 528 model's.
PR Summary by QodoAdd SPI NAND boot images for four Novatek SoCs
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo
1.
|
nand write skips a bad block and goes on in the next, so one write of the whole image let a bad block in the boot area shift the device tree or U-Boot off the offsets the loader reads. Write the loader, both trees and U-Boot each at its partition's start, only as long as it is, and have nvt-image.py leave every partition a spare block. Refuse an image that is not past 0xC0000 (a NOR one) before erasing anything. Under qemu, with block 0x40000 or 0xC0000 marked bad, run ub and reset boot: the loader skips the bad block too.
This reverts commit c329f77.
Adds SPI NAND images for the NT98560, NT98562 and NT98566 (NA51089) and the NT98525 (NA51055).
bash build.sh <soc>-nandbuildsoutput/u-boot-<soc>-nand.bin. The NOR images are unchanged.Layout
This is the vendor SDKs' NAND board layout (
cfg_*_IPCAM1_EVB), in 128 KiB blocks:0x0STORAGEINT=NandSpi0x400000x80000fdt.restore)0xC00000x2C00000x300000The kernel gets
mtdparts=spi_nand.0:2816k(boot),256k(env),-(ubi), and the environment works the same way as on the other OpenIPC SPI NAND targets (ubwrite/urwrite/loadkernel). The image file is 1 MiB.${ubwrite}erases the 2816 KiB boot area and writes the image at 0.Changes
nvt_spinand.c: the NT98633 driver gains the NA51089/NA51055 clock, reset, pin, pad and PHY-delay setup, following the vendorspinand.cdrv_nand_reset()("52x, 560" branch) andnand_phy_config(). The clock comes from the tree's/nandnode (40 MHz).openipc/<soc>-nand.dtsis the board's tree plusopenipc/nvt-nand.dtsi. That file puts the partitions and the nvtpack index in/nand, where the NandSpi loader looks for them, disables and empties/nor, and setsnvt_infoEMBMEM.nvt-image.py --nandpacks the NAND layout.openipc/nand_configadds NAND, UBI and UBIFS and an 8 MiB malloc, andnovatek.hholds the offsets.STORAGEEXT=NONE), as the NT98528's already is. U-Boot's SD recovery is unaffected.Testing
Nothing has been tested on real hardware yet. Everything below was run in QEMU (qemu-hisilicon), where a 128 MiB image is a W25N01 and the mask ROM model runs the NandSpi loader from block 0:
nand write/readand a 2 MBubi create/write/readcompare equal.run ub(the image over TFTP), thenreset, boots the rewritten image and the volume is still there.run urwith a UBIFS rootfs carrying/boot/uImage(built from the nt98562 lite firmware), thenbootflash, loads the kernel from UBIFS and starts it. The kernel then panics at the rootfs mount: the lite kernel is a NOR-only build with no SPI NAND or UBI drivers. A full NAND boot needs OpenIPC firmware built with them.The CI legs are in a separate PR against
openipc.