summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi-nor/micron-st.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/spi-nor/micron-st.c')
-rw-r--r--drivers/mtd/spi-nor/micron-st.c101
1 files changed, 57 insertions, 44 deletions
diff --git a/drivers/mtd/spi-nor/micron-st.c b/drivers/mtd/spi-nor/micron-st.c
index 187239ccd549..88033384a71e 100644
--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -127,9 +127,36 @@ static int micron_st_nor_set_octal_dtr(struct spi_nor *nor, bool enable)
micron_st_nor_octal_dtr_dis(nor);
}
-static void mt35xu512aba_default_init(struct spi_nor *nor)
+static int micron_st_nor_four_die_late_init(struct spi_nor *nor)
{
- nor->params->set_octal_dtr = micron_st_nor_set_octal_dtr;
+ struct spi_nor_flash_parameter *params = nor->params;
+
+ params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
+ params->n_dice = 4;
+
+ /*
+ * Unfortunately the die erase opcode does not have a 4-byte opcode
+ * correspondent for these flashes. The SFDP 4BAIT table fails to
+ * consider the die erase too. We're forced to enter in the 4 byte
+ * address mode in order to benefit of the die erase.
+ */
+ return spi_nor_set_4byte_addr_mode(nor, true);
+}
+
+static int micron_st_nor_two_die_late_init(struct spi_nor *nor)
+{
+ struct spi_nor_flash_parameter *params = nor->params;
+
+ params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
+ params->n_dice = 2;
+
+ /*
+ * Unfortunately the die erase opcode does not have a 4-byte opcode
+ * correspondent for these flashes. The SFDP 4BAIT table fails to
+ * consider the die erase too. We're forced to enter in the 4 byte
+ * address mode in order to benefit of the die erase.
+ */
+ return spi_nor_set_4byte_addr_mode(nor, true);
}
static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor)
@@ -155,22 +182,38 @@ static int mt35xu512aba_post_sfdp_fixup(struct spi_nor *nor)
}
static const struct spi_nor_fixups mt35xu512aba_fixups = {
- .default_init = mt35xu512aba_default_init,
.post_sfdp = mt35xu512aba_post_sfdp_fixup,
};
+static const struct spi_nor_fixups mt35xu01gbba_fixups = {
+ .post_sfdp = mt35xu512aba_post_sfdp_fixup,
+ .late_init = micron_st_nor_two_die_late_init,
+};
+
static const struct flash_info micron_nor_parts[] = {
{
+ /* MT35XU512ABA */
.id = SNOR_ID(0x2c, 0x5b, 0x1a),
- .name = "mt35xu512aba",
- .sector_size = SZ_128K,
- .size = SZ_64M,
- .no_sfdp_flags = SECT_4K | SPI_NOR_OCTAL_READ |
- SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP,
.mfr_flags = USE_FSR,
- .fixup_flags = SPI_NOR_4B_OPCODES | SPI_NOR_IO_MODE_EN_VOLATILE,
+ .fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
.fixups = &mt35xu512aba_fixups,
}, {
+ /* MT35XU01GBBA */
+ .id = SNOR_ID(0x2c, 0x5b, 0x1b),
+ .mfr_flags = USE_FSR,
+ .fixup_flags = SPI_NOR_IO_MODE_EN_VOLATILE,
+ .fixups = &mt35xu01gbba_fixups,
+ }, {
+ /*
+ * The MT35XU02GCBA flash device does not support chip erase,
+ * according to its datasheet. It supports die erase, which
+ * means the current driver implementation will likely need to
+ * be converted to use die erase. Furthermore, similar to the
+ * MT35XU01GBBA, the SPI_NOR_IO_MODE_EN_VOLATILE flag probably
+ * needs to be enabled.
+ *
+ * TODO: Fix these and test on real hardware.
+ */
.id = SNOR_ID(0x2c, 0x5b, 0x1c),
.name = "mt35xu02g",
.sector_size = SZ_128K,
@@ -193,48 +236,16 @@ static const struct spi_nor_fixups mt25qu512a_fixups = {
.post_bfpt = mt25qu512a_post_bfpt_fixup,
};
-static int st_nor_four_die_late_init(struct spi_nor *nor)
-{
- struct spi_nor_flash_parameter *params = nor->params;
-
- params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
- params->n_dice = 4;
-
- /*
- * Unfortunately the die erase opcode does not have a 4-byte opcode
- * correspondent for these flashes. The SFDP 4BAIT table fails to
- * consider the die erase too. We're forced to enter in the 4 byte
- * address mode in order to benefit of the die erase.
- */
- return spi_nor_set_4byte_addr_mode(nor, true);
-}
-
-static int st_nor_two_die_late_init(struct spi_nor *nor)
-{
- struct spi_nor_flash_parameter *params = nor->params;
-
- params->die_erase_opcode = SPINOR_OP_MT_DIE_ERASE;
- params->n_dice = 2;
-
- /*
- * Unfortunately the die erase opcode does not have a 4-byte opcode
- * correspondent for these flashes. The SFDP 4BAIT table fails to
- * consider the die erase too. We're forced to enter in the 4 byte
- * address mode in order to benefit of the die erase.
- */
- return spi_nor_set_4byte_addr_mode(nor, true);
-}
-
static const struct spi_nor_fixups n25q00_fixups = {
- .late_init = st_nor_four_die_late_init,
+ .late_init = micron_st_nor_four_die_late_init,
};
static const struct spi_nor_fixups mt25q01_fixups = {
- .late_init = st_nor_two_die_late_init,
+ .late_init = micron_st_nor_two_die_late_init,
};
static const struct spi_nor_fixups mt25q02_fixups = {
- .late_init = st_nor_four_die_late_init,
+ .late_init = micron_st_nor_four_die_late_init,
};
static const struct flash_info st_nor_parts[] = {
@@ -635,6 +646,8 @@ static int micron_st_nor_late_init(struct spi_nor *nor)
if (!params->set_4byte_addr_mode)
params->set_4byte_addr_mode = spi_nor_set_4byte_addr_mode_wren_en4b_ex4b;
+ params->set_octal_dtr = micron_st_nor_set_octal_dtr;
+
return 0;
}