Lines Matching refs:mtd
36 static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) in ram_erase() argument
38 if (instr->addr + instr->len > mtd->size) in ram_erase()
41 memset((char *)mtd->priv + instr->addr, 0xff, instr->len); in ram_erase()
49 static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, in ram_point() argument
52 if (from + len > mtd->size) in ram_point()
59 *virt = mtd->priv + from; in ram_point()
64 static void ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) in ram_unpoint() argument
68 static int ram_read(struct mtd_info *mtd, loff_t from, size_t len, in ram_read() argument
71 if (from + len > mtd->size) in ram_read()
74 memcpy(buf, mtd->priv + from, len); in ram_read()
80 static int ram_write(struct mtd_info *mtd, loff_t to, size_t len, in ram_write() argument
83 if (to + len > mtd->size) in ram_write()
86 memcpy((char *)mtd->priv + to, buf, len); in ram_write()
101 int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, in mtdram_init_device() argument
104 memset(mtd, 0, sizeof(*mtd)); in mtdram_init_device()
107 mtd->name = name; in mtdram_init_device()
108 mtd->type = MTD_RAM; in mtdram_init_device()
109 mtd->flags = MTD_CAP_RAM; in mtdram_init_device()
110 mtd->size = size; in mtdram_init_device()
111 mtd->writesize = 1; in mtdram_init_device()
112 mtd->erasesize = MTDRAM_ERASE_SIZE; in mtdram_init_device()
113 mtd->priv = mapped_address; in mtdram_init_device()
115 mtd->owner = THIS_MODULE; in mtdram_init_device()
116 mtd->erase = ram_erase; in mtdram_init_device()
117 mtd->point = ram_point; in mtdram_init_device()
118 mtd->unpoint = ram_unpoint; in mtdram_init_device()
119 mtd->read = ram_read; in mtdram_init_device()
120 mtd->write = ram_write; in mtdram_init_device()
122 if (add_mtd_device(mtd)) { in mtdram_init_device()