From: liang.yang@amlogic.com (Liang Yang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller
Date: Fri, 19 Oct 2018 15:29:13 +0800 [thread overview]
Message-ID: <30ceed2f-03a2-8e4c-b267-df14d052f13d@amlogic.com> (raw)
In-Reply-To: <20181018162449.3fe433e7@bbrezillon>
On 2018/10/18 22:24, Boris Brezillon wrote:
> On Thu, 18 Oct 2018 13:09:05 +0800
> Jianxin Pan <jianxin.pan@amlogic.com> wrote:
>
>> +static int meson_nfc_exec_op(struct nand_chip *chip,
>> + const struct nand_operation *op, bool check_only)
>> +{
>> + struct mtd_info *mtd = nand_to_mtd(chip);
>> + struct meson_nfc *nfc = nand_get_controller_data(chip);
>> + const struct nand_op_instr *instr = NULL;
>> + int ret = 0, cmd;
>> + unsigned int op_id;
>> + int i;
>> +
>> + for (op_id = 0; op_id < op->ninstrs; op_id++) {
>> + instr = &op->instrs[op_id];
>> + switch (instr->type) {
>> + case NAND_OP_CMD_INSTR:
>> + if (instr->ctx.cmd.opcode == NAND_CMD_STATUS)
>> + meson_nfc_cmd_idle(nfc, nfc->timing.twb);
>
> Hm, I don't want drivers to base their decisions on the opcode value.
> There's a ->delay_ns field in the instruction object, can't you use
> that one instead? Also, I don't understand why this is only needed for
> the STATUS command. It should normally be applied to all instructions.
>
em, it should be applied to all instructions.
i will fix it and use instr->delay_ns instead.
>> + cmd = nfc->param.chip_select | NFC_CMD_CLE;
>> + cmd |= instr->ctx.cmd.opcode & 0xff;
>> + writel(cmd, nfc->reg_base + NFC_REG_CMD);
>> + if (instr->ctx.cmd.opcode == NAND_CMD_STATUS)
>> + meson_nfc_cmd_idle(nfc, nfc->timing.twhr);
>> + break;
>> +
>> + case NAND_OP_ADDR_INSTR:
>> + for (i = 0; i < instr->ctx.addr.naddrs; i++) {
>> + cmd = nfc->param.chip_select | NFC_CMD_ALE;
>> + cmd |= instr->ctx.addr.addrs[i] & 0xff;
>> + writel(cmd, nfc->reg_base + NFC_REG_CMD);
>> + }
>> + break;
>> +
>> + case NAND_OP_DATA_IN_INSTR:
>> + meson_nfc_read_buf(mtd, instr->ctx.data.buf.in,
>> + instr->ctx.data.len);
>> + break;
>> +
>> + case NAND_OP_DATA_OUT_INSTR:
>> + meson_nfc_write_buf(mtd, instr->ctx.data.buf.out,
>> + instr->ctx.data.len);
>> + break;
>> +
>> + case NAND_OP_WAITRDY_INSTR:
>> + meson_nfc_queue_rb(nfc, instr->ctx.waitrdy.timeout_ms);
>> + break;
>> + }
>> + }
>> + return ret;
>> +}
>
> .
>
next prev parent reply other threads:[~2018-10-19 7:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 5:09 [PATCH v5 0/2] mtd: rawnand: meson: add Amlogic NAND driver support Jianxin Pan
2018-10-18 5:09 ` [PATCH v5 1/2] dt-bindings: nand: meson: add Amlogic NAND controller driver Jianxin Pan
2018-10-18 16:48 ` Rob Herring
2018-10-18 5:09 ` [PATCH v5 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller Jianxin Pan
2018-10-18 14:24 ` Boris Brezillon
2018-10-19 7:29 ` Liang Yang [this message]
2018-10-18 19:33 ` Boris Brezillon
2018-10-19 7:29 ` Liang Yang
2018-10-19 8:10 ` Boris Brezillon
2018-10-19 8:30 ` Liang Yang
2018-10-18 20:34 ` Boris Brezillon
2018-10-18 20:39 ` Boris Brezillon
2018-10-19 8:04 ` Liang Yang
2018-10-18 20:50 ` Boris Brezillon
2018-10-19 8:29 ` Liang Yang
2018-10-19 8:42 ` Boris Brezillon
2018-10-19 9:01 ` Liang Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=30ceed2f-03a2-8e4c-b267-df14d052f13d@amlogic.com \
--to=liang.yang@amlogic.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).