brdbootldr/ubootldr/inc/flash_nor.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __FLASH_NOR_H__
       
    17 #define __FLASH_NOR_H__
       
    18 
       
    19 // If Flash parameters are not already defined, set them to Tyax values.
       
    20 #ifndef FLASHERASEBLOCKSIZE
       
    21 #define FLASHERASEBLOCKSIZE 0x20000 //128KB
       
    22 #endif
       
    23 #ifndef FLASHWRITEBUFSIZE
       
    24 #define FLASHWRITEBUFSIZE 0x40 //64 bytes
       
    25 #endif
       
    26 
       
    27 ///////////////////////////////////////////////////////////////////////////////
       
    28 //
       
    29 // CFI - flash identification
       
    30 //
       
    31 ///////////////////////////////////////////////////////////////////////////////
       
    32 enum CfiManifacturerId
       
    33 	{
       
    34 	CFI_MANUF_SPANSION = 0x01,
       
    35 	CFI_MANUF_INTEL    = 0x89,
       
    36 	CFI_MANUF_ANY      = (TUint16) -1, // some manufacturers' flash chips comform to one standard CFI command set
       
    37 	};
       
    38 
       
    39 enum CfiDeviceId
       
    40 	{
       
    41 	CFI_DEV_S29GL512N  = 0x227e,
       
    42 	CFI_DEV_SIBLEY     = 0x88b1,          // Intel Sibley as found on 3430 SDP (H6)
       
    43 	CFI_DEV_28F256L18T = 0x880d,          // Intel Tyax as found on my H4
       
    44 	CFI_DEV_ANY        = (TUint16) -1,    // some manufacturers' flash chips comform to one standard CFI command set
       
    45 	};
       
    46 
       
    47 typedef struct
       
    48 	{
       
    49 	TPtrC   name;
       
    50 	TUint16	manufacturerId;
       
    51 	TUint16 deviceId;
       
    52 
       
    53 	TInt (*reset)(TUint32 flashId, TUint32 address);
       
    54 	TInt (*erase)(TUint32 flashId, TUint32 aBase,  TUint32 anAddr, TUint32 aSize);
       
    55 	TInt (*write)(TUint32 flashId, TUint32 anAddr, TUint32 aSize,  const TUint32* aPS);
       
    56 
       
    57 	TUint   blockSize;  // the physical block size of the flash
       
    58 	}
       
    59 TFlashInfo;
       
    60 
       
    61 const TUint	FLASH_TYPE_UNKNOWN        = 0;
       
    62 
       
    63 ///////////////////////////////////////////////////////////////////////////////
       
    64 //
       
    65 // CFI - generic command processing
       
    66 //
       
    67 ///////////////////////////////////////////////////////////////////////////////
       
    68 typedef struct
       
    69 	{
       
    70 	TUint32 location; // where to write this command to
       
    71 	TUint32	offset;   // the offset for this command
       
    72 	TUint32 command;  // the command itself
       
    73 	}
       
    74 TCfiCommands;
       
    75 
       
    76 enum
       
    77 	{
       
    78 	CFI_BASE8,   // use the base   address for this 8 bit command
       
    79 	CFI_SECTOR8, // use the sector address for this 8 bit command
       
    80 
       
    81 	CFI_END = (TUint32) -1 // used to mark the end of the command sequence
       
    82 	};
       
    83 
       
    84 
       
    85 
       
    86 const TUint32 KFlashEraseBlockSize = FLASHERASEBLOCKSIZE;
       
    87 const TUint32 KFlashWriteBufSize   = FLASHWRITEBUFSIZE;
       
    88 const TUint32 KRebootDelaySecs     = 5; // Delay(S) between flashing bootldr to reboot
       
    89 
       
    90 // Flash commands
       
    91 //const TUint8	KCmdWordProgram        = 0x40 ;
       
    92 const TUint8	KCmdBlockErase1        = 0x20 ;
       
    93 const TUint8	KCmdBlockErase2        = 0xd0 ;
       
    94 //const TUint8	KCmdEraseSuspend       = 0xb0 ;
       
    95 //const TUint8	KCmdEraseResume        = 0xd0 ;
       
    96 const TUint8	KCmdReadStatus         = 0x70 ; 
       
    97 const TUint8	KCmdClearStatus        = 0x50 ;
       
    98 const TUint8	KCmdReadArrayMode      = 0xFF ; 
       
    99 const TUint8	KCmdClearBlockLockBit1 = 0x60 ;
       
   100 const TUint8	KCmdClearBlockLockBit2 = 0xD0 ;
       
   101 //const TUint8  KCmdSetBlockLockBit1   = 0x60 ;
       
   102 //const TUint8	KCmdSetBlockLockBit2   = 0x01 ;
       
   103 
       
   104 // Flash status
       
   105 const TUint8	KStatusBusy            = 0x80 ;
       
   106 //const TUint8	KStatusProgramError    = 0x38 ;
       
   107 //const TUint8	KStatusVoltageError    = 0x08 ;
       
   108 const TUint8	KStatusCmdSeqError     = 0x30 ;
       
   109 const TUint8	KStatusLockBitError    = 0x20 ;
       
   110 
       
   111 const TUint8    KCmdWriteStatusSibley  = 0xE9; // Sibley write
       
   112 const TUint8    KCmdWriteStatus        = 0xE8; // send Tyax write
       
   113 
       
   114 GLREF_C TUint32 * GetFlashChunk(void);
       
   115 GLREF_C TBool     BlankCheck   (TUint32 anAddr, TUint32 aSize);
       
   116 GLREF_C TInt      Erase        (TUint32 anAddr, TUint32 aSize);
       
   117 GLREF_C TInt      Write        (TUint32 anAddr, TUint32 aSize, const TUint32* aPS);
       
   118 
       
   119 #endif