How to let Qi to write NAND?

Wentao Han wentao.han at gmail.com
Fri Apr 24 09:52:18 CEST 2009


On Fri, Apr 24, 2009 at 1:32 AM, Michael Trimarchi
<trimarchi at gandalf.sssup.it> wrote:
>
> Hi
> Ruini Xue wrote:
>>
>> Hi, all,
>>
>>  any one knows how to write (actually erase+program) NAND within Qi? We want Qi to keep some information between different bootups in NAND. We tried to write the nand write code by mimicking Qi's nand read codes, but it refuses to work. Any advice is appreciated.
>>
>> -- ruini
>
> Can you send the code?
Here is our code for erasing a block:
void nand_erase(int row_addr)
{
        nand_select();
        nand_clear_RnB();
        NFCMD = NAND_CMD_ERASE1;
        NFADDR = row_addr & 0xff;
        NFADDR = (row_addr >> 8) & 0xff;
        NFADDR = (row_addr >> 16) & 0xff;
        NFCMD = NAND_CMD_ERASE2;
        nand_wait();
        nand_deselect();
}
where NAND_CMD_ERASE1 = 0x60 and NAND_CMD_ERASE2 = 0xD0. After it was
called in bootloader_second_phase() with row_addr = 128 (which stands
for the erasing block starting from 0x40000, I think), the contents
remained. I suppose they should become all 1's. Any hints?
>
> Michael
>



--
Wentao Han

Institute of High-Performance Computing
Department of Computer Science and Technology
Tsinghua University

Beijing 100084, China



More information about the openmoko-kernel mailing list