Philips Semiconductors
AN10476
Getting started Linux with LPC3180
And in Linux:
linux-2.6.10/drivers/mtd/nand/lpc3180_nand_phytec.c
linux-2.6.10/drivers/mtd/nand/Makefile
linux-2.6.10/drivers/mtd/nand/Kconfig
linux-2.6.10/arch/arm/configs/lpc3180_defconfig
[Remark] The boldface files are the key files for NAND flash driver porting.
When users use different NAND flash devices, they still use the same LPC3180 on-chip
NAND flash controller that has the same code implementation. We can port the NAND
flash driver with modifying only the device dependent codes. Basically the listed files
without boldface don’t need to be modified.
7.2 NAND flash support in SIBL
Basically NAND flash functions include read, write and erase. But in SIBL, only ‘read’ is
used to load images from NAND flash to SDRAM.
In file
sibl/sibl_flashboot_phytec.c
, the device dependent functions in reading data
include:
void set_addr( UInt32 page, UInt32 column);
void set_page_addr( UInt32 page);
int check_bad_block(int block);
static int crc_check(image_header_t * iheader);
UInt32 oob_check_ff_on_byte5( UInt8 *p_buf );
Void waitForReady(void);
For a new NAND flash device, these functions should be modified according to its user
manual.
7.2.1 Loading image algorithm
For better understanding in reading and modifying the source code, this section gives
detailed descriptions on SIBL loading image algorithm. Just for your reference.
In file
sibl/sibl_flashboot_phytec.c
, functions for reading image data from
NAND flash are:
int read_page_data(UInt8 * buf, UInt32 page);
int read_data(UInt8 * buf, int len);
int read_block(UInt8 * buf, int block, int offset);
int read_first_block( UInt8 *p_buf, int block_nr,
int
page_offset, unsigned int hdr_size);
The most common situation for the image allocation in the NAND flash is shown as below figure:
…
one block
1 2
31
30
0
one page
…
1 2
31
30
29
0
…
1 2
31
30
29
0
…
…
1 2
31
30
29
0
…
1 2
31
30
29
0
…
1 2
31
30
29
0
…
1 2
31
29
0
…
…
1 2
31
30
29
0
...
read_first_block
read_block
read_page_data
read_data
the start address of the image
the last block
the last page
blue area :
the allocation of the image
<12NC>
© Koninklijke Philips Electronics N.V. 2004. All rights reserved.
Application note
Rev.03 — 21 Dec 2006
21 of 28