OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2006-2009 NVIDIA Corporation. |
| 3 * All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: |
| 7 * |
| 8 * Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. |
| 10 * |
| 11 * Redistributions in binary form must reproduce the above copyright notice, |
| 12 * this list of conditions and the following disclaimer in the documentation |
| 13 * and/or other materials provided with the distribution. |
| 14 * |
| 15 * Neither the name of the NVIDIA Corporation nor the names of its contributors |
| 16 * may be used to endorse or promote products derived from this software |
| 17 * without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 * POSSIBILITY OF SUCH DAMAGE. |
| 30 * |
| 31 */ |
| 32 |
| 33 /** |
| 34 * @file |
| 35 * <b>NVIDIA Tegra ODM Kit: |
| 36 * NAND Memory Query Interface</b> |
| 37 * |
| 38 * @b Description: Defines the ODM query interface for NVIDIA NAND memory adapta
tion. |
| 39 * |
| 40 */ |
| 41 #ifndef INCLUDED_NVODM_QUERY_NAND_H |
| 42 #define INCLUDED_NVODM_QUERY_NAND_H |
| 43 |
| 44 #include "nvcommon.h" |
| 45 #include "nvodm_modules.h" |
| 46 |
| 47 #if defined(__cplusplus) |
| 48 extern "C" { |
| 49 #endif |
| 50 |
| 51 /** |
| 52 * @defgroup nvodm_query_Nand NAND Memory Query Interface |
| 53 * This is the ODM query interface for NAND configurations. |
| 54 * @ingroup nvodm_query |
| 55 * @{ |
| 56 */ |
| 57 |
| 58 #define FLASH_TYPE_SHIFT 16 |
| 59 #define DEVICE_SHIFT 8 |
| 60 #define FOURTH_ID_SHIFT 24 |
| 61 /** |
| 62 * Defines the list of various capabilities of the NAND devices. |
| 63 */ |
| 64 typedef enum |
| 65 { |
| 66 /// Specifies detected NAND device has only one plane; interleave not |
| 67 /// supported. |
| 68 SINGLE_PLANE, |
| 69 /// Specifies detected NAND device has only one plane; but interleave is |
| 70 /// supported for page programming. |
| 71 SINGLE_PLANE_INTERLEAVE, |
| 72 /// Specifies all types of multiplane capabilities should be declared after |
| 73 /// this. |
| 74 MULTI_PLANE, |
| 75 /// Specifies detected NAND device has multiple planes, and each plane is |
| 76 /// formed with alternate blocks from each bank. |
| 77 MULTIPLANE_ALT_BLOCK, |
| 78 /// Specifies detected NAND device has multiple planes, and each plane is |
| 79 /// formed with sequential blocks from each bank. |
| 80 MULTIPLANE_ALT_PLANE, |
| 81 /// Specifies detected NAND device has multiple planes, and each plane is |
| 82 /// formed with alternate blocks from each bank. Interleaving operation is |
| 83 /// supported across the banks. |
| 84 MULTIPLANE_ALT_BLOCK_INTERLEAVE, |
| 85 /// Specifies detected NAND device has multiple planes, and each plane is |
| 86 /// formed with sequential blocks from each bank. Interleaving operation is |
| 87 /// supported across the banks. |
| 88 MULTIPLANE_ALT_PLANE_INTERLEAVE |
| 89 }NvOdmNandInterleaveCapability; |
| 90 |
| 91 /** |
| 92 * Specifies the NAND Flash type. |
| 93 */ |
| 94 typedef enum |
| 95 { |
| 96 /// Specifies NAND flash type is not known. |
| 97 NvOdmNandFlashType_UnKnown, |
| 98 /// Specifies SLC NAND flash type. |
| 99 NvOdmNandFlashType_Slc, |
| 100 /// Specifies MLC NAND flash type. |
| 101 NvOdmNandFlashType_Mlc, |
| 102 /// Ignore. Forces compilers to make 32-bit enums. |
| 103 NvOdmNandFlashType_Force32 = 0x7FFFFFFF |
| 104 }NvOdmNandFlashType; |
| 105 |
| 106 /// Defines the type of algorithm for error-correcting code (ECC). |
| 107 typedef enum |
| 108 { |
| 109 /// Specifies Hamming ECC. |
| 110 NvOdmNandECCAlgorithm_Hamming = 0, |
| 111 /// Specifies Reed-Solomon ECC. |
| 112 NvOdmNandECCAlgorithm_ReedSolomon, |
| 113 /// Specifies BCH ECC. |
| 114 NvOdmNandECCAlgorithm_BCH, |
| 115 /// Specifies to disable ECC, if the the NAND flash part being used |
| 116 /// has error correction capability within itself. |
| 117 NvOdmNandECCAlgorithm_NoEcc, |
| 118 /// Ignore. Forces compilers to make 32-bit enums. |
| 119 NvOdmNandECCAlgorithm_Force32 = 0x7FFFFFFF |
| 120 }NvOdmNandECCAlgorithm; |
| 121 |
| 122 /// Defines the number of skip spare bytes. |
| 123 typedef enum |
| 124 { |
| 125 NvOdmNandSkipSpareBytes_0, |
| 126 NvOdmNandSkipSpareBytes_4, |
| 127 NvOdmNandSkipSpareBytes_8, |
| 128 NvOdmNandSkipSpareBytes_12, |
| 129 NvOdmNandSkipSpareBytes_16, |
| 130 NvOdmNandSkipSpareBytes_Force32 = 0x7FFFFFFF |
| 131 }NvOdmNandSkipSpareBytes; |
| 132 |
| 133 /** |
| 134 * Defines the number of symbol errors correctable per each 512 continous |
| 135 * bytes of the flash area when Reed-Solomon algorithm is chosen for error |
| 136 * correction. Here each symbol is of 9 contiguous bits in the flash. |
| 137 * |
| 138 * @note Based on the chosen number of errors correctable, parity bytes |
| 139 * required to be stored in the spare area of NAND flash will vary. For 4 |
| 140 * correctable errors the number of parity bytes required are 36 bytes. |
| 141 * Similarly, for 6 and 8 symbol error correction, 56 and 72 parity bytes |
| 142 * must be stored in the spare area. As we also must use the spare area for |
| 143 * bad block management and wear levelling, we need to have 12 bytes for that |
| 144 * in the spare area. So, the spare area size should be able to accommodate |
| 145 * parity bytes and bytes required for bad block management. |
| 146 * Hence fill this parameter based on the spare area size of the flash being |
| 147 * used. |
| 148 */ |
| 149 typedef enum |
| 150 { |
| 151 /// Specifies 4 symbol error correction per 512 byte area of NAND flash. |
| 152 NvOdmNandNumberOfCorrectableSymbolErrors_Four, |
| 153 /// Specifies 6 symbol error correction per 512 byte area of NAND flash. |
| 154 NvOdmNandNumberOfCorrectableSymbolErrors_Six, |
| 155 /// Specifies 8 symbol error correction per 512 byte area of NAND flash. |
| 156 NvOdmNandNumberOfCorrectableSymbolErrors_Eight, |
| 157 /// Ignore. Forces compilers to make 32-bit enums. |
| 158 NvOdmNandNumberOfCorrectableSymbolErrors_Force32 = 0x7FFFFFFF |
| 159 }NvOdmNandNumberOfCorrectableSymbolErrors; |
| 160 |
| 161 /// Defines the NAND flash command set. |
| 162 typedef enum |
| 163 { |
| 164 /// Specifies to read command 1st cycle. |
| 165 NvOdmNandCommandList_Read = 0x00, |
| 166 /// Specifies to read command start 2nd cycle. |
| 167 NvOdmNandCommandList_Read_Start = 0x30, |
| 168 /// Specifies to read copy back 1st cycle. |
| 169 NvOdmNandCommandList_Read_Cpy_Bck = 0x00, |
| 170 /// Specifies to read copy back start 2nd cycle. |
| 171 NvOdmNandCommandList_Read_Cpy_Bck_Start = 0x35, |
| 172 /// Specifies to cache the read command. |
| 173 NvOdmNandCommandList_Cache_Read = 0x31, |
| 174 /// Specifies the last command to end cache read operation. |
| 175 NvOdmNandCommandList_Cache_ReadEnd = 0x3F, |
| 176 /// Specifies to read device ID. |
| 177 NvOdmNandCommandList_Read_Id = 0x90, |
| 178 /// Specifies to reset the device. |
| 179 NvOdmNandCommandList_Reset = 0xFF, |
| 180 /// Specifies to program/write page 1st cycle. |
| 181 NvOdmNandCommandList_Page_Program = 0x80, |
| 182 /// Specifies to program/write page 2nd cycle. |
| 183 NvOdmNandCommandList_Page_Program_Start = 0x10, |
| 184 /// Specifies to cache program 1st cycle. |
| 185 NvOdmNandCommandList_Cache_Program = 0x80, |
| 186 /// Specifies to cache program 2nd cycle. |
| 187 NvOdmNandCommandList_Cache_Program_Start = 0x15, |
| 188 /// Specifies to erase block. |
| 189 NvOdmNandCommandList_Block_Erase = 0x60, |
| 190 /// Specifies erase block start. |
| 191 NvOdmNandCommandList_Block_Erase_Start = 0xD0, |
| 192 /// Specifies copy back data. |
| 193 NvOdmNandCommandList_Copy_Back = 0x85, |
| 194 /// Specifies random data write. |
| 195 NvOdmNandCommandList_Random_Data_Input = 0x85, |
| 196 /// Specifies random data read. |
| 197 NvOdmNandCommandList_Random_Data_Out = 0x05, |
| 198 /// Specifies random data read start. |
| 199 NvOdmNandCommandList_Random_Data_Out_Start = 0xE0, |
| 200 /// Specifies multi page command. |
| 201 NvOdmNandCommandList_MultiPage = 0x11, |
| 202 NvOdmNandCommandList_MultiPageProgPlane2 = 0x81, |
| 203 /// Specifies read device status. |
| 204 NvOdmNandCommandList_Status = 0x70, |
| 205 /// Specifies read status of chip 1. |
| 206 NvOdmNandCommandList_Status_1 = 0xF1, |
| 207 /// Specifies read status of chip 2. |
| 208 NvOdmNandCommandList_Status_2 = 0xF2, |
| 209 /// Specifies ONFI read ID command. |
| 210 NvOdmNandCommandList_ONFIReadId = 0xEC, |
| 211 /// Ignore -- Forces compilers to make 32-bit enums. |
| 212 NvOdmNandCommandList_Force32 = 0x7FFFFFFF |
| 213 }NvOdmNandCommandList; |
| 214 |
| 215 /// Defines NAND flash types (42nm NAND or normal NAND). |
| 216 typedef enum |
| 217 { |
| 218 /// Specifies conventional NAND flash (50nm, 60nm). |
| 219 NvOdmNandDeviceType_Type1, |
| 220 /// Specifies 42nm technology NAND flash. |
| 221 NvOdmNandDeviceType_Type2, |
| 222 NvOdmNandDeviceType_Force32 = 0x7FFFFFFF |
| 223 }NvOdmNandDeviceType; |
| 224 |
| 225 /** |
| 226 * This structure holds various NAND flash parameters. |
| 227 */ |
| 228 typedef struct NvOdmNandFlashParamsRec |
| 229 { |
| 230 /// Holds the vendor ID code. |
| 231 NvU8 VendorId; |
| 232 /// Holds the device ID code. |
| 233 NvU8 DeviceId; |
| 234 /// Holds the device type. |
| 235 NvOdmNandFlashType NandType; |
| 236 /// Holds the information whether the used NAND flash supports internal |
| 237 /// copy back command. |
| 238 NvBool IsCopyBackCommandSupported; |
| 239 /// Holds the information whether the used NAND flash supports cache |
| 240 /// write operations. |
| 241 NvBool IsCacheWriteSupported; |
| 242 /// Holds the size of the flash (in megabytes). |
| 243 NvU32 CapacityInMB; |
| 244 /// Holds the Zones per flash device--minimum value possible is 1. |
| 245 /// Zone is a group of contiguous blocks among which internal copy back can |
| 246 /// be performed, if the chip supports copy-back operation. |
| 247 /// Zone is also referred as plane or district by some flashes. |
| 248 NvU32 ZonesPerDevice; |
| 249 /// Holds the blocks per Zone of the flash. |
| 250 NvU32 BlocksPerZone; |
| 251 /// Holds the expected flash response for READ STATUS command |
| 252 /// when requested previous operation is successful. |
| 253 NvU32 OperationSuccessStatus; |
| 254 /// Holds the interleave mechanism supported by the flash. |
| 255 NvOdmNandInterleaveCapability InterleaveCapability; |
| 256 /// Holds the ECC algorithm to be used for error correction. |
| 257 NvOdmNandECCAlgorithm EccAlgorithm; |
| 258 /// Holds the number of errors that can be corrected per 512 byte area of NA
ND |
| 259 /// flash using Reed-Solomon algorithm. |
| 260 NvOdmNandNumberOfCorrectableSymbolErrors ErrorsCorrectable; |
| 261 /// Holds the number of bytes to be skipped in spare area, starting from |
| 262 /// spare byte 0. |
| 263 NvOdmNandSkipSpareBytes SkippedSpareBytes; |
| 264 /// Flash timing parameters, which are all to be filled in nSec. |
| 265 /// Holds read pulse width in nSec. |
| 266 NvU32 TRP; |
| 267 /// Holds read hold delay in nSec. |
| 268 NvU32 TRH; |
| 269 /// Holds write pulse width in nSec. |
| 270 NvU32 TWP; |
| 271 /// Holds write hold delay in nSec. |
| 272 NvU32 TWH; |
| 273 /// Holds CE# setup time. |
| 274 NvU32 TCS; |
| 275 /// Holds write hold to read delay in nSec. |
| 276 NvU32 TWHR; |
| 277 /// Holds WE to BSY set wait time in nSec. |
| 278 NvU32 TWB; |
| 279 /// Holds read pulse width for PIO read commands. |
| 280 NvU32 TREA; |
| 281 /// Holds time from final rising edge of WE of addrress input to |
| 282 /// first rising edge of WE for data input. |
| 283 NvU32 TADL; |
| 284 /* |
| 285 tCLH, tALH, tCH, tCLS, tALS params are also |
| 286 required to calculate tCS value. |
| 287 */ |
| 288 /// Holds CLE setup time. |
| 289 NvU32 TCLS; |
| 290 /// Holds CLE hold time. |
| 291 NvU32 TCLH; |
| 292 /// Holds CE# hold time. |
| 293 NvU32 TCH; |
| 294 /// Holds ALE setup time. |
| 295 NvU32 TALS; |
| 296 /// Holds ALE hold time. |
| 297 NvU32 TALH; |
| 298 /// Holds Read Cycle hold time. |
| 299 NvU32 TRC; |
| 300 /// Holds Write Cycle hold time. |
| 301 NvU32 TWC; |
| 302 /// Holds CLE High to Read Delay Some data sheets refer it as TCLR. |
| 303 NvU32 TCR; |
| 304 /// Holds ALE High to Read Delay |
| 305 NvU32 TAR; |
| 306 /// Holds RBSY High to Read Delay |
| 307 NvU32 TRR; |
| 308 /// Describes whether the NAND is 42 nm NAND or normal. |
| 309 NvOdmNandDeviceType NandDeviceType; |
| 310 |
| 311 /// Holds the 4th ID data of the read ID command (as given by the data sheet
) |
| 312 /// here to differentiate between 42 nm and other flashes that have the |
| 313 /// same ManufaturerId, DevId, and Flash type (e.g., K9LBG08U0M & K9LBG08U0D
). |
| 314 NvU8 ReadIdFourthByte; |
| 315 }NvOdmNandFlashParams; |
| 316 |
| 317 /** |
| 318 * Gets the NAND flash device information. |
| 319 * |
| 320 * @param ReadID The NAND flash ID value that is read from the flash. |
| 321 * @return NULL if unsuccessful, or the appropriate flash params structure. |
| 322 */ |
| 323 NvOdmNandFlashParams *NvOdmNandGetFlashInfo (NvU32 ReadID); |
| 324 |
| 325 /** @}*/ |
| 326 |
| 327 #if defined(__cplusplus) |
| 328 } |
| 329 #endif |
| 330 |
| 331 #endif // INCLUDED_NVODM_QUERY_NAND_H |
| 332 |
OLD | NEW |