Chinaunix首页 | 论坛 | 博客
  • 博客访问: 208800
  • 博文数量: 33
  • 博客积分: 1241
  • 博客等级: 中尉
  • 技术积分: 330
  • 用 户 组: 普通用户
  • 注册时间: 2007-01-20 16:34
个人简介

..

文章分类

全部博文(33)

文章存档

2012年(1)

2011年(8)

2010年(8)

2009年(4)

2007年(12)

我的朋友

分类: LINUX

2010-07-22 17:49:57

mtd driver tips
(kernel: 2.6.29)
 
1>
in mips processor, build mtd partition should use physical address.
 
make menuconfig
Device Drivers  --->
Memory Technology Device (MTD) support  --->
Mapping drivers for chip access  --->
------------------------------
<*> Flash device in physical memory map
[*]   Physmap compat support
(0x1f800000) Physical start address of flash mapping
(0x800000) Physical length of flash mapping
(2)     Bank width in octets
------------------------------
 
note: start address should write 0x1f800000, not use 0xbf800000.
 
2>
 
#ifdef CONFIG_MTD_PARTITIONS
#define my_SECTOR_SIZE 0x20000
static struct mtd_partition my_partitions[] = {
    {
        .name   = "reset config",
        .size   = my_SECTOR_SIZE * 8,
        .offset = 0,
    },{
        .name   = "winmon env",
        .size   = my_SECTOR_SIZE,
        .offset = my_SECTOR_SIZE * 8,
    },{
        .name   = "area1",
        .size   = 0x2E0000,
        .offset = 0x120000
        //.mask_flags = MTD_WRITEABLE
    },{
        .name   = "bootloader",
        .size   = 0x100000,
        .offset = 0x400000,
    },{
        .name   = "area2",
        .size   = 0x300000,
        .offset = 0x500000,
        //.mask_flags = MTD_WRITEABLE
    }
};
#endif
 
static int __init physmap_init(void)
{
    int err;
    err = platform_driver_register(&physmap_flash_driver);
#ifdef CONFIG_MTD_PHYSMAP_COMPAT
-    if (err == 0)
+    if (err == 0){
+       physmap_set_partitions(ngVDSL_partitions, ARRAY_SIZE(my_partitions));
        platform_device_register(&physmap_flash);
+    }
#endif
    return err;
}
 
 
阅读(2260) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~