linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: boris brezillon <b.brezillon@overkiz.com>
To: "Henrik Nordström" <henrik@henriknordstrom.net>
Cc: dev@linux-sunxi.org, linux-mtd@lists.infradead.org,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	David Woodhouse <dwmw2@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [linux-sunxi] Re: [RFC PATCH 0/9] mtd: nand: add sunxi NAND Flash Controller support
Date: Mon, 13 Jan 2014 10:02:46 +0100	[thread overview]
Message-ID: <52D3ABB6.9030204@overkiz.com> (raw)
In-Reply-To: <1389474709.22660.4.camel@localhost>

Hi Henrik,

On 11/01/2014 22:11, Henrik Nordström wrote:
> <bbrezillon> thanks for pointing out your documents
> <bbrezillon> I'm trying to get the NAND driver with HW ECC (and HW RND)
> without using DMA at all
>
> I tried many things but did not quite get the ECC reading command to
> return meaningful resuts. But should work somehow.
>
> <bbrezillon> do you have any other information I could use to do this ?
>
> Not really. There is no known code to look at using the nand controller
> without DMA. All allwinner code uses DMA even the boot ROM (BROM).
>
> <bbrezillon> For example, I wonder why there are 2 RAM sectors (the
> driver I found only make use of RAM0)
>
> I think it's used during DMA to fetch next sector while the previous one
> is transferred by DMA. But not sure.

Some feedback on my tests:

- I managed to get HW ECC working without any DMA transfer (using CMD = 01):
   * I only tested the sequential ECC => ECC are stored between 2 data 
blocks (1024 byte)
   * Non sequential ECC should work if I store ECC bytes in the OOB area 
too (I'll just have
      to send RANDOM_OUT commands to move to the OOB area before sending 
the ECC
      cmd and another RANDOM_OUT to go back to the DATA area)

- The HW RND (randomizer) works too, I'll just have to figure out how 
this could be
   mainlined:
    * using a simple dt property to tell the controller it should enable 
the randomizer
    * provide an interface (like the nand_ecc_ctrl struct ) for other to 
add their own
       randomizer implementation (this was requested: 
https://lkml.org/lkml/2013/12/13/154)


The most complicated part is the boot0 partition.

Tell me if I'm wrong, but here's what I understood from your work (and 
yuq's work too):

boot 0 part properties:
- uses sequential ECC
- uses 1024 bytes ECC blocks
- boot0 code is stored only on the first ECC block of each page (1024 
bytes + ecc bytes)
- boot0 code is stored on the first 64 pages of the first block
- boot0 uses HW randomizer with a specific rnd seed (0x4a80)

It's not that complicated to read/write from/to boot0, but it's a bit 
more to mainline this
implementation:
  - the nand chip must use the same ECC algorithm and ECC layout on the 
whole flash
    (no partition specific config available)
- you cannot mark some part of pages as unused => the nand driver will 
write the
   whole page, not just the first ECC block (1024 bytes)

I thought about manually creating an mtd device that fullfils these 
needs (in case we
encounter the "allwinner,nandn-boot" property on a nand@X node), but I'm 
not sure
this is the right approach.

Any ideas ?


Best Regards,

Boris
>
> Regards
> Henrik
>

  parent reply	other threads:[~2014-01-13  9:03 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 14:21 [RFC PATCH 0/9] mtd: nand: add sunxi NAND Flash Controller support Boris BREZILLON
     [not found] ` < 1389190924-26226-4-git-send-email-b.brezillon@overkiz.com>
2014-01-08 14:21 ` [RFC PATCH 1/9] mtd: nand: retrieve ECC requirements from Hynix READ ID byte 4 Boris BREZILLON
2014-01-23  1:49   ` Brian Norris
2014-01-29 10:29     ` boris brezillon
2014-02-05 13:53     ` Boris BREZILLON
2014-01-08 14:21 ` [RFC PATCH 2/9] mtd: nand: define struct nand_timings Boris BREZILLON
2014-01-08 14:21 ` [RFC PATCH 3/9] of: mtd: add NAND timings retrieval support Boris BREZILLON
2014-01-08 16:30   ` Rob Herring
2014-01-08 16:36     ` boris brezillon
2014-01-08 18:34   ` Jason Gunthorpe
2014-01-08 19:00     ` boris brezillon
2014-01-08 19:13       ` Jason Gunthorpe
2014-01-09  8:36         ` boris brezillon
2014-01-09 17:35           ` Jason Gunthorpe
2014-01-15 15:09             ` boris brezillon
2014-01-15 17:03               ` boris brezillon
2014-01-21 22:57                 ` Jason Gunthorpe
2014-02-04 17:02                   ` Grant Likely
2014-01-08 14:21 ` [RFC PATCH 4/9] of: mtd: add NAND timings bindings documentation Boris BREZILLON
2014-01-08 14:22 ` [RFC PATCH 5/9] mtd: nand: add sunxi NFC support Boris BREZILLON
2014-01-08 19:21   ` boris brezillon
2014-01-08 14:22 ` [RFC PATCH 6/9] mtd: nand: add sunxi NFC dt bindings doc Boris BREZILLON
2014-01-08 21:28   ` Arnd Bergmann
2014-01-09  8:31     ` boris brezillon
2014-01-09 10:00       ` Arnd Bergmann
2014-01-08 14:22 ` [RFC PATCH 7/9] ARM: dt/sunxi: add NFC node to Allwinner A20 SoC Boris BREZILLON
2014-01-08 14:22 ` [RFC PATCH 8/9] ARM: dt/sunxi: add NFC pinctrl pin definitions Boris BREZILLON
2014-01-08 15:28 ` [RFC PATCH 9/9] ARM: sunxi/dt: enable NAND on cubietruck board Boris BREZILLON
2014-01-08 15:30   ` boris brezillon
2014-01-11 13:38 ` [RFC PATCH 0/9] mtd: nand: add sunxi NAND Flash Controller support boris brezillon
     [not found]   ` <1389449230.19197.2.camel@localhost>
     [not found]     ` <52D1541F.4040400@overkiz.com>
     [not found]       ` <1389456075.20989.11.camel@localhost>
     [not found]         ` <1389474709.22660.4.camel@localhost>
2014-01-13  9:02           ` boris brezillon [this message]
2014-01-13  9:48             ` [linux-sunxi] " Henrik Nordström
     [not found]               ` <6de6ead1-e437-410b-91c0-74afb37dbf39@googlegroups.com>
2014-01-21 18:13                 ` Henrik Nordström
2014-01-21 20:55                   ` Henrik Nordström
2014-01-29 15:11             ` Michal Suchanek
2014-01-29 15:43               ` boris brezillon dev
2014-01-29 16:08                 ` Michal Suchanek
2014-01-29 16:55                   ` boris brezillon dev
2014-01-23 15:22   ` Rob Herring
2014-01-29 10:20     ` boris brezillon

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=52D3ABB6.9030204@overkiz.com \
    --to=b.brezillon@overkiz.com \
    --cc=dev@linux-sunxi.org \
    --cc=dwmw2@infradead.org \
    --cc=henrik@henriknordstrom.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=maxime.ripard@free-electrons.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;
as well as URLs for NNTP newsgroup(s).