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.addr.nbytes = nor->addr_nbytes; in cypress_nor_sr_ready_and_clear_reg()
110 op.dummy.nbytes = params->rdsr_dummy; in cypress_nor_sr_ready_and_clear_reg()
114 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_sr_ready_and_clear_reg()
118 if (nor->bouncebuf[0] & (SR_E_ERR | SR_P_ERR)) { in cypress_nor_sr_ready_and_clear_reg()
119 if (nor->bouncebuf[0] & SR_E_ERR) in cypress_nor_sr_ready_and_clear_reg()
120 dev_err(nor->dev, "Erase Error occurred\n"); in cypress_nor_sr_ready_and_clear_reg()
122 dev_err(nor->dev, "Programming Error occurred\n"); in cypress_nor_sr_ready_and_clear_reg()
124 spansion_nor_clear_sr(nor); in cypress_nor_sr_ready_and_clear_reg()
126 ret = spi_nor_write_disable(nor); in cypress_nor_sr_ready_and_clear_reg()
130 return -EIO; in cypress_nor_sr_ready_and_clear_reg()
133 return !(nor->bouncebuf[0] & SR_WIP); in cypress_nor_sr_ready_and_clear_reg()
136 * cypress_nor_sr_ready_and_clear() - Query the Status Register of each die by
139 * @nor: pointer to 'struct spi_nor'.
141 * Return: 1 if ready, 0 if not ready, -errno on errors.
143 static int cypress_nor_sr_ready_and_clear(struct spi_nor *nor) in cypress_nor_sr_ready_and_clear() argument
145 struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_sr_ready_and_clear()
150 for (i = 0; i < params->n_dice; i++) { in cypress_nor_sr_ready_and_clear()
151 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_STR1; in cypress_nor_sr_ready_and_clear()
152 ret = cypress_nor_sr_ready_and_clear_reg(nor, addr); in cypress_nor_sr_ready_and_clear()
162 static int cypress_nor_set_memlat(struct spi_nor *nor, u64 addr) in cypress_nor_set_memlat() argument
165 u8 *buf = nor->bouncebuf; in cypress_nor_set_memlat()
167 u8 addr_mode_nbytes = nor->params->addr_mode_nbytes; in cypress_nor_set_memlat()
172 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_set_memlat()
183 ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto); in cypress_nor_set_memlat()
187 nor->read_dummy = 24; in cypress_nor_set_memlat()
192 static int cypress_nor_set_octal_dtr_bits(struct spi_nor *nor, u64 addr) in cypress_nor_set_octal_dtr_bits() argument
195 u8 *buf = nor->bouncebuf; in cypress_nor_set_octal_dtr_bits()
200 CYPRESS_NOR_WR_ANY_REG_OP(nor->params->addr_mode_nbytes, in cypress_nor_set_octal_dtr_bits()
203 return spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto); in cypress_nor_set_octal_dtr_bits()
206 static int cypress_nor_octal_dtr_en(struct spi_nor *nor) in cypress_nor_octal_dtr_en() argument
208 const struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_octal_dtr_en()
209 u8 *buf = nor->bouncebuf; in cypress_nor_octal_dtr_en()
213 for (i = 0; i < params->n_dice; i++) { in cypress_nor_octal_dtr_en()
214 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR2; in cypress_nor_octal_dtr_en()
215 ret = cypress_nor_set_memlat(nor, addr); in cypress_nor_octal_dtr_en()
219 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR5; in cypress_nor_octal_dtr_en()
220 ret = cypress_nor_set_octal_dtr_bits(nor, addr); in cypress_nor_octal_dtr_en()
226 ret = spi_nor_read_id(nor, nor->addr_nbytes, 3, buf, in cypress_nor_octal_dtr_en()
229 dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret); in cypress_nor_octal_dtr_en()
233 if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) in cypress_nor_octal_dtr_en()
234 return -EINVAL; in cypress_nor_octal_dtr_en()
239 static int cypress_nor_set_single_spi_bits(struct spi_nor *nor, u64 addr) in cypress_nor_set_single_spi_bits() argument
242 u8 *buf = nor->bouncebuf; in cypress_nor_set_single_spi_bits()
245 * The register is 1-byte wide, but 1-byte transactions are not allowed in cypress_nor_set_single_spi_bits()
246 * in 8D-8D-8D mode. Since there is no register at the next location, in cypress_nor_set_single_spi_bits()
252 CYPRESS_NOR_WR_ANY_REG_OP(nor->addr_nbytes, addr, 2, buf); in cypress_nor_set_single_spi_bits()
253 return spi_nor_write_any_volatile_reg(nor, &op, SNOR_PROTO_8_8_8_DTR); in cypress_nor_set_single_spi_bits()
256 static int cypress_nor_octal_dtr_dis(struct spi_nor *nor) in cypress_nor_octal_dtr_dis() argument
258 const struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_octal_dtr_dis()
259 u8 *buf = nor->bouncebuf; in cypress_nor_octal_dtr_dis()
263 for (i = 0; i < params->n_dice; i++) { in cypress_nor_octal_dtr_dis()
264 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR5; in cypress_nor_octal_dtr_dis()
265 ret = cypress_nor_set_single_spi_bits(nor, addr); in cypress_nor_octal_dtr_dis()
271 ret = spi_nor_read_id(nor, 0, 0, buf, SNOR_PROTO_1_1_1); in cypress_nor_octal_dtr_dis()
273 dev_dbg(nor->dev, "error %d reading JEDEC ID after disabling 8D-8D-8D mode\n", ret); in cypress_nor_octal_dtr_dis()
277 if (memcmp(buf, nor->info->id->bytes, nor->info->id->len)) in cypress_nor_octal_dtr_dis()
278 return -EINVAL; in cypress_nor_octal_dtr_dis()
283 static int cypress_nor_quad_enable_volatile_reg(struct spi_nor *nor, u64 addr) in cypress_nor_quad_enable_volatile_reg() argument
286 u8 addr_mode_nbytes = nor->params->addr_mode_nbytes; in cypress_nor_quad_enable_volatile_reg()
292 nor->bouncebuf); in cypress_nor_quad_enable_volatile_reg()
294 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_quad_enable_volatile_reg()
298 if (nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR1_QUAD_EN) in cypress_nor_quad_enable_volatile_reg()
302 nor->bouncebuf[0] |= SPINOR_REG_CYPRESS_CFR1_QUAD_EN; in cypress_nor_quad_enable_volatile_reg()
305 nor->bouncebuf); in cypress_nor_quad_enable_volatile_reg()
306 ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto); in cypress_nor_quad_enable_volatile_reg()
310 cfr1v_written = nor->bouncebuf[0]; in cypress_nor_quad_enable_volatile_reg()
315 nor->bouncebuf); in cypress_nor_quad_enable_volatile_reg()
316 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_quad_enable_volatile_reg()
320 if (nor->bouncebuf[0] != cfr1v_written) { in cypress_nor_quad_enable_volatile_reg()
321 dev_err(nor->dev, "CFR1: Read back test failed\n"); in cypress_nor_quad_enable_volatile_reg()
322 return -EIO; in cypress_nor_quad_enable_volatile_reg()
329 * cypress_nor_quad_enable_volatile() - enable Quad I/O mode in volatile
331 * @nor: pointer to a 'struct spi_nor'
334 * to a risk of the non-volatile registers corruption by power interrupt. This
336 * bit in the CFR1 non-volatile in advance (typically by a Flash programmer
338 * also set during Flash power-up.
340 * Return: 0 on success, -errno otherwise.
342 static int cypress_nor_quad_enable_volatile(struct spi_nor *nor) in cypress_nor_quad_enable_volatile() argument
344 struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_quad_enable_volatile()
349 for (i = 0; i < params->n_dice; i++) { in cypress_nor_quad_enable_volatile()
350 addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR1; in cypress_nor_quad_enable_volatile()
351 ret = cypress_nor_quad_enable_volatile_reg(nor, addr); in cypress_nor_quad_enable_volatile()
360 * cypress_nor_determine_addr_mode_by_sr1() - Determine current address mode
361 * (3 or 4-byte) by querying status
363 * @nor: pointer to a 'struct spi_nor'
368 * from RDSR1(no address), RDAR(3-byte address), and RDAR(4-byte address).
370 * Return: 0 on success, -errno otherwise.
372 static int cypress_nor_determine_addr_mode_by_sr1(struct spi_nor *nor, in cypress_nor_determine_addr_mode_by_sr1() argument
377 nor->bouncebuf); in cypress_nor_determine_addr_mode_by_sr1()
381 ret = spi_nor_read_sr(nor, &nor->bouncebuf[1]); in cypress_nor_determine_addr_mode_by_sr1()
385 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_determine_addr_mode_by_sr1()
389 is3byte = (nor->bouncebuf[0] == nor->bouncebuf[1]); in cypress_nor_determine_addr_mode_by_sr1()
393 nor->bouncebuf); in cypress_nor_determine_addr_mode_by_sr1()
394 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_determine_addr_mode_by_sr1()
398 is4byte = (nor->bouncebuf[0] == nor->bouncebuf[1]); in cypress_nor_determine_addr_mode_by_sr1()
401 return -EIO; in cypress_nor_determine_addr_mode_by_sr1()
411 * cypress_nor_set_addr_mode_nbytes() - Set the number of address bytes mode of
413 * @nor: pointer to a 'struct spi_nor'
416 * query CFR2V[7] to confirm. If determination is failed, force enter to 4-byte
419 * Return: 0 on success, -errno otherwise.
421 static int cypress_nor_set_addr_mode_nbytes(struct spi_nor *nor) in cypress_nor_set_addr_mode_nbytes() argument
428 * Read SR1 by RDSR1 and RDAR(3- AND 4-byte addr). Use write enable in cypress_nor_set_addr_mode_nbytes()
429 * that sets bit-1 in SR1. in cypress_nor_set_addr_mode_nbytes()
431 ret = spi_nor_write_enable(nor); in cypress_nor_set_addr_mode_nbytes()
434 ret = cypress_nor_determine_addr_mode_by_sr1(nor, &addr_mode); in cypress_nor_set_addr_mode_nbytes()
436 ret = spi_nor_set_4byte_addr_mode(nor, true); in cypress_nor_set_addr_mode_nbytes()
439 return spi_nor_write_disable(nor); in cypress_nor_set_addr_mode_nbytes()
441 ret = spi_nor_write_disable(nor); in cypress_nor_set_addr_mode_nbytes()
451 0, nor->bouncebuf); in cypress_nor_set_addr_mode_nbytes()
452 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_set_addr_mode_nbytes()
456 if (nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR2_ADRBYT) { in cypress_nor_set_addr_mode_nbytes()
458 return spi_nor_set_4byte_addr_mode(nor, true); in cypress_nor_set_addr_mode_nbytes()
461 return spi_nor_set_4byte_addr_mode(nor, true); in cypress_nor_set_addr_mode_nbytes()
464 nor->params->addr_nbytes = addr_mode; in cypress_nor_set_addr_mode_nbytes()
465 nor->params->addr_mode_nbytes = addr_mode; in cypress_nor_set_addr_mode_nbytes()
471 * cypress_nor_get_page_size() - Get flash page size configuration.
472 * @nor: pointer to a 'struct spi_nor'
478 * Return: 0 on success, -errno otherwise.
480 static int cypress_nor_get_page_size(struct spi_nor *nor) in cypress_nor_get_page_size() argument
483 CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes, in cypress_nor_get_page_size()
484 0, 0, nor->bouncebuf); in cypress_nor_get_page_size()
485 struct spi_nor_flash_parameter *params = nor->params; in cypress_nor_get_page_size()
490 * Use the minimum common page size configuration. Programming 256-byte in cypress_nor_get_page_size()
491 * under 512-byte page size configuration is safe. in cypress_nor_get_page_size()
493 params->page_size = 256; in cypress_nor_get_page_size()
494 for (i = 0; i < params->n_dice; i++) { in cypress_nor_get_page_size()
495 op.addr.val = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR3; in cypress_nor_get_page_size()
497 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in cypress_nor_get_page_size()
501 if (!(nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR3_PGSZ)) in cypress_nor_get_page_size()
505 params->page_size = 512; in cypress_nor_get_page_size()
510 static void cypress_nor_ecc_init(struct spi_nor *nor) in cypress_nor_ecc_init() argument
513 * Programming is supported only in 16-byte ECC data unit granularity. in cypress_nor_ecc_init()
514 * Byte-programming, bit-walking, or multiple program operations to the in cypress_nor_ecc_init()
517 nor->params->writesize = 16; in cypress_nor_ecc_init()
518 nor->flags |= SNOR_F_ECC; in cypress_nor_ecc_init()
522 s25fs256t_post_bfpt_fixup(struct spi_nor *nor, in s25fs256t_post_bfpt_fixup() argument
529 ret = cypress_nor_set_addr_mode_nbytes(nor); in s25fs256t_post_bfpt_fixup()
535 CYPRESS_NOR_RD_ANY_REG_OP(nor->params->addr_mode_nbytes, in s25fs256t_post_bfpt_fixup()
537 nor->bouncebuf); in s25fs256t_post_bfpt_fixup()
538 ret = spi_nor_read_any_reg(nor, &op, nor->reg_proto); in s25fs256t_post_bfpt_fixup()
543 if (nor->bouncebuf[0]) in s25fs256t_post_bfpt_fixup()
544 return -ENODEV; in s25fs256t_post_bfpt_fixup()
549 static int s25fs256t_post_sfdp_fixup(struct spi_nor *nor) in s25fs256t_post_sfdp_fixup() argument
551 struct spi_nor_flash_parameter *params = nor->params; in s25fs256t_post_sfdp_fixup()
558 params->vreg_offset = devm_kmalloc(nor->dev, sizeof(u32), GFP_KERNEL); in s25fs256t_post_sfdp_fixup()
559 if (!params->vreg_offset) in s25fs256t_post_sfdp_fixup()
560 return -ENOMEM; in s25fs256t_post_sfdp_fixup()
562 params->vreg_offset[0] = SPINOR_REG_CYPRESS_VREG; in s25fs256t_post_sfdp_fixup()
563 params->n_dice = 1; in s25fs256t_post_sfdp_fixup()
566 params->hwcaps.mask |= SNOR_HWCAPS_PP_1_1_4; in s25fs256t_post_sfdp_fixup()
567 spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP_1_1_4], in s25fs256t_post_sfdp_fixup()
571 return cypress_nor_get_page_size(nor); in s25fs256t_post_sfdp_fixup()
574 static int s25fs256t_late_init(struct spi_nor *nor) in s25fs256t_late_init() argument
576 cypress_nor_ecc_init(nor); in s25fs256t_late_init()
588 s25hx_t_post_bfpt_fixup(struct spi_nor *nor, in s25hx_t_post_bfpt_fixup() argument
594 ret = cypress_nor_set_addr_mode_nbytes(nor); in s25hx_t_post_bfpt_fixup()
599 nor->params->quad_enable = cypress_nor_quad_enable_volatile; in s25hx_t_post_bfpt_fixup()
604 static int s25hx_t_post_sfdp_fixup(struct spi_nor *nor) in s25hx_t_post_sfdp_fixup() argument
606 struct spi_nor_flash_parameter *params = nor->params; in s25hx_t_post_sfdp_fixup()
607 struct spi_nor_erase_type *erase_type = params->erase_map.erase_type; in s25hx_t_post_sfdp_fixup()
610 if (!params->n_dice || !params->vreg_offset) { in s25hx_t_post_sfdp_fixup()
611 dev_err(nor->dev, "%s failed. The volatile register offset could not be retrieved from SFDP.\n", in s25hx_t_post_sfdp_fixup()
613 return -EOPNOTSUPP; in s25hx_t_post_sfdp_fixup()
617 if (params->size == SZ_256M) in s25hx_t_post_sfdp_fixup()
618 params->n_dice = 2; in s25hx_t_post_sfdp_fixup()
637 return cypress_nor_get_page_size(nor); in s25hx_t_post_sfdp_fixup()
640 static int s25hx_t_late_init(struct spi_nor *nor) in s25hx_t_late_init() argument
642 struct spi_nor_flash_parameter *params = nor->params; in s25hx_t_late_init()
645 params->reads[SNOR_CMD_READ_FAST].num_mode_clocks = 8; in s25hx_t_late_init()
646 params->ready = cypress_nor_sr_ready_and_clear; in s25hx_t_late_init()
647 cypress_nor_ecc_init(nor); in s25hx_t_late_init()
649 params->die_erase_opcode = SPINOR_OP_CYPRESS_DIE_ERASE; in s25hx_t_late_init()
660 * cypress_nor_set_octal_dtr() - Enable or disable octal DTR on Cypress flashes.
661 * @nor: pointer to a 'struct spi_nor'
667 * Return: 0 on success, -errno otherwise.
669 static int cypress_nor_set_octal_dtr(struct spi_nor *nor, bool enable) in cypress_nor_set_octal_dtr() argument
671 return enable ? cypress_nor_octal_dtr_en(nor) : in cypress_nor_set_octal_dtr()
672 cypress_nor_octal_dtr_dis(nor); in cypress_nor_set_octal_dtr()
675 static int s28hx_t_post_sfdp_fixup(struct spi_nor *nor) in s28hx_t_post_sfdp_fixup() argument
677 struct spi_nor_flash_parameter *params = nor->params; in s28hx_t_post_sfdp_fixup()
679 if (!params->n_dice || !params->vreg_offset) { in s28hx_t_post_sfdp_fixup()
680 dev_err(nor->dev, "%s failed. The volatile register offset could not be retrieved from SFDP.\n", in s28hx_t_post_sfdp_fixup()
682 return -EOPNOTSUPP; in s28hx_t_post_sfdp_fixup()
686 if (params->size == SZ_256M) in s28hx_t_post_sfdp_fixup()
687 params->n_dice = 2; in s28hx_t_post_sfdp_fixup()
690 * On older versions of the flash the xSPI Profile 1.0 table has the in s28hx_t_post_sfdp_fixup()
691 * 8D-8D-8D Fast Read opcode as 0x00. But it actually should be 0xEE. in s28hx_t_post_sfdp_fixup()
693 if (params->reads[SNOR_CMD_READ_8_8_8_DTR].opcode == 0) in s28hx_t_post_sfdp_fixup()
694 params->reads[SNOR_CMD_READ_8_8_8_DTR].opcode = in s28hx_t_post_sfdp_fixup()
697 /* This flash is also missing the 4-byte Page Program opcode bit. */ in s28hx_t_post_sfdp_fixup()
698 spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP], in s28hx_t_post_sfdp_fixup()
701 * Since xSPI Page Program opcode is backward compatible with in s28hx_t_post_sfdp_fixup()
704 spi_nor_set_pp_settings(&params->page_programs[SNOR_CMD_PP_8_8_8_DTR], in s28hx_t_post_sfdp_fixup()
708 * The xSPI Profile 1.0 table advertises the number of additional in s28hx_t_post_sfdp_fixup()
712 params->rdsr_addr_nbytes = 4; in s28hx_t_post_sfdp_fixup()
714 return cypress_nor_get_page_size(nor); in s28hx_t_post_sfdp_fixup()
717 static int s28hx_t_post_bfpt_fixup(struct spi_nor *nor, in s28hx_t_post_bfpt_fixup() argument
721 return cypress_nor_set_addr_mode_nbytes(nor); in s28hx_t_post_bfpt_fixup()
724 static int s28hx_t_late_init(struct spi_nor *nor) in s28hx_t_late_init() argument
726 struct spi_nor_flash_parameter *params = nor->params; in s28hx_t_late_init()
728 params->set_octal_dtr = cypress_nor_set_octal_dtr; in s28hx_t_late_init()
729 params->ready = cypress_nor_sr_ready_and_clear; in s28hx_t_late_init()
730 cypress_nor_ecc_init(nor); in s28hx_t_late_init()
742 s25fs_s_nor_post_bfpt_fixups(struct spi_nor *nor, in s25fs_s_nor_post_bfpt_fixups() argument
747 * The S25FS-S chip family reports 512-byte pages in BFPT but in s25fs_s_nor_post_bfpt_fixups()
752 nor->params->page_size = 256; in s25fs_s_nor_post_bfpt_fixups()
1013 * spansion_nor_sr_ready_and_clear() - Query the Status Register to see if the
1015 * @nor: pointer to 'struct spi_nor'.
1017 * Return: 1 if ready, 0 if not ready, -errno on errors.
1019 static int spansion_nor_sr_ready_and_clear(struct spi_nor *nor) in spansion_nor_sr_ready_and_clear() argument
1023 ret = spi_nor_read_sr(nor, nor->bouncebuf); in spansion_nor_sr_ready_and_clear()
1027 if (nor->bouncebuf[0] & (SR_E_ERR | SR_P_ERR)) { in spansion_nor_sr_ready_and_clear()
1028 if (nor->bouncebuf[0] & SR_E_ERR) in spansion_nor_sr_ready_and_clear()
1029 dev_err(nor->dev, "Erase Error occurred\n"); in spansion_nor_sr_ready_and_clear()
1031 dev_err(nor->dev, "Programming Error occurred\n"); in spansion_nor_sr_ready_and_clear()
1033 spansion_nor_clear_sr(nor); in spansion_nor_sr_ready_and_clear()
1041 ret = spi_nor_write_disable(nor); in spansion_nor_sr_ready_and_clear()
1045 return -EIO; in spansion_nor_sr_ready_and_clear()
1048 return !(nor->bouncebuf[0] & SR_WIP); in spansion_nor_sr_ready_and_clear()
1051 static int spansion_nor_late_init(struct spi_nor *nor) in spansion_nor_late_init() argument
1053 struct spi_nor_flash_parameter *params = nor->params; in spansion_nor_late_init()
1055 u8 mfr_flags = nor->info->mfr_flags; in spansion_nor_late_init()
1057 if (params->size > SZ_16M) { in spansion_nor_late_init()
1058 nor->flags |= SNOR_F_4B_OPCODES; in spansion_nor_late_init()
1059 /* No small sector erase for 4-byte command set */ in spansion_nor_late_init()
1060 nor->erase_opcode = SPINOR_OP_SE; in spansion_nor_late_init()
1061 nor->mtd.erasesize = nor->info->sector_size ?: in spansion_nor_late_init()
1066 priv_params = devm_kmalloc(nor->dev, sizeof(*priv_params), in spansion_nor_late_init()
1069 return -ENOMEM; in spansion_nor_late_init()
1072 priv_params->clsr = SPINOR_OP_CLSR; in spansion_nor_late_init()
1074 priv_params->clsr = SPINOR_OP_CLPEF; in spansion_nor_late_init()
1076 params->priv = priv_params; in spansion_nor_late_init()
1077 params->ready = spansion_nor_sr_ready_and_clear; in spansion_nor_late_init()