Skip to contentSkip to conversation

FLASH AM29LV320DB on AdderII

U-Boot-Users Raghu 2 participants 4 messages Aug 5, 2003

lore
Share & tools
lore

Raghu

author
#0 lore raw

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

#1 lore raw
Quoted 2 lines · In message <[email protected]> you wrote:

On the AdderII, I am facing some issue w.r.t Flash.

What's an AdderII? This is not one of the supported configurations of U-Boot. At least none that I know of.

Quoted 8 lines

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)

Which source file is this?

Wolfgang Denk

Signature · 7 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Remember thee Ay, thou poor ghost while memory holds a seat  In  this
distracted  globe.  Remember  thee!  Yea, from the table of my memory
I'll wipe away all trivial fond  records,  All  saws  of  books,  all
forms,  all  pressures past, That youth and observation copied there.
Hamlet, I : v : 95 William Shakespeare
author
#2 lore raw
Quoted 3 lines

What's an AdderII? This is not one of the supported configurations of
U-Boot. At least none that I know of.

yeah, I am trying to port u-boot to this card. Its from analogue-micro ( MPC852T ) and you ( wolfgang ) helped me earlier for sdram and SMC1 issue for this.

Quoted 1 line

Which source file is this?

I picked the flash.c from fads and modified few things.

I went through the code of walnut405 ( flash.c ) looks like it has some kind of fix for this. The ( unsigned short ) declarations.
But I am able to detect the sectors correctly.
*****************************************************
Bank # 1: AMD AM29LV320B (32 Mbit, bottom boot sect)
Size: 4 MB in 70 Sectors
Sector Start Addresses:

    FE000000 (RO) FE002000 (RO) FE004000 (RO) FE006000
(RO) FE008000 (RO)
    FE00A000 (RO) FE00C000 (RO) FE00E000 (RO) FE020000
     FE030000
    FE040000      FE050000      FE060000      FE070000
     FE080000
    FE090000      FE0A0000      FE0B0000      FE0C0000
     FE0D0000
    FE0E0000      FE0F0000      FE100000      FE110000
     FE120000
    FE130000      FE140000      FE150000      FE160000
     FE170000
    FE180000      FE190000      FE1A0000      FE1B0000
     FE1C0000
    FE1D0000      FE1E0000      FE1F0000      FE200000
     FE210000
    FE220000      FE230000      FE240000      FE250000
     FE260000
    FE270000      FE280000      FE290000      FE2A0000
     FE2B0000
    FE2C0000      FE2D0000      FE2E0000      FE2F0000
     FE300000
    FE310000      FE320000      FE330000      FE340000
     FE350000
    FE360000      FE370000      FE380000      FE390000
     FE3A0000
    FE3B0000      FE3C0000      FE3D0000      FE3E0000
     FE3F0000

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

regards
Raghu.

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

#3 lore raw
Quoted 7 lines · In message <[email protected]> you wrote:

I picked the flash.c from fads and modified few
things.

I went through the code of walnut405 ( flash.c ) looks like it has some kind of fix for this. The ( unsigned short ) declarations.

This is not a "fix". It is a different configuration for a different board.

You cannot simply pick any flash driver and hope it will work as is for you. You must adapt (port) the flash driver as required by the hardware on your board.

Note that it is generally a bad idea to use the FADS as an example configuration.

Quoted 1 line

But I am able to detect the sectors correctly.

That means nothing.

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Let's say the docs present a simplified view of reality...    :-)
                      - Larry Wall in  <[email protected]>