Lines Matching +full:manufacturer +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0
4 * 2002-2006 Thomas Gleixner (tglx@linutronix.de)
24 while (len--) { in onfi_crc16()
37 struct nand_device *base = &chip->base; in nand_flash_detect_ext_param_page()
47 len = le16_to_cpu(p->ext_param_page_length) * 16; in nand_flash_detect_ext_param_page()
50 return -ENOMEM; in nand_flash_detect_ext_param_page()
57 sizeof(*p) * p->num_of_param_pages, in nand_flash_detect_ext_param_page()
62 ret = -EINVAL; in nand_flash_detect_ext_param_page()
63 if ((onfi_crc16(ONFI_CRC_BASE, ((uint8_t *)ep) + 2, len - 2) in nand_flash_detect_ext_param_page()
64 != le16_to_cpu(ep->crc))) { in nand_flash_detect_ext_param_page()
73 if (strncmp(ep->sig, "EPPS", 4)) { in nand_flash_detect_ext_param_page()
81 s = ep->sections + i; in nand_flash_detect_ext_param_page()
82 if (s->type == ONFI_SECTION_TYPE_2) in nand_flash_detect_ext_param_page()
84 cursor += s->length * 16; in nand_flash_detect_ext_param_page()
94 if (!ecc->codeword_size) { in nand_flash_detect_ext_param_page()
99 requirements.strength = ecc->ecc_bits; in nand_flash_detect_ext_param_page()
100 requirements.step_size = 1 << ecc->codeword_size; in nand_flash_detect_ext_param_page()
111 * Recover data with bit-wise majority
146 struct nand_device *base = &chip->base; in nand_onfi_detect()
153 char id[4]; in nand_onfi_detect() local
157 memorg = nanddev_get_memorg(&chip->base); in nand_onfi_detect()
160 ret = nand_readid_op(chip, 0x20, id, sizeof(id)); in nand_onfi_detect()
161 if (ret || strncmp(id, "ONFI", 4)) in nand_onfi_detect()
167 return -ENOMEM; in nand_onfi_detect()
169 if (!nand_has_exec_op(chip) || chip->controller->supported_op.data_only_read) in nand_onfi_detect()
202 pr_warn("Could not find a valid ONFI parameter page, trying bit-wise majority to recover it\n"); in nand_onfi_detect()
207 if (crc != le16_to_cpu(pbuf->crc)) { in nand_onfi_detect()
214 if (chip->manufacturer.desc && chip->manufacturer.desc->ops && in nand_onfi_detect()
215 chip->manufacturer.desc->ops->fixup_onfi_param_page) in nand_onfi_detect()
216 chip->manufacturer.desc->ops->fixup_onfi_param_page(chip, p); in nand_onfi_detect()
219 val = le16_to_cpu(p->revision); in nand_onfi_detect()
236 sanitize_string(p->manufacturer, sizeof(p->manufacturer)); in nand_onfi_detect()
237 sanitize_string(p->model, sizeof(p->model)); in nand_onfi_detect()
238 chip->parameters.model = kstrdup(p->model, GFP_KERNEL); in nand_onfi_detect()
239 if (!chip->parameters.model) { in nand_onfi_detect()
240 ret = -ENOMEM; in nand_onfi_detect()
244 memorg->pagesize = le32_to_cpu(p->byte_per_page); in nand_onfi_detect()
245 mtd->writesize = memorg->pagesize; in nand_onfi_detect()
248 * pages_per_block and blocks_per_lun may not be a power-of-2 size in nand_onfi_detect()
250 * dimensions will be power-of-2, so just truncate the remaining area. in nand_onfi_detect()
252 memorg->pages_per_eraseblock = in nand_onfi_detect()
253 1 << (fls(le32_to_cpu(p->pages_per_block)) - 1); in nand_onfi_detect()
254 mtd->erasesize = memorg->pages_per_eraseblock * memorg->pagesize; in nand_onfi_detect()
256 memorg->oobsize = le16_to_cpu(p->spare_bytes_per_page); in nand_onfi_detect()
257 mtd->oobsize = memorg->oobsize; in nand_onfi_detect()
259 memorg->luns_per_target = p->lun_count; in nand_onfi_detect()
260 memorg->planes_per_lun = 1 << p->interleaved_bits; in nand_onfi_detect()
263 memorg->eraseblocks_per_lun = in nand_onfi_detect()
264 1 << (fls(le32_to_cpu(p->blocks_per_lun)) - 1); in nand_onfi_detect()
265 memorg->max_bad_eraseblocks_per_lun = le32_to_cpu(p->blocks_per_lun); in nand_onfi_detect()
266 memorg->bits_per_cell = p->bits_per_cell; in nand_onfi_detect()
268 if (le16_to_cpu(p->features) & ONFI_FEATURE_16_BIT_BUS) in nand_onfi_detect()
269 chip->options |= NAND_BUSWIDTH_16; in nand_onfi_detect()
271 if (p->ecc_bits != 0xff) { in nand_onfi_detect()
273 .strength = p->ecc_bits, in nand_onfi_detect()
279 (le16_to_cpu(p->features) & ONFI_FEATURE_EXT_PARAM_PAGE)) { in nand_onfi_detect()
284 * by the chip->legacy.cmdfunc. So try to update the in nand_onfi_detect()
285 * chip->legacy.cmdfunc now. We do not replace user supplied in nand_onfi_detect()
298 if (le16_to_cpu(p->opt_cmd) & ONFI_OPT_CMD_SET_GET_FEATURES) { in nand_onfi_detect()
299 chip->parameters.supports_set_get_features = true; in nand_onfi_detect()
300 bitmap_set(chip->parameters.get_feature_list, in nand_onfi_detect()
302 bitmap_set(chip->parameters.set_feature_list, in nand_onfi_detect()
306 if (le16_to_cpu(p->opt_cmd) & ONFI_OPT_CMD_READ_CACHE) in nand_onfi_detect()
307 chip->parameters.supports_read_cache = true; in nand_onfi_detect()
311 ret = -ENOMEM; in nand_onfi_detect()
315 onfi->version = onfi_version; in nand_onfi_detect()
316 onfi->tPROG = le16_to_cpu(p->t_prog); in nand_onfi_detect()
317 onfi->tBERS = le16_to_cpu(p->t_bers); in nand_onfi_detect()
318 onfi->tR = le16_to_cpu(p->t_r); in nand_onfi_detect()
319 onfi->tCCS = le16_to_cpu(p->t_ccs); in nand_onfi_detect()
320 onfi->fast_tCAD = le16_to_cpu(p->nvddr_nvddr2_features) & BIT(0); in nand_onfi_detect()
321 onfi->sdr_timing_modes = le16_to_cpu(p->sdr_timing_modes); in nand_onfi_detect()
322 if (le16_to_cpu(p->features) & ONFI_FEATURE_NV_DDR) in nand_onfi_detect()
323 onfi->nvddr_timing_modes = le16_to_cpu(p->nvddr_timing_modes); in nand_onfi_detect()
324 onfi->vendor_revision = le16_to_cpu(p->vendor_revision); in nand_onfi_detect()
325 memcpy(onfi->vendor, p->vendor, sizeof(p->vendor)); in nand_onfi_detect()
326 chip->parameters.onfi = onfi; in nand_onfi_detect()
334 kfree(chip->parameters.model); in nand_onfi_detect()