EXTENDED_ID_NAND("NAND 256MiB 3,3V 8-bit", 0xDA, 256, LP_OPTIONS),
nand get flash type
dev_id 14??????????`??????????`??????????
`??????????`??????????`??????????`??????????`??????????
`????@????@????@????@????@????@return from nand_scan
打印出一堆乱码
entry nand get flash type
maf_id 14
dev_id 14
id_data[0]:14
id_data[1]:14
id_data[2]:14
id_data[3]:14
id_data[4]:14
id_data[5]:14
id_data[6]:14
id_data[7]:14
????@????@????@????@????@????@return from nand_scan
明白问什么乱码了,这是打印行号写错了,应该写成”123“这种形式。
id读写也出了问题,先解决读的问题,好像跟我移植1.1.6出现的问题相同,应该是什么地址写错了
entry nand get flash type
maf_id 14
dev_id 14
id_data[0]:14
id_data[1]:14
id_data[2]:14
id_data[3]:14
id_data[4]:14
id_data[5]:14
id_data[6]:14
id_data[7]:14
3485
3485
3485
3485
3485
3485
return from nand_scan
void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column,
int page_addr);
chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
/* Send the command for reading device ID */
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
chip->cmdfunc(mtd, NAND_CMD_READID, 0x00, -1);
#define NAND_NCE 0x01
/* Select the command latch by setting CLE to high */
#define NAND_CLE 0x02
/* Select the address latch by setting ALE to high */
#define NAND_ALE 0x04
#define NAND_CTRL_CLE (NAND_NCE | NAND_CLE)
#define NAND_CTRL_ALE (NAND_NCE | NAND_ALE)
#define NAND_CTRL_CHANGE 0x80
/*
* Standard NAND flash commands
*/
#define NAND_CMD_READ0 0
#define NAND_CMD_READ1 1
#define NAND_CMD_RNDOUT 5
#define NAND_CMD_PAGEPROG 0x10
#define NAND_CMD_READOOB 0x50
#define NAND_CMD_ERASE1 0x60
#define NAND_CMD_STATUS 0x70
#define NAND_CMD_SEQIN 0x80
#define NAND_CMD_RNDIN 0x85
#define NAND_CMD_READID 0x90
#define NAND_CMD_ERASE2 0xd0
#define NAND_CMD_PARAM 0xec
#define NAND_CMD_GET_FEATURES 0xee
#define NAND_CMD_SET_FEATURES 0xef
#define NAND_CMD_RESET 0xff
#define NAND_CMD_LOCK 0x2a
#define NAND_CMD_UNLOCK1 0x23
#define NAND_CMD_UNLOCK2 0x24
/* Extended commands for large page devices */
#define NAND_CMD_READSTART 0x30
#define NAND_CMD_RNDOUTSTART 0xE0
#define NAND_CMD_CACHEDPROG 0x15
static void nand_select_chip()
{
struct s3c24x0_nand * nand = s3c24x0_get_base_nand();
//nand->nfconf &= ~(1<<1);
nand->nfcont &= ~(1<<1);
}
if (ctrl & NAND_NCE)
//writel(readl(&nand->nfconf) & ~S3C2440_NFCONT_nFCE,
// &nand->nfconf);
writel(readl(&nand->nfcont) & ~S3C2440_NFCONT_nFCE,
&nand->nfconf);
else
// writel(readl(&nand->nfconf) | S3C2440_NFCONT_nFCE,
// &nand->nfconf);
writel(readl(&nand->nfcont) | S3C2440_NFCONT_nFCE,
&nand->nfcont);
nand->nfcont = 1308622852
nand base addr = 1308622848
nand base addr = 1308622848
nand base addr = 1308622848
nand base addr = 1308622848
nand base addr = 1308622848
chip->IO_ADDR_R = 1308622864
chip->IO_ADDR_R = 1308622864
entry nand get flash type
maf_id 16
dev_id 16
nand base addr = 1308622848
nand base addr = 1308622848
nand base addr = 1308622848
chip->IO_ADDR_R = 1308622864
id_data[0]:16
chip->IO_ADDR_R = 1308622864
id_data[1]:16
chip->IO_ADDR_R = 1308622864
id_data[2]:16
chip->IO_ADDR_R = 1308622864
id_data[3]:16
chip->IO_ADDR_R = 1308622864
id_data[4]:16
chip->IO_ADDR_R = 1308622864
id_data[5]:16
chip->IO_ADDR_R = 1308622864
id_data[6]:16
chip->IO_ADDR_R = 1308622864
id_data[7]:16
3485
3485
3485
3485
3485
3485
nand base addr = 1308622848
nand base addr = 1308622848
nand base addr = 1308622848
chip->IO_ADDR_R = 1308622864
nand->nfcont = 1308622852
return from nand_scan
#define S3C2440_ADDR_NALE 0x08
#define S3C2440_ADDR_NCLE 0x0c
交换了这两个宏定义的值竟然好用了,令人费解的操作:
if ( ! (ctrl & NAND_CLE))
IO_ADDR_W |= S3C2440_ADDR_NCLE;
if ( ! (ctrl & NAND_ALE))
IO_ADDR_W |= S3C2440_ADDR_NALE;
现在的问题是能正确读取ID序列值,但是开始无限重启。有可能是执行了什么未定义的函数,
由于未定义,所以地址为0,然后程序重新执行,造成重启的现象。也有可能是等待超时重启了,
待解决。
cmd = 255
chip->IO_ADDR_W = 1308622856
cmd = -1
chip->IO_ADDR_W = 1308622860
cmd = 144
chip->IO_ADDR_W = 1308622856
cmd = 0
chip->IO_ADDR_W = 1308622860
cmd = -1
chip->IO_ADDR_W = 1308622860
chip->IO_ADDR_R = 1308622864
chip->IO_ADDR_R = 1308622864
entry nand get flash type
maf_id 236
dev_id 218
cmd = 144
chip->IO_ADDR_W = 1308622856
cmd = 0
chip->IO_ADDR_W = 1308622860
cmd = -1
chip->IO_ADDR_W = 1308622860
chip->IO_ADDR_R = 1308622864
id_data[0]:236
chip->IO_ADDR_R = 1308622864
id_data[1]:218
chip->IO_ADDR_R = 1308622864
id_data[2]:16
chip->IO_ADDR_R = 1308622864
id_data[3]:149
chip->IO_ADDR_R = 1308622864
id_data[4]:68
chip->IO_ADDR_R = 1308622864
id_data[5]:236
chip->IO_ADDR_R = 1308622864
id_data[6]:218
chip->IO_ADDR_R = 1308622864
id_data[7]:16
3485
3485
3485
3485
3485
3485
3487
cmd = 144
chip->IO_ADDR_W = 1308622856
cmd = 64
chip->IO_ADDR_W = 1308622860
cmd = -1
chip->IO_ADDR_W = 1308622860
chip->IO_ADDR_R = 1308622864