public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Re: Boot from NAND flash ???
  2002-05-13 16:47 Vadim Khmelnitsky
@ 2000-01-12 11:50 ` Thomas Gleixner
  2002-05-20  8:17   ` Charles Manning
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Gleixner @ 2000-01-12 11:50 UTC (permalink / raw)
  To: Vadim Khmelnitsky, manningc2, David Woodhouse, franck.fleter; +Cc: linux-mtd

On Monday, 13. May 2002 18:47, Vadim Khmelnitsky wrote:
> [Thomas]
> There's another important limitation. Who guarantees you, that your
> "boot-page" does not get bad or is a bad block already. That's the reason,
> why DOC has 4 blocks with the same code.
>
> [Vadim]
> Actually, in Diskonchip Millennium 8MB we have first erasable unit
> guaranteed to be good .
> We do have two copies of a boot-code stored one after another in page 0 and
> 1 of the first erasable unit .

That applies for DOC devices, but not for raw NAND chips.

Thomas
___________________________________
autronix automation GmbH
http://www.autronix.de gleixner@autronix.de

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

* Boot from NAND flash ???
@ 2002-05-13  7:20 franck.fleter
  2002-05-13  9:29 ` David Woodhouse
  0 siblings, 1 reply; 13+ messages in thread
From: franck.fleter @ 2002-05-13  7:20 UTC (permalink / raw)
  To: linux-mtd

Hi,

I read in mails archive that Linux kernel can't boot from NAND flash. It

can  boot from NOR flash.
Does Linux  kernel not able to boot  from NAND flash because :
    1) a NAND flash is connected to an I/O controller and not to a BUS.
    2)  access to a NAND flash would be only handled  by JFFS with the
handling of bad blocks.
    3)  it doesn't exist bootloader for NAND flash.
    4) other reasons.

If someone could help me to understand  why Linux can't boot from
NAND flash, I would appreciate.


Thanks,

Franck FLETER
Software Engineer
NETBRICK - France.
email : franck.fleter@netbricks.com

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

* Re: Boot from NAND flash ???
  2002-05-13  7:20 Boot from NAND flash ??? franck.fleter
@ 2002-05-13  9:29 ` David Woodhouse
  2002-05-13 10:11   ` Charles Manning
  0 siblings, 1 reply; 13+ messages in thread
From: David Woodhouse @ 2002-05-13  9:29 UTC (permalink / raw)
  To: franck.fleter; +Cc: linux-mtd

franck.fleter@netbricks.com said:
> I read in mails archive that Linux kernel can't boot from NAND flash.
> It can  boot from NOR flash. Does Linux  kernel not able to boot  from
> NAND flash because :
>     1) a NAND flash is connected to an I/O controller and not to a BUS. 

That's the one. You cannot just put a NAND flash chip at the CPU's startup 
vector and let it boot from it. You need _something_ for the CPU to start 
with, be that SROM, a tiny NOR flash or ROM, or something else. All you 
need is a few bytes to set up your DRAM and start pulling the real 
bootloader off the NAND flash.

--
dwmw2

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

* Re: Boot from NAND flash ???
  2002-05-13  9:29 ` David Woodhouse
@ 2002-05-13 10:11   ` Charles Manning
  2002-05-13 11:18     ` Thomas Gleixner
  2002-05-13 12:05     ` David Woodhouse
  0 siblings, 2 replies; 13+ messages in thread
From: Charles Manning @ 2002-05-13 10:11 UTC (permalink / raw)
  To: David Woodhouse, franck.fleter; +Cc: linux-mtd

What Daid wrote is generally true....
On Mon, 13 May 2002 21:29, you wrote:
> franck.fleter@netbricks.com said:
> > I read in mails archive that Linux kernel can't boot from NAND flash.
> > It can  boot from NOR flash. Does Linux  kernel not able to boot  from
> > NAND flash because :
> >     1) a NAND flash is connected to an I/O controller and not to a BUS.
>
> That's the one. You cannot just put a NAND flash chip at the CPU's startup
> vector and let it boot from it. You need _something_ for the CPU to start
> with, be that SROM, a tiny NOR flash or ROM, or something else. All you
> need is a few bytes to set up your DRAM and start pulling the real
> bootloader off the NAND flash.

There are however two mechanisms to get around this:
* Some people and micros implement a "data pump" state machine to extract an 
executable sequence from a NAND device.
* Some of the newer NAND devices can be accessed directly from the bus and 
can do the job of a boot ROM. 

There is however a limitation to both of these. The NAND can only be accessed 
sequentially (it is not random access like NOR) which limits the types of 
instruction the boot code can perform. In particular it can't branch or fetch 
from elsewhere in ROM.

The way this works is to use these mechanisms to build up a limited bootstrap 
in RAM by using load immediate instructions. ie something like {using ARM-ish 
here}:

 ; r0 is the start address of our bootstrap.
 ; r1 is used as an indexing address for building up the bootstrap
 ; r2 is used as the data register.

 ; build up start address
  ldr  r0,#0xaa000000
  or   r0,r0,#0x00bb0000
  or   r0,r0,#0x0000cc00
  or   r0,r0,#0x000000dd

 ; set up r1
  mov  r1,r0

  ; fill the bootstrap by doing a load immediate, then store for each byte we 
  ; need to transfer into RAM.
  ldrb r2,#0x11
  strb r2,[r1],#1
  ldrb r2,#0x22
  strb r2,[r1],#1
  ......
 ; jump to start of bootstrap.
  mov pc,r0

 Some preamble (eg initialising memory controller) has been ommitted.
 
 The bootstrap we load is then something pretty normal (eg. reads in the next 
level bootloader from NAND for execution).

This works, though it might seem rather contrived. 

-- Charles

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

* Re: Boot from NAND flash ???
  2002-05-13 10:11   ` Charles Manning
@ 2002-05-13 11:18     ` Thomas Gleixner
  2002-05-14  7:37       ` Charles Manning
  2002-05-13 12:05     ` David Woodhouse
  1 sibling, 1 reply; 13+ messages in thread
From: Thomas Gleixner @ 2002-05-13 11:18 UTC (permalink / raw)
  To: manningc2, David Woodhouse, franck.fleter; +Cc: linux-mtd

On Monday, 13. May 2002 12:11, Charles Manning wrote:

> There are however two mechanisms to get around this:
> * Some people and micros implement a "data pump" state machine to extract
> an executable sequence from a NAND device.
> * Some of the newer NAND devices can be accessed directly from the bus and
> can do the job of a boot ROM.
>
> There is however a limitation to both of these. The NAND can only be
> accessed sequentially (it is not random access like NOR) which limits the
> types of instruction the boot code can perform. In particular it can't
> branch or fetch from elsewhere in ROM.

There's another important limitation. Who guarantees you, that your 
"boot-page" does not get bad or is a bad block already. That's the reason, 
why DOC has 4 blocks with the same code. 

-- 
Thomas
___________________________________
autronix automation GmbH
http://www.autronix.de gleixner@autronix.de

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

* Re: Boot from NAND flash ???
  2002-05-13 10:11   ` Charles Manning
  2002-05-13 11:18     ` Thomas Gleixner
@ 2002-05-13 12:05     ` David Woodhouse
  2002-05-15  9:14       ` Charles Manning
  1 sibling, 1 reply; 13+ messages in thread
From: David Woodhouse @ 2002-05-13 12:05 UTC (permalink / raw)
  To: manningc2; +Cc: franck.fleter, linux-mtd

manningc2@actrix.gen.nz said:
>  There are however two mechanisms to get around this: * Some people
> and micros implement a "data pump" state machine to extract an
> executable sequence from a NAND device.

The DiskOnChip Millennium does this. Which is how it's used for LinuxBIOS 
-- the device has 512 bytes of SRAM which is initialised from the flash at 
reset time, and that's just about enough to initialise the system and pull 
the rest of the startup code off the flash.

Note that the DiskOnChip 2000 has ROM instead of RAM, so you can't change 
the startup code from the PC BIOS extension header that it ships with, 
hence can't use it for such things.

--
dwmw2

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

* RE: Boot from NAND flash ???
@ 2002-05-13 16:47 Vadim Khmelnitsky
  2000-01-12 11:50 ` Thomas Gleixner
  0 siblings, 1 reply; 13+ messages in thread
From: Vadim Khmelnitsky @ 2002-05-13 16:47 UTC (permalink / raw)
  To: 'gleixner@autronix.de', manningc2, David Woodhouse,
	franck.fleter
  Cc: linux-mtd

[Thomas]
There's another important limitation. Who guarantees you, that your 
"boot-page" does not get bad or is a bad block already. That's the reason, 
why DOC has 4 blocks with the same code.

[Vadim]
Actually, in Diskonchip Millennium 8MB we have first erasable unit
guaranteed to be good .
We do have two copies of a boot-code stored one after another in page 0 and
1 of the first erasable unit .

Vadim

-----Original Message-----
From: Thomas Gleixner [mailto:gleixner@autronix.de]
Sent: Mon, May 13, 2002 4:19 AM
To: manningc2@actrix.gen.nz; David Woodhouse;
franck.fleter@netbricks.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: Boot from NAND flash ???


On Monday, 13. May 2002 12:11, Charles Manning wrote:

> There are however two mechanisms to get around this:
> * Some people and micros implement a "data pump" state machine to extract
> an executable sequence from a NAND device.
> * Some of the newer NAND devices can be accessed directly from the bus and
> can do the job of a boot ROM.
>
> There is however a limitation to both of these. The NAND can only be
> accessed sequentially (it is not random access like NOR) which limits the
> types of instruction the boot code can perform. In particular it can't
> branch or fetch from elsewhere in ROM.

There's another important limitation. Who guarantees you, that your 
"boot-page" does not get bad or is a bad block already. That's the reason, 
why DOC has 4 blocks with the same code. 

-- 
Thomas
___________________________________
autronix automation GmbH
http://www.autronix.de gleixner@autronix.de

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

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

* Re: Boot from NAND flash ???
  2002-05-13 11:18     ` Thomas Gleixner
@ 2002-05-14  7:37       ` Charles Manning
  2002-06-16  5:58         ` Der Herr Hofrat
  0 siblings, 1 reply; 13+ messages in thread
From: Charles Manning @ 2002-05-14  7:37 UTC (permalink / raw)
  To: gleixner, David Woodhouse, franck.fleter; +Cc: linux-mtd

> There's another important limitation. Who guarantees you, that your
> "boot-page" does not get bad or is a bad block already. That's the reason,
> why DOC has 4 blocks with the same code.

The first page of NAND is guaranteed to be good.

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

* Re: Boot from NAND flash ???
  2002-05-13 12:05     ` David Woodhouse
@ 2002-05-15  9:14       ` Charles Manning
  2002-05-15  9:21         ` David Woodhouse
  0 siblings, 1 reply; 13+ messages in thread
From: Charles Manning @ 2002-05-15  9:14 UTC (permalink / raw)
  To: David Woodhouse; +Cc: franck.fleter, linux-mtd

On Tue, 14 May 2002 00:05, David Woodhouse wrote:
> manningc2@actrix.gen.nz said:
> >  There are however two mechanisms to get around this: * Some people
> > and micros implement a "data pump" state machine to extract an
> > executable sequence from a NAND device.
>
> The DiskOnChip Millennium does this. Which is how it's used for LinuxBIOS
> -- the device has 512 bytes of SRAM which is initialised from the flash at
> reset time, and that's just about enough to initialise the system and pull
> the rest of the startup code off the flash.
>
> Note that the DiskOnChip 2000 has ROM instead of RAM, so you can't change
> the startup code from the PC BIOS extension header that it ships with,
> hence can't use it for such things.

Another difference is that the DOC's RAM and ROM are surely random access and 
hence can hold branching code etc.

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

* Re: Boot from NAND flash ???
  2002-05-15  9:14       ` Charles Manning
@ 2002-05-15  9:21         ` David Woodhouse
  0 siblings, 0 replies; 13+ messages in thread
From: David Woodhouse @ 2002-05-15  9:21 UTC (permalink / raw)
  To: manningc2; +Cc: franck.fleter, linux-mtd

manningc2@actrix.gen.nz said:
>  Another difference is that the DOC's RAM and ROM are surely random
> access and  hence can hold branching code etc.

True; and they do.

--
dwmw2

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

* Re: Boot from NAND flash ???
  2000-01-12 11:50 ` Thomas Gleixner
@ 2002-05-20  8:17   ` Charles Manning
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Manning @ 2002-05-20  8:17 UTC (permalink / raw)
  To: linux-mtd

On Thu, 13 Jan 2000 00:50, Thomas Gleixner wrote:
> On Monday, 13. May 2002 18:47, Vadim Khmelnitsky wrote:
> > [Thomas]
> > There's another important limitation. Who guarantees you, that your
> > "boot-page" does not get bad or is a bad block already. That's the
> > reason, why DOC has 4 blocks with the same code.
> >
> > [Vadim]
> > Actually, in Diskonchip Millennium 8MB we have first erasable unit
> > guaranteed to be good .
> > We do have two copies of a boot-code stored one after another in page 0
> > and 1 of the first erasable unit .
>
> That applies for DOC devices, but not for raw NAND chips.
>
> Thomas


The raw Samsung/Toshiba parts are tested and their bad blocks are marked. 
They guarantee that the first block is not bad when shipped.

BTW: Some of the newer raw NAND devices power up with page 0 pre-selected for 
read. Thus, you can fetch executable code directly off these devices at boot 
time (ie. use them to replace boot NOR).

-- Charles

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

* Re: Boot from NAND flash ???
  2002-05-14  7:37       ` Charles Manning
@ 2002-06-16  5:58         ` Der Herr Hofrat
  2002-06-16  8:18           ` Charles Manning
  0 siblings, 1 reply; 13+ messages in thread
From: Der Herr Hofrat @ 2002-06-16  5:58 UTC (permalink / raw)
  To: manningc2; +Cc: gleixner, David Woodhouse, franck.fleter, linux-mtd

> 
> > There's another important limitation. Who guarantees you, that your
> > "boot-page" does not get bad or is a bad block already. That's the reason,
> > why DOC has 4 blocks with the same code.
> 
> The first page of NAND is guaranteed to be good.
>
do you have a pointer to docs that explains this ?
is it common to all NAND devices that they replicated the first block in
hardware or did I missunderstand your statement.

hofrat
 

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

* Re: Boot from NAND flash ???
  2002-06-16  5:58         ` Der Herr Hofrat
@ 2002-06-16  8:18           ` Charles Manning
  0 siblings, 0 replies; 13+ messages in thread
From: Charles Manning @ 2002-06-16  8:18 UTC (permalink / raw)
  To: Der Herr Hofrat; +Cc: linux-mtd

On Sun, 16 Jun 2002 17:58, Der Herr Hofrat wrote:
> > > There's another important limitation. Who guarantees you, that your
> > > "boot-page" does not get bad or is a bad block already. That's the
> > > reason, why DOC has 4 blocks with the same code.
> >
> > The first page of NAND is guaranteed to be good.
>
> do you have a pointer to docs that explains this ?
> is it common to all NAND devices that they replicated the first block in
> hardware or did I missunderstand your statement.
>

They do not replicate the first block.

What happens is this:
* At manufacturing test time, bad blocks are identified and are marked.
* If more than n blocks are found to be defective, the part is discarded.
* If the first block is found to be defective, the part is discarded. 
ie. when it ships, block zero is guaranteed good.

Of course, block 0 might fail with time....

At least one doc on the Samsung www explains this.

-- Charles

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

end of thread, other threads:[~2002-06-16  8:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-13  7:20 Boot from NAND flash ??? franck.fleter
2002-05-13  9:29 ` David Woodhouse
2002-05-13 10:11   ` Charles Manning
2002-05-13 11:18     ` Thomas Gleixner
2002-05-14  7:37       ` Charles Manning
2002-06-16  5:58         ` Der Herr Hofrat
2002-06-16  8:18           ` Charles Manning
2002-05-13 12:05     ` David Woodhouse
2002-05-15  9:14       ` Charles Manning
2002-05-15  9:21         ` David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
2002-05-13 16:47 Vadim Khmelnitsky
2000-01-12 11:50 ` Thomas Gleixner
2002-05-20  8:17   ` Charles Manning

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