[U-Boot-Users] FLASH AM29LV320DB on AdderII

Raghu raghu_dk at yahoo.com
Tue Aug 5 15:12:14 CEST 2003


hello all, 

On the AdderII, I am facing some issue w.r.t Flash. 
I am able to erase sectors but not correctly able to
program. The reason I understand so far is because I
am trying to write ulong data, while it is writing
only a word. Code sample 

****************************************************
static int write_word (flash_info_t *info, ulong dest,
ulong data)
{
        vu_short *addr = (vu_short *)(info->start[0]);
        ulong start;
        int flag;

        /* Check if Flash is (sufficiently) erased */
        if ((*((vu_long *)dest) & data ) != data ) {
                return (2);
        }
        /* Disable interrupts */
        flag = disable_interrupts();

        addr[0x0555] = 0xAAAA;
        addr[0x02AA] = 0x5555;
        addr[0x0555] = 0xA0A0;

        *((vu_short *)dest) = data;

        /* re-enable interrupts if necessary */
        if (flag)
                enable_interrupts();

        /* data polling for D7 */
        start = get_timer (0);

        while ((*((vu_short *)dest) & 0x8080) != (data
& 0x8080))
        {
                if (get_timer(start) >
CFG_FLASH_WRITE_TOUT) {
                        return (1);
                }
        }

        return (0);
}

******************************************************

     

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com




More information about the U-Boot mailing list