Lines Matching refs:nfc_op
243 static void anfc_trigger_op(struct arasan_nfc *nfc, struct anfc_op *nfc_op) in anfc_trigger_op() argument
245 writel_relaxed(nfc_op->pkt_reg, nfc->base + PKT_REG); in anfc_trigger_op()
246 writel_relaxed(nfc_op->addr1_reg, nfc->base + MEM_ADDR1_REG); in anfc_trigger_op()
247 writel_relaxed(nfc_op->addr2_reg, nfc->base + MEM_ADDR2_REG); in anfc_trigger_op()
248 writel_relaxed(nfc_op->cmd_reg, nfc->base + CMD_REG); in anfc_trigger_op()
249 writel_relaxed(nfc_op->prog_reg, nfc->base + PROG_REG); in anfc_trigger_op()
338 struct anfc_op nfc_op = { in anfc_read_page_hw_ecc() local
368 anfc_trigger_op(nfc, &nfc_op); in anfc_read_page_hw_ecc()
455 struct anfc_op nfc_op = { in anfc_write_page_hw_ecc() local
491 anfc_trigger_op(nfc, &nfc_op); in anfc_write_page_hw_ecc()
521 struct anfc_op *nfc_op) in anfc_parse_instructions() argument
529 memset(nfc_op, 0, sizeof(*nfc_op)); in anfc_parse_instructions()
530 nfc_op->addr2_reg = ADDR2_CS(anand->cs); in anfc_parse_instructions()
531 nfc_op->cmd_reg = CMD_PAGE_SIZE(anand->page_sz); in anfc_parse_instructions()
543 nfc_op->cmd_reg |= CMD_1(instr->ctx.cmd.opcode); in anfc_parse_instructions()
545 nfc_op->cmd_reg |= CMD_2(instr->ctx.cmd.opcode); in anfc_parse_instructions()
554 nfc_op->cmd_reg |= CMD_NADDRS(naddrs); in anfc_parse_instructions()
558 nfc_op->addr1_reg |= (u32)addrs[i] << i * 8; in anfc_parse_instructions()
560 nfc_op->addr2_reg |= addrs[i]; in anfc_parse_instructions()
565 nfc_op->read = true; in anfc_parse_instructions()
570 nfc_op->buf = &buf[offset]; in anfc_parse_instructions()
571 nfc_op->len = nand_subop_get_data_len(subop, op_id); in anfc_parse_instructions()
572 ret = anfc_pkt_len_config(nfc_op->len, &nfc_op->steps, in anfc_parse_instructions()
591 nfc_op->pkt_reg |= PKT_SIZE(round_up(pktsize, 4)) | in anfc_parse_instructions()
592 PKT_STEPS(nfc_op->steps); in anfc_parse_instructions()
595 nfc_op->rdy_timeout_ms = instr->ctx.waitrdy.timeout_ms; in anfc_parse_instructions()
603 static int anfc_rw_pio_op(struct arasan_nfc *nfc, struct anfc_op *nfc_op) in anfc_rw_pio_op() argument
605 unsigned int dwords = (nfc_op->len / 4) / nfc_op->steps; in anfc_rw_pio_op()
606 unsigned int last_len = nfc_op->len % 4; in anfc_rw_pio_op()
608 u8 *buf = nfc_op->buf; in anfc_rw_pio_op()
611 for (i = 0; i < nfc_op->steps; i++) { in anfc_rw_pio_op()
612 dir = nfc_op->read ? READ_READY : WRITE_READY; in anfc_rw_pio_op()
616 nfc_op->read ? "Read" : "Write"); in anfc_rw_pio_op()
621 if (nfc_op->read) in anfc_rw_pio_op()
632 offset = nfc_op->len - last_len; in anfc_rw_pio_op()
634 if (nfc_op->read) { in anfc_rw_pio_op()
651 struct anfc_op nfc_op = {}; in anfc_misc_data_type_exec() local
654 ret = anfc_parse_instructions(chip, subop, &nfc_op); in anfc_misc_data_type_exec()
658 nfc_op.prog_reg = prog_reg; in anfc_misc_data_type_exec()
659 anfc_trigger_op(nfc, &nfc_op); in anfc_misc_data_type_exec()
661 if (nfc_op.rdy_timeout_ms) { in anfc_misc_data_type_exec()
662 ret = anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms); in anfc_misc_data_type_exec()
667 return anfc_rw_pio_op(nfc, &nfc_op); in anfc_misc_data_type_exec()
699 struct anfc_op nfc_op = {}; in anfc_misc_zerolen_type_exec() local
702 ret = anfc_parse_instructions(chip, subop, &nfc_op); in anfc_misc_zerolen_type_exec()
706 nfc_op.prog_reg = prog_reg; in anfc_misc_zerolen_type_exec()
707 anfc_trigger_op(nfc, &nfc_op); in anfc_misc_zerolen_type_exec()
713 if (nfc_op.rdy_timeout_ms) in anfc_misc_zerolen_type_exec()
714 ret = anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms); in anfc_misc_zerolen_type_exec()
756 struct anfc_op nfc_op = {}; in anfc_wait_type_exec() local
759 ret = anfc_parse_instructions(chip, subop, &nfc_op); in anfc_wait_type_exec()
763 return anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms); in anfc_wait_type_exec()