The information which kind of bbt (if any) is used is hidden somewhere in the NAND layer. Expose it to a device parameter to make it detectable and visible during runtime. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- drivers/mtd/nand/nand_base.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ac223ca..7675695 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1688,6 +1688,23 @@ static int mtd_set_erasebad(struct device_d *dev, struct param_d *param, return 0; } +static const char *mtd_get_bbt_type(struct device_d *dev, struct param_d *p) +{ + struct mtd_info *mtd = container_of(dev, struct mtd_info, class_dev); + struct nand_chip *chip = mtd->priv; + char *str; + + if (!chip->bbt) + str = "none"; + else if ((chip->bbt_td && chip->bbt_td->pages[0] != -1) || + (chip->bbt_md && chip->bbt_md->pages[0] != -1)) + str = "flashbased"; + else + str = "memorybased"; + + return str; +} + int add_mtd_nand_device(struct mtd_info *mtd, char *devname) { int ret; @@ -1700,6 +1717,8 @@ int add_mtd_nand_device(struct mtd_info *mtd, char *devname) dev_add_param(&mtd->class_dev, "erasebad", mtd_set_erasebad, NULL, 0); + dev_add_param(&mtd->class_dev, "bbt", NULL, mtd_get_bbt_type, 0); + return ret; } -- 1.7.10.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox