#include <linux/printk.h>
#endif
+struct spinand_plat {
+ struct mtd_info *mtd;
+};
+
/* SPI NAND index visible in MTD names */
static int spi_nand_idx;
kfree(spinand->scratchbuf);
}
+static int spinand_bind(struct udevice *dev)
+{
+ if (blk_enabled()) {
+ struct spinand_plat *plat = dev_get_plat(dev);
+
+ if (CONFIG_IS_ENABLED(MTD_BLOCK))
+ return mtd_bind(dev, &plat->mtd);
+ }
+
+ return 0;
+}
+
static int spinand_probe(struct udevice *dev)
{
struct spinand_device *spinand = dev_get_priv(dev);
struct spi_slave *slave = dev_get_parent_priv(dev);
struct mtd_info *mtd = dev_get_uclass_priv(dev);
struct nand_device *nand = spinand_to_nand(spinand);
+ struct spinand_plat *plat = dev_get_plat(dev);
int ret;
#ifndef __UBOOT__
if (ret)
goto err_spinand_cleanup;
+ plat->mtd = mtd;
+
return 0;
err_spinand_cleanup:
.of_match = spinand_ids,
.priv_auto = sizeof(struct spinand_device),
.probe = spinand_probe,
+ .bind = spinand_bind,
+ .plat_auto = sizeof(struct spinand_plat),
};