Lines Matching refs:op

45 				       const struct spi_mem_op *op,  in spi_controller_dma_map_mem_op_data()  argument
50 if (!op->data.nbytes) in spi_controller_dma_map_mem_op_data()
53 if (op->data.dir == SPI_MEM_DATA_OUT && ctlr->dma_tx) in spi_controller_dma_map_mem_op_data()
55 else if (op->data.dir == SPI_MEM_DATA_IN && ctlr->dma_rx) in spi_controller_dma_map_mem_op_data()
63 return spi_map_buf(ctlr, dmadev, sgt, op->data.buf.in, op->data.nbytes, in spi_controller_dma_map_mem_op_data()
64 op->data.dir == SPI_MEM_DATA_IN ? in spi_controller_dma_map_mem_op_data()
91 const struct spi_mem_op *op, in spi_controller_dma_unmap_mem_op_data() argument
96 if (!op->data.nbytes) in spi_controller_dma_unmap_mem_op_data()
99 if (op->data.dir == SPI_MEM_DATA_OUT && ctlr->dma_tx) in spi_controller_dma_unmap_mem_op_data()
101 else if (op->data.dir == SPI_MEM_DATA_IN && ctlr->dma_rx) in spi_controller_dma_unmap_mem_op_data()
107 op->data.dir == SPI_MEM_DATA_IN ? in spi_controller_dma_unmap_mem_op_data()
149 const struct spi_mem_op *op) in spi_mem_default_supports_op() argument
151 if (spi_check_buswidth_req(slave, op->cmd.buswidth, true)) in spi_mem_default_supports_op()
154 if (op->addr.nbytes && in spi_mem_default_supports_op()
155 spi_check_buswidth_req(slave, op->addr.buswidth, true)) in spi_mem_default_supports_op()
158 if (op->dummy.nbytes && in spi_mem_default_supports_op()
159 spi_check_buswidth_req(slave, op->dummy.buswidth, true)) in spi_mem_default_supports_op()
162 if (op->data.dir != SPI_MEM_NO_DATA && in spi_mem_default_supports_op()
163 spi_check_buswidth_req(slave, op->data.buswidth, in spi_mem_default_supports_op()
164 op->data.dir == SPI_MEM_DATA_OUT)) in spi_mem_default_supports_op()
187 const struct spi_mem_op *op) in spi_mem_supports_op() argument
193 return ops->mem_ops->supports_op(slave, op); in spi_mem_supports_op()
195 return spi_mem_default_supports_op(slave, op); in spi_mem_supports_op()
211 int spi_mem_exec_op(struct spi_slave *slave, const struct spi_mem_op *op) in spi_mem_exec_op() argument
223 if (!spi_mem_supports_op(slave, op)) in spi_mem_exec_op()
251 ret = ops->mem_ops->exec_op(slave, op); in spi_mem_exec_op()
273 tmpbufsize = sizeof(op->cmd.opcode) + op->addr.nbytes + in spi_mem_exec_op()
274 op->dummy.nbytes; in spi_mem_exec_op()
287 tmpbuf[0] = op->cmd.opcode; in spi_mem_exec_op()
289 xfers[xferpos].len = sizeof(op->cmd.opcode); in spi_mem_exec_op()
290 xfers[xferpos].tx_nbits = op->cmd.buswidth; in spi_mem_exec_op()
295 if (op->addr.nbytes) { in spi_mem_exec_op()
298 for (i = 0; i < op->addr.nbytes; i++) in spi_mem_exec_op()
299 tmpbuf[i + 1] = op->addr.val >> in spi_mem_exec_op()
300 (8 * (op->addr.nbytes - i - 1)); in spi_mem_exec_op()
303 xfers[xferpos].len = op->addr.nbytes; in spi_mem_exec_op()
304 xfers[xferpos].tx_nbits = op->addr.buswidth; in spi_mem_exec_op()
307 totalxferlen += op->addr.nbytes; in spi_mem_exec_op()
310 if (op->dummy.nbytes) { in spi_mem_exec_op()
311 memset(tmpbuf + op->addr.nbytes + 1, 0xff, op->dummy.nbytes); in spi_mem_exec_op()
312 xfers[xferpos].tx_buf = tmpbuf + op->addr.nbytes + 1; in spi_mem_exec_op()
313 xfers[xferpos].len = op->dummy.nbytes; in spi_mem_exec_op()
314 xfers[xferpos].tx_nbits = op->dummy.buswidth; in spi_mem_exec_op()
317 totalxferlen += op->dummy.nbytes; in spi_mem_exec_op()
320 if (op->data.nbytes) { in spi_mem_exec_op()
321 if (op->data.dir == SPI_MEM_DATA_IN) { in spi_mem_exec_op()
322 xfers[xferpos].rx_buf = op->data.buf.in; in spi_mem_exec_op()
323 xfers[xferpos].rx_nbits = op->data.buswidth; in spi_mem_exec_op()
325 xfers[xferpos].tx_buf = op->data.buf.out; in spi_mem_exec_op()
326 xfers[xferpos].tx_nbits = op->data.buswidth; in spi_mem_exec_op()
329 xfers[xferpos].len = op->data.nbytes; in spi_mem_exec_op()
332 totalxferlen += op->data.nbytes; in spi_mem_exec_op()
346 if (op->data.nbytes) { in spi_mem_exec_op()
347 if (op->data.dir == SPI_MEM_DATA_IN) in spi_mem_exec_op()
348 rx_buf = op->data.buf.in; in spi_mem_exec_op()
350 tx_buf = op->data.buf.out; in spi_mem_exec_op()
353 op_len = sizeof(op->cmd.opcode) + op->addr.nbytes + op->dummy.nbytes; in spi_mem_exec_op()
366 op_buf[pos++] = op->cmd.opcode; in spi_mem_exec_op()
368 if (op->addr.nbytes) { in spi_mem_exec_op()
369 for (i = 0; i < op->addr.nbytes; i++) in spi_mem_exec_op()
370 op_buf[pos + i] = op->addr.val >> in spi_mem_exec_op()
371 (8 * (op->addr.nbytes - i - 1)); in spi_mem_exec_op()
373 pos += op->addr.nbytes; in spi_mem_exec_op()
376 if (op->dummy.nbytes) in spi_mem_exec_op()
377 memset(op_buf + pos, 0xff, op->dummy.nbytes); in spi_mem_exec_op()
391 ret = spi_xfer(slave, op->data.nbytes * 8, tx_buf, in spi_mem_exec_op()
402 tx_buf || rx_buf ? op->data.nbytes : 0, in spi_mem_exec_op()
404 for (i = 0; i < op->data.nbytes; i++) in spi_mem_exec_op()
431 int spi_mem_adjust_op_size(struct spi_slave *slave, struct spi_mem_op *op) in spi_mem_adjust_op_size() argument
437 return ops->mem_ops->adjust_op_size(slave, op); in spi_mem_adjust_op_size()
442 len = sizeof(op->cmd.opcode) + op->addr.nbytes + in spi_mem_adjust_op_size()
443 op->dummy.nbytes; in spi_mem_adjust_op_size()
447 if (op->data.dir == SPI_MEM_DATA_IN) { in spi_mem_adjust_op_size()
449 op->data.nbytes = min(op->data.nbytes, in spi_mem_adjust_op_size()
452 op->data.nbytes = min(op->data.nbytes, in spi_mem_adjust_op_size()
456 if (!op->data.nbytes) in spi_mem_adjust_op_size()