Lines Matching +full:erase +full:- +full:size
1 // SPDX-License-Identifier: GPL-2.0
44 unsigned type = cfi->device_type; in cfi_build_cmd_addr()
88 /* First, determine what the bit-pattern should be for a single in cfi_build_cmd()
103 /* Now replicate it across the size of an unsigned long, or in cfi_build_cmd()
122 /* And finally, for the multi-word case, replicate it in cfi_build_cmd()
178 /* Last, determine what the bit-pattern should be for a single in cfi_merge_status()
199 * If prev_val is non-null, it will be set to the value at the command address,
215 return addr - base; in cfi_send_gen_cmd()
222 int osf = cfi->interleave * cfi->device_type; /* scale factor */ in cfi_qry_present()
250 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
251 cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
256 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
257 cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
258 cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
262 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
263 cfi_send_gen_cmd(0x98, 0x555, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
267 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
268 cfi_send_gen_cmd(0xAA, 0x5555, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
269 cfi_send_gen_cmd(0x55, 0x2AAA, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
270 cfi_send_gen_cmd(0x98, 0x5555, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
274 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
275 cfi_send_gen_cmd(0xAA, 0x555, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
276 cfi_send_gen_cmd(0x55, 0x2AA, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
277 cfi_send_gen_cmd(0x98, 0x555, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_on()
288 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_off()
289 cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_off()
292 if ((cfi->mfr == CFI_MFR_ST) && (cfi->id == 0x227E || cfi->id == 0x7E)) in cfi_qry_mode_off()
293 cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); in cfi_qry_mode_off()
298 __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* name) in cfi_read_pri() argument
300 struct cfi_private *cfi = map->fldrv_priv; in cfi_read_pri()
301 __u32 base = 0; // cfi->chips[0].start; in cfi_read_pri()
302 int ofs_factor = cfi->interleave * cfi->device_type; in cfi_read_pri()
311 extp = kmalloc(size, GFP_KERNEL); in cfi_read_pri()
322 for (i=0; i<size; i++) { in cfi_read_pri()
343 struct map_info *map = mtd->priv; in cfi_fixup()
344 struct cfi_private *cfi = map->fldrv_priv; in cfi_fixup()
347 for (f=fixups; f->fixup; f++) { in cfi_fixup()
348 if (((f->mfr == CFI_MFR_ANY) || (f->mfr == cfi->mfr)) && in cfi_fixup()
349 ((f->id == CFI_ID_ANY) || (f->id == cfi->id))) { in cfi_fixup()
350 f->fixup(mtd); in cfi_fixup()
360 struct map_info *map = mtd->priv; in cfi_varsize_frob()
361 struct cfi_private *cfi = map->fldrv_priv; in cfi_varsize_frob()
365 struct mtd_erase_region_info *regions = mtd->eraseregions; in cfi_varsize_frob()
367 /* Check that both start and end of the requested erase are in cfi_varsize_frob()
373 /* Skip all erase regions which are ended before the start of in cfi_varsize_frob()
374 the requested erase. Actually, to save on the calculations, in cfi_varsize_frob()
375 we skip to the first erase region which starts after the in cfi_varsize_frob()
376 start of the requested erase, and then go back one. in cfi_varsize_frob()
379 while (i < mtd->numeraseregions && ofs >= regions[i].offset) in cfi_varsize_frob()
381 i--; in cfi_varsize_frob()
383 /* OK, now i is pointing at the erase region in which this in cfi_varsize_frob()
384 erase request starts. Check the start of the requested in cfi_varsize_frob()
385 erase range is aligned with the erase size which is in in cfi_varsize_frob()
389 if (ofs & (regions[i].erasesize-1)) in cfi_varsize_frob()
390 return -EINVAL; in cfi_varsize_frob()
392 /* Remember the erase region we start on */ in cfi_varsize_frob()
395 /* Next, check that the end of the requested erase is aligned in cfi_varsize_frob()
396 * with the erase region at that address. in cfi_varsize_frob()
399 while (i<mtd->numeraseregions && (ofs + len) >= regions[i].offset) in cfi_varsize_frob()
405 i--; in cfi_varsize_frob()
407 if ((ofs + len) & (regions[i].erasesize-1)) in cfi_varsize_frob()
408 return -EINVAL; in cfi_varsize_frob()
410 chipnum = ofs >> cfi->chipshift; in cfi_varsize_frob()
411 adr = ofs - (chipnum << cfi->chipshift); in cfi_varsize_frob()
416 int size = regions[i].erasesize; in cfi_varsize_frob() local
418 ret = (*frob)(map, &cfi->chips[chipnum], adr, size, thunk); in cfi_varsize_frob()
423 adr += size; in cfi_varsize_frob()
424 ofs += size; in cfi_varsize_frob()
425 len -= size; in cfi_varsize_frob()
427 if (ofs == regions[i].offset + size * regions[i].numblocks) in cfi_varsize_frob()
430 if (adr >> cfi->chipshift) { in cfi_varsize_frob()
434 if (chipnum >= cfi->numchips) in cfi_varsize_frob()