[PATCH v2 2/9] mtd: spi: enable spi_nor_remove() in soft reset config
Kathpalia, Tanmay
tanmay.kathpalia at altera.com
Wed May 27 15:40:39 CEST 2026
On 5/20/2026 4:15 PM, Guodong Xu wrote:
> From: Raymond Mao <raymond.mao at riscstar.com>
>
> spi_nor_remove() is only implemented in spi-nor-core.o, not spi-nor-tiny.o.
>
> So make spi_nor_remove() only valid for CONFIG_SPI_FLASH_SOFT_RESET.
>
> Signed-off-by: Raymond Mao <raymond.mao at riscstar.com>
> Signed-off-by: Guodong Xu <guodong at riscstar.com>
>
> ---
> v2:
> - No change.
> ---
> drivers/mtd/spi/sf_probe.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
> index 7100b64bf22..dee03662d45 100644
> --- a/drivers/mtd/spi/sf_probe.c
> +++ b/drivers/mtd/spi/sf_probe.c
> @@ -229,9 +229,11 @@ static int spi_flash_std_remove(struct udevice *dev)
> spi_mem_dirmap_destroy(flash->dirmap.rdesc);
> }
>
> - ret = spi_nor_remove(flash);
> - if (ret)
> - return ret;
> + if (CONFIG_IS_ENABLED(SPI_FLASH_SOFT_RESET)) {
> + ret = spi_nor_remove(flash);
> + if (ret)
> + return ret;
> + }
>
> if (CONFIG_IS_ENABLED(SPI_FLASH_MTD))
> spi_flash_mtd_unregister(flash);
The tiny configuration is already handled by the inline stub in spi-nor.h,
where spi_nor_remove() is a no-op for SPI_FLASH_TINY. So I think adding a
SPI_FLASH_SOFT_RESET guard around the remove call does not provide
additional value.
More information about the U-Boot
mailing list