aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi/spi-mem.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/spi/spi-mem.h')
-rw-r--r--include/linux/spi/spi-mem.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index bb4bd15ae1f6..b2bd4b4127c4 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -3,7 +3,9 @@
3 * Copyright (C) 2018 Exceet Electronics GmbH 3 * Copyright (C) 2018 Exceet Electronics GmbH
4 * Copyright (C) 2018 Bootlin 4 * Copyright (C) 2018 Bootlin
5 * 5 *
6 * Author: Boris Brezillon <boris.brezillon@bootlin.com> 6 * Author:
7 * Peter Pan <peterpandong@micron.com>
8 * Boris Brezillon <boris.brezillon@bootlin.com>
7 */ 9 */
8 10
9#ifndef __LINUX_SPI_MEM_H 11#ifndef __LINUX_SPI_MEM_H
@@ -122,7 +124,8 @@ struct spi_mem_op {
122/** 124/**
123 * struct spi_mem - describes a SPI memory device 125 * struct spi_mem - describes a SPI memory device
124 * @spi: the underlying SPI device 126 * @spi: the underlying SPI device
125 * @drvpriv: spi_mem_drviver private data 127 * @drvpriv: spi_mem_driver private data
128 * @name: name of the SPI memory device
126 * 129 *
127 * Extra information that describe the SPI memory device and may be needed by 130 * Extra information that describe the SPI memory device and may be needed by
128 * the controller to properly handle this device should be placed here. 131 * the controller to properly handle this device should be placed here.
@@ -133,6 +136,7 @@ struct spi_mem_op {
133struct spi_mem { 136struct spi_mem {
134 struct spi_device *spi; 137 struct spi_device *spi;
135 void *drvpriv; 138 void *drvpriv;
139 const char *name;
136}; 140};
137 141
138/** 142/**
@@ -165,6 +169,13 @@ static inline void *spi_mem_get_drvdata(struct spi_mem *mem)
165 * limitations) 169 * limitations)
166 * @supports_op: check if an operation is supported by the controller 170 * @supports_op: check if an operation is supported by the controller
167 * @exec_op: execute a SPI memory operation 171 * @exec_op: execute a SPI memory operation
172 * @get_name: get a custom name for the SPI mem device from the controller.
173 * This might be needed if the controller driver has been ported
174 * to use the SPI mem layer and a custom name is used to keep
175 * mtdparts compatible.
176 * Note that if the implementation of this function allocates memory
177 * dynamically, then it should do so with devm_xxx(), as we don't
178 * have a ->free_name() function.
168 * 179 *
169 * This interface should be implemented by SPI controllers providing an 180 * This interface should be implemented by SPI controllers providing an
170 * high-level interface to execute SPI memory operation, which is usually the 181 * high-level interface to execute SPI memory operation, which is usually the
@@ -176,6 +187,7 @@ struct spi_controller_mem_ops {
176 const struct spi_mem_op *op); 187 const struct spi_mem_op *op);
177 int (*exec_op)(struct spi_mem *mem, 188 int (*exec_op)(struct spi_mem *mem,
178 const struct spi_mem_op *op); 189 const struct spi_mem_op *op);
190 const char *(*get_name)(struct spi_mem *mem);
179}; 191};
180 192
181/** 193/**
@@ -234,6 +246,8 @@ bool spi_mem_supports_op(struct spi_mem *mem,
234int spi_mem_exec_op(struct spi_mem *mem, 246int spi_mem_exec_op(struct spi_mem *mem,
235 const struct spi_mem_op *op); 247 const struct spi_mem_op *op);
236 248
249const char *spi_mem_get_name(struct spi_mem *mem);
250
237int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv, 251int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv,
238 struct module *owner); 252 struct module *owner);
239 253