summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Romanov <avromanov@salutedevices.com>2024-07-18 08:45:28 +0300
committerMichael Trimarchi <michael@amarulasolutions.com>2024-08-08 09:28:09 +0200
commit855f9b6241407d19f01d4245456be428b5d88f52 (patch)
tree455463a04695a164bad917753a1df3e3593aaf22
parentaa5b67ce226267440e64fadc57d3a21e5842027c (diff)
downloadu-boot-855f9b6241407d19f01d4245456be428b5d88f52.tar.gz
u-boot-855f9b6241407d19f01d4245456be428b5d88f52.tar.bz2
u-boot-855f9b6241407d19f01d4245456be428b5d88f52.zip
spinand: bind UBI block
UBI block is virtual block device, which is an abstraction over MTD layer. Therefore it is logical to use it in combination with MTD drivers. Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
-rw-r--r--drivers/mtd/nand/spi/core.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 54a90ff295..f5ddfbf4b8 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -25,6 +25,7 @@
#include <watchdog.h>
#include <spi.h>
#include <spi-mem.h>
+#include <ubi_uboot.h>
#include <dm/device_compat.h>
#include <dm/devres.h>
#include <linux/bitops.h>
@@ -1180,9 +1181,16 @@ static int spinand_bind(struct udevice *dev)
{
if (blk_enabled()) {
struct spinand_plat *plat = dev_get_plat(dev);
+ int ret;
+
+ if (CONFIG_IS_ENABLED(MTD_BLOCK)) {
+ ret = mtd_bind(dev, &plat->mtd);
+ if (ret)
+ return ret;
+ }
- if (CONFIG_IS_ENABLED(MTD_BLOCK))
- return mtd_bind(dev, &plat->mtd);
+ if (CONFIG_IS_ENABLED(UBI_BLOCK))
+ return ubi_bind(dev);
}
return 0;