U-Boot中SMDK2410的NAND Flash驱动。
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 1 MB
*** Warning - bad CRC, using default environment
Out: serial
Err: serial
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 1 MB
NAND: 64 MB
*** Warning - bad CRC, using default environment
Out: serial
Err: serial
* Command definition
***********************************************************/
#define CONFIG_COMMANDS \
(CONFIG_CMD_DFL | \
CFG_CMD_CACHE | \
CFG_CMD_NAND | \
/*CFG_CMD_EEPROM |*/ \
/*CFG_CMD_I2C |*/ \
/*CFG_CMD_USB |*/ \
CFG_CMD_REGINFO | \
CFG_CMD_DATE | \
CFG_CMD_ELF)
NAND_WAIT_READY(nand); /* do the worst case 25us wait */
else
udelay(10);
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
* NAND flash basic functions
* Added by Lu Xianzi 2006.5.27
* Copied from board/mpl/vcma9/vcma9.h & vcma9.c
*/
typedef enum {
NFCE_LOW,
NFCE_HIGH
} NFCE_STATE;
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
NF_Cmd(cmd);
udelay(1);
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
case NFCE_LOW:
nand->NFCONF &= ~(1<<11);
break;
nand->NFCONF |= (1<<11);
break;
}
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
}
{
int i;
NF_Cmd(0xFF); /* reset command */
for(i = 0; i < 10; i++); /* tWB = 100ns. */
NF_WaitRB(); /* wait 200~500us; */
NF_SetCE(NFCE_HIGH);
}
{
#if 0 /* a little bit too optimistic */
#define TACLS 0
#define TWRPH0 3
#define TWRPH1 0
#else
#define TACLS 0
#define TWRPH0 4
#define TWRPH1 2
#endif
/*nand->NFCONF = (1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0); */
/* 1 1 1 1, 1 xxx, r xxx, r xxx */
/* En 512B 4step ECCR nFCE=H tACLS tWRPH0 tWRPH1 */
}
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
#ifdef DEBUG
printf("NAND flash probing at 0x%.8lX\n", (ulong)nand);
#endif
printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20);
}
* NAND flash settings
* Added by Lu Xianzi 2006.5.27
* Copied from include/conifgs/vcma9.h
*/
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
#define SECTORSIZE 512
#define ADDR_PAGE 2
#define ADDR_COLUMN_PAGE 3
#define NAND_MAX_FLOORS 1
#define NAND_MAX_CHIPS 1
#define NAND_ENABLE_CE(nand) NF_SetCE(NFCE_LOW)
#define WRITE_NAND_COMMAND(d, adr) NF_Cmd(d)
#define WRITE_NAND_COMMANDW(d, adr) NF_CmdW(d)
#define WRITE_NAND_ADDRESS(d, adr) NF_Addr(d)
#define WRITE_NAND(d, adr) NF_Write(d)
#define READ_NAND(adr) NF_Read()
/* the following functions are NOP's because S3C24X0 handles this in hardware */
#define NAND_CTL_CLRALE(nandptr)
#define NAND_CTL_SETALE(nandptr)
#define NAND_CTL_CLRCLE(nandptr)
#define NAND_CTL_SETCLE(nandptr)
Because there's no definition of a macro called __mem_pci,
there will be a link error.
*/
#define CONFIG_MTD_NAND_ECC_JFFS2 1
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 1 MB
*** Warning - bad CRC, using default environment
Out: serial
Err: serial
## Start Addr = 0x33000000
## Starting application at 0x33000000 ...
U-Boot 1.1.2 (May 28 2006 - 08:36:42)
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 1 MB
NAND: 64 MB
*** Warning - bad CRC, using default environment
Out: serial
Err: serial
LXZROB #
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read[.jffs2[s]] addr off size
nand write[.jffs2] addr off size - read/write `size' bytes starting
at offset `off' to/from memory address `addr'
nand erase [clean] [off size] - erase `size' bytes from
offset `off' (entire device if not specified)
nand bad - show bad blocks
nand read.oob addr off size - read out-of-band data
nand write.oob addr off size - read out-of-band data
Size: 1 MB in 19 Sectors
Sector Start Addresses:
00000000 (RO) 00004000 (RO) 00006000 (RO) 00008000 (RO) 00010000 (RO)
00020000 00030000 00040000 00050000 00060000
00070000 00080000 00090000 000A0000 000B0000
000C0000 000D0000 000E0000 000F0000 (RO)
Un-Protected 5 sectors
LXZROB # flinfo
Size: 1 MB in 19 Sectors
Sector Start Addresses:
00000000 00004000 00006000 00008000 00010000
00020000 00030000 00040000 00050000 00060000
00070000 00080000 00090000 000A0000 000B0000
000C0000 000D0000 000E0000 000F0000 (RO)
Erasing sector 0 ... ok.
Erasing sector 1 ... ok.
Erasing sector 2 ... ok.
Erasing sector 3 ... ok.
Erasing sector 4 ... ok.
Erased 5 sectors
Copy to Flash... done
0 意見:
发表评论