Skip to content

Commit 9f9ae0c

Browse files
shivamurthyshastrimiquelraynal
authored andcommitted
mtd: spinand: micron: Add new Micron SPI NAND devices with multiple dies
Add device table for new Micron SPI NAND devices, which have multiple dies. Also, enable support to select the dies. Signed-off-by: Shivamurthy Shastri <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent a7e5dac commit 9f9ae0c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

drivers/mtd/nand/spi/micron.c

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020

2121
#define MICRON_CFG_CR BIT(0)
2222

23+
/*
24+
* As per datasheet, die selection is done by the 6th bit of Die
25+
* Select Register (Address 0xD0).
26+
*/
27+
#define MICRON_DIE_SELECT_REG 0xD0
28+
29+
#define MICRON_SELECT_DIE(x) ((x) << 6)
30+
2331
static SPINAND_OP_VARIANTS(read_cache_variants,
2432
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
2533
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
@@ -66,6 +74,20 @@ static const struct mtd_ooblayout_ops micron_8_ooblayout = {
6674
.free = micron_8_ooblayout_free,
6775
};
6876

77+
static int micron_select_target(struct spinand_device *spinand,
78+
unsigned int target)
79+
{
80+
struct spi_mem_op op = SPINAND_SET_FEATURE_OP(MICRON_DIE_SELECT_REG,
81+
spinand->scratchbuf);
82+
83+
if (target > 1)
84+
return -EINVAL;
85+
86+
*spinand->scratchbuf = MICRON_SELECT_DIE(target);
87+
88+
return spi_mem_exec_op(spinand->spimem, &op);
89+
}
90+
6991
static int micron_8_ecc_get_status(struct spinand_device *spinand,
7092
u8 status)
7193
{
@@ -137,6 +159,18 @@ static const struct spinand_info micron_spinand_table[] = {
137159
0,
138160
SPINAND_ECCINFO(&micron_8_ooblayout,
139161
micron_8_ecc_get_status)),
162+
/* M79A 4Gb 3.3V */
163+
SPINAND_INFO("MT29F4G01ADAGD",
164+
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x36),
165+
NAND_MEMORG(1, 2048, 128, 64, 2048, 80, 2, 1, 2),
166+
NAND_ECCREQ(8, 512),
167+
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
168+
&write_cache_variants,
169+
&update_cache_variants),
170+
0,
171+
SPINAND_ECCINFO(&micron_8_ooblayout,
172+
micron_8_ecc_get_status),
173+
SPINAND_SELECT_TARGET(micron_select_target)),
140174
/* M70A 4Gb 3.3V */
141175
SPINAND_INFO("MT29F4G01ABAFD",
142176
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x34),
@@ -159,6 +193,30 @@ static const struct spinand_info micron_spinand_table[] = {
159193
SPINAND_HAS_CR_FEAT_BIT,
160194
SPINAND_ECCINFO(&micron_8_ooblayout,
161195
micron_8_ecc_get_status)),
196+
/* M70A 8Gb 3.3V */
197+
SPINAND_INFO("MT29F8G01ADAFD",
198+
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x46),
199+
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2),
200+
NAND_ECCREQ(8, 512),
201+
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
202+
&write_cache_variants,
203+
&update_cache_variants),
204+
SPINAND_HAS_CR_FEAT_BIT,
205+
SPINAND_ECCINFO(&micron_8_ooblayout,
206+
micron_8_ecc_get_status),
207+
SPINAND_SELECT_TARGET(micron_select_target)),
208+
/* M70A 8Gb 1.8V */
209+
SPINAND_INFO("MT29F8G01ADBFD",
210+
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x47),
211+
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2),
212+
NAND_ECCREQ(8, 512),
213+
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
214+
&write_cache_variants,
215+
&update_cache_variants),
216+
SPINAND_HAS_CR_FEAT_BIT,
217+
SPINAND_ECCINFO(&micron_8_ooblayout,
218+
micron_8_ecc_get_status),
219+
SPINAND_SELECT_TARGET(micron_select_target)),
162220
};
163221

164222
static int micron_spinand_init(struct spinand_device *spinand)

0 commit comments

Comments
 (0)