Lines Matching refs:nfc_op

243 static void anfc_trigger_op(struct arasan_nfc *nfc, struct anfc_op *nfc_op)
245 writel_relaxed(nfc_op->pkt_reg, nfc->base + PKT_REG);
246 writel_relaxed(nfc_op->addr1_reg, nfc->base + MEM_ADDR1_REG);
247 writel_relaxed(nfc_op->addr2_reg, nfc->base + MEM_ADDR2_REG);
248 writel_relaxed(nfc_op->cmd_reg, nfc->base + CMD_REG);
249 writel_relaxed(nfc_op->prog_reg, nfc->base + PROG_REG);
338 struct anfc_op nfc_op = {
368 anfc_trigger_op(nfc, &nfc_op);
456 struct anfc_op nfc_op = {
492 anfc_trigger_op(nfc, &nfc_op);
533 struct anfc_op *nfc_op)
541 memset(nfc_op, 0, sizeof(*nfc_op));
542 nfc_op->addr2_reg = ADDR2_CS(anand->cs);
543 nfc_op->cmd_reg = CMD_PAGE_SIZE(anand->page_sz);
555 nfc_op->cmd_reg |= CMD_1(instr->ctx.cmd.opcode);
557 nfc_op->cmd_reg |= CMD_2(instr->ctx.cmd.opcode);
566 nfc_op->cmd_reg |= CMD_NADDRS(naddrs);
570 nfc_op->addr1_reg |= (u32)addrs[i] << i * 8;
572 nfc_op->addr2_reg |= addrs[i];
577 nfc_op->read = true;
582 nfc_op->buf = &buf[offset];
583 nfc_op->len = nand_subop_get_data_len(subop, op_id);
584 ret = anfc_pkt_len_config(nfc_op->len, &nfc_op->steps,
603 nfc_op->pkt_reg |= PKT_SIZE(round_up(pktsize, 4)) |
604 PKT_STEPS(nfc_op->steps);
607 nfc_op->rdy_timeout_ms = instr->ctx.waitrdy.timeout_ms;
615 static int anfc_rw_pio_op(struct arasan_nfc *nfc, struct anfc_op *nfc_op)
617 unsigned int dwords = (nfc_op->len / 4) / nfc_op->steps;
618 unsigned int last_len = nfc_op->len % 4;
620 u8 *buf = nfc_op->buf;
623 for (i = 0; i < nfc_op->steps; i++) {
624 dir = nfc_op->read ? READ_READY : WRITE_READY;
628 nfc_op->read ? "Read" : "Write");
633 if (nfc_op->read)
644 offset = nfc_op->len - last_len;
646 if (nfc_op->read) {
663 struct anfc_op nfc_op = {};
666 ret = anfc_parse_instructions(chip, subop, &nfc_op);
670 nfc_op.prog_reg = prog_reg;
671 anfc_trigger_op(nfc, &nfc_op);
673 if (nfc_op.rdy_timeout_ms) {
674 ret = anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms);
679 return anfc_rw_pio_op(nfc, &nfc_op);
711 struct anfc_op nfc_op = {};
714 ret = anfc_parse_instructions(chip, subop, &nfc_op);
718 nfc_op.prog_reg = prog_reg;
719 anfc_trigger_op(nfc, &nfc_op);
725 if (nfc_op.rdy_timeout_ms)
726 ret = anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms);
768 struct anfc_op nfc_op = {};
771 ret = anfc_parse_instructions(chip, subop, &nfc_op);
775 return anfc_wait_for_rb(nfc, chip, nfc_op.rdy_timeout_ms);