Files
u-boot-sunxi/nand_sunxi/nand_interface/nand_bsp.h
2013-02-23 14:52:12 +08:00

84 lines
2.9 KiB
C
Executable File

#ifndef _NAND_BSP_H_
#define _NAND_BSP_H_
//#define NAND_CACHE_OPEN
//for simple
struct boot_physical_param{
__u32 chip; //chip no
__u32 block; // block no within chip
__u32 page; // apge no within block
__u32 sectorbitmap; //done't care
void *mainbuf; //data buf
void *oobbuf; //oob buf
};
//---------------------------------------------------------------
// º¯Êý ¶¨Òå
//---------------------------------------------------------------
//for logic
extern __s32 LML_Init(void);
extern __s32 LML_Exit(void);
extern __s32 LML_Read(__u32 nLba, __u32 nLength, void* pBuf);
extern __s32 LML_Write(__u32 nLba, __u32 nLength, void* pBuf);
extern __s32 LML_FlushPageCache(void);
extern __s32 NAND_CacheFlush(void);
extern __s32 NAND_CacheRead(__u32 blk, __u32 nblk, void *buf);
extern __s32 NAND_CacheWrite(__u32 blk, __u32 nblk, void *buf);
extern __s32 NAND_CacheOpen(void);
extern __s32 NAND_CacheClose(void);
//for format
extern __s32 FMT_Init(void);
extern __s32 FMT_Exit(void);
extern __s32 FMT_FormatNand(void);
extern void ClearNandStruct( void );
//for scan
__s32 SCN_AnalyzeNandSystem(void);
//for physical
extern __s32 PHY_Init(void);
extern __s32 PHY_Exit(void);
extern __s32 PHY_ChangeMode(__u8 serial_mode);
//for simplie(boot0)
extern __s32 PHY_SimpleErase(struct boot_physical_param * eraseop);
extern __s32 PHY_SimpleRead(struct boot_physical_param * readop);
extern __s32 PHY_SimpleWrite(struct boot_physical_param * writeop);
extern __s32 PHY_SimpleWrite_1K(struct boot_physical_param * writeop);
extern __s32 PHY_SimpleWrite_Seq(struct boot_physical_param * writeop);
extern __s32 PHY_SimpleRead_Seq(struct boot_physical_param * readop);
extern __s32 PHY_SimpleRead_1K(struct boot_physical_param * readop);
extern __s32 BOOT_AnalyzeNandSystem(void);
//for lsb mode
extern __s32 NFC_LSBEnable(__u32 chip, __u32 read_retry_type);
extern __s32 NFC_LSBDisable(__u32 chip, __u32 read_retry_type);
extern __s32 NFC_LSBInit(__u32 read_retry_type);
extern __s32 NFC_LSBExit(__u32 read_retry_type);
//for param get&set
extern __u32 NAND_GetPageSize(void);
extern __u32 NAND_GetPageCntPerBlk(void);
extern __u32 NAND_GetBlkCntPerChip(void);
extern __u32 NAND_GetChipCnt(void);
extern __u32 NAND_GetChipConnect(void);
extern __u32 NAND_GetBadBlockFlagPos(void);
extern __u32 NAND_GetReadRetryType(void);
extern __u32 NAND_GetDiskSize(void);
extern __u32 NAND_SetParam(void *buffer, uint length);
extern __s32 NAND_GetParam(void *buffer, __u32 length);
extern __u32 NAND_GetValidBlkRatio(void);
extern __s32 NAND_SetValidBlkRatio(__u32 ValidBlkRatio);
extern __u32 NAND_GetFrequencePar(void);
extern __s32 NAND_SetFrequencePar(__u32 FrequencePar);
extern __u32 NAND_GetVersion(__u8 *version);
extern void NAND_SetSrcClkName(__u32 pll_name);
extern int NAND_GetParam_store(void *buffer, uint length);
#endif