mtd: Kconfig: add a Kconfig option to enable the support for MTD block write operations
This allows using CONFIG_IS_ENABLED(SPLMTD_WRITE) to compile out code needed only if write support is required. The option is added for u-boot and for SPL. Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com> Change-Id: Ia48169fcd601ad51d1723923ed71d610901275e1
This commit is contained in:
parent
5beee4e829
commit
a0166cc6be
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue