[U-Boot-Users] NAND flash implementation

Hans Zuidam hans.zuidam at philips.com
Mon Sep 4 17:03:57 CEST 2006


Hi,

We ran into a problem while implementing NAND flash initialisation.

What happens in U-Boot (correct me if I'm wrong):

In drivers/nand/nand.c
        the function nand_init() calls nand_init_chip() 
CFG_MAX_NAND_DEVICE times.
        the function nand_init_chip() calls board_nand_init() and 
subsequently nand_scan()
        if nand_scan() returns something != 0 then it is assumed that 
there is not really a NAND device there

In boards/prodrive/pbnb3/nand.c (to take an existing example)
        the function board_nand_init() fills in hardware specific 
functions and returns
        (it's a void function)

Our hardware has a special bus controller to which up to 5 devices can be 
connected.
NAND flash is one of the device types that can be connected.  Each such 
device is
controlled by a so called "profile".  Before we can access a NAND flash 
connected to
such a profile we read from the profile if a NAND flash is connected.  If 
not, we do
not touch it. 

The problem is that board_nand_init() is a void function and always 
succeeds.  In our case
we would like to check the profile in board_nand_init() and return an 
error if no NAND
exists.  Subsequently nand_init_chip() would not do a nand_scan() for a 
failing board_nand_init().
Attached is what a patch would look like.

We looked at nand_scan() but it returns != 0 only after calling a lot 
board specific functions.
In our case this would not do as the board specific functions would 
seriously fail if no NAND
device is connected.

Regards,
Hans Zuidam
--
Hans Zuidam
Sen. Systems Engineer, BL DTS ICE, Philips Semiconductors

Building A410, Room 3.40
High Tech Campus 41, 5656 AE Eindhoven, The Netherlands
Tel. +31 (0)40 2746579
E-Mail: hans.zuidam at philips.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch1
Type: application/octet-stream
Size: 4564 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20060904/19f84c76/attachment.obj 


More information about the U-Boot mailing list