public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] NAND and bad blocks
@ 2007-09-18 16:55 MatthewLCreech at eaton.com
  2007-09-18 19:21 ` Wolfgang Denk
  2007-09-19  5:49 ` Stefan Roese
  0 siblings, 2 replies; 4+ messages in thread
From: MatthewLCreech at eaton.com @ 2007-09-18 16:55 UTC (permalink / raw)
  To: u-boot

Hi,

I'm trying to figure out what my options are for booting a system
completely from NAND flash.  Googling around hasn't yielded much info,
but browsing "drivers/nand/" I've gathered that U-Boot handles bad
blocks (factory or worn-out) & bit-flips to some degree.  It's not
entirely clear how things work by glancing at the code, though, so I
have a few questions:

1. How does U-Boot handle a bad block in the area where the environment
is stored?  I can create a second environment via CFG_ENV_OFFSET_REDUND,
but that's not very flexible (what if the primary and the backup are
both bad blocks?)  I also need to write to the environment from within
Linux via the "fw_setenv" utility, but it doesn't seem to have any NAND
awareness.

2. It's not obvious to me how U-Boot reacts when it encounters a bad
block.  If I'm copying a kernel image out of NAND, and a bad block is
encountered, does it skip to the next block?  If so, do I need to
compensate by padding each partition with unused blocks, or how else
does addressing work?  Similarly for writes - if I do "nand write
<memaddr> <location> 100000", and the first block is bad, will U-Boot
write all 0x100000 bytes _after_ that block?

3. Can Linux handle bad blocks in the same manner?  Specifically, I need
to use 'nandwrite' to copy a kernel image to an MTD partition from
within Linux, and have U-Boot read the image correctly on bootup, both
in the presence of bad blocks and bit-flips.

The only references I found were at the openmoko site, but I'm not sure
how much of what they discuss is native in U-Boot & Linux, vs. being
added on for openmoko.  Thanks in advance for the help!

-- 
Matthew L. Creech
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] NAND and bad blocks
  2007-09-18 16:55 [U-Boot-Users] NAND and bad blocks MatthewLCreech at eaton.com
@ 2007-09-18 19:21 ` Wolfgang Denk
  2007-09-18 19:51   ` MatthewLCreech at eaton.com
  2007-09-19  5:49 ` Stefan Roese
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2007-09-18 19:21 UTC (permalink / raw)
  To: u-boot

In message <DC8113368EDCB444B74B22F57D9D807E6E33AA@CLEOHSMB05.napa.ad.etn.com> you wrote:
> 
> I'm trying to figure out what my options are for booting a system
> completely from NAND flash.  Googling around hasn't yielded much info,

The first question you shouls answer to yourself - and  probably  let
us  know about the answer - is which sort of CPU you are using, which
sort of NAND controller it has and if the CPU supports  booting  from
NAND.

Without that knowledge, all speculation is just a waste of time.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All he had was nothing, but that was something, and now it  had  been
taken away.                             - Terry Pratchett, _Sourcery_

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] NAND and bad blocks
  2007-09-18 19:21 ` Wolfgang Denk
@ 2007-09-18 19:51   ` MatthewLCreech at eaton.com
  0 siblings, 0 replies; 4+ messages in thread
From: MatthewLCreech at eaton.com @ 2007-09-18 19:51 UTC (permalink / raw)
  To: u-boot

wd at denx.de wrote:
> 
> The first question you shouls answer to yourself - and
> probably  let us  know about the answer - is which sort of
> CPU you are using, which sort of NAND controller it has and
> if the CPU supports  booting  from NAND.
> 
> Without that knowledge, all speculation is just a waste of time.
> 

Sorry, I meant to include that.  The processor (Freescale MPC8313) has a
flash controller that _does_ support booting from NAND - I've built and
loaded "u-boot-nand.bin" (with the split 16kB IPL and SPL), and it boots
fine on my development board.  Now I'm trying to figure out the software
side of things.

Thanks!

-- 
Matthew L. Creech

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] NAND and bad blocks
  2007-09-18 16:55 [U-Boot-Users] NAND and bad blocks MatthewLCreech at eaton.com
  2007-09-18 19:21 ` Wolfgang Denk
@ 2007-09-19  5:49 ` Stefan Roese
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2007-09-19  5:49 UTC (permalink / raw)
  To: u-boot

Hi Matthew,

On Tuesday 18 September 2007, MatthewLCreech at eaton.com wrote:
> 1. How does U-Boot handle a bad block in the area where the environment
> is stored?  I can create a second environment via CFG_ENV_OFFSET_REDUND,
> but that's not very flexible (what if the primary and the backup are
> both bad blocks?)  I also need to write to the environment from within
> Linux via the "fw_setenv" utility, but it doesn't seem to have any NAND
> awareness.

You could be right here. The bad block handling in the NAND environment is not 
perfect. If both blocks of the environment are bad (primary & redundant) then 
we really have a problem.

There was a patch sent to the list a few months ago (IIRC, from the Openmoko 
project), that addressed this problem. Unfortunately I didn't find the time 
till now to take a deeper look at it.

> 2. It's not obvious to me how U-Boot reacts when it encounters a bad
> block.  If I'm copying a kernel image out of NAND, and a bad block is
> encountered, does it skip to the next block?

There are both option:

a) Bad blocks are not skipped and writted as 0xff in memory
b) Bad blocks are skipped upon read from NAND

I personally never used a) and always use b).

> If so, do I need to 
> compensate by padding each partition with unused blocks, or how else
> does addressing work?

Yes, you have to add some reserve to your partitions size for bad blocks that 
could occur.

> Similarly for writes - if I do "nand write 
> <memaddr> <location> 100000", and the first block is bad, will U-Boot
> write all 0x100000 bytes _after_ that block?

Yes.

> 3. Can Linux handle bad blocks in the same manner?  Specifically, I need
> to use 'nandwrite' to copy a kernel image to an MTD partition from
> within Linux, and have U-Boot read the image correctly on bootup, both
> in the presence of bad blocks and bit-flips.

Sure, this works the same way.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-19  5:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18 16:55 [U-Boot-Users] NAND and bad blocks MatthewLCreech at eaton.com
2007-09-18 19:21 ` Wolfgang Denk
2007-09-18 19:51   ` MatthewLCreech at eaton.com
2007-09-19  5:49 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox