summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorApurva Nandan <a-nandan@ti.com>2023-01-23 23:13:17 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2023-01-25 14:10:19 -0600
commit42078e1a75f6ac73d769117bb5e18419c41b8e91 (patch)
tree67920adfc80d2cbccde01397b6fdcb5a5bffb535 /drivers
parentf3182e1ac682da4afeb498701ab47ba1e2daa6f4 (diff)
mtd: spinand: Rename 'op_templates' to 'data_ops'
Manufacturers have been deviating from the standard SPI operations for NAND flashes. There have been variations in non-page read/write instructions too. Additionally, operations, including non-page r/w ops, vary when flash is in different SPI mode, eg. Octal DTR. To avoid live-patching in hot-paths or vendor-specific adjustment, it is better to have a set of operation templates and variants for non-page read/write operations as well. These would get initialized at the probe time or when flash changes modes. These would be called 'ctrl_ops'. To make code better understandable, create two types of op templates which are: data_ops and ctrl_ops. Reason for having two different type of templates is the difference in their use cases i.e. it is possible to have ops of different protocol for read/write/update simulatneously in the data_ops, but all the ops in the ctrl_ops follow same protocol. Rename op_templates to data_ops, and the ctrl_ops would be introduced in later commits. Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/spi/core.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index f741d2ec1d..b2262c1ef1 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -206,9 +206,9 @@ static int spinand_init_quad_enable(struct spinand_device *spinand)
if (!(spinand->flags & SPINAND_HAS_QE_BIT))
return 0;
- if (spinand->op_templates.read_cache->data.buswidth == 4 ||
- spinand->op_templates.write_cache->data.buswidth == 4 ||
- spinand->op_templates.update_cache->data.buswidth == 4)
+ if (spinand->data_ops.read_cache->data.buswidth == 4 ||
+ spinand->data_ops.write_cache->data.buswidth == 4 ||
+ spinand->data_ops.update_cache->data.buswidth == 4)
enable = true;
return spinand_upd_cfg(spinand, CFG_QUAD_ENABLE,
@@ -242,7 +242,7 @@ static int spinand_load_page_op(struct spinand_device *spinand,
static int spinand_read_from_cache_op(struct spinand_device *spinand,
const struct nand_page_io_req *req)
{
- struct spi_mem_op op = *spinand->op_templates.read_cache;
+ struct spi_mem_op op = *spinand->data_ops.read_cache;
struct nand_device *nand = spinand_to_nand(spinand);
struct mtd_info *mtd = nanddev_to_mtd(nand);
struct nand_page_io_req adjreq = *req;
@@ -315,7 +315,7 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
static int spinand_write_to_cache_op(struct spinand_device *spinand,
const struct nand_page_io_req *req)
{
- struct spi_mem_op op = *spinand->op_templates.write_cache;
+ struct spi_mem_op op = *spinand->data_ops.write_cache;
struct nand_device *nand = spinand_to_nand(spinand);
struct mtd_info *mtd = nanddev_to_mtd(nand);
struct nand_page_io_req adjreq = *req;
@@ -357,7 +357,7 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
- op = *spinand->op_templates.update_cache;
+ op = *spinand->data_ops.update_cache;
op.addr.val = column;
/*
@@ -388,7 +388,7 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
*/
if (nbytes) {
column = op.addr.val;
- op = *spinand->op_templates.update_cache;
+ op = *spinand->data_ops.update_cache;
op.addr.val = column;
}
}
@@ -865,8 +865,8 @@ static void spinand_manufacturer_cleanup(struct spinand_device *spinand)
}
static const struct spi_mem_op *
-spinand_select_op_variant(struct spinand_device *spinand,
- const struct spinand_op_variants *variants)
+spinand_select_data_op_variant(struct spinand_device *spinand,
+ const struct spinand_op_variants *variants)
{
struct nand_device *nand = spinand_to_nand(spinand);
unsigned int i;
@@ -933,23 +933,23 @@ int spinand_match_and_init(struct spinand_device *spinand,
spinand->flags = table[i].flags;
spinand->select_target = table[i].select_target;
- op = spinand_select_op_variant(spinand,
- info->op_variants.read_cache);
+ op = spinand_select_data_op_variant(spinand,
+ info->data_ops_variants.read_cache);
if (!op)
return -ENOTSUPP;
- spinand->op_templates.read_cache = op;
+ spinand->data_ops.read_cache = op;
- op = spinand_select_op_variant(spinand,
- info->op_variants.write_cache);
+ op = spinand_select_data_op_variant(spinand,
+ info->data_ops_variants.write_cache);
if (!op)
return -ENOTSUPP;
- spinand->op_templates.write_cache = op;
+ spinand->data_ops.write_cache = op;
- op = spinand_select_op_variant(spinand,
- info->op_variants.update_cache);
- spinand->op_templates.update_cache = op;
+ op = spinand_select_data_op_variant(spinand,
+ info->data_ops_variants.update_cache);
+ spinand->data_ops.update_cache = op;
return 0;
}