diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 0fbd325442..f29424366c 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -482,6 +482,13 @@ config MTD_BLK_U_BOOT_OFFS Set the offset from the start of the nand,spi nand and nor flash where u-boot should be loaded from. +config SPL_MTD_WRITE + bool "nand & spi nand & spi nor support for write operations in SPL" + depends on SPL_MTD_SUPPORT + default n + help + Enable write access to nand & spi nand & spi nor in SPL + config SPL_MUSB_NEW_SUPPORT bool "Support new Mentor Graphics USB" help diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig index 56b6269a45..321f8b2bd5 100644 --- a/drivers/mtd/Kconfig +++ b/drivers/mtd/Kconfig @@ -17,6 +17,13 @@ config MTD_BLK help Enable mtd block model for Memory Technology Devices (MTD). +config MTD_WRITE + bool "support for nand & spi nand & spi nor write operations" + depends on MTD_BLK + default y + help + Enable write access to nand & spi nand & spi nor + config MTD_NOR_FLASH bool "Enable parallel NOR flash support" help diff --git a/drivers/mtd/mtd_blk.c b/drivers/mtd/mtd_blk.c index e1e3929c42..2ee5b87137 100644 --- a/drivers/mtd/mtd_blk.c +++ b/drivers/mtd/mtd_blk.c @@ -486,6 +486,7 @@ ulong mtd_dread(struct udevice *udev, lbaint_t start, } } +#if CONFIG_IS_ENABLED(MTD_WRITE) ulong mtd_dwrite(struct udevice *udev, lbaint_t start, lbaint_t blkcnt, const void *src) { @@ -598,6 +599,7 @@ ulong mtd_derase(struct udevice *udev, lbaint_t start, return 0; } +#endif static int mtd_blk_probe(struct udevice *udev) { @@ -648,8 +650,8 @@ static int mtd_blk_probe(struct udevice *udev) static const struct blk_ops mtd_blk_ops = { .read = mtd_dread, +#if CONFIG_IS_ENABLED(MTD_WRITE) .write = mtd_dwrite, -#ifndef CONFIG_SPL_BUILD .erase = mtd_derase, #endif };