read NAND (my thinking)

xiangfu xiangfu at openmoko.org
Tue Jul 1 11:21:50 CEST 2008


I read the datesheet and
read the code uboot/cpu/arm920t/s3c24x0/nand_read.c
and there is some function may be we can use ,i am not sure.
like:
/* low level nand read function */
int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
{
    int i, j;
    if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK))
        return -1;    /* invalid alignment */
    /* chip Enable */
    nand_select();
    nand_clear_RnB();
    for (i=0; i<10; i++);
    for (i=start_addr; i < (start_addr + size);) {
        j = nand_read_page_ll(buf, i);
        i += j;
        buf += j;
    }
    /* chip Disable */
    nand_deselect();
    return 0;
}
my thinking is:
    1.   store a LED_ON image in NAND flash
    2.   use the OPENOCD read the another LED_ON to the ROM.
    3.   and run the ROM LED_ON , it will read the NAND flash and load
the (1)LED_ON

there is some question,
    1. how can i store a file  in NAND like LED_ON ? use the dfu-util ?
like werner tell me before.
    2. the file must have a size like 1020byte. read the NAND must page
by page ,
       is there must spare in the NAND?
    3. may be i can read the file from NAND to the BUF ,how can i make
the CPU run this code.

THANKS

a beginner





More information about the openmoko-kernel mailing list