171#include "xil_types.h"
174#include "xil_assert.h"
177#include "xil_cache.h"
178#if defined (XCLOCKING)
179#include "xil_clocking.h"
182#include <bsp/xil-compat.h>
189#define XNANDPSU_DEBUG
192#define XNANDPSU_MAX_TARGETS 2U
194#define XNANDPSU_MAX_TARGETS 1U
196#define XNANDPSU_MAX_PKT_SIZE 0x7FFU
197#define XNANDPSU_MAX_PKT_COUNT 0xFFFU
199#define XNANDPSU_PAGE_SIZE_512 512U
200#define XNANDPSU_PAGE_SIZE_2K 2048U
201#define XNANDPSU_PAGE_SIZE_4K 4096U
202#define XNANDPSU_PAGE_SIZE_8K 8192U
203#define XNANDPSU_PAGE_SIZE_16K 16384U
204#define XNANDPSU_PAGE_SIZE_1K_16BIT 1024U
205#define XNANDPSU_MAX_PAGE_SIZE 16384U
207#define XNANDPSU_HAMMING 0x1U
208#define XNANDPSU_BCH 0x2U
210#define XNANDPSU_MAX_BLOCKS 16384U
211#define XNANDPSU_MAX_SPARE_SIZE 0x800U
213#define XNANDPSU_MAX_LUNS 8U
214#define XNANDPSU_MAX_PAGES_PER_BLOCK 512U
216#define XNANDPSU_INTR_POLL_TIMEOUT 0xF000000U
218#define XNANDPSU_SDR_CLK ((u16)100U * (u16)1000U * (u16)1000U)
219#define XNANDPSU_NVDDR_CLK_0 ((u16)20U * (u16)1000U * (u16)1000U)
220#define XNANDPSU_NVDDR_CLK_1 ((u16)33U * (u16)1000U * (u16)1000U)
221#define XNANDPSU_NVDDR_CLK_2 ((u16)50U * (u16)1000U * (u16)1000U)
222#define XNANDPSU_NVDDR_CLK_3 ((u16)66U * (u16)1000U * (u16)1000U)
223#define XNANDPSU_NVDDR_CLK_4 ((u16)83U * (u16)1000U * (u16)1000U)
224#define XNANDPSU_NVDDR_CLK_5 ((u16)100U * (u16)1000U * (u16)1000U)
226#define XNANDPSU_MAX_TIMING_MODE 5
229#define XNANDPSU_PAGE_CACHE_UNAVAILABLE -2
230#define XNANDPSU_PAGE_CACHE_NONE -1
241#if defined (XCLOCKING)
407 int32_t PartialDataPageIndex;
439#define XNandPsu_SetBits(InstancePtr, RegOffset, BitMask) \
440 XNandPsu_WriteReg((InstancePtr)->Config.BaseAddress, \
442 ((u32)(XNandPsu_ReadReg((InstancePtr)->Config.BaseAddress, \
443 (RegOffset)) | (BitMask))))
459#define XNandPsu_ClrBits(InstancePtr, RegOffset, BitMask) \
460 XNandPsu_WriteReg((InstancePtr)->Config.BaseAddress, \
462 ((u32)(XNandPsu_ReadReg((InstancePtr)->Config.BaseAddress, \
463 (RegOffset)) & ~(BitMask))))
480#define XNandPsu_ReadModifyWrite(InstancePtr, RegOffset, Mask, Value) \
481 XNandPsu_WriteReg((InstancePtr)->Config.BaseAddress, \
483 ((u32)((u32)(XNandPsu_ReadReg((InstancePtr)->Config.BaseAddress,\
484 (u32)(RegOffset)) & (u32)(~(Mask))) | (u32)(Value))))
498#define XNandPsu_IntrSigEnable(InstancePtr, Mask) \
499 XNandPsu_SetBits((InstancePtr), \
500 XNANDPSU_INTR_SIG_EN_OFFSET, \
515#define XNandPsu_IntrSigClear(InstancePtr, Mask) \
516 XNandPsu_ClrBits((InstancePtr), \
517 XNANDPSU_INTR_SIG_EN_OFFSET, \
532#define XNandPsu_IntrStsEnable(InstancePtr, Mask) \
533 XNandPsu_SetBits((InstancePtr), \
534 XNANDPSU_INTR_STS_EN_OFFSET, \
546#define IS_ONFI(Buff) \
547 ((Buff)[0] == (u8)'O') && ((Buff)[1] == (u8)'N') && \
548 ((Buff)[2] == (u8)'F') && ((Buff)[3] == (u8)'I')
598s32 XNandPsu_MarkBlock(
XNandPsu *InstancePtr, u32 Block, u8 BlockMark);
613bool XNandPsu_StageBlockMark(
XNandPsu *InstancePtr, u32 Block, u8 BlockMark);
626s32 XNandPsu_UpdateBbt(
XNandPsu *InstancePtr, u32 Target);
638 u8 DmaMode, u8 AddrCycles);
void XNandPsu_DisableEccMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:820
void XNandPsu_EnableEccMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:798
s32 XNandPsu_ReadSpareBytes(XNandPsu *InstancePtr, u32 Page, u8 *Buf)
Definition: xnandpsu.c:2158
XNandPsu_SWMode
Definition: xnandpsu.h:275
#define XNANDPSU_MAX_TARGETS
Definition: xnandpsu.h:194
s32 XNandPsu_ChangeTimingMode(XNandPsu *InstancePtr, XNandPsu_DataInterface NewIntf, XNandPsu_TimingMode NewMode)
Definition: xnandpsu.c:2436
void XNandPsu_EnableDmaMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:754
XNandPsu_DmaMode
Definition: xnandpsu.h:283
#define XNANDPSU_MAX_BLOCKS
Definition: xnandpsu.h:210
s32 XNandPsu_EraseBlock(XNandPsu *InstancePtr, u32 Target, u32 Block)
Definition: xnandpsu.c:2233
#define XNANDPSU_MAX_PAGE_SIZE
Definition: xnandpsu.h:205
s32 XNandPsu_SetFeature(XNandPsu *InstancePtr, u32 Target, u8 Feature, u8 *Buf)
Definition: xnandpsu.c:2354
s32 XNandPsu_WriteSpareBytes(XNandPsu *InstancePtr, u32 Page, u8 *Buf)
Definition: xnandpsu.c:1885
s32 XNandPsu_Erase(XNandPsu *InstancePtr, u64 Offset, u64 Length)
Definition: xnandpsu.c:1708
s32 XNandPsu_CfgInitialize(XNandPsu *InstancePtr, XNandPsu_Config *ConfigPtr, u32 EffectiveAddr)
Definition: xnandpsu.c:227
s32 XNandPsu_ScanBbt(XNandPsu *InstancePtr)
Definition: xnandpsu_bbm.c:259
s32 XNandPsu_MarkBlockBad(XNandPsu *InstancePtr, u32 Block)
Definition: xnandpsu_bbm.c:931
XNandPsu_EccMode
Definition: xnandpsu.h:292
XNandPsu_TimingMode
Definition: xnandpsu.h:257
void XNandPsu_DisableDmaMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:776
s32 XNandPsu_GetFeature(XNandPsu *InstancePtr, u32 Target, u8 Feature, u8 *Buf)
Definition: xnandpsu.c:2295
void XNandPsu_Prepare_Cmd(XNandPsu *InstancePtr, u8 Cmd1, u8 Cmd2, u8 EccState, u8 DmaMode, u8 AddrCycles)
Definition: xnandpsu.c:2764
XNandPsu_DataInterface
Definition: xnandpsu.h:249
s32 XNandPsu_Read(XNandPsu *InstancePtr, u64 Offset, u64 Length, u8 *DestBuf)
Definition: xnandpsu.c:1562
s32 XNandPsu_Write(XNandPsu *InstancePtr, u64 Offset, u64 Length, u8 *SrcBuf)
Definition: xnandpsu.c:1437
@ XNANDPSU_POLLING
Definition: xnandpsu.h:276
@ XNANDPSU_INTERRUPT
Definition: xnandpsu.h:277
@ XNANDPSU_MDMA
Definition: xnandpsu.h:286
@ XNANDPSU_PIO
Definition: xnandpsu.h:284
@ XNANDPSU_SDMA
Definition: xnandpsu.h:285
@ XNANDPSU_SDR
Definition: xnandpsu.h:250
@ XNANDPSU_NVDDR
Definition: xnandpsu.h:251
Definition: xnandpsu.h:318
u32 Options
Definition: xnandpsu.h:319
u32 Length
Definition: xnandpsu.h:321
u32 Offset
Definition: xnandpsu.h:320
Definition: xnandpsu.h:302
u32 MaxBlocks
Definition: xnandpsu.h:308
u32 VerOffset
Definition: xnandpsu.h:306
u32 SigOffset
Definition: xnandpsu.h:305
u32 SigLength
Definition: xnandpsu.h:307
u32 Valid
Definition: xnandpsu.h:312
Definition: xnandpsu.h:237
u16 DeviceId
Definition: xnandpsu.h:238
u8 IsCacheCoherent
Definition: xnandpsu.h:240
u32 BaseAddress
Definition: xnandpsu.h:239
Definition: xnandpsu.h:376
Definition: xnandpsu.h:364
Definition: xnandpsu.h:354
Definition: xnandpsu.h:328
u8 NumBitsPerCell
Definition: xnandpsu.h:337
u32 NumTargetPages
Definition: xnandpsu.h:342
u8 NumLuns
Definition: xnandpsu.h:334
u32 BlocksPerLun
Definition: xnandpsu.h:333
u8 NumBitsECC
Definition: xnandpsu.h:338
u32 PagesPerBlock
Definition: xnandpsu.h:332
u32 EccCodeWordSize
Definition: xnandpsu.h:339
u64 DeviceSize
Definition: xnandpsu.h:348
u32 BlockSize
Definition: xnandpsu.h:341
u8 ColAddrCycles
Definition: xnandpsu.h:336
u64 TargetSize
Definition: xnandpsu.h:344
u32 NumBlocks
Definition: xnandpsu.h:347
u8 NumTargets
Definition: xnandpsu.h:345
u32 NumPages
Definition: xnandpsu.h:346
u32 NumTargetBlocks
Definition: xnandpsu.h:343
u16 SpareBytesPerPage
Definition: xnandpsu.h:331
u32 BytesPerPage
Definition: xnandpsu.h:330
u8 RowAddrCycles
Definition: xnandpsu.h:335
Definition: xnandpsu.h:393
XNandPsu_EccMode EccMode
Definition: xnandpsu.h:402
XNandPsu_Features Features
Definition: xnandpsu.h:405
XNandPsu_BadBlockPattern BbPattern
Definition: xnandpsu.h:418
XNandPsu_SWMode Mode
Definition: xnandpsu.h:400
XNandPsu_EccCfg EccCfg
Definition: xnandpsu.h:403
u32 Ecc_Stats_total_flips
Definition: xnandpsu.h:397
XNandPsu_BbtDesc BbtMirrorDesc
Definition: xnandpsu.h:417
XNandPsu_BbtDesc BbtDesc
Definition: xnandpsu.h:416
XNandPsu_Geometry Geometry
Definition: xnandpsu.h:404
XNandPsu_DmaMode DmaMode
Definition: xnandpsu.h:401
u32 IsReady
Definition: xnandpsu.h:394
u32 Ecc_Stat_PerPage_flips
Definition: xnandpsu.h:396
Definition: xnandpsu_onfi.h:185