All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Shawn Guo <shawn.guo@linaro.org>,
	linux-mtd@lists.infradead.org, Sascha Hauer <sha@pengutronix.de>,
	kernel@pengutronix.de, Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/4] mtd: mxc_nand: limit the size of used oob
Date: Wed, 29 Apr 2015 09:18:53 +0300	[thread overview]
Message-ID: <20150429061853.GB2258@tarshish> (raw)
In-Reply-To: <20150427193127.GU19431@pengutronix.de>

Hi Uwe,

On Mon, Apr 27, 2015 at 09:31:27PM +0200, Uwe Kleine-König wrote:
> On Mon, Apr 27, 2015 at 02:43:41PM +0300, Baruch Siach wrote:
> > On Mon, Apr 27, 2015 at 09:50:23AM +0200, Uwe Kleine-König wrote:
> > > On Mon, Apr 27, 2015 at 10:20:57AM +0300, Baruch Siach wrote:
> > > > On Mon, Apr 27, 2015 at 09:12:38AM +0200, Uwe Kleine-König wrote:
> > > > > Hmm I rechecked the reference manual and found a register to specify the
> > > > > size of the spare area (I didn't notice that one before). Did you try
> > > > > what happens if you set this to 0x70 for 224 bytes oob?
> > > > 
> > > > Which register is that?
> > > Spare Area Size Register (SPAS) at offset 0x1e10 for the i.MX25 (that's
> > > what you're using, don't you?).
> > 
> > Yes, that's what I'm using.
> > 
> > I tried setting the SPAS register to oobsize/2 (0x70 in my case), but I see no 
> > change in behaviour. Moreover, it turns out the previously Barebox set this 
> > register (apparently wrongly) to 0x20 for spare size of 64. Current Barebox 
> > master still do. For v3 Barebox limits CONFIG2_SPAS to 218 bytes spare size 
> I guess for v21 writing to SPAS is just what the controller assumes
> after reset. I.e. that a 512-byte nand has 16 bytes spare and a 2k-nand
> has 64.
> 
> > since Eric Bénard's commit 632c45795065 (nand_imx: update to support onfi & 4k 
> > flashs, 2012-07-05). As you can see, the kernel doesn't touch this register 
> > for v2 NFC.
> right.
> 
> > I have no idea what is the effect of the SPAS in v2 (or any other) NFC.
> I didn't try, but I'm surprised it doesn't make a difference. How did
> you test? I'd do in barebox:
> 
> 	memset -w 0xbb000000 0x55 0x1200
> 	set SPAS to 218/2
> 	trigger page read
> 	check how much of the 0x55 was overwritten
> 	set SPAS to 224/2
> 	trigger page read
> 	compare with above

Just did this test. No matter how I set SPAS, Only first 26 bytes of each 64 
bytes spare data buffer chunk are overwritten. I tried setting SPAS to 224/2 
(0x70), 218/2 (0x6d), and 128/2 (0x40).

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

WARNING: multiple messages have this Message-ID (diff)
From: baruch@tkos.co.il (Baruch Siach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] mtd: mxc_nand: limit the size of used oob
Date: Wed, 29 Apr 2015 09:18:53 +0300	[thread overview]
Message-ID: <20150429061853.GB2258@tarshish> (raw)
In-Reply-To: <20150427193127.GU19431@pengutronix.de>

Hi Uwe,

On Mon, Apr 27, 2015 at 09:31:27PM +0200, Uwe Kleine-K?nig wrote:
> On Mon, Apr 27, 2015 at 02:43:41PM +0300, Baruch Siach wrote:
> > On Mon, Apr 27, 2015 at 09:50:23AM +0200, Uwe Kleine-K?nig wrote:
> > > On Mon, Apr 27, 2015 at 10:20:57AM +0300, Baruch Siach wrote:
> > > > On Mon, Apr 27, 2015 at 09:12:38AM +0200, Uwe Kleine-K?nig wrote:
> > > > > Hmm I rechecked the reference manual and found a register to specify the
> > > > > size of the spare area (I didn't notice that one before). Did you try
> > > > > what happens if you set this to 0x70 for 224 bytes oob?
> > > > 
> > > > Which register is that?
> > > Spare Area Size Register (SPAS) at offset 0x1e10 for the i.MX25 (that's
> > > what you're using, don't you?).
> > 
> > Yes, that's what I'm using.
> > 
> > I tried setting the SPAS register to oobsize/2 (0x70 in my case), but I see no 
> > change in behaviour. Moreover, it turns out the previously Barebox set this 
> > register (apparently wrongly) to 0x20 for spare size of 64. Current Barebox 
> > master still do. For v3 Barebox limits CONFIG2_SPAS to 218 bytes spare size 
> I guess for v21 writing to SPAS is just what the controller assumes
> after reset. I.e. that a 512-byte nand has 16 bytes spare and a 2k-nand
> has 64.
> 
> > since Eric B?nard's commit 632c45795065 (nand_imx: update to support onfi & 4k 
> > flashs, 2012-07-05). As you can see, the kernel doesn't touch this register 
> > for v2 NFC.
> right.
> 
> > I have no idea what is the effect of the SPAS in v2 (or any other) NFC.
> I didn't try, but I'm surprised it doesn't make a difference. How did
> you test? I'd do in barebox:
> 
> 	memset -w 0xbb000000 0x55 0x1200
> 	set SPAS to 218/2
> 	trigger page read
> 	check how much of the 0x55 was overwritten
> 	set SPAS to 224/2
> 	trigger page read
> 	compare with above

Just did this test. No matter how I set SPAS, Only first 26 bytes of each 64 
bytes spare data buffer chunk are overwritten. I tried setting SPAS to 224/2 
(0x70), 218/2 (0x6d), and 128/2 (0x40).

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

  reply	other threads:[~2015-04-29  6:18 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26  8:16 [PATCH 0/4] mtd: mxc_nand: fix 8 bit ECC and large oob Baruch Siach
2015-04-26  8:16 ` Baruch Siach
2015-04-26  8:16 ` [PATCH 1/4] mtd: nand: mxc_nand: cleanup copy_spare function Baruch Siach
2015-04-26  8:16   ` Baruch Siach
2015-04-26  8:16 ` [PATCH 2/4] mtd: mxc_nand: limit the size of used oob Baruch Siach
2015-04-26  8:16   ` Baruch Siach
2015-04-26 20:07   ` Uwe Kleine-König
2015-04-26 20:07     ` Uwe Kleine-König
2015-04-27  4:39     ` Baruch Siach
2015-04-27  4:39       ` Baruch Siach
2015-04-27  7:12       ` Uwe Kleine-König
2015-04-27  7:12         ` Uwe Kleine-König
2015-04-27  7:20         ` Baruch Siach
2015-04-27  7:20           ` Baruch Siach
2015-04-27  7:50           ` Uwe Kleine-König
2015-04-27  7:50             ` Uwe Kleine-König
2015-04-27 11:43             ` Baruch Siach
2015-04-27 11:43               ` Baruch Siach
2015-04-27 19:31               ` Uwe Kleine-König
2015-04-27 19:31                 ` Uwe Kleine-König
2015-04-29  6:18                 ` Baruch Siach [this message]
2015-04-29  6:18                   ` Baruch Siach
2015-04-29  6:35                   ` Uwe Kleine-König
2015-04-29  6:35                     ` Uwe Kleine-König
2015-04-30 15:20                     ` Fabio Estevam
2015-04-30 15:20                       ` Fabio Estevam
2015-05-03  7:55                       ` Baruch Siach
2015-05-03  7:55                         ` Baruch Siach
2015-04-26  8:16 ` [PATCH 3/4] mtd: mxc_nand: fix truncate of unaligned oob copying Baruch Siach
2015-04-26  8:16   ` Baruch Siach
2015-04-26 19:52   ` Uwe Kleine-König
2015-04-26 19:52     ` Uwe Kleine-König
2015-04-27  4:46     ` Baruch Siach
2015-04-27  4:46       ` Baruch Siach
2015-04-27  6:56       ` Uwe Kleine-König
2015-04-27  6:56         ` Uwe Kleine-König
2015-04-26  8:16 ` [PATCH 4/4] mtd: mxc_nand: generate nand_ecclayout for 8 bit ECC Baruch Siach
2015-04-26  8:16   ` Baruch Siach

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=20150429061853.GB2258@tarshish \
    --to=baruch@tkos.co.il \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sha@pengutronix.de \
    --cc=shawn.guo@linaro.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.