Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1325434
| From | Cyrille Pitchen <cyrille.pitchen@atmel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 07/14] mtd: spi-nor: fix support of Spansion memories |
| Date | 2016-02-03 14:30 +0100 |
| Message-ID | <qY5Fq-2vi-65@gated-at.bofh.it> (permalink) |
| References | <qY5Fn-2vi-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch is only a transitional one. It concludes the series of patches
to select op codes and protocols by manufacturer.
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
---
drivers/mtd/spi-nor/spi-nor.c | 53 ++++++++++++++++++++++++++++++-------------
1 file changed, 37 insertions(+), 16 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 6785e699106d..f9dd1fd3f53c 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1439,10 +1439,35 @@ static int micron_set_single_mode(struct spi_nor *nor)
return 0;
}
-static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
+static int spansion_set_quad_mode(struct spi_nor *nor)
{
int status;
+ status = spansion_quad_enable(nor);
+ if (status) {
+ dev_err(nor->dev, "Spansion quad-read not enabled\n");
+ return -EINVAL;
+ }
+ nor->read_proto = SNOR_PROTO_1_1_4;
+ nor->read_opcode = SPINOR_OP_READ_1_1_4;
+ return 0;
+}
+
+static int spansion_set_dual_mode(struct spi_nor *nor)
+{
+ nor->read_proto = SNOR_PROTO_1_1_2;
+ nor->read_opcode = SPINOR_OP_READ_1_1_2;
+ return 0;
+}
+
+static int spansion_set_single_mode(struct spi_nor *nor)
+{
+ nor->read_proto = SNOR_PROTO_1_1_1;
+ return 0;
+}
+
+static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
+{
switch (JEDEC_MFR(info)) {
case SNOR_MFR_MACRONIX:
return macronix_set_quad_mode(nor);
@@ -1454,20 +1479,13 @@ static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
return micron_set_quad_mode(nor);
case SNOR_MFR_SPANSION:
- status = spansion_quad_enable(nor);
- if (status) {
- dev_err(nor->dev, "Spansion quad-read not enabled\n");
- return -EINVAL;
- }
- nor->read_proto = SNOR_PROTO_1_1_4;
- break;
+ return spansion_set_quad_mode(nor);
default:
- return -EINVAL;
+ break;
}
- nor->read_opcode = SPINOR_OP_READ_1_1_4;
- return 0;
+ return -EINVAL;
}
static int set_dual_mode(struct spi_nor *nor, const struct flash_info *info)
@@ -1482,13 +1500,14 @@ static int set_dual_mode(struct spi_nor *nor, const struct flash_info *info)
case SNOR_MFR_MICRON:
return micron_set_dual_mode(nor);
+ case SNOR_MFR_SPANSION:
+ return spansion_set_dual_mode(nor);
+
default:
- nor->read_proto = SNOR_PROTO_1_1_2;
break;
}
- nor->read_opcode = SPINOR_OP_READ_1_1_2;
- return 0;
+ return -EINVAL;
}
static int set_single_mode(struct spi_nor *nor, const struct flash_info *info)
@@ -1503,12 +1522,14 @@ static int set_single_mode(struct spi_nor *nor, const struct flash_info *info)
case SNOR_MFR_MICRON:
return micron_set_single_mode(nor);
+ case SNOR_MFR_SPANSION:
+ return spansion_set_single_mode(nor);
+
default:
- nor->read_proto = SNOR_PROTO_1_1_1;
break;
}
- return 0;
+ return -EINVAL;
}
static int spi_nor_check(struct spi_nor *nor)
--
1.8.2.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/14] mtd: spi-nor: add driver for Atmel QSPI controller Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:30 +0100 [PATCH v3 06/14] mtd: spi-nor: fix support of Micron memories Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:30 +0100 [PATCH v3 07/14] mtd: spi-nor: fix support of Spansion memories Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:30 +0100 [PATCH v3 05/14] mtd: spi-nor: fix support of Winbond memories Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:30 +0100 [PATCH v3 03/14] mtd: spi-nor: select op codes and SPI NOR protocols by manufacturer Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:30 +0100 [PATCH v3 04/14] mtd: spi-nor: fix support of Macronix memories Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:30 +0100 [PATCH v3 10/14] mtd: spi-nor: configure the number of dummy clock cycles on Macronix memories Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:40 +0100 [PATCH v3 14/14] mtd: atmel-quadspi: add driver for Atmel QSPI controller Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:40 +0100 [PATCH v3 08/14] mtd: spi-nor: configure the number of dummy clock cycles by manufacturer Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:40 +0100 [PATCH v3 12/14] mtd: m25p80: add support of dual and quad spi protocols to all commands Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:40 +0100 [PATCH v3 09/14] mtd: spi-nor: configure the number of dummy clock cycles on Micron memories Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:40 +0100 [PATCH v3 11/14] mtd: spi-nor: configure the number of dummy clock cycles on Spansion memories Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:40 +0100 [PATCH v3 13/14] Documentation: atmel-quadspi: add binding file for Atmel QSPI driver Cyrille Pitchen <cyrille.pitchen@atmel.com> - 2016-02-03 14:40 +0100
csiph-web