Lines Matching refs:op
438 static void rockchip_sfc_adjust_op_work(struct spi_mem_op *op) in rockchip_sfc_adjust_op_work() argument
440 if (unlikely(op->dummy.nbytes && !op->addr.nbytes)) { in rockchip_sfc_adjust_op_work()
445 op->addr.nbytes = op->dummy.nbytes; in rockchip_sfc_adjust_op_work()
446 op->addr.buswidth = op->dummy.buswidth; in rockchip_sfc_adjust_op_work()
447 op->addr.val = 0xFFFFFFFFF; in rockchip_sfc_adjust_op_work()
449 op->dummy.nbytes = 0; in rockchip_sfc_adjust_op_work()
477 const struct spi_mem_op *op, in rockchip_sfc_xfer_setup() argument
484 cmd = op->cmd.opcode; in rockchip_sfc_xfer_setup()
485 ctrl |= ((op->cmd.buswidth >> 1) << SFC_CTRL_CMD_BITS_SHIFT); in rockchip_sfc_xfer_setup()
488 if (op->addr.nbytes) { in rockchip_sfc_xfer_setup()
489 if (op->addr.nbytes == 4) { in rockchip_sfc_xfer_setup()
491 } else if (op->addr.nbytes == 3) { in rockchip_sfc_xfer_setup()
495 writel(op->addr.nbytes * 8 - 1, sfc->regbase + plat->cs * SFC_CS1_REG_OFFSET + SFC_ABIT); in rockchip_sfc_xfer_setup()
498 ctrl |= ((op->addr.buswidth >> 1) << SFC_CTRL_ADDR_BITS_SHIFT); in rockchip_sfc_xfer_setup()
502 if (op->dummy.nbytes) { in rockchip_sfc_xfer_setup()
503 if (op->dummy.buswidth == 4) in rockchip_sfc_xfer_setup()
504 cmd |= op->dummy.nbytes * 2 << SFC_CMD_DUMMY_SHIFT; in rockchip_sfc_xfer_setup()
505 else if (op->dummy.buswidth == 2) in rockchip_sfc_xfer_setup()
506 cmd |= op->dummy.nbytes * 4 << SFC_CMD_DUMMY_SHIFT; in rockchip_sfc_xfer_setup()
508 cmd |= op->dummy.nbytes * 8 << SFC_CMD_DUMMY_SHIFT; in rockchip_sfc_xfer_setup()
517 if (op->data.dir == SPI_MEM_DATA_OUT) in rockchip_sfc_xfer_setup()
520 ctrl |= ((op->data.buswidth >> 1) << SFC_CTRL_DATA_BITS_SHIFT); in rockchip_sfc_xfer_setup()
522 if (!len && op->addr.nbytes) in rockchip_sfc_xfer_setup()
530 op->addr.nbytes, op->addr.buswidth, in rockchip_sfc_xfer_setup()
531 op->dummy.nbytes, op->dummy.buswidth); in rockchip_sfc_xfer_setup()
533 ctrl, cmd, op->addr.val, len, plat->cs); in rockchip_sfc_xfer_setup()
537 if (op->addr.nbytes) in rockchip_sfc_xfer_setup()
538 writel(op->addr.val, sfc->regbase + SFC_ADDR); in rockchip_sfc_xfer_setup()
616 const struct spi_mem_op *op, u32 len) in rockchip_sfc_xfer_data_poll() argument
620 if (op->data.dir == SPI_MEM_DATA_OUT) in rockchip_sfc_xfer_data_poll()
621 return rockchip_sfc_write_fifo(sfc, op->data.buf.out, len); in rockchip_sfc_xfer_data_poll()
623 return rockchip_sfc_read_fifo(sfc, op->data.buf.in, len); in rockchip_sfc_xfer_data_poll()
627 const struct spi_mem_op *op, u32 len) in rockchip_sfc_xfer_data_dma() argument
636 if (op->data.dir == SPI_MEM_DATA_OUT) { in rockchip_sfc_xfer_data_dma()
637 dma_buf = (void *)op->data.buf.out; in rockchip_sfc_xfer_data_dma()
640 dma_buf = (void *)op->data.buf.in; in rockchip_sfc_xfer_data_dma()
656 const struct spi_mem_op *op, u32 len) in rockchip_sfc_xfer_data_dma_async() argument
660 if (op->data.dir == SPI_MEM_DATA_OUT) { in rockchip_sfc_xfer_data_dma_async()
661 dma_buf = (void *)op->data.buf.out; in rockchip_sfc_xfer_data_dma_async()
665 dma_buf = (void *)op->data.buf.in; in rockchip_sfc_xfer_data_dma_async()
712 const struct spi_mem_op *op) in rockchip_sfc_exec_op_bypass() argument
714 u32 len = min_t(u32, op->data.nbytes, sfc->max_iosize); in rockchip_sfc_exec_op_bypass()
717 rockchip_sfc_adjust_op_work((struct spi_mem_op *)op); in rockchip_sfc_exec_op_bypass()
719 rockchip_sfc_xfer_setup(sfc, mem, op, len); in rockchip_sfc_exec_op_bypass()
720 ret = rockchip_sfc_xfer_data_poll(sfc, op, len); in rockchip_sfc_exec_op_bypass()
736 struct spi_mem_op op = SPI_MEM_OP(SPI_MEM_OP_CMD(0x9F, 1), in rockchip_sfc_delay_lines_tuning() local
748 op.data.buf.in = &id; in rockchip_sfc_delay_lines_tuning()
749 rockchip_sfc_exec_op_bypass(sfc, mem, &op); in rockchip_sfc_delay_lines_tuning()
760 op.data.buf.in = &id_temp; in rockchip_sfc_delay_lines_tuning()
765 rockchip_sfc_exec_op_bypass(sfc, mem, &op); in rockchip_sfc_delay_lines_tuning()
821 const struct spi_mem_op *op) in rockchip_sfc_exec_op() argument
825 u32 len = min_t(u32, op->data.nbytes, sfc->max_iosize); in rockchip_sfc_exec_op()
848 rockchip_sfc_adjust_op_work((struct spi_mem_op *)op); in rockchip_sfc_exec_op()
850 rockchip_sfc_xfer_setup(sfc, mem, op, len); in rockchip_sfc_exec_op()
854 return rockchip_sfc_xfer_data_dma_async(sfc, op, len); in rockchip_sfc_exec_op()
855 ret = rockchip_sfc_xfer_data_dma(sfc, op, len); in rockchip_sfc_exec_op()
857 ret = rockchip_sfc_xfer_data_poll(sfc, op, len); in rockchip_sfc_exec_op()
861 dev_err(sfc->dev, "xfer data failed ret %d dir %d\n", ret, op->data.dir); in rockchip_sfc_exec_op()
873 static int rockchip_sfc_adjust_op_size(struct spi_slave *mem, struct spi_mem_op *op) in rockchip_sfc_adjust_op_size() argument
877 op->data.nbytes = min(op->data.nbytes, sfc->max_iosize); in rockchip_sfc_adjust_op_size()