q_op->flag = OP_PROGRAM_PAGE;
nandc->exec_opwrite = true;
break;
+ default:
+ dev_err(nandc->dev, "Opcode not supported: %u\n", opcode);
+ return -EOPNOTSUPP;
}
return cmd;
}
/* NAND framework ->exec_op() hooks and related helpers */
-static void qcom_parse_instructions(struct nand_chip *chip,
+static int qcom_parse_instructions(struct nand_chip *chip,
const struct nand_subop *subop,
struct qcom_op *q_op)
{
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
const struct nand_op_instr *instr = NULL;
unsigned int op_id;
- int i;
+ int i, ret;
for (op_id = 0; op_id < subop->ninstrs; op_id++) {
unsigned int offset, naddrs;
switch (instr->type) {
case NAND_OP_CMD_INSTR:
- q_op->cmd_reg = qcom_op_cmd_mapping(nandc, instr->ctx.cmd.opcode, q_op);
+ ret = qcom_op_cmd_mapping(nandc, instr->ctx.cmd.opcode, q_op);
+ if (ret < 0)
+ return ret;
+
+ q_op->cmd_reg = ret;
q_op->rdy_delay_ns = instr->delay_ns;
break;
break;
}
}
+
+ return 0;
}
static void qcom_delay_ns(unsigned int ns)
host->status = NAND_STATUS_READY | NAND_STATUS_WP;
- qcom_parse_instructions(chip, subop, &q_op);
+ ret = qcom_parse_instructions(chip, subop, &q_op);
+ if (ret)
+ return ret;
num_cw = nandc->exec_opwrite ? ecc->steps : 1;
nandc->exec_opwrite = false;
unsigned int len = 0;
int ret;
- qcom_parse_instructions(chip, subop, &q_op);
+ ret = qcom_parse_instructions(chip, subop, &q_op);
+ if (ret)
+ return ret;
nandc->buf_count = 0;
nandc->buf_start = 0;
struct qcom_op q_op = {};
int ret;
- qcom_parse_instructions(chip, subop, &q_op);
+ ret = qcom_parse_instructions(chip, subop, &q_op);
+ if (ret)
+ return ret;
if (q_op.flag == OP_PROGRAM_PAGE)
goto wait_rdy;
unsigned int len = 0;
int ret;
- qcom_parse_instructions(chip, subop, &q_op);
+ ret = qcom_parse_instructions(chip, subop, &q_op);
+ if (ret)
+ return ret;
q_op.cmd_reg |= PAGE_ACC | LAST_PAGE;
struct qcom_op q_op = {};
int ret;
- qcom_parse_instructions(chip, subop, &q_op);
+ ret = qcom_parse_instructions(chip, subop, &q_op);
+ if (ret)
+ return ret;
q_op.cmd_reg |= PAGE_ACC | LAST_PAGE;