summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2025-04-07 22:01:54 +0200
committerTom Rini <trini@konsulko.com>2025-04-16 19:57:19 -0600
commitef45b9c395f92d9239d6c363b1f5a89f6a53f2e6 (patch)
treea4c134806236664831cd3d23c5ca01632f22aa16
parent225d1ec702b5092cc514932378e810e5e9e92bf7 (diff)
spi: Introduce setup_for_spinand()
A common device attached to SPI are SPI NAND and some device might require to have info on the attached NAND to know the flash page size and spare size. To support this, introduce setup_for_spinand() that pass the attached spinand info from manufacturer. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> [trini: Switch to forward declaration of struct spinand_info] Signed-off-by: Tom Rini <trini@konsulko.com>
-rw-r--r--include/spi.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/spi.h b/include/spi.h
index 6944773b596..2783200d663 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -11,6 +11,8 @@
#include <linux/bitops.h>
+struct spinand_info;
+
/* SPI mode flags */
#define SPI_CPHA BIT(0) /* clock phase (1 = SPI_CLOCK_PHASE_SECOND) */
#define SPI_CPOL BIT(1) /* clock polarity (1 = SPI_POLARITY_HIGH) */
@@ -537,6 +539,16 @@ struct dm_spi_ops {
*/
int (*get_mmap)(struct udevice *dev, ulong *map_basep,
uint *map_sizep, uint *offsetp);
+
+ /**
+ * setup_for_spinand() - Setup the SPI for attached SPI NAND
+ *
+ * @dev: The SPI flash slave device
+ * @spinand_info: The SPI NAND info to configure for
+ * @return 0 if OK, -ve value on error
+ */
+ int (*setup_for_spinand)(struct spi_slave *slave,
+ const struct spinand_info *spinand_info);
};
struct dm_spi_emul_ops {