From f47a2399d864080c1bd0c03991ac8047eb4bdc83 Mon Sep 17 00:00:00 2001 From: Dmitry Ermakov <7954832+dimerr@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:53:21 +0000 Subject: [PATCH] hi3516cv6xx: bsp-sfc: do not use quad A Hi3516CV610 with a KH25L12833FM2I-10GY (ID c2 20 18) panics at boot: bsp-sfc bsp_spi_nor.0: spi nor register fail! bsp-sfc: probe of bsp_spi_nor.0 failed with error -5 VFS: Cannot open root device "mtdblock3" or unknown-block(0,0): error -6 The ID already matches mx25l12835f, whose SPI_NOR_QUAD_READ makes spi_nor_init() set QE through spi_nor_sr1_bit6_quad_enable(). OpenIPC U-Boot before u-boot#105 hands over a Macronix part with WEL set, the SR value read back after the write has WEL clear, and the comparison fails with -EIO. A K662C6S shows the same failure (defib#148). Quad gives more problems than benefits on these cameras, and the other OpenIPC kernels already run without it. Take the quad modes out of bsp-sfc, at probe and at resume. spi_nor_quad_enable() then returns early, SR is not written, and the probe no longer depends on the state U-Boot left, so cameras with the old U-Boot boot too. Reads drop to 1-2-2 on this part, at the same 84 MHz. CLOSE_SPI_8PIN_4IO no longer has any effect here: the OpenIPC config leaves it unset, so that alone could not turn quad off from this tree. With no quad in hwcaps, spi_nor_dtrclear_pinreset() now reaches spi_nor_sr3_to_reset() on Winbond and GigaDevice parts. That writes SR3 with no WREN before it, so it should do nothing with WEL clear. Build-tested only: drivers/mtd/spi-nor with the hi3516cv6xx config from OpenIPC/firmware. --- drivers/mtd/spi-nor/controllers/bsp-sfc.c | 7 ------- drivers/mtd/spi-nor/core.c | 7 ------- 2 files changed, 14 deletions(-) diff --git a/drivers/mtd/spi-nor/controllers/bsp-sfc.c b/drivers/mtd/spi-nor/controllers/bsp-sfc.c index bf6706de7dc..34f67d94e24 100644 --- a/drivers/mtd/spi-nor/controllers/bsp-sfc.c +++ b/drivers/mtd/spi-nor/controllers/bsp-sfc.c @@ -619,13 +619,6 @@ static int bsp_spi_nor_register(struct device_node *np, nor->priv = priv; nor->controller_ops = &bsp_controller_ops; -#ifndef CONFIG_CLOSE_SPI_8PIN_4IO - hwcaps.mask |= SNOR_HWCAPS_READ_1_1_4 | - SNOR_HWCAPS_READ_1_4_4 | - SNOR_HWCAPS_PP_1_1_4 | - SNOR_HWCAPS_PP_1_4_4; -#endif - ret = spi_nor_scan(nor, NULL, &hwcaps); if (ret) return ret; diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 016d48b854f..5c846281317 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3424,13 +3424,6 @@ int bsp_spi_nor_resume(struct spi_nor *nor) #endif SNOR_HWCAPS_PP, }; -#ifndef CONFIG_CLOSE_SPI_8PIN_4IO - hwcaps.mask |= SNOR_HWCAPS_READ_1_1_4 | - SNOR_HWCAPS_READ_1_4_4 | - SNOR_HWCAPS_PP_1_1_4 | - SNOR_HWCAPS_PP_1_4_4; -#endif - if (!info) info = spi_nor_read_id(nor);