summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChin-Ting Kuo <chin-ting_kuo@aspeedtech.com>2022-08-19 17:01:09 +0800
committerTom Rini <trini@konsulko.com>2022-09-13 12:08:41 -0400
commit463cdf66632a0d67bf824cb43b6c1b41782d0765 (patch)
treebc03a523cf1768acdce08daaf827478687738fa2 /include
parentf7e1de4c6a43beec438bce04571469145086efed (diff)
downloadu-boot-463cdf66632a0d67bf824cb43b6c1b41782d0765.tar.gz
u-boot-463cdf66632a0d67bf824cb43b6c1b41782d0765.tar.bz2
u-boot-463cdf66632a0d67bf824cb43b6c1b41782d0765.zip
mtd: spi-nor: Use spi-mem dirmap API
This adds support for the dirmap API to the spi-nor subsystem, as introduced in Linux commit df5c21002cf4 ("mtd: spi-nor: use spi-mem dirmap API"). This patch is synchronize from the following patch https://patchwork.ozlabs.org/project/uboot/patch/20210205043924.149504-4-seanga2@gmail.com/ The corresponding Linux kernel SHA1 is df5c21002cf4. Signed-off-by: Chin-Ting Kuo <chin-ting_kuo@aspeedtech.com> Signed-off-by: Sean Anderson <seanga2@gmail.com> Acked-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mtd/spi-nor.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 2595bad9df..638d807ee5 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -11,6 +11,7 @@
#include <linux/bitops.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/mtd.h>
+#include <spi-mem.h>
/*
* Manufacturer IDs
@@ -522,6 +523,7 @@ struct spi_flash {
* @quad_enable: [FLASH-SPECIFIC] enables SPI NOR quad mode
* @octal_dtr_enable: [FLASH-SPECIFIC] enables SPI NOR octal DTR mode.
* @ready: [FLASH-SPECIFIC] check if the flash is ready
+ * @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes.
* @priv: the private data
*/
struct spi_nor {
@@ -572,6 +574,11 @@ struct spi_nor {
int (*octal_dtr_enable)(struct spi_nor *nor);
int (*ready)(struct spi_nor *nor);
+ struct {
+ struct spi_mem_dirmap_desc *rdesc;
+ struct spi_mem_dirmap_desc *wdesc;
+ } dirmap;
+
void *priv;
char mtd_name[MTD_NAME_SIZE(MTD_DEV_TYPE_NOR)];
/* Compatibility for spi_flash, remove once sf layer is merged with mtd */
@@ -596,6 +603,17 @@ device_node *spi_nor_get_flash_node(struct spi_nor *nor)
#endif /* __UBOOT__ */
/**
+ * spi_nor_setup_op() - Set up common properties of a spi-mem op.
+ * @nor: pointer to a 'struct spi_nor'
+ * @op: pointer to the 'struct spi_mem_op' whose properties
+ * need to be initialized.
+ * @proto: the protocol from which the properties need to be set.
+ */
+void spi_nor_setup_op(const struct spi_nor *nor,
+ struct spi_mem_op *op,
+ const enum spi_nor_protocol proto);
+
+/**
* spi_nor_scan() - scan the SPI NOR
* @nor: the spi_nor structure
*