linux-mips
[Top] [All Lists]

Re: PMON - IdentifyFlashType

To: erras stefan <stefan.erras@dallmeier-electronic.com>
Subject: Re: PMON - IdentifyFlashType
From: Richard Broberg <ribrober@cisco.com>
Date: Thu, 25 Mar 2004 08:35:18 -0800
Cc: linux-mips@linux-mips.org
In-reply-to: <765921A8173EC145948ACBAA0480F67E2C76D6@server10.dallmeier.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <765921A8173EC145948ACBAA0480F67E2C76D6@server10.dallmeier.de>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040204

Can anybody of you great guys can explain me the folling function which
I found in PMON:

BOOL IdentifyFlashType()
{
        ULONG   mId, dId;

        WRITE_REGISTER_ULONG(FLASH_START, 0x90909090);
        mId = READ_REGISTER_ULONG(FLASH_START);
        WRITE_REGISTER_ULONG(FLASH_START, 0x90909090);
        dId = READ_REGISTER_ULONG(FLASH_START+4);
        
if ((mId == 0x00890089) && (dId == 0x00180018)) {
                FlashType = 1;          // J3 flash
                WRITE_REGISTER_ULONG(FLASH_START, 0x00ff00ff);
                printf("J3 32MB flash found on this platform\r\n");
                return TRUE;
        }       
else if ((mId == 0x00890089) && (dId == 0x00170017)) { FlashType = 1; // J3 flash
                WRITE_REGISTER_ULONG(FLASH_START, 0x00ff00ff);
                printf("J3 16MB flash found on this platform\r\n");
                return TRUE;
        }
        return FALSE;
}

I have to know what the WRITE_REGISTER_ULONG and READ_REGISTER_ULONG
functions do affect.
Why do they write 0x90909090 or 0x00ff00ff to FLASH_START?
The 90909090 is a command to the flash chip to describe itself.
(I believe the 2nd write of 90909090 is superfluous). Assumptions are
being made about the flash organization and that's why
you see constants 00890089. I believe 00900090 would have
identical effects to 90909090.

The 00FF00FF is a command to the flash chip to revert to
normal operation where reads return flash contents.

Whats the meaning of mId and dId?
manufacturer id and device id.
89 being intel

Good luck
Richard

<Prev in Thread] Current Thread [Next in Thread>