NorFlash linux分区分析

一般情况下,与板卡相关的内容都在bsp中(即arch/arm/mach-xxx/board-xxx.c)中,但norflash的分区直接放在norflash驱动中。由于norflash应用基于mtd,所以驱动位于drivers/mtd/目录下,chips目录是norflash相关公用驱动,maps是不同板卡应用的的驱动,如at91sam9261.c。分区信息便在板卡norflash驱动文件中。

#define WINDOW_ADDR 0x10000000      /* physical properties of flash */

#define WINDOW_SIZE 0x800000

#define BUSWIDTH    2

 

#define MSG_PREFIX "SAM9261-NOR:"   /* prefix for our printk()'s */

#define MTDID      "sam9261-nor"    /* for mtdparts= partitioning */

 

static struct mtd_info *mymtd;

 

struct map_info sam9261nor_map = {

    .name = "NOR flash on sam9261",

    .size = WINDOW_SIZE,

    .bankwidth = BUSWIDTH,

    .phys = WINDOW_ADDR,

};

 

#ifdef CONFIG_MTD_PARTITIONS

 

/*

 * MTD partitioning stuff

 */

static struct mtd_partition sam9261_partitions[] =

{

#if 1           /* New fs */

    {   /* rootfs 2M */

        .name = "rootfs",

        .size = MTDPART_SIZ_FULL,

        .offset = 0x380000,

    },

#endif

};

驱动定义两个函数,用于加载卸载驱动:

static int __init init_sam9261nor(void);

static void __exit cleanup_sam9261nor(void);

module_init(init_sam9261nor);

module_exit(cleanup_sam9261nor);

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值