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) |