Lines Matching refs:nfc_op

272 static void anfc_trigger_op(struct arasan_nfc *nfc, struct anfc_op *nfc_op)  in anfc_trigger_op()  argument
274 writel_relaxed(nfc_op->pkt_reg, nfc->base + PKT_REG); in anfc_trigger_op()
275 writel_relaxed(nfc_op->addr1_reg, nfc->base + MEM_ADDR1_REG); in anfc_trigger_op()
276 writel_relaxed(nfc_op->addr2_reg, nfc->base + MEM_ADDR2_REG); in anfc_trigger_op()
277 writel_relaxed(nfc_op->cmd_reg, nfc->base + CMD_REG); in anfc_trigger_op()
278 writel_relaxed(nfc_op->prog_reg, nfc->base + PROG_REG); in anfc_trigger_op()
402 struct anfc_op nfc_op = { in anfc_read_page_hw_ecc() local
432 anfc_trigger_op(nfc, &nfc_op); in anfc_read_page_hw_ecc()
520 struct anfc_op nfc_op = { in anfc_write_page_hw_ecc() local
556 anfc_trigger_op(nfc, &nfc_op); in anfc_write_page_hw_ecc()
597 struct anfc_op *nfc_op) in anfc_parse_instructions() argument
606 memset(nfc_op, 0, sizeof(*nfc_op)); in anfc_parse_instructions()
607 nfc_op->addr2_reg = ADDR2_CS(nfc->native_cs); in anfc_parse_instructions()
608 nfc_op->cmd_reg = CMD_PAGE_SIZE(anand->page_sz); in anfc_parse_instructions()
620 nfc_op->cmd_reg |= CMD_1(instr->ctx.cmd.opcode); in anfc_parse_instructions()
622 nfc_op->cmd_reg |= CMD_2(instr->ctx.cmd.opcode); in anfc_parse_instructions()
631 nfc_op->cmd_reg |= CMD_NADDRS(naddrs); in anfc_parse_instructions()
635 nfc_op->addr1_reg |= (u32)addrs[i] << i * 8; in anfc_parse_instructions()
637 nfc_op->addr2_reg |= addrs[i]; in anfc_parse_instructions()
642 nfc_op->read = true; in anfc_parse_instructions()
647 nfc_op->buf = &buf[offset]; in anfc_parse_instructions()
648 nfc_op->len = nand_subop_get_data_len(subop, op_id); in anfc_parse_instructions()
649 ret = anfc_pkt_len_config(nfc_op->len, &nfc_op->steps, in anfc_parse_instructions()
668 nfc_op->pkt_reg |= PKT_SIZE(round_up(pktsize, 4)) | in anfc_parse_instructions()
669 PKT_STEPS(nfc_op->steps); in anfc_parse_instructions()
672 nfc_op->rdy_timeout_ms = instr->ctx.waitrdy.timeout_ms; in anfc_parse_instructions()
680 static int anfc_rw_pio_op(struct arasan_nfc *nfc, struct anfc_op *nfc_op) in anfc_rw_pio_op() argument
682 unsigned int dwords = (nfc_op->len / 4) / nfc_op->steps; in anfc_rw_pio_op()
683 unsigned int last_len = nfc_op->len % 4; in anfc_rw_pio_op()
685 u8 *buf = nfc_op->buf; in anfc_rw_pio_op()
688 for (i = 0; i < nfc_op->steps; i++) { in anfc_rw_pio_op()
689 dir = nfc_op->read ? READ_READY : WRITE_READY; in anfc_rw_pio_op()
693 nfc_op->read ? "Read" : "Write"); in anfc_rw_pio_op()
698 if (nfc_op->read) in anfc_rw_pio_op()
709 offset = nfc_op->len - last_len; in anfc_rw_pio_op()
711 if (nfc_op->read) { in anfc_rw_pio_op()
728 struct anfc_op nfc_op = {}; in anfc_misc_data_type_exec() local
731 ret = anfc_parse_instructions(chip, subop, &nfc_op); in anfc_misc_data_type_exec()
735 nfc_op.prog_reg = prog_reg; in anfc_misc_data_type_exec()
736 anfc_trigger_op(nfc, &nfc_op); in anfc_misc_data_type_exec()
738 if (nfc_op.rdy_timeout_ms) { in anfc_misc_data_type_exec()
739 ret = anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms); in anfc_misc_data_type_exec()
744 return anfc_rw_pio_op(nfc, &nfc_op); in anfc_misc_data_type_exec()
792 struct anfc_op nfc_op = {}; in anfc_misc_zerolen_type_exec() local
795 ret = anfc_parse_instructions(chip, subop, &nfc_op); in anfc_misc_zerolen_type_exec()
799 nfc_op.prog_reg = prog_reg; in anfc_misc_zerolen_type_exec()
800 anfc_trigger_op(nfc, &nfc_op); in anfc_misc_zerolen_type_exec()
806 if (nfc_op.rdy_timeout_ms) in anfc_misc_zerolen_type_exec()
807 ret = anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms); in anfc_misc_zerolen_type_exec()
849 struct anfc_op nfc_op = {}; in anfc_wait_type_exec() local
852 ret = anfc_parse_instructions(chip, subop, &nfc_op); in anfc_wait_type_exec()
856 return anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms); in anfc_wait_type_exec()