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

全部博文(95)

文章存档

2013年(1)

2011年(94)

我的朋友

分类: 嵌入式

2011-08-14 19:30:40

SEP0718 Nand flash驱动
SEP0718的Nand控制器在使用上基本和SEP4020一样(比如DMA操作)。

移植过程中没出现什么大问题,只有有一点点需要注意:
1)ID寄存器可以读到32ib数据,而id和manf只需要8bit,无用数据需要清空
2)CONF1和CONF2寄存器需要重新配置,否则默认开了硬件ECC校验



1 copy /driver/mtd/nand/sep4020.c  to sep0718_nand.c

2 modify /driver/mtd/nand/kconfig
add

config MTD_NAND_SEP0718
tristate "Support for Southeast University SEP0718 easic board"
depends on MTD_NAND && ARCH_SEP0718
help
This enables the driver for the SEU SEP0718 easic
board to access the onboard NAND Flash.

3 modify /driver/mtd/nand/Makefile
add

obj-$(CONFIG_MTD_NAND_SEP0718)  += sep0718_nand.o

4 make menuconfig
  │ │                             --- Memory Technology Device (MTD) support                                                          │ │  
  │ │                             [ ]   Debugging                                                                                     │ │  
  │ │                             <*>   MTD concatenating support                                                                     │ │  
  │ │                             [*]   MTD partitioning support                                                                      │ │  
  │ │                             < >   MTD tests support                                                                             │ │  
  │ │                             < >   RedBoot partition table parsing (NEW)                                                         │ │  
  │ │                             [ ]   Command line partition table parsing (NEW)                                                    │ │  
  │ │                             < >   ARM Firmware Suite partition parsing (NEW)                                                    │ │  
  │ │                             < >   TI AR7 partitioning support (NEW)                                                             │ │  
  │ │                                   *** User Modules And Translation Layers ***                                                   │ │  
  │ │                             <*>   Direct char device access to MTD devices                                                      │ │  
  │ │                             -*-   Common interface to block layer for MTD 'translation layers'                                  │ │  
  │ │                             <*>   Caching block device access to MTD devices                                                    │ │  
  │ │                             < >   FTL (Flash Translation Layer) support                                                         │ │  
  │ │                             < >   NFTL (NAND Flash Translation Layer) support                                                   │ │  
  │ │                             < >   INFTL (Inverse NAND Flash Translation Layer) support                                          │ │  
  │ │                             < >   Resident Flash Disk (Flash Translation Layer) support                                         │ │  
  │ │                             < >   NAND SSFDC (SmartMedia) read only translation layer                                           │ │  
  │ │                             < >   Log panic/oops to an MTD buffer                                                               │ │  
  │ │                                   RAM/ROM/Flash chip drivers  --->                                                              │ │  
  │ │                                   Mapping drivers for chip access  --->                                                         │ │  
  │ │                                   Self-contained MTD device drivers  --->                                                       │ │  
  │ │                             <*>   NAND Device Support  --->                                                                     │ │  
  │ │                             < >   OneNAND Device Support  --->                                                                  │ │  
  │ │                                   LPDDR flash memory drivers  --->                                                              │ │  
  │ │                                   UBI - Unsorted block images  --->   

  │ │                             --- NAND Device Support                                                                             │ │  
  │ │                             [ ]   Verify NAND page writes (NEW)                                                                 │ │  
  │ │                             [ ]   NAND ECC Smart Media byte order (NEW)                                                         │ │  
  │ │                             [ ]   Enable chip ids for obsolete ancient NAND devices (NEW)                                       │ │  
  │ │                             <*>   Support for Southeast University SEP0718 easic board                                          │ │  
  │ │                             < >   DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL) (NEW)  │ │  
  │ │                             < >   Support for NAND Flash Simulator (NEW)                                                        │ │  
  │ │                             < >   Support for generic platform NAND driver (NEW)  

5 modify sep0718_nand.c
del 
line 387 useless  We do not use gpio to control the wp 
//*(volatile unsigned long*)GPIO_PORTG_SEL_V |= 0x0080;
//*(volatile unsigned long*)GPIO_PORTG_DATA_V |= 0x0080;
//*(volatile unsigned long*)GPIO_PORTG_DIR_V &= ~0x0080;

line 272 need repair
static void sep4020_emi_init(void)
{
*(volatile unsigned long*)NAND_CONF1_V = (6<<24) + (3<<20) + (0<<15) + (1<<14) +(8<<8) + (5<<4) + (7<<0);
//0x06302857;//TW2R:6个时钟周期; TALE:4个地址;  TWB:8; 读脉冲:5个; 写脉冲:7个;
*(volatile unsigned long*)NAND_CONF2_V = (4<<18) + (20<<12) + (3<<8) + (1<<6) + (1<<4) + (3<<0);
//0x00514353;//page:512bytes; ecc:soft; TRR:4; TAR:20; TREH:3; CLH:1; TALH:1; TWH:3
}

6 modify /driver/mtd/nand/nand_base.c
line2333
#ifdef CONFIG_MTD_NAND_SEP0718
/* Read manufacturer and device IDs for sep0718  */
*maf_id = chip->read_byte(mtd);
    dev_id  = (*(volatile unsigned long*)NAND_ID1_V)>>8;
dev_id  &= 0xff;
#else
/* Read manufacturer and device IDs */
*maf_id = chip->read_byte(mtd);
dev_id = chip->read_byte(mtd);
#endif

line2354
#ifdef CONFIG_MTD_NAND_SEP0718
/* Read manufacturer and device IDs for sep0718  */
tmp_manf = chip->read_byte(mtd);
    tmp_id  = (*(volatile unsigned long*)NAND_ID1_V)>>8;
tmp_id  &= 0xff;
#else
tmp_manf = chip->read_byte(mtd);
tmp_id = chip->read_byte(mtd);
#endif

7 Build the kernel ,it seems work well ,even yaffs could go through with it.

by rockie cheng
阅读(691) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~