From 27aeed3b8a92004510680e51fd459d2ec5d589d2 Mon Sep 17 00:00:00 2001 From: Dmitry Ermakov <7954832+dimerr@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:36:31 +0000 Subject: [PATCH] fullhan: FH8626V100 boots a 4.9 kernel, so its flash is spi0.0 OpenIPC runs FH8626V100 on the 4.9.129 fullhan-fh8852v200 kernel, but this port gave it the 3.0.8 parts' flash name: - mtdids defaulted to "spi_flash", the 3.0.8 m25p80 platform data's name. Under 4.9 the flash is the SPI device "spi0.0", so the kernel ignored mtdparts, used its built-in table, and panicked on a camera: "VFS: Unable to mount root fs on unknown-block(31,3)". The default is now spi0.0. An environment that an earlier build saved with exactly "spi_flash" is corrected at boot, and only on FH8626V100. FH_ATAG_PHYMODE stays: the 4.9 kernel only logs "Ignoring unrecognised tag 0x41000601" for it, and a 3.0.8 vendor kernel booted by this U-Boot needs it for RMII. In qemu-hisilicon's fh8626v100 machine, booting the fh8626v100_lite image from flash through U-Boot: - the released build: mtdparts=spi_flash, VFS panic, as on the camera; - this build, blank environment: mtdparts=spi0.0, login prompt; - this build after `setenv mtdids spi_flash; saveenv; reset`: mtdparts=spi0.0, login prompt, also on the boot after. --- common/openipc.c | 25 +++++++++++++++++++++++-- include/configs/openipc-common.h | 9 ++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/common/openipc.c b/common/openipc.c index e8e1adb42383..0439a3b4f6fe 100644 --- a/common/openipc.c +++ b/common/openipc.c @@ -130,6 +130,23 @@ static ulong kernel_image_size(void *buf) { return 0; } +#ifdef SFC +/* + * FH8626V100 U-Boots before this one defaulted mtdids to the 3.0.8 kernels' + * "spi_flash", but OpenIPC boots FH8626V100 on 4.9, where the flash is + * "spi0.0": with the old name saved, the kernel ignores mtdparts and cannot + * mount its root. Only that exact value is replaced. + */ +static int stale_mtdids(const char *ids) +{ +#ifdef CONFIG_FULLHAN_8626 + return !strcmp(ids, "spi_flash"); +#else + return 0; +#endif +} +#endif + static int scan_spi_device(struct spi_flash *flash, ulong *kernel_off, ulong *rootfs_off, uint64_t *kernel_size, uint64_t *rootfs_size) { u8 *buf; @@ -842,8 +859,10 @@ int firmware_scan(void) { sprintf(str, "0x%lx", root_slot); env_set("rootsize", str); #ifdef SFC - if (!mtdids || !*mtdids) + if (!mtdids || !*mtdids || stale_mtdids(mtdids)) { mtdids = SFC; + env_set("mtdids", mtdids); + } #endif /* U-Boot's own idea of the flash; the kernel is not told. */ sprintf(mtds, "%dk(u-boot),%dk(env),-(firmware)", @@ -889,8 +908,10 @@ int firmware_scan(void) { * build drives, as its own default environment does. */ #ifdef SFC - if (!mtdids || !*mtdids) + if (!mtdids || !*mtdids || stale_mtdids(mtdids)) { mtdids = SFC; + env_set("mtdids", mtdids); + } #endif sprintf(mtds, "%dk(u-boot),%dk(env),%lldk(kernel),%lldk(rootfs),%lldk@0x%lx(firmware),-(rootfs_data)", CONFIG_ENV_OFFSET / 1024, CONFIG_ENV_SIZE / 1024, kernel_size / 1024, rootfs_size / 1024, diff --git a/include/configs/openipc-common.h b/include/configs/openipc-common.h index 0e08b65d94e3..2e3dae5c0dff 100644 --- a/include/configs/openipc-common.h +++ b/include/configs/openipc-common.h @@ -96,10 +96,13 @@ "bootflash=run fwrecovery; setenv setargs setenv bootargs ${bootargs}; run setargs; run loadkernel; bootm ${baseaddr}; reset\0" /* - * The flash's MTD name in the vendor kernels: the SPI device under 4.9's - * spi-nor, the m25p80 platform data's name under 3.0.8 + * The flash's MTD name in the kernels OpenIPC boots: the SPI device under + * 4.9's spi-nor, the m25p80 platform data's name under 3.0.8. FH8626V100 + * runs 4.9 (OpenIPC/linux fullhan-fh8852v200), whatever the vendor's + * 3.0.8 SDK for it used. */ -#if defined(CONFIG_FULLHAN_V200) || defined(CONFIG_FULLHAN_865X) +#if defined(CONFIG_FULLHAN_V200) || defined(CONFIG_FULLHAN_865X) || \ + defined(CONFIG_FULLHAN_8626) #define SFC "spi0.0" #else #define SFC "spi_flash"