From: Alexey Romanov Date: Thu, 18 Jul 2024 05:45:28 +0000 (+0300) Subject: spinand: bind UBI block X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=855f9b6241407d19f01d4245456be428b5d88f52;p=u-boot.git 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 Reviewed-by: Frieder Schrempf Signed-off-by: Michael Trimarchi --- 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 #include #include +#include #include #include #include @@ -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;