1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef __MTD_CFI_H__ 20 #define __MTD_CFI_H__ 21 #include <linux/delay.h> 22 #include <linux/types.h> 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #include <linux/interrupt.h> 25 #include <linux/mtd/flashchip.h> 26 #include <linux/mtd/map.h> 27 #include <linux/mtd/cfi_endian.h> 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define cfi_interleave_is_1(cfi) (0) 30 #define cfi_interleave_is_2(cfi) (0) 31 #define cfi_interleave_is_4(cfi) (0) 32 #define cfi_interleave_is_8(cfi) (0) 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #define CFI_DEVICETYPE_X8 (8 / 8) 35 #define CFI_DEVICETYPE_X16 (16 / 8) 36 #define CFI_DEVICETYPE_X32 (32 / 8) 37 #define CFI_DEVICETYPE_X64 (64 / 8) 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 struct cfi_ident { 40 uint8_t qry[3]; 41 uint16_t P_ID; 42 uint16_t P_ADR; 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 uint16_t A_ID; 45 uint16_t A_ADR; 46 uint8_t VccMin; 47 uint8_t VccMax; 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 uint8_t VppMin; 50 uint8_t VppMax; 51 uint8_t WordWriteTimeoutTyp; 52 uint8_t BufWriteTimeoutTyp; 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 uint8_t BlockEraseTimeoutTyp; 55 uint8_t ChipEraseTimeoutTyp; 56 uint8_t WordWriteTimeoutMax; 57 uint8_t BufWriteTimeoutMax; 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 uint8_t BlockEraseTimeoutMax; 60 uint8_t ChipEraseTimeoutMax; 61 uint8_t DevSize; 62 uint16_t InterfaceDesc; 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 uint16_t MaxBufWriteSize; 65 uint8_t NumEraseRegions; 66 uint32_t EraseRegionInfo[0]; 67 } __attribute__((packed)); 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 struct cfi_extquery { 70 uint8_t pri[3]; 71 uint8_t MajorVersion; 72 uint8_t MinorVersion; 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 } __attribute__((packed)); 75 struct cfi_pri_intelext { 76 uint8_t pri[3]; 77 uint8_t MajorVersion; 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 uint8_t MinorVersion; 80 uint32_t FeatureSupport; 81 uint8_t SuspendCmdSupport; 82 uint16_t BlkStatusRegMask; 83 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 84 uint8_t VccOptimal; 85 uint8_t VppOptimal; 86 uint8_t NumProtectionFields; 87 uint16_t ProtRegAddr; 88 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 89 uint8_t FactProtRegSize; 90 uint8_t UserProtRegSize; 91 uint8_t extra[0]; 92 } __attribute__((packed)); 93 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 94 struct cfi_intelext_otpinfo { 95 uint32_t ProtRegAddr; 96 uint16_t FactGroups; 97 uint8_t FactProtRegSize; 98 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 99 uint16_t UserGroups; 100 uint8_t UserProtRegSize; 101 } __attribute__((packed)); 102 struct cfi_intelext_blockinfo { 103 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 104 uint16_t NumIdentBlocks; 105 uint16_t BlockSize; 106 uint16_t MinBlockEraseCycles; 107 uint8_t BitsPerCell; 108 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 109 uint8_t BlockCap; 110 } __attribute__((packed)); 111 struct cfi_intelext_regioninfo { 112 uint16_t NumIdentPartitions; 113 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 114 uint8_t NumOpAllowed; 115 uint8_t NumOpAllowedSimProgMode; 116 uint8_t NumOpAllowedSimEraMode; 117 uint8_t NumBlockTypes; 118 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 119 struct cfi_intelext_blockinfo BlockTypes[1]; 120 } __attribute__((packed)); 121 struct cfi_intelext_programming_regioninfo { 122 uint8_t ProgRegShift; 123 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 124 uint8_t Reserved1; 125 uint8_t ControlValid; 126 uint8_t Reserved2; 127 uint8_t ControlInvalid; 128 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 129 uint8_t Reserved3; 130 } __attribute__((packed)); 131 struct cfi_pri_amdstd { 132 uint8_t pri[3]; 133 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 134 uint8_t MajorVersion; 135 uint8_t MinorVersion; 136 uint8_t SiliconRevision; 137 uint8_t EraseSuspend; 138 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 139 uint8_t BlkProt; 140 uint8_t TmpBlkUnprotect; 141 uint8_t BlkProtUnprot; 142 uint8_t SimultaneousOps; 143 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 144 uint8_t BurstMode; 145 uint8_t PageMode; 146 uint8_t VppMin; 147 uint8_t VppMax; 148 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 149 uint8_t TopBottom; 150 } __attribute__((packed)); 151 struct cfi_pri_atmel { 152 uint8_t pri[3]; 153 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 154 uint8_t MajorVersion; 155 uint8_t MinorVersion; 156 uint8_t Features; 157 uint8_t BottomBoot; 158 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 159 uint8_t BurstMode; 160 uint8_t PageMode; 161 } __attribute__((packed)); 162 struct cfi_pri_query { 163 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 164 uint8_t NumFields; 165 uint32_t ProtField[1]; 166 } __attribute__((packed)); 167 struct cfi_bri_query { 168 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 169 uint8_t PageModeReadCap; 170 uint8_t NumFields; 171 uint32_t ConfField[1]; 172 } __attribute__((packed)); 173 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 174 #define P_ID_NONE 0x0000 175 #define P_ID_INTEL_EXT 0x0001 176 #define P_ID_AMD_STD 0x0002 177 #define P_ID_INTEL_STD 0x0003 178 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 179 #define P_ID_AMD_EXT 0x0004 180 #define P_ID_WINBOND 0x0006 181 #define P_ID_ST_ADV 0x0020 182 #define P_ID_MITSUBISHI_STD 0x0100 183 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 184 #define P_ID_MITSUBISHI_EXT 0x0101 185 #define P_ID_SST_PAGE 0x0102 186 #define P_ID_INTEL_PERFORMANCE 0x0200 187 #define P_ID_INTEL_DATA 0x0210 188 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 189 #define P_ID_RESERVED 0xffff 190 #define CFI_MODE_CFI 1 191 #define CFI_MODE_JEDEC 0 192 struct cfi_private { 193 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 194 uint16_t cmdset; 195 void *cmdset_priv; 196 int interleave; 197 int device_type; 198 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 199 int cfi_mode; 200 int addr_unlock1; 201 int addr_unlock2; 202 struct mtd_info *(*cmdset_setup)(struct map_info *); 203 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 204 struct cfi_ident *cfiq; 205 int mfr, id; 206 int numchips; 207 unsigned long chipshift; 208 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 209 const char *im_name; 210 struct flchip chips[0]; 211 }; 212 #if BITS_PER_LONG >= 64 213 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 214 #endif 215 #define CMD(x) cfi_build_cmd((x), map, cfi) 216 #if BITS_PER_LONG >= 64 217 #endif 218 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 219 #define MERGESTATUS(x) cfi_merge_status((x), map, cfi) 220 struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, 221 const char* name); 222 struct cfi_fixup { 223 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 224 uint16_t mfr; 225 uint16_t id; 226 void (*fixup)(struct mtd_info *mtd, void* param); 227 void* param; 228 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 229 }; 230 #define CFI_MFR_ANY 0xffff 231 #define CFI_ID_ANY 0xffff 232 #define CFI_MFR_AMD 0x0001 233 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 234 #define CFI_MFR_ATMEL 0x001F 235 #define CFI_MFR_ST 0x0020 236 typedef int (*varsize_frob_t)(struct map_info *map, struct flchip *chip, 237 unsigned long adr, int len, void *thunk); 238 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 239 #endif 240