[U-Boot] RFC: porting u-boot to sequoia based nand booting board

Stefan Roese
2011-05-17T13:41:01Z

Hi Alex,

On Tuesday 17 May 2011 15:00:45 Alex Waterman wrote:
> I am working on porting U-Boot to a sequoia based PPC440 board. It boots
> off NAND flash via the NDFC on the PPC440. Our NAND chip has a 16 bit bus
> which has presented some minor problems.

Yes, until now, all 4xx boards use 8bit NAND chips.

> The NDFC code is pretty much what we need except for a few functions that I
> made some changes to. In particular the two functions that I changed are
> board_nand_init() and board_nand_select_device().

What changes did you have to make? Some 8/16 bit related changes? Or something
else?

> However, I would like to
> use the rest of the NDFC code.

It should be the goal, to use *only* the common NDFC code. If you have found
some bugs, or you need some changes for 16bit devices, we should try to
integrate them into the common code.

> All of the functions in the NDFC code are
> declared static so I can't access them outside of ndfc.c; is there a
> reason for that? Does it save code space?

One idea behind the static declarations is to not pollute the namespace.

> At the moment, in the source tree I have, I just copied ndfc.c to a
> different source file, made the changes I needed, and compiled that.

Ughhh!

> But I
> don't like the idea of duplicating a significant amount of code. Any
> suggestions on how I should proceed with this?

Yes, please see above. Please explain what changes you need exactly and we
will see, if we can integrate them into the common driver.

> Likewise much of our board specific support files are copies from the
> sequoia code. Would it be better to symlink to the ones that are not
> modified? Or is it OK to just copy the relevant source files into our own
> board directory and make minor adjustments as needed?

Usually we copy those files into a new board directly. When the similarities
are too big, then we should probably think about splitting to common parts
into some other directory (arch/powerpc/cpu/ppc4xx/ppc440epx.c ???).

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