Lines Matching +full:wear +full:- +full:leveling

2  * sharpslpart.c - MTD partition parser for NAND flash using the SHARP FTL
10 * linux/include/asm-arm/sharp_nand_logical.h
57 * struct sharpsl_ftl - Sharp FTL Logical Table
59 * @log2phy: the logical-to-physical table
61 * Structure containing the logical-to-physical translation table
89 freebytes |= BIT(i - 8); in sharpsl_nand_check_ooblayout()
95 return -ENOTSUPP; in sharpsl_nand_check_ooblayout()
104 ops.ooblen = mtd->oobsize; in sharpsl_nand_read_oob()
108 if (ret != 0 || mtd->oobsize != ops.oobretlen) in sharpsl_nand_read_oob()
109 return -1; in sharpsl_nand_read_oob()
116 * of the first page, in 3 16-bit copies with the following layout:
119 * -------- --------
124 * Reserved values 0xffff mean the block is kept for wear leveling.
127 * -------- --------
128 * ECC BB xyxy oob[8]==oob[10] && oob[9]==oob[11] -> byte0=8 byte1=9
129 * ECC BB xyxy oob[10]==oob[12] && oob[11]==oob[13] -> byte0=10 byte1=11
130 * ECC BB xy xy oob[12]==oob[8] && oob[13]==oob[9] -> byte0=12 byte1=13
150 return -EINVAL; in sharpsl_nand_get_logical_num()
157 return -EINVAL; in sharpsl_nand_get_logical_num()
173 oob = kzalloc(mtd->oobsize, GFP_KERNEL); in sharpsl_nand_init_ftl()
175 return -ENOMEM; in sharpsl_nand_init_ftl()
180 ftl->logmax = ((phymax * 95) / 100) - 1; in sharpsl_nand_init_ftl()
182 ftl->log2phy = kmalloc_array(ftl->logmax, sizeof(*ftl->log2phy), in sharpsl_nand_init_ftl()
184 if (!ftl->log2phy) { in sharpsl_nand_init_ftl()
185 ret = -ENOMEM; in sharpsl_nand_init_ftl()
189 /* initialize ftl->log2phy */ in sharpsl_nand_init_ftl()
190 for (i = 0; i < ftl->logmax; i++) in sharpsl_nand_init_ftl()
191 ftl->log2phy[i] = UINT_MAX; in sharpsl_nand_init_ftl()
193 /* create physical-logical table */ in sharpsl_nand_init_ftl()
195 block_adr = (loff_t)block_num * mtd->erasesize; in sharpsl_nand_init_ftl()
206 /* cut-off errors and skip the out-of-range values */ in sharpsl_nand_init_ftl()
207 if (log_num > 0 && log_num < ftl->logmax) { in sharpsl_nand_init_ftl()
208 if (ftl->log2phy[log_num] == UINT_MAX) in sharpsl_nand_init_ftl()
209 ftl->log2phy[log_num] = block_num; in sharpsl_nand_init_ftl()
214 phymax, ftl->logmax, phymax - ftl->logmax); in sharpsl_nand_init_ftl()
224 kfree(ftl->log2phy); in sharpsl_nand_cleanup_ftl()
241 final_log_num = mtd_div_by_eb(((u32)from + len - 1), mtd); in sharpsl_nand_read_laddr()
243 if (len <= 0 || log_num >= ftl->logmax || final_log_num > log_num) in sharpsl_nand_read_laddr()
244 return -EINVAL; in sharpsl_nand_read_laddr()
246 block_num = ftl->log2phy[log_num]; in sharpsl_nand_read_laddr()
247 block_adr = (loff_t)block_num * mtd->erasesize; in sharpsl_nand_read_laddr()
256 err = -EIO; in sharpsl_nand_read_laddr()
268 * Sample values read from SL-C860
306 return -EINVAL; in sharpsl_nand_read_partinfo()
310 buf[2].end = cpu_to_le32(master->size); in sharpsl_nand_read_partinfo()
319 return -EINVAL; in sharpsl_nand_read_partinfo()
369 return -ENOMEM; in sharpsl_parse_mtd_partitions()
374 sharpsl_nand_parts[0].size = le32_to_cpu(buf[0].end) - in sharpsl_parse_mtd_partitions()
379 sharpsl_nand_parts[1].size = le32_to_cpu(buf[1].end) - in sharpsl_parse_mtd_partitions()
384 sharpsl_nand_parts[2].size = le32_to_cpu(buf[2].end) - in sharpsl_parse_mtd_partitions()