Skip to content

Commit ca229bd

Browse files
zmlin1998miquelraynal
authored andcommitted
mtd: spinand: Add support for setting plane select bits
Add two flags for inserting the Plane Select bit into the column address during the write_to_cache and the read_from_cache operation. Add the SPINAND_HAS_PROG_PLANE_SELECT_BIT flag for serial NAND flash that require inserting the Plane Select bit into the column address during the write_to_cache operation. Add the SPINAND_HAS_READ_PLANE_SELECT_BIT flag for serial NAND flash that require inserting the Plane Select bit into the column address during the read_from_cache operation. Signed-off-by: Cheng Ming Lin <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent d53c359 commit ca229bd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

drivers/mtd/nand/spi/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,9 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
408408
else
409409
rdesc = spinand->dirmaps[req->pos.plane].rdesc_ecc;
410410

411+
if (spinand->flags & SPINAND_HAS_READ_PLANE_SELECT_BIT)
412+
column |= req->pos.plane << fls(nanddev_page_size(nand));
413+
411414
while (nbytes) {
412415
ret = spi_mem_dirmap_read(rdesc, column, nbytes, buf);
413416
if (ret < 0)
@@ -489,6 +492,9 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
489492
else
490493
wdesc = spinand->dirmaps[req->pos.plane].wdesc_ecc;
491494

495+
if (spinand->flags & SPINAND_HAS_PROG_PLANE_SELECT_BIT)
496+
column |= req->pos.plane << fls(nanddev_page_size(nand));
497+
492498
while (nbytes) {
493499
ret = spi_mem_dirmap_write(wdesc, column, nbytes, buf);
494500
if (ret < 0)

include/linux/mtd/spinand.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ struct spinand_ecc_info {
312312

313313
#define SPINAND_HAS_QE_BIT BIT(0)
314314
#define SPINAND_HAS_CR_FEAT_BIT BIT(1)
315+
#define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2)
316+
#define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3)
315317

316318
/**
317319
* struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure

0 commit comments

Comments
 (0)