Lines Matching refs:op
361 const struct spi_mem_op *op) in fsl_qspi_supports_op() argument
366 ret = fsl_qspi_check_buswidth(q, op->cmd.buswidth); in fsl_qspi_supports_op()
368 if (op->addr.nbytes) in fsl_qspi_supports_op()
369 ret |= fsl_qspi_check_buswidth(q, op->addr.buswidth); in fsl_qspi_supports_op()
371 if (op->dummy.nbytes) in fsl_qspi_supports_op()
372 ret |= fsl_qspi_check_buswidth(q, op->dummy.buswidth); in fsl_qspi_supports_op()
374 if (op->data.nbytes) in fsl_qspi_supports_op()
375 ret |= fsl_qspi_check_buswidth(q, op->data.buswidth); in fsl_qspi_supports_op()
384 if (op->addr.nbytes + in fsl_qspi_supports_op()
385 (op->dummy.nbytes ? 1 : 0) + in fsl_qspi_supports_op()
386 (op->data.nbytes ? 1 : 0) > 6) in fsl_qspi_supports_op()
390 if (op->dummy.nbytes && in fsl_qspi_supports_op()
391 (op->dummy.nbytes * 8 / op->dummy.buswidth > 64)) in fsl_qspi_supports_op()
395 if (op->data.dir == SPI_MEM_DATA_IN && in fsl_qspi_supports_op()
396 (op->data.nbytes > q->devtype_data->ahb_buf_size || in fsl_qspi_supports_op()
397 (op->data.nbytes > q->devtype_data->rxfifo - 4 && in fsl_qspi_supports_op()
398 !IS_ALIGNED(op->data.nbytes, 8)))) in fsl_qspi_supports_op()
401 if (op->data.dir == SPI_MEM_DATA_OUT && in fsl_qspi_supports_op()
402 op->data.nbytes > q->devtype_data->txfifo) in fsl_qspi_supports_op()
405 return spi_mem_default_supports_op(slave, op); in fsl_qspi_supports_op()
409 const struct spi_mem_op *op) in fsl_qspi_prepare_lut() argument
415 lutval[0] |= LUT_DEF(0, LUT_CMD, LUT_PAD(op->cmd.buswidth), in fsl_qspi_prepare_lut()
416 op->cmd.opcode); in fsl_qspi_prepare_lut()
419 if (op->addr.nbytes) { in fsl_qspi_prepare_lut()
421 LUT_PAD(op->addr.buswidth), in fsl_qspi_prepare_lut()
422 (op->addr.nbytes == 4) ? 0x20 : 0x18); in fsl_qspi_prepare_lut()
431 for (i = 0; i < op->addr.nbytes; i++) { in fsl_qspi_prepare_lut()
432 u8 addrbyte = op->addr.val >> (8 * (op->addr.nbytes - i - 1)); in fsl_qspi_prepare_lut()
435 LUT_PAD(op->addr.buswidth), in fsl_qspi_prepare_lut()
441 if (op->dummy.nbytes) { in fsl_qspi_prepare_lut()
443 LUT_PAD(op->dummy.buswidth), in fsl_qspi_prepare_lut()
444 op->dummy.nbytes * 8 / in fsl_qspi_prepare_lut()
445 op->dummy.buswidth); in fsl_qspi_prepare_lut()
449 if (op->data.nbytes) { in fsl_qspi_prepare_lut()
451 op->data.dir == SPI_MEM_DATA_IN ? in fsl_qspi_prepare_lut()
453 LUT_PAD(op->data.buswidth), in fsl_qspi_prepare_lut()
465 op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3]); in fsl_qspi_prepare_lut()
472 if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_IN && in fsl_qspi_prepare_lut()
473 op->addr.nbytes) { in fsl_qspi_prepare_lut()
533 static void fsl_qspi_read_ahb(struct fsl_qspi *q, const struct spi_mem_op *op) in fsl_qspi_read_ahb() argument
538 if (op->addr.nbytes) in fsl_qspi_read_ahb()
539 ahb_read_addr += op->addr.val; in fsl_qspi_read_ahb()
542 memcpy_fromio(op->data.buf.in, in fsl_qspi_read_ahb()
544 op->data.nbytes); in fsl_qspi_read_ahb()
548 const struct spi_mem_op *op) in fsl_qspi_fill_txfifo() argument
554 for (i = 0; i < ALIGN_DOWN(op->data.nbytes, 4); i += 4) { in fsl_qspi_fill_txfifo()
555 memcpy(&val, op->data.buf.out + i, 4); in fsl_qspi_fill_txfifo()
560 if (i < op->data.nbytes) { in fsl_qspi_fill_txfifo()
561 memcpy(&val, op->data.buf.out + i, op->data.nbytes - i); in fsl_qspi_fill_txfifo()
567 for (i = op->data.nbytes; i < 16; i += 4) in fsl_qspi_fill_txfifo()
573 const struct spi_mem_op *op) in fsl_qspi_read_rxfifo() argument
577 u8 *buf = op->data.buf.in; in fsl_qspi_read_rxfifo()
580 for (i = 0; i < ALIGN_DOWN(op->data.nbytes, 4); i += 4) { in fsl_qspi_read_rxfifo()
586 if (i < op->data.nbytes) { in fsl_qspi_read_rxfifo()
589 memcpy(buf + i, &val, op->data.nbytes - i); in fsl_qspi_read_rxfifo()
604 static int fsl_qspi_do_op(struct fsl_qspi *q, const struct spi_mem_op *op) in fsl_qspi_do_op() argument
614 qspi_writel(q, op->data.nbytes | QUADSPI_IPCR_SEQID(SEQID_LUT), in fsl_qspi_do_op()
623 if (!err && op->data.nbytes && op->data.dir == SPI_MEM_DATA_IN) in fsl_qspi_do_op()
624 fsl_qspi_read_rxfifo(q, op); in fsl_qspi_do_op()
630 const struct spi_mem_op *op) in fsl_qspi_exec_op() argument
647 if (op->addr.nbytes) in fsl_qspi_exec_op()
648 addr_offset += op->addr.val; in fsl_qspi_exec_op()
662 fsl_qspi_prepare_lut(q, op); in fsl_qspi_exec_op()
669 if (op->data.nbytes > (q->devtype_data->rxfifo - 4) && in fsl_qspi_exec_op()
670 op->data.dir == SPI_MEM_DATA_IN) { in fsl_qspi_exec_op()
671 fsl_qspi_read_ahb(q, op); in fsl_qspi_exec_op()
676 if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT) in fsl_qspi_exec_op()
677 fsl_qspi_fill_txfifo(q, op); in fsl_qspi_exec_op()
679 err = fsl_qspi_do_op(q, op); in fsl_qspi_exec_op()
689 struct spi_mem_op *op) in fsl_qspi_adjust_op_size() argument
693 if (op->data.dir == SPI_MEM_DATA_OUT) { in fsl_qspi_adjust_op_size()
694 if (op->data.nbytes > q->devtype_data->txfifo) in fsl_qspi_adjust_op_size()
695 op->data.nbytes = q->devtype_data->txfifo; in fsl_qspi_adjust_op_size()
697 if (op->data.nbytes > q->devtype_data->ahb_buf_size) in fsl_qspi_adjust_op_size()
698 op->data.nbytes = q->devtype_data->ahb_buf_size; in fsl_qspi_adjust_op_size()
699 else if (op->data.nbytes > (q->devtype_data->rxfifo - 4)) in fsl_qspi_adjust_op_size()
700 op->data.nbytes = ALIGN_DOWN(op->data.nbytes, 8); in fsl_qspi_adjust_op_size()