Skip to content

Commit 658488e

Browse files
committed
mtd: spi-nor: Rename Quad Enable methods
Rename macronix_quad_enable() to a generic name: spi_nor_sr1_bit6_quad_enable(). Prepend "spi_nor_" to "sr2_bit7_quad_enable". All SPI NOR generic methods should be prepended by "spi_nor_". Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>
1 parent 7b678c6 commit 658488e

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

‎drivers/mtd/spi-nor/spi-nor.c‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,27 +2078,26 @@ static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
20782078
}
20792079

20802080
/**
2081-
* macronix_quad_enable() - set QE bit in Status Register.
2081+
* spi_nor_sr1_bit6_quad_enable() - Set the Quad Enable BIT(6) in the Status
2082+
* Register 1.
20822083
* @nor: pointer to a 'struct spi_nor'
20832084
*
2084-
* Set the Quad Enable (QE) bit in the Status Register.
2085-
*
2086-
* bit 6 of the Status Register is the QE bit for Macronix like QSPI memories.
2085+
* Bit 6 of the Status Register 1 is the QE bit for Macronix like QSPI memories.
20872086
*
20882087
* Return: 0 on success, -errno otherwise.
20892088
*/
2090-
static int macronix_quad_enable(struct spi_nor *nor)
2089+
static int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor)
20912090
{
20922091
int ret;
20932092

20942093
ret = spi_nor_read_sr(nor, nor->bouncebuf);
20952094
if (ret)
20962095
return ret;
20972096

2098-
if (nor->bouncebuf[0] & SR_QUAD_EN_MX)
2097+
if (nor->bouncebuf[0] & SR1_QUAD_EN_BIT6)
20992098
return 0;
21002099

2101-
nor->bouncebuf[0] |= SR_QUAD_EN_MX;
2100+
nor->bouncebuf[0] |= SR1_QUAD_EN_BIT6;
21022101

21032102
return spi_nor_write_sr1_and_check(nor, nor->bouncebuf[0]);
21042103
}
@@ -2130,7 +2129,7 @@ static int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor)
21302129
}
21312130

21322131
/**
2133-
* sr2_bit7_quad_enable() - set QE bit in Status Register 2.
2132+
* spi_nor_sr2_bit7_quad_enable() - set QE bit in Status Register 2.
21342133
* @nor: pointer to a 'struct spi_nor'
21352134
*
21362135
* Set the Quad Enable (QE) bit in the Status Register 2.
@@ -2141,7 +2140,7 @@ static int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor)
21412140
*
21422141
* Return: 0 on success, -errno otherwise.
21432142
*/
2144-
static int sr2_bit7_quad_enable(struct spi_nor *nor)
2143+
static int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor)
21452144
{
21462145
u8 *sr2 = nor->bouncebuf;
21472146
int ret;
@@ -2281,7 +2280,7 @@ static void gd25q256_default_init(struct spi_nor *nor)
22812280
* indicate the quad_enable method for this case, we need
22822281
* to set it in the default_init fixup hook.
22832282
*/
2284-
nor->params.quad_enable = macronix_quad_enable;
2283+
nor->params.quad_enable = spi_nor_sr1_bit6_quad_enable;
22852284
}
22862285

22872286
static struct spi_nor_fixups gd25q256_fixups = {
@@ -3661,12 +3660,12 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
36613660

36623661
case BFPT_DWORD15_QER_SR1_BIT6:
36633662
nor->flags &= ~SNOR_F_HAS_16BIT_SR;
3664-
params->quad_enable = macronix_quad_enable;
3663+
params->quad_enable = spi_nor_sr1_bit6_quad_enable;
36653664
break;
36663665

36673666
case BFPT_DWORD15_QER_SR2_BIT7:
36683667
nor->flags &= ~SNOR_F_HAS_16BIT_SR;
3669-
params->quad_enable = sr2_bit7_quad_enable;
3668+
params->quad_enable = spi_nor_sr2_bit7_quad_enable;
36703669
break;
36713670

36723671
case BFPT_DWORD15_QER_SR2_BIT1:
@@ -4569,7 +4568,7 @@ static void intel_set_default_init(struct spi_nor *nor)
45694568

45704569
static void macronix_set_default_init(struct spi_nor *nor)
45714570
{
4572-
nor->params.quad_enable = macronix_quad_enable;
4571+
nor->params.quad_enable = spi_nor_sr1_bit6_quad_enable;
45734572
nor->params.set_4byte = macronix_set_4byte;
45744573
}
45754574

‎include/linux/mtd/spi-nor.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
#define SR_E_ERR BIT(5)
134134
#define SR_P_ERR BIT(6)
135135

136-
#define SR_QUAD_EN_MX BIT(6) /* Macronix Quad I/O */
136+
#define SR1_QUAD_EN_BIT6 BIT(6)
137137

138138
/* Enhanced Volatile Configuration Register bits */
139139
#define EVCR_QUAD_EN_MICRON BIT(7) /* Micron Quad I/O */

0 commit comments

Comments
 (0)