Repository navigation
novatek: nt9856x: add Fudan FM25S01A SPI NAND and enable nvt-rng on NA51089 - #330
Conversation
PR Summary by QodoSupport FM25S01A SPI NAND and enable Novatek RNG on NA51089
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
…ixes Keep the bridge patches aligned with OpenIPC/linux#330: - Label FM25S01A as 1Gbit (128 MiB) instead of 1GiB. - Leave nvt-rng quality at default 0 (enable Kconfig for NA51089 only).
openipc-ai
left a comment
There was a problem hiding this comment.
Thanks. The RNG half checks out on hardware. The flash half needs one driver change before it merges.
What I verified. I built rng-core and nvt-rng.c from novatek-nt9856x as modules against a 4.19.91 nt98566 tree and loaded them on a lab NT98566 (stock NOR board, today's nightly). The node is rng@f0680000 (nvt,nvt_rng), and both clocks (f0680000.rng, f0680000.rngro) exist on NA51089. The probe registers, and /dev/hwrng gives 2.5 MB/s. A 4 MiB sample had 119 repeated 32-bit words where a uniform source expects 128, χ² on the 16-bit halves was 65273 and 65170 (df 65535), and byte χ² was 281 (df 255). So relaxing the depends on is fine.
Changes requested
- Set the ECC strength and bitflip threshold for FM25S01A. The part has 1-bit on-die ECC per 512 B (your U-Boot PR #211 declares
NAND_ECC_INFO(1, SZ_512)). In this driver it falls through to theelsearm of the threshold block inspinand_probe(), soecc.strengthstays 4 andbitflip_threshold = DIV_ROUND_UP(4*3, 4) = 3.spinand_read_page_hwecc()reports 1 corrected bit for an unlisted vendor, so a read never reaches the threshold and never returns-EUCLEAN. UBI therefore never scrubs a page that has already used its only correctable bit, and the next flip in that sector is an uncorrectable read inrootfs. Add aMFG_ID_FUDAN(0xA1) define beside the others, use it in the ID table, and give itecc.strength = 1; bitflip_threshold = 1, as the 1-bit Winbond andMICRON_MT29F1G01AAarms already do. - Paste the probe output from the Dahua board, not a summary. I need the spinand identify lines from
dmesg,cat /sys/class/mtd/mtd*/{name,ecc_strength,bitflip_threshold}after fix 1, and the UBI attach lines (they show bad PEBs andmax_ec). - Squash into two commits with accurate messages.
256d8a7860's title still says "set quality to 1000", and53ef6d19f9then reverts that. The history should carry what merges: one commit for the flash entry and one for the Kconfig dependency.
Merge order with OpenIPC/firmware#2970: this one lands first. The firmware build fetches the novatek-nt9856x branch tarball, not a pinned revision, so the firmware PR has to drop its local copies of these patches. Details are on that PR.
Add MFG_ID_FUDAN (0xA1) and Fudan Microelectronics FM25S01A (ID 0xA1 0xE4, 128 MiB / 1 Gbit, 2048 B page, 128 KiB eraseblock, 64 B OOB, 1-bit on-die ECC) to the Novatek SPI NAND driver, setting ecc.strength = 1 and bitflip_threshold = 1 in spinand_probe() so UBI scrubs single-bit flips. Tested on Dahua DH-IPC-HFW2449SP-S-IL (Novatek NT98566 / NA51089, 128 MB DDR3, Fudan FM25S01A 128 MiB SPI NAND ID 0xA1 0xE4, SC430AI).
Allow CONFIG_HW_RANDOM_NVT on NVT_IVOT_PLAT_NA51089 (NT9856x). Tested on Dahua DH-IPC-HFW2449SP-S-IL (Novatek NT98566 / NA51089, 128 MB DDR3, Fudan FM25S01A 128 MiB SPI NAND ID 0xA1 0xE4, SC430AI).
|
Updated and squashed into two clean commits (
Hardware probe output |
53ef6d1 to
b6d67d8
Compare
…CI entry Add nt98566_ultimate_defconfig, Kconfig-ordered nt98566.nand.config (SPI NAND + HWECC, UBI/UBIFS, OF partitions, HW_RANDOM_NVT), ubinize-nand.cfg (rootfs + autoresize rootfs_data), exfat-openipc + exfatprogs, and register nt98566_ultimate in ci-matrix.py. Note: Novatek's drivers/mtd/spiflash/Kconfig defines MTD_SPINOR with 'depends on (MTD) && (!MTD_SPINAND)', so a single NT98566 kernel cannot enable both SPI NOR and SPI NAND simultaneously; nt98566_ultimate is therefore SPI NAND only (nt98566_lite continues to cover SPI NOR). Depends on OpenIPC/linux#330 (FM25S01A + nvt-rng Kconfig) and OpenIPC/u-boot#211. Tested on Dahua DH-IPC-HFW2449SP-S-IL (Novatek NT98566 / NA51089, 128 MB DDR3, Fudan FM25S01A 128 MiB SPI NAND ID 0xA1 0xE4, SC430AI).
openipc-ai
left a comment
There was a problem hiding this comment.
Approved. MFG_ID_FUDAN now has ecc.strength = 1 and bitflip_threshold = 1, and the board shows ecc_strength=1 bitflip_threshold=1 on every partition, so UBI will scrub a page once it has used its one correctable bit. The probe output, the UBI attach lines and the writes behind the rootfs_data mount and the sysupgrade run on OpenIPC/firmware#2970 cover the flash half. The RNG half matches what I measured on the lab NT98566. The history is two clean commits.
This lands before OpenIPC/firmware#2970, whose nt98566_ultimate kernel config relies on both changes.
…CI entry Add nt98566_ultimate_defconfig, Kconfig-ordered nt98566.nand.config (SPI NAND + HWECC, UBI/UBIFS, OF partitions, HW_RANDOM_NVT), ubinize-nand.cfg (rootfs + autoresize rootfs_data), exfat-openipc + exfatprogs, and register nt98566_ultimate in ci-matrix.py. Note: Novatek's drivers/mtd/spiflash/Kconfig defines MTD_SPINOR with 'depends on (MTD) && (!MTD_SPINAND)', so a single NT98566 kernel cannot enable both SPI NOR and SPI NAND simultaneously; nt98566_ultimate is therefore SPI NAND only (nt98566_lite continues to cover SPI NOR). Depends on OpenIPC/linux#330 (FM25S01A + nvt-rng Kconfig) and OpenIPC/u-boot#211. Tested on Dahua DH-IPC-HFW2449SP-S-IL (Novatek NT98566 / NA51089, 128 MB DDR3, Fudan FM25S01A 128 MiB SPI NAND ID 0xA1 0xE4, SC430AI).
Adds Fudan Microelectronics
FM25S01ASPI NAND support and enables the hardware RNG driver (nvt-rng) on Novatek NA51089 / NT98566:drivers/mtd/spiflash/spinand.c— addsFM25S01A 1Gbit 3.3V(0xA1 0xE4, 128 MiB / 1 Gbit, 2048 B page, 128 KiB eraseblock, 64 B OOB).drivers/char/hw_random/Kconfig— allowsCONFIG_HW_RANDOM_NVTonNVT_IVOT_PLAT_NA51089(leavingrng.qualityat default0sincenvt_rng_read()performs unchecked register reads).Companion PRs:
Hardware Testing
Tested on Dahua DH-IPC-HFW2449SP-S-IL (
DHI-IPC-HFW2449SP-S-IL-0280B):0xA1 0xE4)Verified SPI NAND probe, UBI/UBIFS
rootfs+rootfs_datamount, and/dev/hwrngprobe on cold boot from OpenIPC U-Boot 2022.10.