diff mbox series

[v1,6/6] spinand: bind UBI block

Message ID 20240306134906.1179285-7-avromanov@salutedevices.com
State Superseded
Delegated to: Dario Binacchi
Headers show
Series Introduce UBI block device | expand

Commit Message

Alexey Romanov March 6, 2024, 1:49 p.m. UTC
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>
---
 drivers/mtd/nand/spi/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Heiko Schocher March 23, 2024, 5:06 a.m. UTC | #1
Hello Alexey,

On 06.03.24 14:49, Alexey Romanov wrote:
> 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>
> ---
>   drivers/mtd/nand/spi/core.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index f2ec32e1d0..32705e1e2a 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -27,6 +27,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 <dm/uclass.h>
> @@ -1182,7 +1183,13 @@ static void spinand_cleanup(struct spinand_device *spinand)
>   static int spinand_bind(struct udevice *dev)
>   {
>   	struct spinand_plat *plat = dev_get_plat(dev);
> -	return mtd_bind(dev, &plat->mtd);
> +	int ret;
> +
> +	ret = mtd_bind(dev, &plat->mtd);
> +	if (ret)
> +		return ret;
> +
> +	return ubi_bind(dev);

What is with boards which do not use ubi block or CONFIG_BLK at all?

bye,
Heiko
diff mbox series

Patch

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index f2ec32e1d0..32705e1e2a 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -27,6 +27,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 <dm/uclass.h>
@@ -1182,7 +1183,13 @@  static void spinand_cleanup(struct spinand_device *spinand)
 static int spinand_bind(struct udevice *dev)
 {
 	struct spinand_plat *plat = dev_get_plat(dev);
-	return mtd_bind(dev, &plat->mtd);
+	int ret;
+
+	ret = mtd_bind(dev, &plat->mtd);
+	if (ret)
+		return ret;
+
+	return ubi_bind(dev);
 }
 #endif