#ifndef FL_H #define FL_H /* Copyright Motorola, Inc. 1997 ALL RIGHTS RESERVED You are hereby granted a copyright license to use, modify, and distribute the SOFTWARE so long as this entire notice is retained without alteration in any modified and/or redistributed versions, and that such modified versions are clearly identified as such. No licenses are granted by implication, estoppel or otherwise under any patents or trademarks of Motorola, Inc. The SOFTWARE is provided on an "AS IS" basis and without warranty. To the maximum extent permitted by applicable law, MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) AND ANY ACCOMPANYING WRITTEN MATERIALS. To the maximum extent permitted by applicable law, IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE. Motorola assumes no responsibility for the maintenance and support of the SOFTWARE. */ /* History * mo 10/08/98: create file to consolidate all defined values. * mo 1/06/99: Implement mechanism to allow code to work for Rev2 * and prior boards and Rev3 and later boards, by * defining REVISION3 in config.h and defining the * correct data codes in fl.h and using them here in fl.c * mo 1/07/99: Detect flash revision dynamically. */ #define MAX_ERASE_WAIT 90000000 /* max iterations to ensure erase worked */ #define DQ7MASK 0x00800080 /* mask to get DQ7 from top and bottom * flash chips */ #define DQ7MASK_REV3 0x00800080 /* Rev 3 is bits 8 and 24 */ #define DQ7MASK_REV2 0x01000100 /* Rev 2 is bits 7 and 23 */ #define TRUE 1 #define FALSE 0 #define UNPROTECTED 0 #define PROTECTED 1 #define UNDETERMINED 2 #define ERASED 0 #define NOT_ERASED 1 #define MAX_EXCIMER_TABLE_SIZE 19 struct sectors { /* protect_status is 0 unprotected * 1 protected * 2 undetermined */ short int protect_status; /* erased is 0 not erased * 1 erased */ short int erased; unsigned long address; }; /* This structure is derived from Table 3, p11 in the AMD * Am29LV800B manual pub #21490 * These values represent the bit settings for A18-A12, left shifted 12 bits * to accomodate the bit settings for A10-A16, as they are physically * wired. * thus this is the correspondence: * CPU bits 0123456789 1111111 11122 2 2222 22 233 * 0123456 78901 2 3456 78 901 * ||||||| | || * AAAAAAA A AA * Flash bits 1111111 0 00 * 8765432 6 10 * value 1111111111 sector 00000 0 0000 10 000 * flash begins at 1111 1111 11 = ff[cdef], all bits except CPU 27 * corresponding to A1 must be zero, A1 must be 1 (high) * The lower three bits CPU 29, 30, and 31 are zero because of the way * the board is wired. * * hence sectors are: * A0 111111111 0000000 00000 0 0000 10 000 = ffc00010 * A1 111111111 0000010 00000 0 0000 10 000 = ffc10010 * A2 111111111 0000011 00000 0 0000 10 000 = ffc18010 * A3 111111111 0000100 00000 0 0000 10 000 = ffc20010 * A4 111111111 0001000 00000 0 0000 10 000 = ffc40010 * A5 111111111 0010000 00000 0 0000 10 000 = ffc80010 * A6 111111111 0011000 00000 0 0000 10 000 = ffcc0010 * A7 111111111 0100000 00000 0 0000 10 000 = ffd00010 * A8 111111111 0101000 00000 0 0000 10 000 = ffd40010 * A9 111111111 0110000 00000 0 0000 10 000 = ffd80010 * A10 111111111 0111000 00000 0 0000 10 000 = ffdc0010 * A11 111111111 0000000 00000 0 0000 10 000 = ffe00010 * A12 111111111 1001000 00000 0 0000 10 000 = ffe40010 * A13 111111111 1010000 00000 0 0000 10 000 = ffe80010 * A14 111111111 1011000 00000 0 0000 10 000 = ffec0010 * A15 111111111 1100000 00000 0 0000 10 000 = fff00010 * A16 111111111 1101000 00000 0 0000 10 000 = fff40010 * A17 111111111 1110000 00000 0 0000 10 000 = fff80010 * A18 111111111 1111000 00000 0 0000 10 000 = fffc0010 */ struct sectors excimer_sa[] = { UNDETERMINED,NOT_ERASED, 0xffc00010, /* SA0 */ UNDETERMINED,NOT_ERASED, 0xffc10010, /* SA1 */ UNDETERMINED,NOT_ERASED, 0xffc18010, /* SA2 */ UNDETERMINED,NOT_ERASED, 0xffc20010, /* SA3 */ UNDETERMINED,NOT_ERASED, 0xffc40010, /* SA4 */ UNDETERMINED,NOT_ERASED, 0xffc80010, /* SA5 */ UNDETERMINED,NOT_ERASED, 0xffcc0010, /* SA6 */ UNDETERMINED,NOT_ERASED, 0xffd00010, /* SA7 */ UNDETERMINED,NOT_ERASED, 0xffd40010, /* SA8 */ UNDETERMINED,NOT_ERASED, 0xffd80010, /* SA9 */ UNDETERMINED,NOT_ERASED, 0xffdc0010, /* SA10 */ UNDETERMINED,NOT_ERASED, 0xffe00010, /* SA11 */ UNDETERMINED,NOT_ERASED, 0xffe40010, /* SA12 */ UNDETERMINED,NOT_ERASED, 0xffe80010, /* SA13 */ UNDETERMINED,NOT_ERASED, 0xffec0010, /* SA14 */ UNDETERMINED,NOT_ERASED, 0xfff00010, /* SA15 */ UNDETERMINED,NOT_ERASED, 0xfff40010, /* SA16 */ UNDETERMINED,NOT_ERASED, 0xfff80010, /* SA17 */ UNDETERMINED,NOT_ERASED, 0xfffc0010 /* SA18 */ }; struct sectors yellowknife_sa[] = { UNDETERMINED,NOT_ERASED, 0x00000, UNDETERMINED,NOT_ERASED, 0x10000, UNDETERMINED,NOT_ERASED, 0x20000, UNDETERMINED,NOT_ERASED, 0x30000, UNDETERMINED,NOT_ERASED, 0x40000, UNDETERMINED,NOT_ERASED, 0x50000, UNDETERMINED,NOT_ERASED, 0x60000, UNDETERMINED,NOT_ERASED, 0x70000}; /* Flash data values used to program the flash * REVISION3 and up use the bits in order * REVISION2 and prior have the data bits wired in reverse */ #define FLASH_REV_UNKNOWN 100 #define FLASH_REV_NONE 0 #define FLASH_REV_TWO 2 #define FLASH_REV_THREE 3 #define FLASH_MANUFACTURER_ID 0x1 #define FLASH_DEVICE_ID 0x225b /* REVISION3 and up */ #define R3ALLZEROS 0x00000000 #define R3ALLFIVES 0x55555555 #define R3ALLAS 0xaaaaaaaa #define R3ALLONEZEROS 0x10101010 #define R3ALLTWOZEROS 0x20202020 #define R3ALLTHREEZEROS 0x30303030 #define R3ALLFOURZEROS 0x40404040 #define R3ALLFIVEZEROS 0x50505050 #define R3ALLSIXZEROS 0x60606060 #define R3ALLEIGHTZEROS 0x80808080 #define R3ALLNINEZEROS 0x90909090 #define R3ALLAZEROS 0xa0a0a0a0 #define R3ALLFZEROS 0xf0f0f0f0 /* REVISION2 and prior: bit reversed equivalents */ #define R2ALLZEROS 0x00000000 #define R2ALLFIVES 0xaaaaaaaa #define R2ALLAS 0x55555555 #define R2ALLONEZEROS 0x08080808 #define R2ALLTWOZEROS 0x04040404 #define R2ALLTHREEZEROS 0x0c0c0c0c #define R2ALLFOURZEROS 0x02020202 #define R2ALLFIVEZEROS 0x0a0a0a0a #define R2ALLSIXZEROS 0x06060606 #define R2ALLEIGHTZEROS 0x01010101 #define R2ALLNINEZEROS 0x09090909 #define R2ALLAZEROS 0x05050505 #define R2ALLFZEROS 0x0f0f0f0f #endif /* FL_H */