Hello Carlos,

Here's a bit of "Proprietary Code" (a bit like the RBL) 
that writes a 512 byte page to NAND with HW ECC generation.
I used it to program my NAND so it should be OK (no guarantees).

Cheers
Rudy.

#define NAND_COMMAND    *(volatile unsigned char *)(0x02000010)
#define NAND_ADDRESS    *(volatile unsigned char *)(0x02000008)
#define NAND_DATA               *(volatile unsigned char *)(0x02000000)
#define NAND_DISABLE    *(volatile unsigned int *)(0x01E00060)&=~0x101 
#define         NAND_ENABLE     *(volatile unsigned int
*)(0x01E00060)|=0x01 
#define         NAND_START              *(volatile unsigned int
*)(0x01E00060)|=0x100 
#define         NAND_READY              while (!((*(volatile unsigned
int *)0x01E00064) & 1))
#define         NAND_ECC                (*(volatile unsigned int
*)(0x01E00070))&0x0FFF0FFF

int     Nand_Write(unsigned char *buff,int page)
{
unsigned int    ecc,i,j;
unsigned char   ndata;

NAND_ENABLE;
NAND_COMMAND=0x80;
NAND_ADDRESS=0x00;
NAND_ADDRESS=(page)&0xFF;
NAND_ADDRESS=(page>>8)&0xFF;
NAND_ADDRESS=(page>>16)&0xFF;
ecc=NAND_ECC;
NAND_START;
for (i=0;i<512;i++)     NAND_DATA=*(buff++);
ecc=NAND_ECC;
NAND_DATA=(ecc>>24)&0xFF;
NAND_DATA=(ecc>>16)&0xFF;
NAND_DATA=(ecc>>8)&0xFF;
NAND_DATA=(ecc)&0xFF;
for (i=0;i<12;i++)      NAND_DATA=0xFF;
                        
NAND_COMMAND=0x10;
for (i=0;i<1000;i++)    j=j+1;
NAND_READY;
ndata=NAND_DATA;
ndata=NAND_DATA;
NAND_DISABLE;
return 0;
}


> -----Original Message-----
> From: Carlos Ojea [mailto:[EMAIL PROTECTED] 
> Sent: 06 October 2006 09:04
> To: Rudy Reinsch
> Cc: Allred, Daniel; [email protected]
> Subject: Re: Writing UBL and UBOOT in NAND
> 
> Hello Rudy
> > I write the checksum (4 bytes starting at page offset 512).
> Could you give me some clues about how to do that?
> Thank you and regards!
> Carlos
> 
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to