public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Daniel Palmer <daniel@0x0f.com>
Cc: richard@nod.at, linux-mtd@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	vigneshr@ti.com
Subject: Re: [PATCH 1/1] mtd: spinand: add support for Foresee FS35ND01G
Date: Tue, 5 Jan 2021 14:04:31 +0100	[thread overview]
Message-ID: <20210105140431.185e8ce1@xps13> (raw)
In-Reply-To: <CAFr9PXmPEQ2poQUTtaBH4CZ-S+sJjoUjJ5D_qA5aHZj7AASg7w@mail.gmail.com>

Hi Daniel,

Daniel Palmer <daniel@0x0f.com> wrote on Tue, 5 Jan 2021 21:18:21 +0900:

> Hi Miquel,
> 
> On Mon, 4 Jan 2021 at 23:17, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> > Perhaps giving the link of the datasheet here makes sense.  
> 
> Noted. I'll put that into v2.
> 
> > > +#define SPINAND_MFR_LONGSYS          0xcd  
> >
> > Nitpick: I personally prefer uppercase hex numbers.
> >  
> 
> Noted.
> 
> > > +                  NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
> > > +                  NAND_ECCREQ(4, 512),
> > > +                  SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
> > > +                                           &write_cache_variants,
> > > +                                           &update_cache_variants),  
> >
> > This device probably supports more variants (especially dual/quad
> > ones) but I guess it's not a problem to not have them here right now.  
> 
> Right now I can't really test dual or quad because my SPI driver
> doesn't know to do dual or quad io.
> I plan to add those in once I can validate they work.
> 
> > > +                  SPINAND_HAS_QE_BIT,
> > > +                  SPINAND_ECCINFO(NULL,
> > > +                                  NULL)),  
> >
> > You should define the ->ecc and ->free hooks of the
> > mtd_ooblayout_ops structure and point to it here. It defines the free
> > OOB bytes and bytes used by the on-die ECC engine. You should find this
> > in the datasheet. You may look at other manufacturer drivers for
> > examples of how it should be implemented. It is the way to tell the
> > upper layers that eg. "byte 2 to 17 are ECC bytes, 18 until the end are
> > free to use".  
> 
> Ok I'll add those in. Is there a way I can test that my implementation is right?
> I.e. is writing something, reading it back and checking if the data is
> correct a good enough test here?
> I don't really want to make it look like this flash is supported and
> break someone's data. :)

You may try to use flash_erase/nandwrite/nanddump from the mtd-utils
package. You may first use a dummy functions and declare the entire
zone free (except for the bad block marker at the beginning).

Then, you may write the entire OOB area in regular mode then read it in
raw mode (-n). Sometimes the ECC bytes are not visible, in this case it
may be worth trying writing the OOB area with known data and read it
back and see what you get. But these information probably are in the
datasheet.

Good luck,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      reply	other threads:[~2021-01-05 13:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-29  5:50 [PATCH 0/1] Add basic support for Foresee SPI NAND Daniel Palmer
2020-12-29  5:50 ` [PATCH 1/1] mtd: spinand: add support for Foresee FS35ND01G Daniel Palmer
2021-01-04 14:17   ` Miquel Raynal
2021-01-05 12:18     ` Daniel Palmer
2021-01-05 13:04       ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210105140431.185e8ce1@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=daniel@0x0f.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox