summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorApurva Nandan <a-nandan@ti.com>2023-01-23 23:13:21 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2023-01-25 14:10:19 -0600
commitab9dd1b9846216d3fc703c19963897c7894ff4d5 (patch)
treeae4299dbd081fe7f9764cbd6c40934ddd7427e7c /include
parent1e0d0aebe707477c954d30cc225d2f4d184b1bb8 (diff)
mtd: spinand: Add support for manufacturer-based ctrl_ops variations
Add ctrl_ops_variants, which can be used by the manufacturers' codes to define their SPI control operation variants. Add a macro to easily define ctrl_ops_varinats. This can be used to list out all the supported ctrl ops with their respective protocols by the vendors. Add spinand_select_ctrl_ops_variant() helper function to search for a supported ctrl_ops variant with the required SPI protocol in a given list of variants. Signed-off-by: Apurva Nandan <a-nandan@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mtd/spinand.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 95b12689c9..6cf6772895 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -326,6 +326,18 @@ struct spinand_ctrl_ops {
.protocol = __protocol, \
}
+struct spinand_ctrl_ops_variants {
+ const struct spinand_ctrl_ops *ctrl_ops_list;
+ unsigned int nvariants;
+};
+
+#define SPINAND_CTRL_OPS_VARIANTS(name, ...) \
+ const struct spinand_ctrl_ops_variants name = { \
+ .ctrl_ops_list = (struct spinand_ctrl_ops[]){ __VA_ARGS__ }, \
+ .nvariants = sizeof((struct spinand_ctrl_ops[]){ __VA_ARGS__ })/\
+ sizeof(struct spinand_ctrl_ops), \
+ }
+
/**
* spinand_ecc_info - description of the on-die ECC implemented by a SPI NAND
* chip
@@ -374,6 +386,8 @@ struct spinand_info {
const struct spinand_op_variants *write_cache;
const struct spinand_op_variants *update_cache;
} data_ops_variants;
+
+ const struct spinand_ctrl_ops_variants *ctrl_ops_variants;
int (*select_target)(struct spinand_device *spinand,
unsigned int target);
};
@@ -385,6 +399,9 @@ struct spinand_info {
.update_cache = __update, \
}
+#define SPINAND_INFO_CTRL_OPS_VARIANTS(__ctrl_ops_variants) \
+ .ctrl_ops_variants = __ctrl_ops_variants
+
#define SPINAND_ECCINFO(__ooblayout, __get_status) \
.eccinfo = { \
.ooblayout = __ooblayout, \