Skip to content

Commit 20387f2

Browse files
committed
mtd: spinand: Add support for setting a bus interface
Create a bus interface enumeration, currently only containing the one we support: SSDR, for single SDR, so any operation whose command is sent over a single data line in SDR mode, ie. any operation matching 1S-XX-XX. The main spinand_device structure gets a new parameter to store this enumeration, for now unused. Of course it is set to SSDR during the SSDR templates initialization to further clarify the state we are in at the moment. This member is subject to be used to know in which bus configuration we and be updated by the core when we switch to faster mode(s). Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent be0b86c commit 20387f2

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/mtd/nand/spi/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,7 @@ static void spinand_init_ssdr_templates(struct spinand_device *spinand)
14071407
tmpl->page_read = (struct spi_mem_op)SPINAND_PAGE_READ_1S_1S_0_OP(0);
14081408
tmpl->prog_exec = (struct spi_mem_op)SPINAND_PROG_EXEC_1S_1S_0_OP(0);
14091409
spinand->op_templates = &spinand->ssdr_op_templates;
1410+
spinand->bus_iface = SSDR;
14101411
}
14111412

14121413
static int spinand_support_vendor_ops(struct spinand_device *spinand,

include/linux/mtd/spinand.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,14 @@ struct spinand_user_otp {
482482
const struct spinand_user_otp_ops *ops;
483483
};
484484

485+
/**
486+
* enum spinand_bus_interface - SPI NAND bus interface types
487+
* @SSDR: Bus configuration supporting all 1S-XX-XX operations, including dual and quad
488+
*/
489+
enum spinand_bus_interface {
490+
SSDR,
491+
};
492+
485493
/**
486494
* struct spinand_info - Structure used to describe SPI NAND chips
487495
* @model: model name
@@ -644,6 +652,7 @@ struct spinand_mem_ops {
644652
* @flags: NAND flags
645653
* @ssdr_op_templates: Templates for all single SDR SPI mem operations
646654
* @op_templates: Templates for all SPI mem operations
655+
* @bus_iface: Current bus interface
647656
* @select_target: select a specific target/die. Usually called before sending
648657
* a command addressing a page or an eraseblock embedded in
649658
* this die. Only required if your chip exposes several dies
@@ -679,6 +688,7 @@ struct spinand_device {
679688

680689
struct spinand_mem_ops ssdr_op_templates;
681690
struct spinand_mem_ops *op_templates;
691+
enum spinand_bus_interface bus_iface;
682692

683693
struct spinand_dirmap *dirmaps;
684694

0 commit comments

Comments
 (0)