mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-26 12:27:12 +00:00
mtd: Add some fallbacks for add/del_mtd_device
This allows using these functions without ifdefs. OneNAND depends on MTD, so this ifdef was redundant in the first place. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
This commit is contained in:
parent
b35df87ae5
commit
b37a9208a2
3 changed files with 12 additions and 4 deletions
|
@ -60,13 +60,11 @@ int nand_register(int devnum, struct mtd_info *mtd)
|
||||||
sprintf(dev_name[devnum], "nand%d", devnum);
|
sprintf(dev_name[devnum], "nand%d", devnum);
|
||||||
mtd->name = dev_name[devnum];
|
mtd->name = dev_name[devnum];
|
||||||
|
|
||||||
#ifdef CONFIG_MTD
|
|
||||||
/*
|
/*
|
||||||
* Add MTD device so that we can reference it later
|
* Add MTD device so that we can reference it later
|
||||||
* via the mtdcore infrastructure (e.g. ubi).
|
* via the mtdcore infrastructure (e.g. ubi).
|
||||||
*/
|
*/
|
||||||
add_mtd_device(mtd);
|
add_mtd_device(mtd);
|
||||||
#endif
|
|
||||||
|
|
||||||
total_nand_size += mtd->size / 1024;
|
total_nand_size += mtd->size / 1024;
|
||||||
|
|
||||||
|
|
|
@ -44,14 +44,12 @@ void onenand_init(void)
|
||||||
puts("Flex-");
|
puts("Flex-");
|
||||||
puts("OneNAND: ");
|
puts("OneNAND: ");
|
||||||
|
|
||||||
#ifdef CONFIG_MTD
|
|
||||||
/*
|
/*
|
||||||
* Add MTD device so that we can reference it later
|
* Add MTD device so that we can reference it later
|
||||||
* via the mtdcore infrastructure (e.g. ubi).
|
* via the mtdcore infrastructure (e.g. ubi).
|
||||||
*/
|
*/
|
||||||
onenand_mtd.name = dev_name;
|
onenand_mtd.name = dev_name;
|
||||||
add_mtd_device(&onenand_mtd);
|
add_mtd_device(&onenand_mtd);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
print_size(onenand_chip.chipsize, "\n");
|
print_size(onenand_chip.chipsize, "\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,8 +552,20 @@ unsigned mtd_mmap_capabilities(struct mtd_info *mtd);
|
||||||
|
|
||||||
#ifdef __UBOOT__
|
#ifdef __UBOOT__
|
||||||
/* drivers/mtd/mtdcore.h */
|
/* drivers/mtd/mtdcore.h */
|
||||||
|
#if CONFIG_IS_ENABLED(MTD)
|
||||||
int add_mtd_device(struct mtd_info *mtd);
|
int add_mtd_device(struct mtd_info *mtd);
|
||||||
int del_mtd_device(struct mtd_info *mtd);
|
int del_mtd_device(struct mtd_info *mtd);
|
||||||
|
#else
|
||||||
|
static inline int add_mtd_device(struct mtd_info *mtd)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int del_mtd_device(struct mtd_info *mtd)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PARTITIONS
|
#ifdef CONFIG_MTD_PARTITIONS
|
||||||
int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
|
int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
|
||||||
|
|
Loading…
Add table
Reference in a new issue