|
Marvell PXA310 wince6.0 nand 驱动求助
[复制链接]
平台 Marvell PXA310 wince 6.0 flash NAND01GR3B2B 8位
问题:按照现有NAND驱动添加了自己的falsh,但是不好用,flash ID为能读出
下面为修改的驱动代码,请大家帮忙分析一下,问题出在那里了,或者告诉一下
添加nand驱动,都需要该改动那些,谢谢(带颜色的字为添加的部分)
#include
extern INT32 PXA_DfcNandInit(PXA_DFC_NAND_CONTEXT *pContext, UINT32 dfcClock);
extern INT32 PXA_DfcNandReadID (PXA_DFC_NAND_CONTEXT *pContext, UINT8* pMakerID, UINT8* pDevID);
typedef enum {
SAMSUNG_CODE = 0xEC,
MICRON_CODE = 0x2C,
STM_CODE = 0x20,
TOSHIBA_CODE = 0x98,
} MAKER_CODE;
typedef enum {
PXA_PLATFORM_DFC_FLASH_NULL = 0 ,
PXA_PLATFORM_DFC_FLASH_Samsung512MbX16 = 1,
PXA_PLATFORM_DFC_FLASH_Micron1GbX8 = 2,
PXA_PLATFORM_DFC_FLASH_Micron1GbX16 = 3,
PXA_PLATFORM_DFC_FLASH_STM1GbX8 = 4,
PXA_PLATFORM_DFC_FLASH_STM2GbX16 = 5,
PXA_PLATFORM_DFC_FLASH_TOSHIBA2GbX16 = 6,
PXA_PLATFORM_DFC_FLASH_STM1GbX16 = 7,
}PXA_PLATFORM_DFC_FLASH_TYPE;
typedef struct {
UINT8 manufacturerId;
UINT8 deviceId;
PXA_PLATFORM_DFC_FLASH_TYPE type;
PXA_DFC_NAND_SPEC *pSpec;
} PXA_PLATFROM_DFC_FLASH_TYPE_INFO;
static INT32 Samsung512MbX16Addr2NDCB1(UINT16 cmd, UINT32 addr, UINT32 *pNdcb1);
static INT32 Samsung512MbX16NDBBR2Addr(UINT16 cmd, UINT32 ndbbr, UINT32 *pAddr);
static INT32 Micron1GbX8Addr2NDCB1(UINT16 cmd, UINT32 addr, UINT32 *pNdcb1);
static INT32 Micron1GbX8NDBBR2Addr(UINT16 cmd, UINT32 ndbbr, UINT32 *pAddr);
static INT32 Micron1GbX16Addr2NDCB1(UINT16 cmd, UINT32 addr, UINT32 *pNdcb1);
static INT32 Micron1GbX16NDBBR2Addr(UINT16 cmd, UINT32 ndbbr, UINT32 *pAddr);
static INT32 STM1GbX16Addr2NDCB1(UINT16 cmd, UINT32 addr, UINT32 *pNdcb1);
static INT32 STM1GbX16NDBBR2Addr(UINT16 cmd, UINT32 ndbbr, UINT32 *pAddr);
static INT32 STM1GbX8Addr2NDCB1(UINT16 cmd, UINT32 addr, UINT32 *pNdcb1);
static INT32 STM1GbX8NDBBR2Addr(UINT16 cmd, UINT32 ndbbr, UINT32 *pAddr);
static INT32 STM2GbX16Addr2NDCB1(UINT16 cmd, UINT32 addr, UINT32 *pNdcb1);
static INT32 STM2GbX16NDBBR2Addr(UINT16 cmd, UINT32 ndbbr, UINT32 *pAddr);
static INT32 TOSHIBA2GbX16Addr2NDCB1(UINT16 cmd, UINT32 addr, UINT32 *pNdcb1);
static INT32 TOSHIBA2GbX16NDBBR2Addr(UINT16 cmd, UINT32 ndbbr, UINT32 *pAddr);
static PXA_DFC_NAND_SPEC samsung512MbX16 =
{
{
10, // tCH, Enable signal hold time.
0, // tCS, Enable signal setup time.
20, // tWH, ND_nWE high duration.
40, // tWP, ND_nWE pulse time.
20, // tRH, ND_nRE high duration.
40, // tRP, ND_nRE pulse width.
11123, // tR = tR + tRR + tWB + 1, ND_nWE high to ND_nRE low for read.
110, // tWHR, ND_nWE high to ND_nRE low delay for status read.
10, // tAR, ND_ALE low to ND_nRE low delay.
},
1, // Data flash bus arbiter enable (ND_ARB_EN).
32, // Pages per block (PG_PER_BLK).
0, // Second cycle start, Row address start position (RA_START).
7, // 2, // 2 bytes, returned ID bytes(RD_ID_CNT).
0, // NAND, (ND_MODE)
0, // Chip select don't care bit (NCSX).
512, // Page size in bytes (PAGE_SZ).
16, //spare size
16, // 16, Width of Flash memory (DWIDTH_M).
16, // 16, Width of flash controller(DWIDTH_C).
4096, // Number of physical blocks in Flash
4, // Number of bytes for read1 and program addresses.
0x46EC, //result of read ID, device code + manufacturer code
// command codes
0x0000, // Read
0x0050, // Read1 unused, current DFC don't support
0x1080, // Write, two cycle command
0x0070, // Read status
0x0090, // Read ID
0xD060, // Erase, two cycle command
0x00FF, // Reset
0x002A, // Lock whole flash
0x2423, // Unlock, two cycle command, supporting partial unlock
0x007A, // Read block lock status
Samsung512MbX16Addr2NDCB1,
Samsung512MbX16NDBBR2Addr,
};
static PXA_DFC_NAND_SPEC micron1GbX8 =
{
{
10, // tCH, Enable signal hold time.
25, // tCS, Enable signal setup time.
15, // tWH, ND_nWE high duration.
25, // tWP, ND_nWE pulse time.
15, // tRH, ND_nRE high duration.
25, // tRP, ND_nRE pulse width.
25000, // tR = tR + tRR + tWB + 1, ND_nWE high to ND_nRE low for read.
60, // tWHR, ND_nWE high to ND_nRE low delay for status read.
10, // tAR, ND_ALE low to ND_nRE low delay.
},
1, // Data flash bus arbiter enable (ND_ARB_EN).
64, // 64, Pages per block (PG_PER_BLK).
1, // Third cycle start, Row address start position (RA_START).
7, // 4 bytes, returned ID bytes(RD_ID_CNT).
0, // NAND, (ND_MODE)
0, // Chip select don't care bit (NCSX).
2048, // 2048bytes, Page size in bytes (PAGE_SZ).
64, //spare size
8, // 8, Width of Flash memory (DWIDTH_M).
8, // 8, Width of flash controller(DWIDTH_C).
1024, // Number of physical blocks in Flash
4, // Number of bytes for read1 and program addresses.
0xA12C, //result of read ID, device code + manufacturer code
// command codes
0x3000, // Read
0x0050, // Read1 unused, current DFC don't support
0x1080, // Write, two cycle command
0x0070, // Read status
0x0090, // Read ID
0xD060, // Erase, two cycle command
0x00FF, // Reset
0x002A, // Lock whole flash
0x2423, // Unlock, two cycle command, supporting partial unlock
0x007A, // Read block lock status
Micron1GbX8Addr2NDCB1,
Micron1GbX8NDBBR2Addr,
};
static PXA_DFC_NAND_SPEC micron1GbX16 =
{
{
10, // tCH, Enable signal hold time.
25, // tCS, Enable signal setup time.
15, // tWH, ND_nWE high duration.
25, // tWP, ND_nWE pulse time.
15, // tRH, ND_nRE high duration.
25, // tRP, ND_nRE pulse width.
25000, // tR = tR + tRR + tWB + 1, ND_nWE high to ND_nRE low for read.
60, // tWHR, ND_nWE high to ND_nRE low delay for status read.
10, // tAR, ND_ALE low to ND_nRE low delay.
},
1, // Data flash bus arbiter enable (ND_ARB_EN).
64, // 64, Pages per block (PG_PER_BLK).
1, // Third cycle start, Row address start position (RA_START).
4, // 4 bytes, returned ID bytes(RD_ID_CNT).
0, // NAND, (ND_MODE)
0, // Chip select don't care bit (NCSX).
2048, // 1024words, Page size in bytes (PAGE_SZ).
64, //spare size
16, // 16, Width of Flash memory (DWIDTH_M).
16, // 16, Width of flash controller(DWIDTH_C).
1024, // Number of physical blocks in Flash
4, // Number of bytes for read1 and program addresses.
0xB12C, //result of read ID, device code + manufacturer code
// command codes
0x3000, // Read
0x0050, // Read1 unused, current DFC don't support
0x1080, // Write, two cycle command
0x0070, // Read status
0x0090, // Read ID
0xD060, // Erase, two cycle command
0x00FF, // Reset
0x002A, // Lock whole flash
0x2423, // Unlock, two cycle command, supporting partial unlock
0x007A, // Read block lock status
Micron1GbX16Addr2NDCB1,
Micron1GbX16NDBBR2Addr,
};
|
|