Lines Matching refs:mtd
38 static int check_offs_len(struct mtd_info *mtd, loff_t ofs, uint64_t len) in check_offs_len() argument
43 if (mtd_mod_by_eb(ofs, mtd)) { in check_offs_len()
49 if (mtd_mod_by_eb(len, mtd)) { in check_offs_len()
57 static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) in ram_erase() argument
59 if (check_offs_len(mtd, instr->addr, instr->len)) in ram_erase()
61 memset((char *)mtd->priv + instr->addr, 0xff, instr->len); in ram_erase()
67 static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, in ram_point() argument
70 *virt = mtd->priv + from; in ram_point()
75 static int ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) in ram_unpoint() argument
85 static unsigned long ram_get_unmapped_area(struct mtd_info *mtd, in ram_get_unmapped_area() argument
90 return (unsigned long) mtd->priv + offset; in ram_get_unmapped_area()
93 static int ram_read(struct mtd_info *mtd, loff_t from, size_t len, in ram_read() argument
96 memcpy(buf, mtd->priv + from, len); in ram_read()
101 static int ram_write(struct mtd_info *mtd, loff_t to, size_t len, in ram_write() argument
104 memcpy((char *)mtd->priv + to, buf, len); in ram_write()
118 int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, in mtdram_init_device() argument
121 memset(mtd, 0, sizeof(*mtd)); in mtdram_init_device()
124 mtd->name = name; in mtdram_init_device()
125 mtd->type = MTD_RAM; in mtdram_init_device()
126 mtd->flags = MTD_CAP_RAM; in mtdram_init_device()
127 mtd->size = size; in mtdram_init_device()
128 mtd->writesize = 1; in mtdram_init_device()
129 mtd->writebufsize = writebuf_size; in mtdram_init_device()
130 mtd->erasesize = MTDRAM_ERASE_SIZE; in mtdram_init_device()
131 mtd->priv = mapped_address; in mtdram_init_device()
133 mtd->owner = THIS_MODULE; in mtdram_init_device()
134 mtd->_erase = ram_erase; in mtdram_init_device()
135 mtd->_point = ram_point; in mtdram_init_device()
136 mtd->_unpoint = ram_unpoint; in mtdram_init_device()
137 mtd->_get_unmapped_area = ram_get_unmapped_area; in mtdram_init_device()
138 mtd->_read = ram_read; in mtdram_init_device()
139 mtd->_write = ram_write; in mtdram_init_device()
141 if (mtd_device_register(mtd, NULL, 0)) in mtdram_init_device()