GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / arch / mips / board / ptswarm / include / dev_ptflash.h
blob1403d91df79e8f722cba45d95c5212fae21748e4
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,2002,2003
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
25 * as they appear in the source file.
27 * 2) No right is granted to use any trade name, trademark, or
28 * logo of Broadcom Corporation. The "Broadcom Corporation"
29 * name may not be used to endorse or promote products derived
30 * from this software without the prior written permission of
31 * Broadcom Corporation.
33 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
34 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
37 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
38 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
41 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
43 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
45 * THE POSSIBILITY OF SUCH DAMAGE.
46 ********************************************************************* */
49 * AMD Flash commands and magic offsets
52 #define AMD_FLASH_MAGIC_ADDR_1 0x555 /* AAA for 16-bit devices in 8-bit mode */
53 #define AMD_FLASH_MAGIC_ADDR_2 0x2AA /* 554 for 16-bit devices in 8-bit mode */
55 #define AMD_FLASH_RESET 0xF0
56 #define AMD_FLASH_MAGIC_1 0xAA
57 #define AMD_FLASH_MAGIC_2 0x55
58 #define AMD_FLASH_AUTOSEL 0x90
59 #define AMD_FLASH_PROGRAM 0xA0
60 #define AMD_FLASH_UNLOCK_BYPASS 0x20
61 #define AMD_FLASH_ERASE_3 0x80
62 #define AMD_FLASH_ERASE_4 0xAA
63 #define AMD_FLASH_ERASE_5 0x55
64 #define AMD_FLASH_ERASE_ALL_6 0x10
65 #define AMD_FLASH_ERASE_SEC_6 0x30
68 * INTEL Flash commands and magic offsets
71 #define INTEL_FLASH_READ_MODE 0xFF
72 #define INTEL_FLASH_ERASE_BLOCK 0x20
73 #define INTEL_FLASH_ERASE_CONFIRM 0xD0
74 #define INTEL_FLASH_PROGRAM 0x40
76 /* INTEL Flash commands for 16-bit mode */
77 #define INTEL_FLASH_16BIT_READ_MODE 0xFF00
78 #define INTEL_FLASH_16BIT_ERASE_BLOCK 0x2000
79 #define INTEL_FLASH_16BIT_ERASE_CONFIRM 0xD000
80 #define INTEL_FLASH_16BIT_PROGRAM 0x4000
81 #define INTEL_FLASH_8BIT 0
82 #define INTEL_FLASH_16BIT 1
86 * Common Flash Interface (CFI) commands and offsets
89 #define FLASH_CFI_QUERY_ADDR 0x55
90 #define FLASH_CFI_QUERY_MODE 0x98
91 #define FLASH_CFI_QUERY_EXIT 0xFF
93 #define FLASH_CFI_MANUFACTURER 0x00
94 #define FLASH_CFI_DEVICE 0x01
95 #define FLASH_CFI_SIGNATURE 0x10
96 #define FLASH_CFI_QUERY_STRING 0x10
97 #define FLASH_CFI_COMMAND_SET 0x13
98 #define FLASH_CFI_DEVICE_SIZE 0x27
99 #define FLASH_CFI_DEVICE_INTERFACE 0x28
100 #define FLASH_CFI_REGION_COUNT 0x2C
101 #define FLASH_CFI_REGION_TABLE 0x2D
103 #define FLASH_CFI_CMDSET_INTEL_ECS 0x0001 /* Intel extended */
104 #define FLASH_CFI_CMDSET_AMD_STD 0x0002 /* AMD Standard */
105 #define FLASH_CFI_CMDSET_INTEL_STD 0x0003 /* Intel Standard */
106 #define FLASH_CFI_CMDSET_AMD_ECS 0x0004 /* AMD Extended */
108 #define FLASH_CFI_DEVIF_X8 0x0000 /* 8-bit asynchronous */
109 #define FLASH_CFI_DEVIF_X16 0x0001 /* 16-bit asynchronous */
110 #define FLASH_CFI_DEVIF_X8X16 0x0002 /* 8 or 16-bit with BYTE# pin */
111 #define FLASH_CFI_DEVIF_X32 0x0003 /* 32-bit asynchronous */
114 * JEDEC offsets
117 #define FLASH_JEDEC_OFFSET_MFR 0
118 #define FLASH_JEDEC_OFFSET_DEV 1
120 /* Vendor-specific flash identifiers */
122 #define FLASH_MFR_HYUNDAI 0xAD
124 /* *********************************************************************
125 * Macros for defining custom sector tables
126 ********************************************************************* */
128 #define FLASH_SECTOR_RANGE(nblks,size) (((nblks)-1) << 16) + ((size)/256)
129 #define FLASH_SECTOR_NBLKS(x) (((x) >> 16)+1)
130 #define FLASH_SECTOR_SIZE(x) (((x) & 0xFFFF)*256)
131 #define FLASH_MAXSECTORS 8
134 /* *********************************************************************
135 * Structures
136 ********************************************************************* */
139 * This structure is passed in the "probe_ptr" field of the
140 * flash's probe routines and can be used for advanced
141 * configuration. If you pass this structure, probe_a and
142 * probe_b will be ignored by the driver
144 * flash_prog_phys is the base address you use for flash commands -
145 * you can put 0 here if it's the same as flash_phys. some boards,
146 * like the Algor P5064, have a different PA region used for doing
147 * byte accesses to the flash. In this case the special
148 * "flash_prog_phys" field is used for that.
152 #define FLASH_FLG_NVRAM 0x00000001 /* Reserve space for NVRAM */
153 #define FLASH_FLG_AUTOSIZE 0x00000002 /* resize to actual device size */
154 #define FLASH_FLG_16BIT 0x00000004 /* it's a 16-bit ROM in 16-bit mode */
155 #define FLASH_FLG_MANUAL 0x00000008 /* Not CFI, manual sectoring */
156 #define FLASH_FLG_WIDE 0x00000010 /* must shift control addresses left one bit */
158 #ifndef __ASSEMBLER__
159 typedef struct flash_probe_t {
160 long flash_phys;
161 long flash_prog_phys; /* base address for programming, if different */
162 int flash_size; /* total flash size */
163 int flash_flags;
164 int nchips; /* number of physical sequential devices */
165 int chipsize; /* size of single flash chip */
166 /* The following are used when manually sectoring */
167 int flash_cmdset;
168 int flash_nsectors; /* number of ranges */
169 int flash_sectors[FLASH_MAXSECTORS];
170 } flash_probe_t;
171 #endif