Lines Matching +full:xspi +full:- +full:nor

1 // SPDX-License-Identifier: GPL-2.0
10 #include <linux/mtd/spi-nor.h>
48 /* Cypress SPI NOR flash operations. */
68 * struct spansion_nor_params - Spansion private parameters.
77 * spansion_nor_clear_sr() - Clear the Status Register.
78 * @nor: pointer to 'struct spi_nor'.
80 static void spansion_nor_clear_sr(struct spi_nor *nor) in spansion_nor_clear_sr() argument
82 const struct spansion_nor_params *priv_params = nor->params->priv; in spansion_nor_clear_sr()
85 if (nor->spimem) { in spansion_nor_clear_sr()
86 struct spi_mem_op op = SPANSION_OP(priv_params->clsr); in spansion_nor_clear_sr()
88 spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); in spansion_nor_clear_sr()
90 ret = spi_mem_exec_op(nor->spimem, &op); in spansion_nor_clear_sr()
92 ret = spi_nor_controller_ops_write_reg(nor, SPINOR_OP_CLSR, in spansion_nor_clear_sr()
97 dev_dbg(nor->dev, "error %d clearing SR\n", ret); in spansion_nor_clear_sr()
100 static int cypress_nor_sr_ready_and_clear_reg(struct spi_nor *nor, u64 addr) in cypress_nor_sr_ready_and_clear_reg() argument
102 struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_sr_ready_and_clear_reg()
104 CYPRESS_NOR_RD_ANY_REG_OP(params->addr_mode_nbytes, addr, in cypress_nor_sr_ready_and_clear_reg()
105 0, nor->bouncebuf); in cypress_nor_sr_ready_and_clear_reg()
108 if (nor->reg_proto == SNOR_PROTO_8_8_8_DTR) { in cypress_nor_sr_ready_and_clear_reg()
109 op.dummy.nbytes = params->rdsr_dummy; in cypress_nor_sr_ready_and_clear_reg()
113 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_sr_ready_and_clear_reg()
117 if (nor->bouncebuf[0] & (SR_E_ERR | SR_P_ERR)) { in cypress_nor_sr_ready_and_clear_reg()
118 if (nor->bouncebuf[0] & SR_E_ERR) in cypress_nor_sr_ready_and_clear_reg()
119 dev_err(nor->dev, "Erase Error occurred\n"); in cypress_nor_sr_ready_and_clear_reg()
121 dev_err(nor->dev, "Programming Error occurred\n"); in cypress_nor_sr_ready_and_clear_reg()
123 spansion_nor_clear_sr(nor); in cypress_nor_sr_ready_and_clear_reg()
125 ret = spi_nor_write_disable(nor); in cypress_nor_sr_ready_and_clear_reg()
129 return -EIO; in cypress_nor_sr_ready_and_clear_reg()
132 return !(nor->bouncebuf[0] & SR_WIP); in cypress_nor_sr_ready_and_clear_reg()
135 * cypress_nor_sr_ready_and_clear() - Query the Status Register of each die by
138 * @nor: pointer to 'struct spi_nor'.
140 * Return: 1 if ready, 0 if not ready, -errno on errors.
142 static int cypress_nor_sr_ready_and_clear(struct spi_nor *nor) in cypress_nor_sr_ready_and_clear() argument
144 struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_sr_ready_and_clear()
149 for (i = 0; i < params->n_dice; i++) { in cypress_nor_sr_ready_and_clear()
150 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_STR1; in cypress_nor_sr_ready_and_clear()
151 ret = cypress_nor_sr_ready_and_clear_reg(nor, addr); in cypress_nor_sr_ready_and_clear()
161 static int cypress_nor_set_memlat(struct spi_nor *nor, u64 addr) in cypress_nor_set_memlat() argument
164 u8 *buf = nor->bouncebuf; in cypress_nor_set_memlat()
166 u8 addr_mode_nbytes = nor->params->addr_mode_nbytes; in cypress_nor_set_memlat()
171 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_set_memlat()
182 ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto); in cypress_nor_set_memlat()
186 nor->read_dummy = 24; in cypress_nor_set_memlat()
191 static int cypress_nor_set_octal_dtr_bits(struct spi_nor *nor, u64 addr) in cypress_nor_set_octal_dtr_bits() argument
194 u8 *buf = nor->bouncebuf; in cypress_nor_set_octal_dtr_bits()
199 CYPRESS_NOR_WR_ANY_REG_OP(nor->params->addr_mode_nbytes, in cypress_nor_set_octal_dtr_bits()
202 return spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto); in cypress_nor_set_octal_dtr_bits()
205 static int cypress_nor_octal_dtr_en(struct spi_nor *nor) in cypress_nor_octal_dtr_en() argument
207 const struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_octal_dtr_en()
208 u8 *buf = nor->bouncebuf; in cypress_nor_octal_dtr_en()
212 for (i = 0; i < params->n_dice; i++) { in cypress_nor_octal_dtr_en()
213 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR2; in cypress_nor_octal_dtr_en()
214 ret = cypress_nor_set_memlat(nor, addr); in cypress_nor_octal_dtr_en()
218 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR5; in cypress_nor_octal_dtr_en()
219 ret = cypress_nor_set_octal_dtr_bits(nor, addr); in cypress_nor_octal_dtr_en()
225 ret = spi_nor_read_id(nor, nor->addr_nbytes, 3, buf, in cypress_nor_octal_dtr_en()
228 dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret); in cypress_nor_octal_dtr_en()
232 if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) in cypress_nor_octal_dtr_en()
233 return -EINVAL; in cypress_nor_octal_dtr_en()
238 static int cypress_nor_set_single_spi_bits(struct spi_nor *nor, u64 addr) in cypress_nor_set_single_spi_bits() argument
241 u8 *buf = nor->bouncebuf; in cypress_nor_set_single_spi_bits()
244 * The register is 1-byte wide, but 1-byte transactions are not allowed in cypress_nor_set_single_spi_bits()
245 * in 8D-8D-8D mode. Since there is no register at the next location, in cypress_nor_set_single_spi_bits()
251 CYPRESS_NOR_WR_ANY_REG_OP(nor->addr_nbytes, addr, 2, buf); in cypress_nor_set_single_spi_bits()
252 return spi_nor_write_any_volatile_reg(nor, &op, SNOR_PROTO_8_8_8_DTR); in cypress_nor_set_single_spi_bits()
255 static int cypress_nor_octal_dtr_dis(struct spi_nor *nor) in cypress_nor_octal_dtr_dis() argument
257 const struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_octal_dtr_dis()
258 u8 *buf = nor->bouncebuf; in cypress_nor_octal_dtr_dis()
262 for (i = 0; i < params->n_dice; i++) { in cypress_nor_octal_dtr_dis()
263 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR5; in cypress_nor_octal_dtr_dis()
264 ret = cypress_nor_set_single_spi_bits(nor, addr); in cypress_nor_octal_dtr_dis()
270 ret = spi_nor_read_id(nor, 0, 0, buf, SNOR_PROTO_1_1_1); in cypress_nor_octal_dtr_dis()
272 dev_dbg(nor->dev, "error %d reading JEDEC ID after disabling 8D-8D-8D mode\n", ret); in cypress_nor_octal_dtr_dis()
276 if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) in cypress_nor_octal_dtr_dis()
277 return -EINVAL; in cypress_nor_octal_dtr_dis()
282 static int cypress_nor_quad_enable_volatile_reg(struct spi_nor *nor, u64 addr) in cypress_nor_quad_enable_volatile_reg() argument
285 u8 addr_mode_nbytes = nor->params->addr_mode_nbytes; in cypress_nor_quad_enable_volatile_reg()
291 nor->bouncebuf); in cypress_nor_quad_enable_volatile_reg()
293 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_quad_enable_volatile_reg()
297 if (nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR1_QUAD_EN) in cypress_nor_quad_enable_volatile_reg()
301 nor->bouncebuf[0] |= SPINOR_REG_CYPRESS_CFR1_QUAD_EN; in cypress_nor_quad_enable_volatile_reg()
304 nor->bouncebuf); in cypress_nor_quad_enable_volatile_reg()
305 ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto); in cypress_nor_quad_enable_volatile_reg()
309 cfr1v_written = nor->bouncebuf[0]; in cypress_nor_quad_enable_volatile_reg()
314 nor->bouncebuf); in cypress_nor_quad_enable_volatile_reg()
315 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_quad_enable_volatile_reg()
319 if (nor->bouncebuf[0] != cfr1v_written) { in cypress_nor_quad_enable_volatile_reg()
320 dev_err(nor->dev, "CFR1: Read back test failed\n"); in cypress_nor_quad_enable_volatile_reg()
321 return -EIO; in cypress_nor_quad_enable_volatile_reg()
328 * cypress_nor_quad_enable_volatile() - enable Quad I/O mode in volatile
330 * @nor: pointer to a 'struct spi_nor'
333 * to a risk of the non-volatile registers corruption by power interrupt. This
335 * bit in the CFR1 non-volatile in advance (typically by a Flash programmer
337 * also set during Flash power-up.
339 * Return: 0 on success, -errno otherwise.
341 static int cypress_nor_quad_enable_volatile(struct spi_nor *nor) in cypress_nor_quad_enable_volatile() argument
343 struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_quad_enable_volatile()
348 for (i = 0; i < params->n_dice; i++) { in cypress_nor_quad_enable_volatile()
349 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR1; in cypress_nor_quad_enable_volatile()
350 ret = cypress_nor_quad_enable_volatile_reg(nor, addr); in cypress_nor_quad_enable_volatile()
359 * cypress_nor_determine_addr_mode_by_sr1() - Determine current address mode
360 * (3 or 4-byte) by querying status
362 * @nor: pointer to a 'struct spi_nor'
367 * from RDSR1(no address), RDAR(3-byte address), and RDAR(4-byte address).
369 * Return: 0 on success, -errno otherwise.
371 static int cypress_nor_determine_addr_mode_by_sr1(struct spi_nor *nor, in cypress_nor_determine_addr_mode_by_sr1() argument
376 nor->bouncebuf); in cypress_nor_determine_addr_mode_by_sr1()
380 ret = spi_nor_read_sr(nor, &nor->bouncebuf[1]); in cypress_nor_determine_addr_mode_by_sr1()
384 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_determine_addr_mode_by_sr1()
388 is3byte = (nor->bouncebuf[0] == nor->bouncebuf[1]); in cypress_nor_determine_addr_mode_by_sr1()
392 nor->bouncebuf); in cypress_nor_determine_addr_mode_by_sr1()
393 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_determine_addr_mode_by_sr1()
397 is4byte = (nor->bouncebuf[0] == nor->bouncebuf[1]); in cypress_nor_determine_addr_mode_by_sr1()
400 return -EIO; in cypress_nor_determine_addr_mode_by_sr1()
410 * cypress_nor_set_addr_mode_nbytes() - Set the number of address bytes mode of
412 * @nor: pointer to a 'struct spi_nor'
415 * query CFR2V[7] to confirm. If determination is failed, force enter to 4-byte
418 * Return: 0 on success, -errno otherwise.
420 static int cypress_nor_set_addr_mode_nbytes(struct spi_nor *nor) in cypress_nor_set_addr_mode_nbytes() argument
427 * Read SR1 by RDSR1 and RDAR(3- AND 4-byte addr). Use write enable in cypress_nor_set_addr_mode_nbytes()
428 * that sets bit-1 in SR1. in cypress_nor_set_addr_mode_nbytes()
430 ret = spi_nor_write_enable(nor); in cypress_nor_set_addr_mode_nbytes()
433 ret = cypress_nor_determine_addr_mode_by_sr1(nor, &addr_mode); in cypress_nor_set_addr_mode_nbytes()
435 ret = spi_nor_set_4byte_addr_mode(nor, true); in cypress_nor_set_addr_mode_nbytes()
438 return spi_nor_write_disable(nor); in cypress_nor_set_addr_mode_nbytes()
440 ret = spi_nor_write_disable(nor); in cypress_nor_set_addr_mode_nbytes()
450 0, nor->bouncebuf); in cypress_nor_set_addr_mode_nbytes()
451 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_set_addr_mode_nbytes()
455 if (nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR2_ADRBYT) { in cypress_nor_set_addr_mode_nbytes()
457 return spi_nor_set_4byte_addr_mode(nor, true); in cypress_nor_set_addr_mode_nbytes()
460 return spi_nor_set_4byte_addr_mode(nor, true); in cypress_nor_set_addr_mode_nbytes()
463 nor->params->addr_nbytes = addr_mode; in cypress_nor_set_addr_mode_nbytes()
464 nor->params->addr_mode_nbytes = addr_mode; in cypress_nor_set_addr_mode_nbytes()
470 * cypress_nor_get_page_size() - Get flash page size configuration.
471 * @nor: pointer to a 'struct spi_nor'
477 * Return: 0 on success, -errno otherwise.
479 static int cypress_nor_get_page_size(struct spi_nor *nor) in cypress_nor_get_page_size() argument
482 CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes, in cypress_nor_get_page_size()
483 0, 0, nor->bouncebuf); in cypress_nor_get_page_size()
484 struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_get_page_size()
489 * Use the minimum common page size configuration. Programming 256-byte in cypress_nor_get_page_size()
490 * under 512-byte page size configuration is safe. in cypress_nor_get_page_size()
492 params->page_size = 256; in cypress_nor_get_page_size()
493 for (i = 0; i < params->n_dice; i++) { in cypress_nor_get_page_size()
494 op.addr.val = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR3; in cypress_nor_get_page_size()
496 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_get_page_size()
500 if (!(nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR3_PGSZ)) in cypress_nor_get_page_size()
504 params->page_size = 512; in cypress_nor_get_page_size()
509 static void cypress_nor_ecc_init(struct spi_nor *nor) in cypress_nor_ecc_init() argument
512 * Programming is supported only in 16-byte ECC data unit granularity. in cypress_nor_ecc_init()
513 * Byte-programming, bit-walking, or multiple program operations to the in cypress_nor_ecc_init()
516 nor->params->writesize = 16; in cypress_nor_ecc_init()
517 nor->flags |= SNOR_F_ECC; in cypress_nor_ecc_init()
521 s25fs256t_post_bfpt_fixup(struct spi_nor *nor, in s25fs256t_post_bfpt_fixup() argument
528 ret = cypress_nor_set_addr_mode_nbytes(nor); in s25fs256t_post_bfpt_fixup()
534 CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes, in s25fs256t_post_bfpt_fixup()
536 nor->bouncebuf); in s25fs256t_post_bfpt_fixup()
537 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in s25fs256t_post_bfpt_fixup()
542 if (nor->bouncebuf[0]) in s25fs256t_post_bfpt_fixup()
543 return -ENODEV; in s25fs256t_post_bfpt_fixup()
548 static int s25fs256t_post_sfdp_fixup(struct spi_nor *nor) in s25fs256t_post_sfdp_fixup() argument
550 struct spi_nor_flash_parameter *params = nor->params; in s25fs256t_post_sfdp_fixup()
557 params->vreg_offset = devm_kmalloc(nor->dev, sizeof(u32), GFP_KERNEL); in s25fs256t_post_sfdp_fixup()
558 if (!params->vreg_offset) in s25fs256t_post_sfdp_fixup()
559 return -ENOMEM; in s25fs256t_post_sfdp_fixup()
561 params->vreg_offset[0] = SPINOR_REG_CYPRESS_VREG; in s25fs256t_post_sfdp_fixup()
562 params->n_dice = 1; in s25fs256t_post_sfdp_fixup()
565 params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4; in s25fs256t_post_sfdp_fixup()
566 spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP_1_1_4], in s25fs256t_post_sfdp_fixup()
570 return cypress_nor_get_page_size(nor); in s25fs256t_post_sfdp_fixup()
573 static int s25fs256t_late_init(struct spi_nor *nor) in s25fs256t_late_init() argument
575 cypress_nor_ecc_init(nor); in s25fs256t_late_init()
587 s25hx_t_post_bfpt_fixup(struct spi_nor *nor, in s25hx_t_post_bfpt_fixup() argument
593 ret = cypress_nor_set_addr_mode_nbytes(nor); in s25hx_t_post_bfpt_fixup()
598 nor->params->quad_enable = cypress_nor_quad_enable_volatile; in s25hx_t_post_bfpt_fixup()
603 static int s25hx_t_post_sfdp_fixup(struct spi_nor *nor) in s25hx_t_post_sfdp_fixup() argument
605 struct spi_nor_flash_parameter *params = nor->params; in s25hx_t_post_sfdp_fixup()
606 struct spi_nor_erase_type *erase_type = params->erase_map.erase_type; in s25hx_t_post_sfdp_fixup()
609 if (!params->n_dice || !params->vreg_offset) { in s25hx_t_post_sfdp_fixup()
610 dev_err(nor->dev, "%s failed. The volatile register offset could not be retrieved from SFDP.\n", in s25hx_t_post_sfdp_fixup()
612 return -EOPNOTSUPP; in s25hx_t_post_sfdp_fixup()
616 if (params->size == SZ_256M) in s25hx_t_post_sfdp_fixup()
617 params->n_dice = 2; in s25hx_t_post_sfdp_fixup()
636 return cypress_nor_get_page_size(nor); in s25hx_t_post_sfdp_fixup()
639 static int s25hx_t_late_init(struct spi_nor *nor) in s25hx_t_late_init() argument
641 struct spi_nor_flash_parameter *params = nor->params; in s25hx_t_late_init()
644 params->reads[SNOR_CMD_READ_FAST].num_mode_clocks = 8; in s25hx_t_late_init()
645 params->ready = cypress_nor_sr_ready_and_clear; in s25hx_t_late_init()
646 cypress_nor_ecc_init(nor); in s25hx_t_late_init()
648 params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE; in s25hx_t_late_init()
659 * cypress_nor_set_octal_dtr() - Enable or disable octal DTR on Cypress flashes.
660 * @nor: pointer to a 'struct spi_nor'
666 * Return: 0 on success, -errno otherwise.
668 static int cypress_nor_set_octal_dtr(struct spi_nor *nor, bool enable) in cypress_nor_set_octal_dtr() argument
670 return enable ? cypress_nor_octal_dtr_en(nor) : in cypress_nor_set_octal_dtr()
671 cypress_nor_octal_dtr_dis(nor); in cypress_nor_set_octal_dtr()
674 static int s28hx_t_post_sfdp_fixup(struct spi_nor *nor) in s28hx_t_post_sfdp_fixup() argument
676 struct spi_nor_flash_parameter *params = nor->params; in s28hx_t_post_sfdp_fixup()
678 if (!params->n_dice || !params->vreg_offset) { in s28hx_t_post_sfdp_fixup()
679 dev_err(nor->dev, "%s failed. The volatile register offset could not be retrieved from SFDP.\n", in s28hx_t_post_sfdp_fixup()
681 return -EOPNOTSUPP; in s28hx_t_post_sfdp_fixup()
685 if (params->size == SZ_256M) in s28hx_t_post_sfdp_fixup()
686 params->n_dice = 2; in s28hx_t_post_sfdp_fixup()
689 * On older versions of the flash the xSPI Profile 1.0 table has the in s28hx_t_post_sfdp_fixup()
690 * 8D-8D-8D Fast Read opcode as 0x00. But it actually should be 0xEE. in s28hx_t_post_sfdp_fixup()
692 if (params->reads[SNOR_CMD_READ_8_8_8_DTR].opcode == 0) in s28hx_t_post_sfdp_fixup()
693 params->reads[SNOR_CMD_READ_8_8_8_DTR].opcode = in s28hx_t_post_sfdp_fixup()
696 /* This flash is also missing the 4-byte Page Program opcode bit. */ in s28hx_t_post_sfdp_fixup()
697 spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP], in s28hx_t_post_sfdp_fixup()
700 * Since xSPI Page Program opcode is backward compatible with in s28hx_t_post_sfdp_fixup()
703 spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP_8_8_8_DTR], in s28hx_t_post_sfdp_fixup()
707 * The xSPI Profile 1.0 table advertises the number of additional in s28hx_t_post_sfdp_fixup()
711 params->rdsr_addr_nbytes = 4; in s28hx_t_post_sfdp_fixup()
713 return cypress_nor_get_page_size(nor); in s28hx_t_post_sfdp_fixup()
716 static int s28hx_t_post_bfpt_fixup(struct spi_nor *nor, in s28hx_t_post_bfpt_fixup() argument
720 return cypress_nor_set_addr_mode_nbytes(nor); in s28hx_t_post_bfpt_fixup()
723 static int s28hx_t_late_init(struct spi_nor *nor) in s28hx_t_late_init() argument
725 struct spi_nor_flash_parameter *params = nor->params; in s28hx_t_late_init()
727 params->set_octal_dtr = cypress_nor_set_octal_dtr; in s28hx_t_late_init()
728 params->ready = cypress_nor_sr_ready_and_clear; in s28hx_t_late_init()
729 cypress_nor_ecc_init(nor); in s28hx_t_late_init()
741 s25fs_s_nor_post_bfpt_fixups(struct spi_nor *nor, in s25fs_s_nor_post_bfpt_fixups() argument
746 * The S25FS-S chip family reports 512-byte pages in BFPT but in s25fs_s_nor_post_bfpt_fixups()
751 nor->params->page_size = 256; in s25fs_s_nor_post_bfpt_fixups()
1012 * spansion_nor_sr_ready_and_clear() - Query the Status Register to see if the
1014 * @nor: pointer to 'struct spi_nor'.
1016 * Return: 1 if ready, 0 if not ready, -errno on errors.
1018 static int spansion_nor_sr_ready_and_clear(struct spi_nor *nor) in spansion_nor_sr_ready_and_clear() argument
1022 ret = spi_nor_read_sr(nor, nor->bouncebuf); in spansion_nor_sr_ready_and_clear()
1026 if (nor->bouncebuf[0] & (SR_E_ERR | SR_P_ERR)) { in spansion_nor_sr_ready_and_clear()
1027 if (nor->bouncebuf[0] & SR_E_ERR) in spansion_nor_sr_ready_and_clear()
1028 dev_err(nor->dev, "Erase Error occurred\n"); in spansion_nor_sr_ready_and_clear()
1030 dev_err(nor->dev, "Programming Error occurred\n"); in spansion_nor_sr_ready_and_clear()
1032 spansion_nor_clear_sr(nor); in spansion_nor_sr_ready_and_clear()
1040 ret = spi_nor_write_disable(nor); in spansion_nor_sr_ready_and_clear()
1044 return -EIO; in spansion_nor_sr_ready_and_clear()
1047 return !(nor->bouncebuf[0] & SR_WIP); in spansion_nor_sr_ready_and_clear()
1050 static int spansion_nor_late_init(struct spi_nor *nor) in spansion_nor_late_init() argument
1052 struct spi_nor_flash_parameter *params = nor->params; in spansion_nor_late_init()
1054 u8 mfr_flags = nor->info->mfr_flags; in spansion_nor_late_init()
1056 if (params->size > SZ_16M) { in spansion_nor_late_init()
1057 nor->flags |= SNOR_F_4B_OPCODES; in spansion_nor_late_init()
1058 /* No small sector erase for 4-byte command set */ in spansion_nor_late_init()
1059 nor->erase_opcode = SPINOR_OP_SE; in spansion_nor_late_init()
1060 nor->mtd.erasesize = nor->info->sector_size ?: in spansion_nor_late_init()
1065 priv_params = devm_kmalloc(nor->dev, sizeof(*priv_params), in spansion_nor_late_init()
1068 return -ENOMEM; in spansion_nor_late_init()
1071 priv_params->clsr = SPINOR_OP_CLSR; in spansion_nor_late_init()
1073 priv_params->clsr = SPINOR_OP_CLPEF; in spansion_nor_late_init()
1075 params->priv = priv_params; in spansion_nor_late_init()
1076 params->ready = spansion_nor_sr_ready_and_clear; in spansion_nor_late_init()