Hi Miquel, On 19-08-19 10:17, Miquel Raynal wrote: > Hi Marco, > > Marco Felsch <m.felsch@xxxxxxxxxxxxxx> wrote on Wed, 14 Aug 2019 > 10:22:32 +0200: > > > The MT29F1G01AAADD is a single die, SLC based SPI NAND. It has a > > capacity of 1Gb and supports 4-bit ECC. The datasheet can be found [1]. > > > > Unfortunatly the linked device is marked as EoL, but I will expect that > > the MT29F1G01AAADDH4-ITX behaves the same way. > > > > [1] https://datasheet.octopart.com/ \ > > MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf > > > > Cc: Peter Pan <peterpandong@xxxxxxxxxx> > > Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> > > --- > > drivers/mtd/nand/spi/micron.c | 68 +++++++++++++++++++++++++++++++++++ > > 1 file changed, 68 insertions(+) > > > > diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c > > index 7d7b1f7fcf71..9d63450afc69 100644 > > --- a/drivers/mtd/nand/spi/micron.c > > +++ b/drivers/mtd/nand/spi/micron.c > > @@ -34,6 +34,18 @@ static SPINAND_OP_VARIANTS(update_cache_variants, > > SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), > > SPINAND_PROG_LOAD(false, 0, NULL, 0)); > > > > +static SPINAND_OP_VARIANTS(read_cache_variants_mt29f1g01aaadd, > > + SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), > > + SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0), > > + SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), > > + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); > > + > > +static SPINAND_OP_VARIANTS(write_cache_variants_mt29f1g01aaadd, > > + SPINAND_PROG_LOAD(true, 0, NULL, 0)); > > + > > +static SPINAND_OP_VARIANTS(update_cache_variants_mt29f1g01aaadd, > > + SPINAND_PROG_LOAD(false, 0, NULL, 0)); > > + > > static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section, > > struct mtd_oob_region *region) > > { > > @@ -90,6 +102,52 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand, > > return -EINVAL; > > } > > > > +static int mt29f1g01aaadd_ooblayout_ecc(struct mtd_info *mtd, int section, > > + struct mtd_oob_region *region) > > +{ > > + if (section > 3) > > + return -ERANGE; > > + > > + region->offset = (section * 0x10) + 8; > > Any reason to use hex here? ^ > > If not I would prefer decimal numbers. Since the datasheet describe it in hex to. Can you have a look on [1] table 11? May we do something like: region->offset = (section * 0x10) + 0x8; [1] https://datasheet.octopart.com/MT29F1G01AAADDH4-IT:D-Micron-datasheet-11572380.pdf > > Otherwise looks fine. Anyway I can change the above code to use only decimal values if you like it more. Regards, Marco > > Thanks, > Miquèl > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/