RTEMS 6.1-rc5
Loading...
Searching...
No Matches
xnandpsu_onfi.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (C) 2015 - 2022 Xilinx, Inc. All rights reserved.
3* SPDX-License-Identifier: MIT
4******************************************************************************/
5
6/*****************************************************************************/
27#ifndef XNANDPSU_ONFI_H /* prevent circular inclusions */
28#define XNANDPSU_ONFI_H /* by using protection macros */
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/***************************** Include Files *********************************/
35#ifndef __rtems__
36#include "xil_types.h"
37#else
38#include <bsp/xil-compat.h>
39#endif
40
41/************************** Constant Definitions *****************************/
42/* Standard ONFI 3.1 Commands */
43/* ONFI 3.1 Mandatory Commands */
44#define ONFI_CMD_RD1 0x00U
45#define ONFI_CMD_RD2 0x30U
46#define ONFI_CMD_CHNG_RD_COL1 0x05U
48#define ONFI_CMD_CHNG_RD_COL2 0xE0U
50#define ONFI_CMD_BLK_ERASE1 0x60U
51#define ONFI_CMD_BLK_ERASE2 0xD0U
52#define ONFI_CMD_RD_STS 0x70U
53#define ONFI_CMD_PG_PROG1 0x80U
54#define ONFI_CMD_PG_PROG2 0x10U
55#define ONFI_CMD_CHNG_WR_COL 0x85U
56#define ONFI_CMD_RD_ID 0x90U
57#define ONFI_CMD_RD_PRM_PG 0xECU
58#define ONFI_CMD_RST 0xFFU
59/* ONFI 3.1 Optional Commands */
60#define ONFI_CMD_MUL_RD1 0x00U
62#define ONFI_CMD_MUL_RD2 0x32U
64#define ONFI_CMD_CPBK_RD1 0x00U
66#define ONFI_CMD_CPBK_RD2 0x35U
68#define ONFI_CMD_CHNG_RD_COL_ENHCD1 0x06U
70#define ONFI_CMD_CHNG_RD_COL_ENHCD2 0xE0U
72#define ONFI_CMD_RD_CACHE_RND1 0x00U
74#define ONFI_CMD_RD_CACHE_RND2 0x31U
76#define ONFI_CMD_RD_CACHE_SEQ 0x31U
77#define ONFI_CMD_RD_CACHE_END 0x3FU
78#define ONFI_CMD_MUL_BLK_ERASE1 0x60U
80#define ONFI_CMD_MUL_BLK_ERASE2 0xD1U
82#define ONFI_CMD_RD_STS_ENHCD 0x78U
83#define ONFI_CMD_BLK_ERASE_INTRLVD2 0xD1U
85#define ONFI_CMD_MUL_PG_PROG1 0x80U
87#define ONFI_CMD_MUL_PG_PROG2 0x11U
89#define ONFI_CMD_PG_CACHE_PROG1 0x80U
91#define ONFI_CMD_PG_CACHE_PROG2 0x15U
93#define ONFI_CMD_CPBK_PROG1 0x85U
95#define ONFI_CMD_CPBK_PROG2 0x10U
97#define ONFI_CMD_MUL_CPBK_PROG1 0x85U
99#define ONFI_CMD_MUL_CPBK_PROG2 0x10U
101#define ONFI_CMD_SMALL_DATA_MV1 0x85U
103#define ONFI_CMD_SMALL_DATA_MV2 0x10U
105#define ONFI_CMD_CHNG_ROW_ADDR 0x85U
106#define ONFI_CMD_VOL_SEL 0xE1U
107#define ONFI_CMD_ODT_CONF 0xE2U
108#define ONFI_CMD_RD_UNIQID 0xEDU
109#define ONFI_CMD_GET_FEATURES 0xEEU
110#define ONFI_CMD_SET_FEATURES 0xEFU
111#define ONFI_CMD_LUN_GET_FEATURES 0xD4U
112#define ONFI_CMD_LUN_SET_FEATURES 0xD5U
113#define ONFI_CMD_RST_LUN 0xFAU
114#define ONFI_CMD_SYN_RST 0xFCU
116/* ONFI Status Register bit offsets */
117#define ONFI_STS_FAIL 0x01U
118#define ONFI_STS_FAILC 0x02U
119#define ONFI_STS_CSP 0x08U
120#define ONFI_STS_VSP 0x10U
121#define ONFI_STS_ARDY 0x20U
122#define ONFI_STS_RDY 0x40U
123#define ONFI_STS_WP 0x80U
125/* ONFI constants */
126#define ONFI_CRC_LEN 254U
127#define ONFI_PRM_PG_LEN 256U
128#define ONFI_MND_PRM_PGS 3U
130#define ONFI_SIG_LEN 4U
131#define ONFI_CMD_INVALID 0x00U
133#define ONFI_READ_ID_LEN 4U
134#define ONFI_READ_ID_ADDR 0x20U
135#define ONFI_READ_ID_ADDR_CYCLES 1U
138#define ONFI_PRM_PG_ADDR_CYCLES 1U
177 MAX_CMDS
179
180/**************************** Type Definitions *******************************/
181/* Parameter page structure of ONFI 3.1 specification. */
182#ifdef __ICCARM__
183#pragma pack(push, 1)
184#endif
185typedef struct {
186 /* Revision information and features block */
187 u8 Signature[4];
196 u8 Reserved1[17];
197 /* Manufacturer information block */
198 u8 DeviceManufacturer[12];
199 u8 DeviceModel[20];
201 u8 DateCode[2];
202 u8 Reserved2[13];
203 /* Memory organization block */
229 u8 Reserved3[12];
230 /* Electrical parameters block */
234 u16 TProg;
235 u16 TBers;
236 u16 TR;
237 u16 TCcs;
247 u16 TMr;
248 u16 TAdl;
250 u16 TEr;
254 u8 Reserved4[4];
255 /* Vendor block */
257 u8 VendorSpecific[88];
258 u16 Crc;
259#ifdef __ICCARM__
260} OnfiParamPage;
261#pragma pack(pop)
262#else
263}__attribute__((packed))OnfiParamPage;
264#endif
265
266/* ONFI extended parameter page structure. */
267#ifdef __ICCARM__
268#pragma pack(push, 1)
269#endif
270typedef struct {
271 u16 Crc;
272 u8 Sig[4];
273 u8 Reserved1[10];
274 u8 Section0Type;
275 u8 Section0Len;
276 u8 Section1Type;
277 u8 Section1Len;
278 u8 ResSection[12];
279 u8 SectionData[256];
280#ifdef __ICCARM__
281} OnfiExtPrmPage;
282#pragma pack(pop)
283#else
284}__attribute__((packed))OnfiExtPrmPage;
285#endif
286
287/* Driver extended parameter page information. */
288#ifdef __ICCARM__
289#pragma pack(push, 1)
290#endif
291typedef struct {
292 u8 NumEccBits;
293 u8 CodeWordSize;
294 u16 MaxBadBlocks;
295 u16 BlockEndurance;
296 u16 Reserved;
297#ifdef __ICCARM__
298} OnfiExtEccBlock;
299#pragma pack(pop)
300#else
301}__attribute__((packed))OnfiExtEccBlock;
302#endif
303
304typedef struct {
308
309extern const OnfiCmdFormat OnfiCmd[MAX_CMDS];
310
311/************************** Function Prototypes ******************************/
312
313u32 XNandPsu_OnfiParamPageCrc(u8 *ParamBuf, u32 StartOff, u32 Length);
314
315#ifdef __cplusplus
316}
317#endif
318
319#endif /* XNANDPSU_ONFI_H end of protection macro */
u32 XNandPsu_OnfiParamPageCrc(u8 *ParamBuf, u32 StartOff, u32 Length)
Definition: xnandpsu_onfi.c:54
OnfiCommandList
Definition: xnandpsu_onfi.h:144
@ BLOCK_ERASE
Definition: xnandpsu_onfi.h:153
@ READ_ID
Definition: xnandpsu_onfi.h:165
@ READ_STATUS_ENHANCED
Definition: xnandpsu_onfi.h:156
@ READ_PARAM_PAGE
Definition: xnandpsu_onfi.h:168
@ SYN_RESET
Definition: xnandpsu_onfi.h:175
@ VOLUME_SELECT
Definition: xnandpsu_onfi.h:166
@ SMALL_DATA_MOVE
Definition: xnandpsu_onfi.h:162
@ LUN_GET_FEATURES
Definition: xnandpsu_onfi.h:172
@ READ_STATUS
Definition: xnandpsu_onfi.h:155
@ MAX_CMDS
Definition: xnandpsu_onfi.h:177
@ SET_FEATURES
Definition: xnandpsu_onfi.h:171
@ RESET
Definition: xnandpsu_onfi.h:176
@ COPYBACK_READ
Definition: xnandpsu_onfi.h:147
@ MULTIPLANE_BLOCK_ERASE
Definition: xnandpsu_onfi.h:154
@ READ_CACHE_SEQUENTIAL
Definition: xnandpsu_onfi.h:151
@ CHANGE_ROW_ADDR
Definition: xnandpsu_onfi.h:164
@ CHANGE_WRITE_COLUMN
Definition: xnandpsu_onfi.h:163
@ COPYBACK_PROGRAM
Definition: xnandpsu_onfi.h:160
@ READ_CACHE_RANDOM
Definition: xnandpsu_onfi.h:150
@ ODT_CONFIGURE
Definition: xnandpsu_onfi.h:167
@ PAGE_CACHE_PROGRAM
Definition: xnandpsu_onfi.h:159
@ CHANGE_READ_COLUMN
Definition: xnandpsu_onfi.h:148
@ GET_FEATURES
Definition: xnandpsu_onfi.h:170
@ MULTIPLANE_PAGE_PROGRAM
Definition: xnandpsu_onfi.h:158
@ LUN_SET_FEATURES
Definition: xnandpsu_onfi.h:173
@ CHANGE_READ_COLUMN_ENHANCED
Definition: xnandpsu_onfi.h:149
@ PAGE_PROGRAM
Definition: xnandpsu_onfi.h:157
@ MULTIPLANE_READ
Definition: xnandpsu_onfi.h:146
@ READ
Definition: xnandpsu_onfi.h:145
@ READ_UNIQUE_ID
Definition: xnandpsu_onfi.h:169
@ RESET_LUN
Definition: xnandpsu_onfi.h:174
@ MULTIPLANE_COPYBACK_PROGRAM
Definition: xnandpsu_onfi.h:161
@ READ_CACHE_END
Definition: xnandpsu_onfi.h:152
Definition: xnandpsu_onfi.h:304
u8 Command1
Definition: xnandpsu_onfi.h:305
u8 Command2
Definition: xnandpsu_onfi.h:306
Definition: xnandpsu_onfi.h:185
u16 SDRPagecacheTimingMode
Definition: xnandpsu_onfi.h:233
u8 ProgramsPerPage
Definition: xnandpsu_onfi.h:221
u16 SpareBytesPerPage
Definition: xnandpsu_onfi.h:205
u8 GuaranteedValidBlock
Definition: xnandpsu_onfi.h:217
u16 OptionalCmds
Definition: xnandpsu_onfi.h:190
u16 InputPinCap
Definition: xnandpsu_onfi.h:244
u16 SDRTimingMode
Definition: xnandpsu_onfi.h:232
u32 PagesPerBlock
Definition: xnandpsu_onfi.h:210
u16 SpareBytesPerPartialPage
Definition: xnandpsu_onfi.h:208
u32 BytesPerPartialPage
Definition: xnandpsu_onfi.h:206
u8 DrvStrength
Definition: xnandpsu_onfi.h:246
u8 NVDDR2TimingMode
Definition: xnandpsu_onfi.h:240
u8 NVDDRTimingMode
Definition: xnandpsu_onfi.h:239
u8 BitsPerCell
Definition: xnandpsu_onfi.h:214
u16 Revision
Definition: xnandpsu_onfi.h:188
u16 ClkInputPinCap
Definition: xnandpsu_onfi.h:242
u8 PlaneOperationAttr
Definition: xnandpsu_onfi.h:226
u8 SynFeatures
Definition: xnandpsu_onfi.h:241
u16 ExtParamPageLen
Definition: xnandpsu_onfi.h:194
u16 Crc
Definition: xnandpsu_onfi.h:258
u8 PlaneAddrBits
Definition: xnandpsu_onfi.h:225
u16 BlockEnduranceGVB
Definition: xnandpsu_onfi.h:219
u16 TR
Definition: xnandpsu_onfi.h:236
u16 VendorRevisionNum
Definition: xnandpsu_onfi.h:256
u8 PartialProgAttr
Definition: xnandpsu_onfi.h:222
u8 NumLuns
Definition: xnandpsu_onfi.h:212
u16 MaxBadBlocksPerLun
Definition: xnandpsu_onfi.h:215
u8 IOPinCapacitance
Definition: xnandpsu_onfi.h:231
u8 JedecManufacturerId
Definition: xnandpsu_onfi.h:200
u16 TCcs
Definition: xnandpsu_onfi.h:237
u16 IOPinCap
Definition: xnandpsu_onfi.h:243
u8 NVDDR2Features
Definition: xnandpsu_onfi.h:252
u16 TEr
Definition: xnandpsu_onfi.h:250
u16 BlockEndurance
Definition: xnandpsu_onfi.h:216
u8 InputPinCapMax
Definition: xnandpsu_onfi.h:245
u8 Reserved0
Definition: xnandpsu_onfi.h:193
u8 EzNandSupport
Definition: xnandpsu_onfi.h:228
u16 TMr
Definition: xnandpsu_onfi.h:247
u8 NumOfParamPages
Definition: xnandpsu_onfi.h:195
u8 NVDDR2WarmupCycles
Definition: xnandpsu_onfi.h:253
u8 AddrCycles
Definition: xnandpsu_onfi.h:213
u8 JedecJtgPrmAdvCmd
Definition: xnandpsu_onfi.h:191
u8 EccBits
Definition: xnandpsu_onfi.h:223
u16 TAdl
Definition: xnandpsu_onfi.h:248
u16 TProg
Definition: xnandpsu_onfi.h:234
u32 BytesPerPage
Definition: xnandpsu_onfi.h:204
u16 TBers
Definition: xnandpsu_onfi.h:235
u16 Features
Definition: xnandpsu_onfi.h:189
u32 BlocksPerLun
Definition: xnandpsu_onfi.h:211