Lines Matching refs:mtd

179 static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd)  in mtd_to_spi_nor()  argument
181 return mtd->priv; in mtd_to_spi_nor()
286 dev_dbg(nor->dev, " %lldKiB\n", (long long)(nor->mtd.size >> 10)); in erase_chip()
319 static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) in spi_nor_erase() argument
321 struct spi_nor *nor = mtd_to_spi_nor(mtd); in spi_nor_erase()
329 div_u64_rem(instr->len, mtd->erasesize, &rem); in spi_nor_erase()
341 if (len == mtd->size) { in spi_nor_erase()
359 (unsigned long)(mtd->size / SZ_2M)); in spi_nor_erase()
379 addr += mtd->erasesize; in spi_nor_erase()
380 len -= mtd->erasesize; in spi_nor_erase()
406 struct mtd_info *mtd = &nor->mtd; in stm_get_locked_range() local
417 *len = mtd->size >> pow; in stm_get_locked_range()
418 *ofs = mtd->size - *len; in stm_get_locked_range()
461 struct mtd_info *mtd = &nor->mtd; in stm_lock() local
469 if (ofs + len != mtd->size) { in stm_lock()
471 if (!stm_is_locked_sr(nor, ofs + len, mtd->size - ofs - len, in stm_lock()
474 len = mtd->size - ofs; in stm_lock()
486 pow = ilog2(mtd->size) - ilog2(len); in stm_lock()
511 struct mtd_info *mtd = &nor->mtd; in stm_unlock() local
519 if (stm_is_locked_sr(nor, ofs - mtd->erasesize, mtd->erasesize, in stm_unlock()
532 pow = ilog2(mtd->size) - order_base_2(mtd->size - (ofs + len)); in stm_unlock()
533 if (ofs + len == mtd->size) { in stm_unlock()
570 static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) in spi_nor_lock() argument
572 struct spi_nor *nor = mtd_to_spi_nor(mtd); in spi_nor_lock()
585 static int spi_nor_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) in spi_nor_unlock() argument
587 struct spi_nor *nor = mtd_to_spi_nor(mtd); in spi_nor_unlock()
600 static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) in spi_nor_is_locked() argument
602 struct spi_nor *nor = mtd_to_spi_nor(mtd); in spi_nor_is_locked()
875 static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, in spi_nor_read() argument
878 struct spi_nor *nor = mtd_to_spi_nor(mtd); in spi_nor_read()
893 static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, in sst_write() argument
896 struct spi_nor *nor = mtd_to_spi_nor(mtd); in sst_write()
964 static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, in spi_nor_write() argument
967 struct spi_nor *nor = mtd_to_spi_nor(mtd); in spi_nor_write()
1109 struct mtd_info *mtd = &nor->mtd; in spi_nor_scan() local
1164 if (!mtd->name) in spi_nor_scan()
1165 mtd->name = dev_name(dev); in spi_nor_scan()
1166 mtd->priv = nor; in spi_nor_scan()
1167 mtd->type = MTD_NORFLASH; in spi_nor_scan()
1168 mtd->writesize = 1; in spi_nor_scan()
1169 mtd->flags = MTD_CAP_NORFLASH; in spi_nor_scan()
1170 mtd->size = info->sector_size * info->n_sectors; in spi_nor_scan()
1171 mtd->_erase = spi_nor_erase; in spi_nor_scan()
1172 mtd->_read = spi_nor_read; in spi_nor_scan()
1182 mtd->_lock = spi_nor_lock; in spi_nor_scan()
1183 mtd->_unlock = spi_nor_unlock; in spi_nor_scan()
1184 mtd->_is_locked = spi_nor_is_locked; in spi_nor_scan()
1189 mtd->_write = sst_write; in spi_nor_scan()
1191 mtd->_write = spi_nor_write; in spi_nor_scan()
1200 mtd->erasesize = 4096; in spi_nor_scan()
1203 mtd->erasesize = 4096; in spi_nor_scan()
1208 mtd->erasesize = info->sector_size; in spi_nor_scan()
1212 mtd->flags |= MTD_NO_ERASE; in spi_nor_scan()
1214 mtd->dev.parent = dev; in spi_nor_scan()
1216 mtd->writebufsize = nor->page_size; in spi_nor_scan()
1268 else if (mtd->size > 0x1000000) { in spi_nor_scan()
1290 mtd->erasesize = info->sector_size; in spi_nor_scan()
1300 (long long)mtd->size >> 10); in spi_nor_scan()
1305 mtd->name, (long long)mtd->size, (long long)(mtd->size >> 20), in spi_nor_scan()
1306 mtd->erasesize, mtd->erasesize / 1024, mtd->numeraseregions); in spi_nor_scan()
1308 if (mtd->numeraseregions) in spi_nor_scan()
1309 for (i = 0; i < mtd->numeraseregions; i++) in spi_nor_scan()
1314 i, (long long)mtd->eraseregions[i].offset, in spi_nor_scan()
1315 mtd->eraseregions[i].erasesize, in spi_nor_scan()
1316 mtd->eraseregions[i].erasesize / 1024, in spi_nor_scan()
1317 mtd->eraseregions[i].numblocks); in spi_nor_scan()