Skip to content

Commit fb63bfa

Browse files
committed
mtd: spi-nor: spansion: switch s25hx_t to use vreg_offset for quad_enable()
All s25hx_t flashes have single or multi chip flavors and already use n_dice and vreg_offset in cypress_nor_sr_ready_and_clear. Switch s25hx_t to always use vreg_offset for the quad_enable() method, so that we use the same code base for both single and multi chip package flashes. Tested-by: Takahiro Kuwano <Takahiro.Kuwano@infineon.com> Link: https://lore.kernel.org/r/20230726075257.12985-11-tudor.ambarus@linaro.org Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
1 parent 39133e5 commit fb63bfa

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

drivers/mtd/spi-nor/spansion.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#define SPINOR_REG_CYPRESS_STR1V \
2525
(SPINOR_REG_CYPRESS_VREG + SPINOR_REG_CYPRESS_STR1)
2626
#define SPINOR_REG_CYPRESS_CFR1 0x2
27-
#define SPINOR_REG_CYPRESS_CFR1V \
28-
(SPINOR_REG_CYPRESS_VREG + SPINOR_REG_CYPRESS_CFR1)
2927
#define SPINOR_REG_CYPRESS_CFR1_QUAD_EN BIT(1) /* Quad Enable */
3028
#define SPINOR_REG_CYPRESS_CFR2 0x3
3129
#define SPINOR_REG_CYPRESS_CFR2V \
@@ -348,10 +346,6 @@ static int cypress_nor_quad_enable_volatile(struct spi_nor *nor)
348346
u8 i;
349347
int ret;
350348

351-
if (!params->n_dice)
352-
return cypress_nor_quad_enable_volatile_reg(nor,
353-
SPINOR_REG_CYPRESS_CFR1V);
354-
355349
for (i = 0; i < params->n_dice; i++) {
356350
addr = params->vreg_offset[i] + SPINOR_REG_CYPRESS_CFR1;
357351
ret = cypress_nor_quad_enable_volatile_reg(nor, addr);
@@ -657,15 +651,17 @@ static int s25hx_t_late_init(struct spi_nor *nor)
657651
{
658652
struct spi_nor_flash_parameter *params = nor->params;
659653

654+
if (!params->n_dice || !params->vreg_offset) {
655+
dev_err(nor->dev, "%s failed. The volatile register offset could not be retrieved from SFDP.\n",
656+
__func__);
657+
return -EOPNOTSUPP;
658+
}
659+
660660
/* Fast Read 4B requires mode cycles */
661661
params->reads[SNOR_CMD_READ_FAST].num_mode_clocks = 8;
662-
662+
params->ready = cypress_nor_sr_ready_and_clear;
663663
cypress_nor_ecc_init(nor);
664664

665-
/* Replace ready() with multi die version */
666-
if (params->n_dice)
667-
params->ready = cypress_nor_sr_ready_and_clear;
668-
669665
return 0;
670666
}
671667

0 commit comments

Comments
 (0)