summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/spi
diff options
context:
space:
mode:
authorApurva Nandan <a-nandan@ti.com>2023-05-26 14:42:36 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2023-05-30 06:35:37 -0500
commitfc4c5893b930379c838ef2e12acb575d6dd01d3b (patch)
tree61098311e7974497027e8b49390e6cdfbea538d3 /drivers/mtd/nand/spi
parent11312b2fed2006db1d250a71d8c59ccfa7bc35d9 (diff)
mtd: spinand: Define default ctrl_ops in the core
Add default ctrl_ops in the core, which can be used when the op templates are commonly used ones. Till now, the core had used only fixed ctrl operations, so the default 'ctrl_ops' is just these ops macros initialized with default arguments. The default protocol is 1S-1S-1S. Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Diffstat (limited to 'drivers/mtd/nand/spi')
-rw-r--r--drivers/mtd/nand/spi/core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 62f8fa006d2..3bee2f34536 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -834,6 +834,16 @@ static const struct spinand_manufacturer *spinand_manufacturers[] = {
&winbond_spinand_manufacturer,
};
+static const struct spinand_ctrl_ops spinand_default_ctrl_ops =
+ SPINAND_CTRL_OPS(SPINAND_1S,
+ SPINAND_RESET_OP,
+ SPINAND_GET_FEATURE_OP(0, NULL),
+ SPINAND_SET_FEATURE_OP(0, NULL),
+ SPINAND_WR_EN_DIS_OP(true),
+ SPINAND_BLK_ERASE_OP(0),
+ SPINAND_PAGE_READ_OP(0),
+ SPINAND_PROG_EXEC_OP(0));
+
static int spinand_manufacturer_detect(struct spinand_device *spinand)
{
unsigned int i;
@@ -1037,6 +1047,8 @@ static int spinand_init(struct spinand_device *spinand)
return -ENOMEM;
spinand->protocol = SPINAND_1S;
+ spinand->ctrl_ops = &spinand_default_ctrl_ops;
+
ret = spinand_detect(spinand);
if (ret)
goto err_free_bufs;