GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / arch / mips / board / pt1125 / include / dev_ptflash.h
blob661ee2b9321fc34b3ae24a8b4d05dc1716e0e778
1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * Flash memory definitions File: dev_ptflash.h
5 *
6 * Stuff we use when manipulating flash memory devices.
7 * Note: this is a special version for the PTSWARM board.
8 *
9 * Author: Mitch Lichtenberg (mpl@broadcom.com)
11 *********************************************************************
13 * Copyright 2000,2001
14 * Broadcom Corporation. All rights reserved.
16 * This software is furnished under license and may be used and
17 * copied only in accordance with the following terms and
18 * conditions. Subject to these conditions, you may download,
19 * copy, install, use, modify and distribute modified or unmodified
20 * copies of this software in source and/or binary form. No title
21 * or ownership is transferred hereby.
23 * 1) Any source code used, modified or distributed must reproduce
24 * and retain this copyright notice and list of conditions as
25 * they appear in the source file.
27 * 2) No right is granted to use any trade name, trademark, or
28 * logo of Broadcom Corporation. Neither the "Broadcom
29 * Corporation" name nor any trademark or logo of Broadcom
30 * Corporation may be used to endorse or promote products
31 * derived from this software without the prior written
32 * permission of Broadcom Corporation.
34 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
35 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
36 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
38 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
39 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
40 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
41 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
42 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
44 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
45 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
46 * THE POSSIBILITY OF SUCH DAMAGE.
47 ********************************************************************* */
50 * AMD Flash commands and magic offsets
53 #define AMD_FLASH_MAGIC_ADDR_1 0x555 /* AAA for 16-bit devices in 8-bit mode */
54 #define AMD_FLASH_MAGIC_ADDR_2 0x2AA /* 554 for 16-bit devices in 8-bit mode */
56 #define AMD_FLASH_RESET 0xF0
57 #define AMD_FLASH_MAGIC_1 0xAA
58 #define AMD_FLASH_MAGIC_2 0x55
59 #define AMD_FLASH_AUTOSEL 0x90
60 #define AMD_FLASH_PROGRAM 0xA0
61 #define AMD_FLASH_UNLOCK_BYPASS 0x20
62 #define AMD_FLASH_ERASE_3 0x80
63 #define AMD_FLASH_ERASE_4 0xAA
64 #define AMD_FLASH_ERASE_5 0x55
65 #define AMD_FLASH_ERASE_ALL_6 0x10
66 #define AMD_FLASH_ERASE_SEC_6 0x30
69 * INTEL Flash commands and magic offsets
72 #define INTEL_FLASH_READ_MODE 0xFF
73 #define INTEL_FLASH_ERASE_BLOCK 0x20
74 #define INTEL_FLASH_ERASE_CONFIRM 0xD0
75 #define INTEL_FLASH_PROGRAM 0x40
77 /* INTEL Flash commands for 16-bit mode */
78 #define INTEL_FLASH_16BIT_READ_MODE 0xFF00
79 #define INTEL_FLASH_16BIT_ERASE_BLOCK 0x2000
80 #define INTEL_FLASH_16BIT_ERASE_CONFIRM 0xD000
81 #define INTEL_FLASH_16BIT_PROGRAM 0x4000
82 #define INTEL_FLASH_8BIT 0
83 #define INTEL_FLASH_16BIT 1
87 * Common Flash Interface (CFI) commands and offsets
90 #define FLASH_CFI_QUERY_ADDR 0x55
91 #define FLASH_CFI_QUERY_MODE 0x98
92 #define FLASH_CFI_QUERY_EXIT 0xFF
94 #define FLASH_CFI_MANUFACTURER 0x00
95 #define FLASH_CFI_DEVICE 0x01
96 #define FLASH_CFI_SIGNATURE 0x10
97 #define FLASH_CFI_QUERY_STRING 0x10
98 #define FLASH_CFI_COMMAND_SET 0x13
99 #define FLASH_CFI_DEVICE_SIZE 0x27
100 #define FLASH_CFI_DEVICE_INTERFACE 0x28
101 #define FLASH_CFI_REGION_COUNT 0x2C
102 #define FLASH_CFI_REGION_TABLE 0x2D
104 #define FLASH_CFI_CMDSET_INTEL_ECS 0x0001 /* Intel extended */
105 #define FLASH_CFI_CMDSET_AMD_STD 0x0002 /* AMD Standard */
106 #define FLASH_CFI_CMDSET_INTEL_STD 0x0003 /* Intel Standard */
107 #define FLASH_CFI_CMDSET_AMD_ECS 0x0004 /* AMD Extended */
109 #define FLASH_CFI_DEVIF_X8 0x0000 /* 8-bit asynchronous */
110 #define FLASH_CFI_DEVIF_X16 0x0001 /* 16-bit asynchronous */
111 #define FLASH_CFI_DEVIF_X8X16 0x0002 /* 8 or 16-bit with BYTE# pin */
112 #define FLASH_CFI_DEVIF_X32 0x0003 /* 32-bit asynchronous */
115 * JEDEC offsets
118 #define FLASH_JEDEC_OFFSET_MFR 0
119 #define FLASH_JEDEC_OFFSET_DEV 1
121 /* Vendor-specific flash identifiers */
123 #define FLASH_MFR_HYUNDAI 0xAD
125 /* *********************************************************************
126 * Macros for defining custom sector tables
127 ********************************************************************* */
129 #define FLASH_SECTOR_RANGE(nblks,size) (((nblks)-1) << 16) + ((size)/256)
130 #define FLASH_SECTOR_NBLKS(x) (((x) >> 16)+1)
131 #define FLASH_SECTOR_SIZE(x) (((x) & 0xFFFF)*256)
132 #define FLASH_MAXSECTORS 8
135 /* *********************************************************************
136 * Structures
137 ********************************************************************* */
140 * This structure is passed in the "probe_ptr" field of the
141 * flash's probe routines and can be used for advanced
142 * configuration. If you pass this structure, probe_a and
143 * probe_b will be ignored by the driver
145 * flash_prog_phys is the base address you use for flash commands -
146 * you can put 0 here if it's the same as flash_phys. some boards,
147 * like the Algor P5064, have a different PA region used for doing
148 * byte accesses to the flash. In this case the special
149 * "flash_prog_phys" field is used for that.
153 #define FLASH_FLG_NVRAM 0x00000001 /* Reserve space for NVRAM */
154 #define FLASH_FLG_AUTOSIZE 0x00000002 /* resize to actual device size */
155 #define FLASH_FLG_16BIT 0x00000004 /* it's a 16-bit ROM in 16-bit mode */
156 #define FLASH_FLG_MANUAL 0x00000008 /* Not CFI, manual sectoring */
157 #define FLASH_FLG_WIDE 0x00000010 /* must shift control addresses left one bit */
159 #ifndef __ASSEMBLER__
160 typedef struct flash_probe_t {
161 long flash_phys;
162 long flash_prog_phys; /* base address for programming, if different */
163 int flash_size; /* total flash size */
164 int flash_flags;
165 int nchips; /* number of physical sequential devices */
166 int chipsize; /* size of single flash chip */
167 /* The following are used when manually sectoring */
168 int flash_cmdset;
169 int flash_nsectors; /* number of ranges */
170 int flash_sectors[FLASH_MAXSECTORS];
171 } flash_probe_t;
172 #endif