Chinaunix首页 | 论坛 | 博客
  • 博客访问: 271606
  • 博文数量: 95
  • 博客积分: 2047
  • 博客等级: 大尉
  • 技术积分: 1022
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-14 16:18
文章分类

全部博文(95)

文章存档

2013年(1)

2011年(94)

我的朋友

分类: 嵌入式

2011-08-14 19:32:52

u-boot提供了MTD层支持,可以使用Linux下的nand驱动,如果Linux下nand驱动开发完成了,移植到u-boot下可以让你的工作方便很多。

1 copy linux driver to /u-boot-1.3.3/cpu/sep0718/nand_flash.c

2 修改 /u-boot-1.3.3/cpu/sep0718/Makefile
OBJS = serial.o interrupts.o cpu.o nand_flash.o

3 修改 /include/configs/SEP4020.c
add 

#define CONFIG_CMD_NAND

#define NAND_MAX_CHIPS 1
#define CFG_NAND_BASE 0x11000200

#define CFG_MAX_NAND_DEVICE 1 // Max number of NAND devices
#define SECTORSIZE 512
#define ADDR_COLUMN 1
#define ADDR_PAGE 2
#define ADDR_COLUMN_PAGE 3
#define NAND_ChipID_UNKNOWN 0x00
#define NAND_MAX_FLOORS 1

4 修改nand_flash.c
注意没有虚拟地址,只有实地址

5 修改 /drivers/mtd/nand_base.c
line2322
#ifdef CONFIG_MTD_NAND_SEP0718
/* Read manufacturer and device IDs for sep4020  */
nand_maf_id = this->read_byte(mtd);
  nand_dev_id = (*(volatile unsigned long*)NAND_ID1)>>8;
nand_dev_id &= 0xff;
//printf("read id! id is 0x%x\n",nand_dev_id);
#else
nand_maf_id = this->read_byte(mtd);
    nand_dev_id = this->read_byte(mtd);
#endif

line 2406

//this will change if the chip is sep0718 
#ifndef CONFIG_MTD_NAND_SEP0718
if (this->options & NAND_4PAGE_ARRAY)
this->erase_cmd = multi_erase_cmd;
else
this->erase_cmd = single_erase_cmd;
#endif
阅读(653) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~