summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPratyush Yadav <p.yadav@ti.com>2023-04-28 16:50:10 +0530
committerUdit Kumar <u-kumar1@ti.com>2023-05-22 22:07:17 +0530
commit4282a8e6f1457843e180be16cd0b327de2ac97e8 (patch)
tree2bb8b5f9401859ef84071964dc9ae499674cbd94 /include
parent9a62668f7eb36e12e89a99653d265e93e7ef37d1 (diff)
spi: spi-mem: Tell controller when device is ready for calibration
Some controllers like the Cadence OSPI controller need to perform a calibration sequence to operate at high clock speeds. This calibration should happen after the flash is fully initialized otherwise the calibration might happen in a different SPI mode from the one the flash is finally set to. Add a hook that can be used to tell the controller when the flash is ready for calibration. Whether calibration is needed depends on the controller. Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'include')
-rw-r--r--include/spi-mem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/spi-mem.h b/include/spi-mem.h
index b07cf2ed83..f55361d628 100644
--- a/include/spi-mem.h
+++ b/include/spi-mem.h
@@ -241,6 +241,12 @@ static inline void *spi_mem_get_drvdata(struct spi_mem *mem)
* the currently mapped area), and the caller of
* spi_mem_dirmap_write() is responsible for calling it again in
* this case.
+ * @do_calibration: perform calibration needed for high SPI clock speed
+ * operation. Should be called after the SPI memory device has
+ * been completely initialized. The op passed should contain
+ * a template for the read operation used for the device so
+ * the controller can decide what type of calibration is
+ * required for this type of read.
*
* This interface should be implemented by SPI controllers providing an
* high-level interface to execute SPI memory operation, which is usually the
@@ -264,6 +270,7 @@ struct spi_controller_mem_ops {
u64 offs, size_t len, void *buf);
ssize_t (*dirmap_write)(struct spi_mem_dirmap_desc *desc,
u64 offs, size_t len, const void *buf);
+ void (*do_calibration)(struct spi_slave *slave, struct spi_mem_op *op);
};
#ifndef __UBOOT__
@@ -338,6 +345,7 @@ ssize_t spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc,
u64 offs, size_t len, void *buf);
ssize_t spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
u64 offs, size_t len, const void *buf);
+int spi_mem_do_calibration(struct spi_slave *slave, struct spi_mem_op *op);
#ifndef __UBOOT__
int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv,