1 /* SPDX-License-Identifier: GPL-2.0+ */ 1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 2 /* 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: 6 * Author: 7 * Peter Pan <peterpandong@micron.com> 7 * Peter Pan <peterpandong@micron.com> 8 * Boris Brezillon <boris.brezillon@bootl 8 * Boris Brezillon <boris.brezillon@bootlin.com> 9 */ 9 */ 10 10 11 #ifndef __LINUX_SPI_MEM_H 11 #ifndef __LINUX_SPI_MEM_H 12 #define __LINUX_SPI_MEM_H 12 #define __LINUX_SPI_MEM_H 13 13 14 #include <linux/spi/spi.h> 14 #include <linux/spi/spi.h> 15 15 16 #define SPI_MEM_OP_CMD(__opcode, __buswidth) 16 #define SPI_MEM_OP_CMD(__opcode, __buswidth) \ 17 { 17 { \ 18 .buswidth = __buswidth, 18 .buswidth = __buswidth, \ 19 .opcode = __opcode, 19 .opcode = __opcode, \ 20 .nbytes = 1, << 21 } 20 } 22 21 23 #define SPI_MEM_OP_ADDR(__nbytes, __val, __bus 22 #define SPI_MEM_OP_ADDR(__nbytes, __val, __buswidth) \ 24 { 23 { \ 25 .nbytes = __nbytes, 24 .nbytes = __nbytes, \ 26 .val = __val, 25 .val = __val, \ 27 .buswidth = __buswidth, 26 .buswidth = __buswidth, \ 28 } 27 } 29 28 30 #define SPI_MEM_OP_NO_ADDR { } 29 #define SPI_MEM_OP_NO_ADDR { } 31 30 32 #define SPI_MEM_OP_DUMMY(__nbytes, __buswidth) 31 #define SPI_MEM_OP_DUMMY(__nbytes, __buswidth) \ 33 { 32 { \ 34 .nbytes = __nbytes, 33 .nbytes = __nbytes, \ 35 .buswidth = __buswidth, 34 .buswidth = __buswidth, \ 36 } 35 } 37 36 38 #define SPI_MEM_OP_NO_DUMMY { } 37 #define SPI_MEM_OP_NO_DUMMY { } 39 38 40 #define SPI_MEM_OP_DATA_IN(__nbytes, __buf, __ 39 #define SPI_MEM_OP_DATA_IN(__nbytes, __buf, __buswidth) \ 41 { 40 { \ 42 .dir = SPI_MEM_DATA_IN, 41 .dir = SPI_MEM_DATA_IN, \ 43 .nbytes = __nbytes, 42 .nbytes = __nbytes, \ 44 .buf.in = __buf, 43 .buf.in = __buf, \ 45 .buswidth = __buswidth, 44 .buswidth = __buswidth, \ 46 } 45 } 47 46 48 #define SPI_MEM_OP_DATA_OUT(__nbytes, __buf, _ 47 #define SPI_MEM_OP_DATA_OUT(__nbytes, __buf, __buswidth) \ 49 { 48 { \ 50 .dir = SPI_MEM_DATA_OUT, 49 .dir = SPI_MEM_DATA_OUT, \ 51 .nbytes = __nbytes, 50 .nbytes = __nbytes, \ 52 .buf.out = __buf, 51 .buf.out = __buf, \ 53 .buswidth = __buswidth, 52 .buswidth = __buswidth, \ 54 } 53 } 55 54 56 #define SPI_MEM_OP_NO_DATA { } 55 #define SPI_MEM_OP_NO_DATA { } 57 56 58 /** 57 /** 59 * enum spi_mem_data_dir - describes the direc 58 * enum spi_mem_data_dir - describes the direction of a SPI memory data 60 * transfer from the c 59 * transfer from the controller perspective 61 * @SPI_MEM_NO_DATA: no data transferred 60 * @SPI_MEM_NO_DATA: no data transferred 62 * @SPI_MEM_DATA_IN: data coming from the SPI 61 * @SPI_MEM_DATA_IN: data coming from the SPI memory 63 * @SPI_MEM_DATA_OUT: data sent to the SPI mem 62 * @SPI_MEM_DATA_OUT: data sent to the SPI memory 64 */ 63 */ 65 enum spi_mem_data_dir { 64 enum spi_mem_data_dir { 66 SPI_MEM_NO_DATA, 65 SPI_MEM_NO_DATA, 67 SPI_MEM_DATA_IN, 66 SPI_MEM_DATA_IN, 68 SPI_MEM_DATA_OUT, 67 SPI_MEM_DATA_OUT, 69 }; 68 }; 70 69 71 /** 70 /** 72 * struct spi_mem_op - describes a SPI memory 71 * struct spi_mem_op - describes a SPI memory operation 73 * @cmd.nbytes: number of opcode bytes (only 1 << 74 * sent MSB-first. << 75 * @cmd.buswidth: number of IO lines used to t 72 * @cmd.buswidth: number of IO lines used to transmit the command 76 * @cmd.opcode: operation opcode 73 * @cmd.opcode: operation opcode 77 * @cmd.dtr: whether the command opcode should << 78 * @addr.nbytes: number of address bytes to se 74 * @addr.nbytes: number of address bytes to send. Can be zero if the operation 79 * does not need to send an addr 75 * does not need to send an address 80 * @addr.buswidth: number of IO lines used to 76 * @addr.buswidth: number of IO lines used to transmit the address cycles 81 * @addr.dtr: whether the address should be se << 82 * @addr.val: address value. This value is alw 77 * @addr.val: address value. This value is always sent MSB first on the bus. 83 * Note that only @addr.nbytes are 78 * Note that only @addr.nbytes are taken into account in this 84 * address value, so users should m 79 * address value, so users should make sure the value fits in the 85 * assigned number of bytes. 80 * assigned number of bytes. 86 * @dummy.nbytes: number of dummy bytes to sen 81 * @dummy.nbytes: number of dummy bytes to send after an opcode or address. Can 87 * be zero if the operation doe 82 * be zero if the operation does not require dummy bytes 88 * @dummy.buswidth: number of IO lanes used to 83 * @dummy.buswidth: number of IO lanes used to transmit the dummy bytes 89 * @dummy.dtr: whether the dummy bytes should << 90 * @data.buswidth: number of IO lanes used to 84 * @data.buswidth: number of IO lanes used to send/receive the data 91 * @data.dtr: whether the data should be sent << 92 * @data.ecc: whether error correction is requ << 93 * @data.dir: direction of the transfer 85 * @data.dir: direction of the transfer 94 * @data.nbytes: number of data bytes to send/ 86 * @data.nbytes: number of data bytes to send/receive. Can be zero if the 95 * operation does not involve tr 87 * operation does not involve transferring data 96 * @data.buf.in: input buffer (must be DMA-abl 88 * @data.buf.in: input buffer (must be DMA-able) 97 * @data.buf.out: output buffer (must be DMA-a 89 * @data.buf.out: output buffer (must be DMA-able) 98 */ 90 */ 99 struct spi_mem_op { 91 struct spi_mem_op { 100 struct { 92 struct { 101 u8 nbytes; << 102 u8 buswidth; 93 u8 buswidth; 103 u8 dtr : 1; !! 94 u8 opcode; 104 u8 __pad : 7; << 105 u16 opcode; << 106 } cmd; 95 } cmd; 107 96 108 struct { 97 struct { 109 u8 nbytes; 98 u8 nbytes; 110 u8 buswidth; 99 u8 buswidth; 111 u8 dtr : 1; << 112 u8 __pad : 7; << 113 u64 val; 100 u64 val; 114 } addr; 101 } addr; 115 102 116 struct { 103 struct { 117 u8 nbytes; 104 u8 nbytes; 118 u8 buswidth; 105 u8 buswidth; 119 u8 dtr : 1; << 120 u8 __pad : 7; << 121 } dummy; 106 } dummy; 122 107 123 struct { 108 struct { 124 u8 buswidth; 109 u8 buswidth; 125 u8 dtr : 1; << 126 u8 ecc : 1; << 127 u8 __pad : 6; << 128 enum spi_mem_data_dir dir; 110 enum spi_mem_data_dir dir; 129 unsigned int nbytes; 111 unsigned int nbytes; 130 union { 112 union { 131 void *in; 113 void *in; 132 const void *out; 114 const void *out; 133 } buf; 115 } buf; 134 } data; 116 } data; 135 }; 117 }; 136 118 137 #define SPI_MEM_OP(__cmd, __addr, __dummy, __d 119 #define SPI_MEM_OP(__cmd, __addr, __dummy, __data) \ 138 { 120 { \ 139 .cmd = __cmd, 121 .cmd = __cmd, \ 140 .addr = __addr, 122 .addr = __addr, \ 141 .dummy = __dummy, 123 .dummy = __dummy, \ 142 .data = __data, 124 .data = __data, \ 143 } 125 } 144 126 145 /** 127 /** 146 * struct spi_mem_dirmap_info - Direct mapping 128 * struct spi_mem_dirmap_info - Direct mapping information 147 * @op_tmpl: operation template that should be 129 * @op_tmpl: operation template that should be used by the direct mapping when 148 * the memory device is accessed 130 * the memory device is accessed 149 * @offset: absolute offset this direct mappin 131 * @offset: absolute offset this direct mapping is pointing to 150 * @length: length in byte of this direct mapp 132 * @length: length in byte of this direct mapping 151 * 133 * 152 * These information are used by the controlle 134 * These information are used by the controller specific implementation to know 153 * the portion of memory that is directly mapp 135 * the portion of memory that is directly mapped and the spi_mem_op that should 154 * be used to access the device. 136 * be used to access the device. 155 * A direct mapping is only valid for one dire 137 * A direct mapping is only valid for one direction (read or write) and this 156 * direction is directly encoded in the ->op_t 138 * direction is directly encoded in the ->op_tmpl.data.dir field. 157 */ 139 */ 158 struct spi_mem_dirmap_info { 140 struct spi_mem_dirmap_info { 159 struct spi_mem_op op_tmpl; 141 struct spi_mem_op op_tmpl; 160 u64 offset; 142 u64 offset; 161 u64 length; 143 u64 length; 162 }; 144 }; 163 145 164 /** 146 /** 165 * struct spi_mem_dirmap_desc - Direct mapping 147 * struct spi_mem_dirmap_desc - Direct mapping descriptor 166 * @mem: the SPI memory device this direct map 148 * @mem: the SPI memory device this direct mapping is attached to 167 * @info: information passed at direct mapping 149 * @info: information passed at direct mapping creation time 168 * @nodirmap: set to 1 if the SPI controller d 150 * @nodirmap: set to 1 if the SPI controller does not implement 169 * ->mem_ops->dirmap_create() or wh 151 * ->mem_ops->dirmap_create() or when this function returned an 170 * error. If @nodirmap is true, all 152 * error. If @nodirmap is true, all spi_mem_dirmap_{read,write}() 171 * calls will use spi_mem_exec_op() 153 * calls will use spi_mem_exec_op() to access the memory. This is a 172 * degraded mode that allows spi_me 154 * degraded mode that allows spi_mem drivers to use the same code 173 * no matter whether the controller 155 * no matter whether the controller supports direct mapping or not 174 * @priv: field pointing to controller specifi 156 * @priv: field pointing to controller specific data 175 * 157 * 176 * Common part of a direct mapping descriptor. 158 * Common part of a direct mapping descriptor. This object is created by 177 * spi_mem_dirmap_create() and controller impl 159 * spi_mem_dirmap_create() and controller implementation of ->create_dirmap() 178 * can create/attach direct mapping resources 160 * can create/attach direct mapping resources to the descriptor in the ->priv 179 * field. 161 * field. 180 */ 162 */ 181 struct spi_mem_dirmap_desc { 163 struct spi_mem_dirmap_desc { 182 struct spi_mem *mem; 164 struct spi_mem *mem; 183 struct spi_mem_dirmap_info info; 165 struct spi_mem_dirmap_info info; 184 unsigned int nodirmap; 166 unsigned int nodirmap; 185 void *priv; 167 void *priv; 186 }; 168 }; 187 169 188 /** 170 /** 189 * struct spi_mem - describes a SPI memory dev 171 * struct spi_mem - describes a SPI memory device 190 * @spi: the underlying SPI device 172 * @spi: the underlying SPI device 191 * @drvpriv: spi_mem_driver private data 173 * @drvpriv: spi_mem_driver private data 192 * @name: name of the SPI memory device 174 * @name: name of the SPI memory device 193 * 175 * 194 * Extra information that describe the SPI mem 176 * Extra information that describe the SPI memory device and may be needed by 195 * the controller to properly handle this devi 177 * the controller to properly handle this device should be placed here. 196 * 178 * 197 * One example would be the device size since 179 * One example would be the device size since some controller expose their SPI 198 * mem devices through a io-mapped region. 180 * mem devices through a io-mapped region. 199 */ 181 */ 200 struct spi_mem { 182 struct spi_mem { 201 struct spi_device *spi; 183 struct spi_device *spi; 202 void *drvpriv; 184 void *drvpriv; 203 const char *name; 185 const char *name; 204 }; 186 }; 205 187 206 /** 188 /** 207 * struct spi_mem_set_drvdata() - attach drive 189 * struct spi_mem_set_drvdata() - attach driver private data to a SPI mem 208 * device 190 * device 209 * @mem: memory device 191 * @mem: memory device 210 * @data: data to attach to the memory device 192 * @data: data to attach to the memory device 211 */ 193 */ 212 static inline void spi_mem_set_drvdata(struct 194 static inline void spi_mem_set_drvdata(struct spi_mem *mem, void *data) 213 { 195 { 214 mem->drvpriv = data; 196 mem->drvpriv = data; 215 } 197 } 216 198 217 /** 199 /** 218 * struct spi_mem_get_drvdata() - get driver p 200 * struct spi_mem_get_drvdata() - get driver private data attached to a SPI mem 219 * device 201 * device 220 * @mem: memory device 202 * @mem: memory device 221 * 203 * 222 * Return: the data attached to the mem device 204 * Return: the data attached to the mem device. 223 */ 205 */ 224 static inline void *spi_mem_get_drvdata(struct 206 static inline void *spi_mem_get_drvdata(struct spi_mem *mem) 225 { 207 { 226 return mem->drvpriv; 208 return mem->drvpriv; 227 } 209 } 228 210 229 /** 211 /** 230 * struct spi_controller_mem_ops - SPI memory 212 * struct spi_controller_mem_ops - SPI memory operations 231 * @adjust_op_size: shrink the data xfer of an 213 * @adjust_op_size: shrink the data xfer of an operation to match controller's 232 * limitations (can be alignm !! 214 * limitations (can be alignment of max RX/TX size 233 * limitations) 215 * limitations) 234 * @supports_op: check if an operation is supp 216 * @supports_op: check if an operation is supported by the controller 235 * @exec_op: execute a SPI memory operation 217 * @exec_op: execute a SPI memory operation 236 * not all driver provides supports_ << 237 * if the op is not supported by the << 238 * @get_name: get a custom name for the SPI me 218 * @get_name: get a custom name for the SPI mem device from the controller. 239 * This might be needed if the cont 219 * This might be needed if the controller driver has been ported 240 * to use the SPI mem layer and a c 220 * to use the SPI mem layer and a custom name is used to keep 241 * mtdparts compatible. 221 * mtdparts compatible. 242 * Note that if the implementation 222 * Note that if the implementation of this function allocates memory 243 * dynamically, then it should do s 223 * dynamically, then it should do so with devm_xxx(), as we don't 244 * have a ->free_name() function. 224 * have a ->free_name() function. 245 * @dirmap_create: create a direct mapping des 225 * @dirmap_create: create a direct mapping descriptor that can later be used to 246 * access the memory device. T 226 * access the memory device. This method is optional 247 * @dirmap_destroy: destroy a memory descripto 227 * @dirmap_destroy: destroy a memory descriptor previous created by 248 * ->dirmap_create() 228 * ->dirmap_create() 249 * @dirmap_read: read data from the memory dev 229 * @dirmap_read: read data from the memory device using the direct mapping 250 * created by ->dirmap_create(). 230 * created by ->dirmap_create(). The function can return less 251 * data than requested (for exam 231 * data than requested (for example when the request is crossing 252 * the currently mapped area), a 232 * the currently mapped area), and the caller of 253 * spi_mem_dirmap_read() is resp 233 * spi_mem_dirmap_read() is responsible for calling it again in 254 * this case. 234 * this case. 255 * @dirmap_write: write data to the memory dev 235 * @dirmap_write: write data to the memory device using the direct mapping 256 * created by ->dirmap_create() 236 * created by ->dirmap_create(). The function can return less 257 * data than requested (for exa 237 * data than requested (for example when the request is crossing 258 * the currently mapped area), 238 * the currently mapped area), and the caller of 259 * spi_mem_dirmap_write() is re 239 * spi_mem_dirmap_write() is responsible for calling it again in 260 * this case. 240 * this case. 261 * @poll_status: poll memory device status unt << 262 * when the timeout has expired. << 263 * the last status value. << 264 * 241 * 265 * This interface should be implemented by SPI 242 * This interface should be implemented by SPI controllers providing an 266 * high-level interface to execute SPI memory 243 * high-level interface to execute SPI memory operation, which is usually the 267 * case for QSPI controllers. 244 * case for QSPI controllers. 268 * 245 * 269 * Note on ->dirmap_{read,write}(): drivers sh 246 * Note on ->dirmap_{read,write}(): drivers should avoid accessing the direct 270 * mapping from the CPU because doing that can 247 * mapping from the CPU because doing that can stall the CPU waiting for the 271 * SPI mem transaction to finish, and this wil 248 * SPI mem transaction to finish, and this will make real-time maintainers 272 * unhappy and might make your system less rea 249 * unhappy and might make your system less reactive. Instead, drivers should 273 * use DMA to access this direct mapping. 250 * use DMA to access this direct mapping. 274 */ 251 */ 275 struct spi_controller_mem_ops { 252 struct spi_controller_mem_ops { 276 int (*adjust_op_size)(struct spi_mem * 253 int (*adjust_op_size)(struct spi_mem *mem, struct spi_mem_op *op); 277 bool (*supports_op)(struct spi_mem *me 254 bool (*supports_op)(struct spi_mem *mem, 278 const struct spi_m 255 const struct spi_mem_op *op); 279 int (*exec_op)(struct spi_mem *mem, 256 int (*exec_op)(struct spi_mem *mem, 280 const struct spi_mem_op 257 const struct spi_mem_op *op); 281 const char *(*get_name)(struct spi_mem 258 const char *(*get_name)(struct spi_mem *mem); 282 int (*dirmap_create)(struct spi_mem_di 259 int (*dirmap_create)(struct spi_mem_dirmap_desc *desc); 283 void (*dirmap_destroy)(struct spi_mem_ 260 void (*dirmap_destroy)(struct spi_mem_dirmap_desc *desc); 284 ssize_t (*dirmap_read)(struct spi_mem_ 261 ssize_t (*dirmap_read)(struct spi_mem_dirmap_desc *desc, 285 u64 offs, size_ 262 u64 offs, size_t len, void *buf); 286 ssize_t (*dirmap_write)(struct spi_mem 263 ssize_t (*dirmap_write)(struct spi_mem_dirmap_desc *desc, 287 u64 offs, size 264 u64 offs, size_t len, const void *buf); 288 int (*poll_status)(struct spi_mem *mem << 289 const struct spi_me << 290 u16 mask, u16 match << 291 unsigned long initi << 292 unsigned long polli << 293 unsigned long timeo << 294 }; 265 }; 295 266 296 /** 267 /** 297 * struct spi_controller_mem_caps - SPI memory << 298 * @dtr: Supports DTR operations << 299 * @ecc: Supports operations with error correc << 300 */ << 301 struct spi_controller_mem_caps { << 302 bool dtr; << 303 bool ecc; << 304 }; << 305 << 306 #define spi_mem_controller_is_capable(ctlr, ca << 307 ((ctlr)->mem_caps && (ctlr)->mem_caps- << 308 << 309 /** << 310 * struct spi_mem_driver - SPI memory driver 268 * struct spi_mem_driver - SPI memory driver 311 * @spidrv: inherit from a SPI driver 269 * @spidrv: inherit from a SPI driver 312 * @probe: probe a SPI memory. Usually where d 270 * @probe: probe a SPI memory. Usually where detection/initialization takes 313 * place 271 * place 314 * @remove: remove a SPI memory 272 * @remove: remove a SPI memory 315 * @shutdown: take appropriate action when the 273 * @shutdown: take appropriate action when the system is shutdown 316 * 274 * 317 * This is just a thin wrapper around a spi_dr 275 * This is just a thin wrapper around a spi_driver. The core takes care of 318 * allocating the spi_mem object and forwardin 276 * allocating the spi_mem object and forwarding the probe/remove/shutdown 319 * request to the spi_mem_driver. The reason w 277 * request to the spi_mem_driver. The reason we use this wrapper is because 320 * we might have to stuff more information int 278 * we might have to stuff more information into the spi_mem struct to let 321 * SPI controllers know more about the SPI mem 279 * SPI controllers know more about the SPI memory they interact with, and 322 * having this intermediate layer allows us to 280 * having this intermediate layer allows us to do that without adding more 323 * useless fields to the spi_device object. 281 * useless fields to the spi_device object. 324 */ 282 */ 325 struct spi_mem_driver { 283 struct spi_mem_driver { 326 struct spi_driver spidrv; 284 struct spi_driver spidrv; 327 int (*probe)(struct spi_mem *mem); 285 int (*probe)(struct spi_mem *mem); 328 int (*remove)(struct spi_mem *mem); 286 int (*remove)(struct spi_mem *mem); 329 void (*shutdown)(struct spi_mem *mem); 287 void (*shutdown)(struct spi_mem *mem); 330 }; 288 }; 331 289 332 #if IS_ENABLED(CONFIG_SPI_MEM) 290 #if IS_ENABLED(CONFIG_SPI_MEM) 333 int spi_controller_dma_map_mem_op_data(struct 291 int spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr, 334 const s 292 const struct spi_mem_op *op, 335 struct 293 struct sg_table *sg); 336 294 337 void spi_controller_dma_unmap_mem_op_data(stru 295 void spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr, 338 cons 296 const struct spi_mem_op *op, 339 stru 297 struct sg_table *sg); 340 298 341 bool spi_mem_default_supports_op(struct spi_me 299 bool spi_mem_default_supports_op(struct spi_mem *mem, 342 const struct 300 const struct spi_mem_op *op); >> 301 343 #else 302 #else 344 static inline int 303 static inline int 345 spi_controller_dma_map_mem_op_data(struct spi_ 304 spi_controller_dma_map_mem_op_data(struct spi_controller *ctlr, 346 const struc 305 const struct spi_mem_op *op, 347 struct sg_t 306 struct sg_table *sg) 348 { 307 { 349 return -ENOTSUPP; 308 return -ENOTSUPP; 350 } 309 } 351 310 352 static inline void 311 static inline void 353 spi_controller_dma_unmap_mem_op_data(struct sp 312 spi_controller_dma_unmap_mem_op_data(struct spi_controller *ctlr, 354 const str 313 const struct spi_mem_op *op, 355 struct sg 314 struct sg_table *sg) 356 { 315 { 357 } 316 } 358 317 359 static inline 318 static inline 360 bool spi_mem_default_supports_op(struct spi_me 319 bool spi_mem_default_supports_op(struct spi_mem *mem, 361 const struct 320 const struct spi_mem_op *op) 362 { 321 { 363 return false; 322 return false; 364 } 323 } >> 324 365 #endif /* CONFIG_SPI_MEM */ 325 #endif /* CONFIG_SPI_MEM */ 366 326 367 int spi_mem_adjust_op_size(struct spi_mem *mem 327 int spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op); 368 328 369 bool spi_mem_supports_op(struct spi_mem *mem, 329 bool spi_mem_supports_op(struct spi_mem *mem, 370 const struct spi_mem_ 330 const struct spi_mem_op *op); 371 331 372 int spi_mem_exec_op(struct spi_mem *mem, 332 int spi_mem_exec_op(struct spi_mem *mem, 373 const struct spi_mem_op *o 333 const struct spi_mem_op *op); 374 334 375 const char *spi_mem_get_name(struct spi_mem *m 335 const char *spi_mem_get_name(struct spi_mem *mem); 376 336 377 struct spi_mem_dirmap_desc * 337 struct spi_mem_dirmap_desc * 378 spi_mem_dirmap_create(struct spi_mem *mem, 338 spi_mem_dirmap_create(struct spi_mem *mem, 379 const struct spi_mem_dir 339 const struct spi_mem_dirmap_info *info); 380 void spi_mem_dirmap_destroy(struct spi_mem_dir 340 void spi_mem_dirmap_destroy(struct spi_mem_dirmap_desc *desc); 381 ssize_t spi_mem_dirmap_read(struct spi_mem_dir 341 ssize_t spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc, 382 u64 offs, size_t l 342 u64 offs, size_t len, void *buf); 383 ssize_t spi_mem_dirmap_write(struct spi_mem_di 343 ssize_t spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc, 384 u64 offs, size_t 344 u64 offs, size_t len, const void *buf); 385 struct spi_mem_dirmap_desc * 345 struct spi_mem_dirmap_desc * 386 devm_spi_mem_dirmap_create(struct device *dev, 346 devm_spi_mem_dirmap_create(struct device *dev, struct spi_mem *mem, 387 const struct spi_me 347 const struct spi_mem_dirmap_info *info); 388 void devm_spi_mem_dirmap_destroy(struct device 348 void devm_spi_mem_dirmap_destroy(struct device *dev, 389 struct spi_me 349 struct spi_mem_dirmap_desc *desc); 390 << 391 int spi_mem_poll_status(struct spi_mem *mem, << 392 const struct spi_mem_o << 393 u16 mask, u16 match, << 394 unsigned long initial_ << 395 unsigned long polling_ << 396 u16 timeout_ms); << 397 350 398 int spi_mem_driver_register_with_owner(struct 351 int spi_mem_driver_register_with_owner(struct spi_mem_driver *drv, 399 struct 352 struct module *owner); 400 353 401 void spi_mem_driver_unregister(struct spi_mem_ 354 void spi_mem_driver_unregister(struct spi_mem_driver *drv); 402 355 403 #define spi_mem_driver_register(__drv) 356 #define spi_mem_driver_register(__drv) \ 404 spi_mem_driver_register_with_owner(__d 357 spi_mem_driver_register_with_owner(__drv, THIS_MODULE) 405 358 406 #define module_spi_mem_driver(__drv) 359 #define module_spi_mem_driver(__drv) \ 407 module_driver(__drv, spi_mem_driver_re 360 module_driver(__drv, spi_mem_driver_register, \ 408 spi_mem_driver_unregiste 361 spi_mem_driver_unregister) 409 362 410 #endif /* __LINUX_SPI_MEM_H */ 363 #endif /* __LINUX_SPI_MEM_H */ 411 364
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.