[PATCH 03/10] spi: dw: Add support for client driver memory operations

Lars Povlsen
2020-05-13T14:00:54Z

This minor change allow dw-spi drivers to register
spi_controller_mem_ops memory operations if the platform supports it.

Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
---
drivers/spi/spi-dw.c | 3 +++
drivers/spi/spi-dw.h | 2 ++
2 files changed, 5 insertions(+)

diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 32997f28fa5bb..d0c611c42421e 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -527,6 +527,9 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
/* Basic HW init */
spi_hw_init(dev, dws);

+ /* Memory ops? */
+ master->mem_ops = dws->mem_ops;
+
if (dws->dma_ops && dws->dma_ops->dma_init) {
ret = dws->dma_ops->dma_init(dws);
if (ret) {
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
index ed6e47b3f50da..8ecccbde10a20 100644
--- a/drivers/spi/spi-dw.h
+++ b/drivers/spi/spi-dw.h
@@ -3,6 +3,7 @@
#define DW_SPI_HEADER_H

#include <linux/io.h>
+#include <linux/spi/spi-mem.h>
#include <linux/scatterlist.h>

/* Register offsets */
@@ -116,6 +117,7 @@ struct dw_spi {
u16 bus_num;
u16 num_cs; /* supported slave numbers */
void (*set_cs)(struct spi_device *spi, bool enable);
+ const struct spi_controller_mem_ops *mem_ops;

/* Current message transfer state info */
size_t len;
--
2.26.2