[U-Boot] NAND support on AVR32

David Collier from_denx_uboot at dexdyne.com
Mon Oct 25 12:40:00 CEST 2010


If you've seen this before, my apologies - this is my 3rd attempt to post
this - it doesn't appear in anything I've downloaded, so I assume it's
not getting posted.

--------------------------------------------------------------

I thought the whole point of using this linux and u-boot stuff was that
whatever you did, someone else had done it first and you just had to copy
them.

Well I've been caught out :-)

I want to ditch using the uSD card at all on our AVR32 board , and use
NAND where we have been using uSD.

I have a Linux JFFS2 disk working out of NAND - quite easy as Linux
pretty much knew how, once you told it you had a chip.

But the u-boot seems to have no clue about NAND on the AVR32 - it doesn't
set up the hardware to get to it at all, and there's no code set up in
the target board header and code files for any AVR32-based board, as far
as I can see!!!

I did pull the latest files, but I couldn't spot any relevant additions.

I have found some stuff in support for other Atmel devices, which seems
relevant.

I'm totally in the dark about what u-boot can or should do with ecc .....

------------

So far I've worked out that I've got to

1. in cpu.c add set up MODE3, CYCLE3, SETUP3, PULSE3 registers for cs3
timing.

2. in <target>.c/board_early_init_f
add hmatrix_slave_write call to enable nand in ebi

3. in <target>.c/board_early_init_f
set up chip select(s) and busy(s) in the GPIO setup to point the right
way, and initially turn everything off

4 in <target>.h

#undef CONFIG_NAND_LEGACY

#define CONFIG_CMD_NAND
#define CONFIG_JFFS2_NAND
#define CFG_MAX_NAND_DEVICE
#define NAND_MAX_CHIPS
#define CFG_NAND_BASE 0x0c000000

I'm still pretty woolly about these though

CONFIG_MTD_NAND_VERIFY_WRITE
CONFIG_MTD_PARTITIONS

And I may have missed other compulsory settings

5. create a file called nand.c in the same directory as my <target>.c -
I've based mine on the one for the at91sam9261ek. This needs to implement

    board_nand_init
      which must set up service routines
        cmd_ctrl to alter ALE,CLE etc
        dev_ready to read the "chip ready" status
        chip_delay - no idea!
I note that there are a couple of other entries in the nand_chip
that are marked "BOARDSPECIFIC" which I don't set up myself... but I
can't see anyone else doing it either!
      
So far I've no clue how the nand.c file gets included in the make of
u-boot - is it automatic, or do I need to edit a makefile?


More information about the U-Boot mailing list