170#include "xil_types.h"
176#include "xil_cache.h"
177#if defined (XCLOCKING)
178#include "xil_clocking.h"
182#define XNANDPSU_DEBUG
185#define XNANDPSU_MAX_TARGETS 2U
187#define XNANDPSU_MAX_TARGETS 1U
189#define XNANDPSU_MAX_PKT_SIZE 0x7FFU
190#define XNANDPSU_MAX_PKT_COUNT 0xFFFU
192#define XNANDPSU_PAGE_SIZE_512 512U
193#define XNANDPSU_PAGE_SIZE_2K 2048U
194#define XNANDPSU_PAGE_SIZE_4K 4096U
195#define XNANDPSU_PAGE_SIZE_8K 8192U
196#define XNANDPSU_PAGE_SIZE_16K 16384U
197#define XNANDPSU_PAGE_SIZE_1K_16BIT 1024U
198#define XNANDPSU_MAX_PAGE_SIZE 16384U
200#define XNANDPSU_HAMMING 0x1U
201#define XNANDPSU_BCH 0x2U
203#define XNANDPSU_MAX_BLOCKS 16384U
204#define XNANDPSU_MAX_SPARE_SIZE 0x800U
206#define XNANDPSU_MAX_LUNS 8U
207#define XNANDPSU_MAX_PAGES_PER_BLOCK 512U
209#define XNANDPSU_INTR_POLL_TIMEOUT 0xF000000U
211#define XNANDPSU_SDR_CLK ((u16)100U * (u16)1000U * (u16)1000U)
212#define XNANDPSU_NVDDR_CLK_0 ((u16)20U * (u16)1000U * (u16)1000U)
213#define XNANDPSU_NVDDR_CLK_1 ((u16)33U * (u16)1000U * (u16)1000U)
214#define XNANDPSU_NVDDR_CLK_2 ((u16)50U * (u16)1000U * (u16)1000U)
215#define XNANDPSU_NVDDR_CLK_3 ((u16)66U * (u16)1000U * (u16)1000U)
216#define XNANDPSU_NVDDR_CLK_4 ((u16)83U * (u16)1000U * (u16)1000U)
217#define XNANDPSU_NVDDR_CLK_5 ((u16)100U * (u16)1000U * (u16)1000U)
219#define XNANDPSU_MAX_TIMING_MODE 5
228#if defined (XCLOCKING)
423#define XNandPsu_SetBits(InstancePtr, RegOffset, BitMask) \
424 XNandPsu_WriteReg((InstancePtr)->Config.BaseAddress, \
426 ((u32)(XNandPsu_ReadReg((InstancePtr)->Config.BaseAddress, \
427 (RegOffset)) | (BitMask))))
443#define XNandPsu_ClrBits(InstancePtr, RegOffset, BitMask) \
444 XNandPsu_WriteReg((InstancePtr)->Config.BaseAddress, \
446 ((u32)(XNandPsu_ReadReg((InstancePtr)->Config.BaseAddress, \
447 (RegOffset)) & ~(BitMask))))
464#define XNandPsu_ReadModifyWrite(InstancePtr, RegOffset, Mask, Value) \
465 XNandPsu_WriteReg((InstancePtr)->Config.BaseAddress, \
467 ((u32)((u32)(XNandPsu_ReadReg((InstancePtr)->Config.BaseAddress,\
468 (u32)(RegOffset)) & (u32)(~(Mask))) | (u32)(Value))))
482#define XNandPsu_IntrSigEnable(InstancePtr, Mask) \
483 XNandPsu_SetBits((InstancePtr), \
484 XNANDPSU_INTR_SIG_EN_OFFSET, \
499#define XNandPsu_IntrSigClear(InstancePtr, Mask) \
500 XNandPsu_ClrBits((InstancePtr), \
501 XNANDPSU_INTR_SIG_EN_OFFSET, \
516#define XNandPsu_IntrStsEnable(InstancePtr, Mask) \
517 XNandPsu_SetBits((InstancePtr), \
518 XNANDPSU_INTR_STS_EN_OFFSET, \
530#define IS_ONFI(Buff) \
531 ((Buff)[0] == (u8)'O') && ((Buff)[1] == (u8)'N') && \
532 ((Buff)[2] == (u8)'F') && ((Buff)[3] == (u8)'I')
582s32 XNandPsu_MarkBlock(
XNandPsu *InstancePtr, u32 Block, u8 BlockMark);
597bool XNandPsu_StageBlockMark(
XNandPsu *InstancePtr, u32 Block, u8 BlockMark);
610s32 XNandPsu_UpdateBbt(
XNandPsu *InstancePtr, u32 Target);
622 u8 DmaMode, u8 AddrCycles);
void XNandPsu_DisableEccMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:808
void XNandPsu_EnableEccMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:786
s32 XNandPsu_ReadSpareBytes(XNandPsu *InstancePtr, u32 Page, u8 *Buf)
Definition: xnandpsu.c:2115
XNandPsu_SWMode
Definition: xnandpsu.h:262
#define XNANDPSU_MAX_TARGETS
Definition: xnandpsu.h:187
s32 XNandPsu_ChangeTimingMode(XNandPsu *InstancePtr, XNandPsu_DataInterface NewIntf, XNandPsu_TimingMode NewMode)
Definition: xnandpsu.c:2393
void XNandPsu_EnableDmaMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:742
XNandPsu_DmaMode
Definition: xnandpsu.h:270
#define XNANDPSU_MAX_BLOCKS
Definition: xnandpsu.h:203
s32 XNandPsu_EraseBlock(XNandPsu *InstancePtr, u32 Target, u32 Block)
Definition: xnandpsu.c:2190
#define XNANDPSU_MAX_PAGE_SIZE
Definition: xnandpsu.h:198
s32 XNandPsu_SetFeature(XNandPsu *InstancePtr, u32 Target, u8 Feature, u8 *Buf)
Definition: xnandpsu.c:2311
s32 XNandPsu_WriteSpareBytes(XNandPsu *InstancePtr, u32 Page, u8 *Buf)
Definition: xnandpsu.c:1842
s32 XNandPsu_Erase(XNandPsu *InstancePtr, u64 Offset, u64 Length)
Definition: xnandpsu.c:1665
s32 XNandPsu_CfgInitialize(XNandPsu *InstancePtr, XNandPsu_Config *ConfigPtr, u32 EffectiveAddr)
Definition: xnandpsu.c:225
s32 XNandPsu_ScanBbt(XNandPsu *InstancePtr)
Definition: xnandpsu_bbm.c:255
s32 XNandPsu_MarkBlockBad(XNandPsu *InstancePtr, u32 Block)
Definition: xnandpsu_bbm.c:927
XNandPsu_EccMode
Definition: xnandpsu.h:279
XNandPsu_TimingMode
Definition: xnandpsu.h:244
void XNandPsu_DisableDmaMode(XNandPsu *InstancePtr)
Definition: xnandpsu.c:764
s32 XNandPsu_GetFeature(XNandPsu *InstancePtr, u32 Target, u8 Feature, u8 *Buf)
Definition: xnandpsu.c:2252
void XNandPsu_Prepare_Cmd(XNandPsu *InstancePtr, u8 Cmd1, u8 Cmd2, u8 EccState, u8 DmaMode, u8 AddrCycles)
Definition: xnandpsu.c:2721
XNandPsu_DataInterface
Definition: xnandpsu.h:236
s32 XNandPsu_Read(XNandPsu *InstancePtr, u64 Offset, u64 Length, u8 *DestBuf)
Definition: xnandpsu.c:1544
s32 XNandPsu_Write(XNandPsu *InstancePtr, u64 Offset, u64 Length, u8 *SrcBuf)
Definition: xnandpsu.c:1425
@ XNANDPSU_POLLING
Definition: xnandpsu.h:263
@ XNANDPSU_INTERRUPT
Definition: xnandpsu.h:264
@ XNANDPSU_MDMA
Definition: xnandpsu.h:273
@ XNANDPSU_PIO
Definition: xnandpsu.h:271
@ XNANDPSU_SDMA
Definition: xnandpsu.h:272
@ XNANDPSU_SDR
Definition: xnandpsu.h:237
@ XNANDPSU_NVDDR
Definition: xnandpsu.h:238
Definition: xnandpsu.h:305
u32 Options
Definition: xnandpsu.h:306
u32 Length
Definition: xnandpsu.h:308
u32 Offset
Definition: xnandpsu.h:307
Definition: xnandpsu.h:289
u32 MaxBlocks
Definition: xnandpsu.h:295
u32 VerOffset
Definition: xnandpsu.h:293
u32 SigOffset
Definition: xnandpsu.h:292
u32 SigLength
Definition: xnandpsu.h:294
u32 Valid
Definition: xnandpsu.h:299
Definition: xnandpsu.h:224
u16 DeviceId
Definition: xnandpsu.h:225
u8 IsCacheCoherent
Definition: xnandpsu.h:227
u32 BaseAddress
Definition: xnandpsu.h:226
Definition: xnandpsu.h:363
Definition: xnandpsu.h:351
Definition: xnandpsu.h:341
Definition: xnandpsu.h:315
u8 NumBitsPerCell
Definition: xnandpsu.h:324
u32 NumTargetPages
Definition: xnandpsu.h:329
u8 NumLuns
Definition: xnandpsu.h:321
u32 BlocksPerLun
Definition: xnandpsu.h:320
u8 NumBitsECC
Definition: xnandpsu.h:325
u32 PagesPerBlock
Definition: xnandpsu.h:319
u32 EccCodeWordSize
Definition: xnandpsu.h:326
u64 DeviceSize
Definition: xnandpsu.h:335
u32 BlockSize
Definition: xnandpsu.h:328
u8 ColAddrCycles
Definition: xnandpsu.h:323
u64 TargetSize
Definition: xnandpsu.h:331
u32 NumBlocks
Definition: xnandpsu.h:334
u8 NumTargets
Definition: xnandpsu.h:332
u32 NumPages
Definition: xnandpsu.h:333
u32 NumTargetBlocks
Definition: xnandpsu.h:330
u16 SpareBytesPerPage
Definition: xnandpsu.h:318
u32 BytesPerPage
Definition: xnandpsu.h:317
u8 RowAddrCycles
Definition: xnandpsu.h:322
Definition: xnandpsu.h:380
XNandPsu_EccMode EccMode
Definition: xnandpsu.h:389
XNandPsu_Features Features
Definition: xnandpsu.h:392
XNandPsu_BadBlockPattern BbPattern
Definition: xnandpsu.h:402
XNandPsu_SWMode Mode
Definition: xnandpsu.h:387
XNandPsu_EccCfg EccCfg
Definition: xnandpsu.h:390
u32 Ecc_Stats_total_flips
Definition: xnandpsu.h:384
XNandPsu_BbtDesc BbtMirrorDesc
Definition: xnandpsu.h:401
XNandPsu_BbtDesc BbtDesc
Definition: xnandpsu.h:400
XNandPsu_Geometry Geometry
Definition: xnandpsu.h:391
XNandPsu_DmaMode DmaMode
Definition: xnandpsu.h:388
u32 IsReady
Definition: xnandpsu.h:381
u32 Ecc_Stat_PerPage_flips
Definition: xnandpsu.h:383
Definition: xnandpsu_onfi.h:181