ddd
全部博文(22)
分类: 嵌入式
2010-06-03 18:39:45
移植U-Boot-2010.03到友善之臂mini2440(四)
4.1 Nand Flash 驱动
(1)修改drivers/mtd/nand/s3c2410_nand.c,原来的nand驱动在/cpu/arm920t/s3c24x0/nand.c中文件名和放置的位置都已经改变。
#define NF_BASE 0x4e000000
#if defined(CONFIG_S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#endif
#if defined(CONFIG_S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#define S
#endif
(2)u-boot.2010.03自带的S
ulong IO_ADDR_W = NF_BASE;
static void s
{
// struct nand_chip *chip = mtd->priv;
struct s
debugX(1, "hwcontrol(): 0x%02x 0x%02x\n", cmd, ctrl);
if (ctrl & NAND_CTRL_CHANGE) {
//ulong IO_ADDR_W = (ulong)nand;
IO_ADDR_W = (ulong)nand;
if (!(ctrl & NAND_CLE))
IO_ADDR_W |= S
if (!(ctrl & NAND_ALE))
IO_ADDR_W |= S
//chip->IO_ADDR_W = (void *)IO_ADDR_W;
#if defined(CONFIG_S
if (ctrl & NAND_NCE)
writel(readl(&nand->NFCONF) & ~S
&nand->NFCONF);
else
writel(readl(&nand->NFCONF) | S
&nand->NFCONF);
}
#endif
#if defined(CONFIG_S
if (ctrl & NAND_NCE)
writel(readl(&nand->NFCONT) & ~S
&nand->NFCONT);
else
writel(readl(&nand->NFCONT) | S
&nand->NFCONT);
}
#endif
if (cmd != NAND_CMD_NONE)
//writeb(cmd, chip->IO_ADDR_W);
writeb(cmd, (void *)IO_ADDR_W);
}
#ifdef CONFIG_S
void s
{
DEBUGN("s
//writel(readl(&nand->NFCONF) | S
#if defined(CONFIG_S
writel(readl(&nand->NFCONF) | S
#endif
#if defined(CONFIG_S
writel(readl(&nand->NFCONT) | S
#endif
}
(3)修改board_nand_init 函数如下
int board_nand_init(struct nand_chip *nand)
{
u_int32_t cfg;
u_int8_t tacls, twrph0, twrph1;
struct s
struct s
debugX(1, "board_nand_init()\n");
writel(readl(&clk_power->CLKCON) | (1 << 4), &clk_power->CLKCON);
#if defined(CONFIG_S
/* initialize hardware */
twrph0 = 3;
twrph1 = 0;
tacls = 0;
cfg = S
cfg |= S
cfg |= S
cfg |= S
writel(cfg, &nand_reg->NFCONF);
/* initialize nand_chip data structure */
nand->IO_ADDR_R = nand->IO_ADDR_W = (void *)&nand_reg->NFDATA;
#endif
#if defined(CONFIG_S
twrph0 = 4;
twrph1 = 2;
tacls = 0;
cfg = 0;
cfg |= S
cfg |= S
cfg |= S
writel(cfg, &nand_reg->NFCONF);
cfg = (0<<13)|(0<<12)|(0<<10)|(0<<9)|(0<<8)|(0<<6)|(0<<5)|(1<<4)|(0<<1)|(1<<0);
writel(cfg, &nand_reg->NFCONT);
/* initialize nand_chip data structure */
nand->IO_ADDR_R = nand->IO_ADDR_W = (void *)&nand_reg->NFDATA;
#endif
nand->select_chip = NULL;
/* read_buf and write_buf are default */
/* read_byte and write_byte are default */
chinaunix网友2010-11-25 22:05:51
你好,我在移植这个版本的时候,加入nand flash后提示这个有错,nand->NFCONF,编译时提示s3c2410_nand.c:72: error: dereferencing pointer to incomplete type,