On Sun, 8 Jul 2018 14:29:24 +0300 Sergey Larin <cerg2010cerg2010 at mail.ru> wrote: > This fixes WARN() in nand_is_slc(). > > DoC G4 is 2-bit MLC, so set bits_per_cell value according to this. What you do here implies "no UBI on docg4". To be honest, I'm pretty sure there's an FTL in there, which clearly does not make it a good candidate for the raw NAND framework. Not to mention that it's not even using the same instruction set which forced developers of this driver to guess what the core was trying to do in the ->cmdfunc() implementation and convert it to docg4 operations. This approach is going against the recent evolution of the raw NAND framework (deprecating ->cmdfunc() in favor of ->exec_op()). I'd really like to see this driver moved outside of drivers/mtd/nand/raw/. If it really has NAND constraints, you could re-use the interface agnostic NAND framework (include/linux/nand.h) and add a new driver under drivers/mtd/nand/diskonchip/docg4.c. That's the very reason I asked if you if you had access to this HW. I can help you with the development part, but I can't test. > > Signed-off-by: Sergey Larin <cerg2010cerg2010 at mail.ru> > --- > drivers/mtd/nand/raw/docg4.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/mtd/nand/raw/docg4.c b/drivers/mtd/nand/raw/docg4.c > index bbed8ea7858c..82d97a16e246 100644 > --- a/drivers/mtd/nand/raw/docg4.c > +++ b/drivers/mtd/nand/raw/docg4.c > @@ -1250,6 +1250,7 @@ static void __init init_mtd_structs(struct mtd_info *mtd) > nand->pagemask = 0x3ffff; > nand->badblockpos = NAND_LARGE_BADBLOCK_POS; > nand->badblockbits = 8; > + nand->bits_per_cell = 2; > nand->ecc.mode = NAND_ECC_HW_SYNDROME; > nand->ecc.size = DOCG4_PAGE_SIZE; > nand->ecc.prepad = 8;