Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2856826imm; Fri, 19 Oct 2018 00:30:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV612gCxQ8QypG9lEjqFkbwRNNCmeKAORJzvtx1Ow3FwpGzKjdNSGt/VerKh+Ncp5PoQ1HBrU X-Received: by 2002:a63:1b61:: with SMTP id b33-v6mr31666513pgm.245.1539934204686; Fri, 19 Oct 2018 00:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539934204; cv=none; d=google.com; s=arc-20160816; b=cleh086wOwLVUjuIU1xahOpx67xX8nkw31NaWRVZvto8h6JSCM1CvsbM+XeILQ/ZLN iy/S9NM2Wvn5WWXKEQ0wRUc0CHBHDF/xfp/AZD1R7hDNil+fQJt96xCH7I7sV1lhmKg4 2PZa8VNHhKK3E3KRPx7iYAJ1i5LNtmiNYTvSTJvAVZsdnxu8gl7p7zgbS2ytOCRHr0St qf7sSHI1M34KhLUFYPtHhl+OmchrKvSym2kRFEijEe7VUyJ02ArLwUTKg0GihBNdWK8J 2O6aHnOnin1WWvbKlbOrZaIej4tsJYn8kQiUNepR7OXc+Ou+I/QNxGlkDb3BA/gVwtIx jCPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ZGqN9Ct7YDpyNVWMI0/LBB1zIP7X1ZELui7naehHZlY=; b=O4dfNlm4H+tnEymqWyc+ZTjQY2xyikOS2bv5G15fHe396oq4yIXQAC13C33/ty0TYO iUgVNeLNb4QAxDCt5laBtfOZrH558nWWjZcu/2hVhIWtO5sUSkOdvKLQreJ3RHMfbDHc +dyZu9IvQqmuCsFdWNkTD/YpkNbG8i/aCE11KTDhHaQ+TJ791+YYf19V+ZMKc4utEJBr eE5DFogwUsg/LXdlLhmZpNpFckb2tIqECAvOOtKAottuM201eueqKniipuxL7uuivR7s iwyj1hj7r0hqybNL5To8FFO1uXsY6But/KGe26oGTc2S7BOyrwUEuf1ZeSQRzCsVh+a4 I8gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si1588923plz.196.2018.10.19.00.29.47; Fri, 19 Oct 2018 00:30:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727033AbeJSPeP (ORCPT + 99 others); Fri, 19 Oct 2018 11:34:15 -0400 Received: from mail-sz2.amlogic.com ([211.162.65.114]:23115 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726340AbeJSPeP (ORCPT ); Fri, 19 Oct 2018 11:34:15 -0400 Received: from [10.28.18.51] (10.28.18.51) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 19 Oct 2018 15:29:13 +0800 Subject: Re: [PATCH v5 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller To: Boris Brezillon , Jianxin Pan CC: , Yixun Lan , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Jerome Brunet , Neil Armstrong , Martin Blumenstingl , Carlo Caione , Kevin Hilman , Rob Herring , Jian Hu , Hanjie Lin , Victor Wan , , , References: <1539839345-14021-1-git-send-email-jianxin.pan@amlogic.com> <1539839345-14021-3-git-send-email-jianxin.pan@amlogic.com> <20181018162449.3fe433e7@bbrezillon> From: Liang Yang Message-ID: <30ceed2f-03a2-8e4c-b267-df14d052f13d@amlogic.com> Date: Fri, 19 Oct 2018 15:29:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181018162449.3fe433e7@bbrezillon> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.28.18.51] X-ClientProxiedBy: mail-sz2.amlogic.com (10.28.11.6) To mail-sz2.amlogic.com (10.28.11.6) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/18 22:24, Boris Brezillon wrote: > On Thu, 18 Oct 2018 13:09:05 +0800 > Jianxin Pan 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; >> +} > > . >