Linux 下 Nand Flash 驱动主要数据结构说明

s3c2410 专有数据结构

  1. s3c2410_nand_set

struct s3c2410_nand_set {

int                    nr_chips;     /* 芯片的数目 */

int                    nr_partitions; /* 分区的数目 */

char                   *name;          /* 集合名称   */

int                   nr_map;       /* 可选, 底层逻辑到物理的芯片数目 */ struct mtd_partition                      partitions;   /* 分区列表   */

};

  1. s3c2410_platform_and

struct s3c2410_platform_nand {

/* timing information for controller, all times in nanoseconds */

int     tacls; /* 从 CLE/ALE 有效到 nWE/nOE 的时间 */ int   twrph0; /* nWE/nOE 的有效时间 */

int     twrph1; /* 从释放 CLE/ALE 到 nWE/nOE 不活动的时间 */

int     nr_sets; /* 集合数目 */

struct s3c2410_nand_set sets; /* 集合列表 */

/* 根据芯片编号选择有效集合 */

void (*select_chip)(struct s3c2410_nand_set , int chip);

};

  1. s3c2410_nand_mtd               在 drivers/mtd/nand/s3c2410.c 中, struct s3c2410_nand_mtd {

struct mtd_info               mtd;    /* MTD 信息 */

struct nand_chip              chip;   /* nand flash 芯片信息 */ struct s3c2410_nand_set   set;    /* nand flash 集合    */ struct s3c2410_nand_info     *info;  /* nand flash 信息    */  int    scan_res;

};

  1. s3c2410_nand_info

struct s3c2410_nand_info {

/* mtd info */

struct nand_hw_control        controller; /* 硬件控制器 */ struct s3c2410_nand_mtd                              *mtds;     /* MTD 设备表 */ struct s3c2410_platform_nand         platform;  /* Nand 设备的平台 */

/* device info */

struct device

*device;

/* 设备指针 */

struct resource

*area;

/* 资源指针 */

struct clk

*clk;

/* Nand Flash 时钟 */

void  iomem

int

*regs;

mtd_count;

/* 寄存器基地址(map 后的逻辑地址) */

/* MTD 的数目 */

unsigned char

is_s3c2440;

};

  1. struct                                       clk 在 arch/arm/mach­s3c2410/clock.h 中 struct clk {

struct list_head  list;   /* clock 列表结点 */ struct module    *owner;    /* 所属模块     */ struct clk    *parent;   /* 父结点        */

const char          *name;     /* 名称          */

int                  id;       /* 编号           */

atomic_t             used;     /* 使用者计数    */ unsigned long   rate;    /* 时钟速率     */ unsigned long         ctrlbit;  /* 控制位        */

int                (*enable)(struct clk *, int enable); /* Clock 打开方法 */

};

原文地址:https://www.cnblogs.com/fanweisheng/p/11106197.html