Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7094958imm; Tue, 28 Aug 2018 06:22:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaBvX1hSVjbNi6Jk1FVylJI6JxusjBh+HB37zHekWej37F0Ox5IU8RYtseXBTsQP0KRxE67 X-Received: by 2002:a63:66c7:: with SMTP id a190-v6mr1562713pgc.411.1535462577819; Tue, 28 Aug 2018 06:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535462577; cv=none; d=google.com; s=arc-20160816; b=mvnSNcMWZKsYyPydwt++4beAMyAUGgu8rIiB+VDk9P/2QgFa+FFzbRmjFfbHFih+Lp jEdOu9bu0ma3p3ZgVNMXoiELBha9p5utOp7wyOV/me9gDXZIlYXC6ZnoHNT0p+YUho4a UDyqJ+UDAHeGUUGuDnuBYg0kPjyaStCDHU2PfxtnRH/0ibmCleIevgqZOnrfGDkosLAU ixfI07+AIp13QnXpB9tDP3K8SJ6P6/d+iX1yLkIdNJHaaMV2AxPqIKAdUquoH2UJ3Qhm 2raYVEfq2mp513akXablovYU0Vgw0KZWOoJwOohtjglAdMBWiMzSYJQegLk/waG+oVkG UhvQ== 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:arc-authentication-results; bh=B3qzyo1xA7wUzL9x+o/vR5YmR4K8QGCte9Iei42LloU=; b=ArFMQn1FNBURk2lQs8sim5hjR4mmnuuwBy0RsSyGaLj7hsGQbXHgCSCO9qz4No6dk0 0fOic8B6iVVN7NFarybcSxZ1Ez7FLXN6Vu8Dn9hewXBIWAQkpj65P104FbcGdZ75ozGX 4xiSHEt9ZpzmB3Oi4MG3QU/nVYPOckjoJS2civ59OzyGb97ZsUQ6/qWYmEmfFmGxUmZF CzV/kjSsz4FatIU1b0n03IJyEG7hnNjClsjJvb499U9ePyVyHC1jEs6fnnGEBrhl5JG6 ntfGRHyJe3as4iJxVgPke20V9Jmjst4BUzEW8iX+MTb87RffR9RDKjZefn+32anw1C3K d1IQ== 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 k10-v6si979888pfe.41.2018.08.28.06.22.42; Tue, 28 Aug 2018 06:22:57 -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 S1728132AbeH1RNJ (ORCPT + 99 others); Tue, 28 Aug 2018 13:13:09 -0400 Received: from mail-sz2.amlogic.com ([211.162.65.114]:56048 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbeH1RNJ (ORCPT ); Tue, 28 Aug 2018 13:13:09 -0400 Received: from [10.28.18.79] (10.28.18.79) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 28 Aug 2018 21:21:48 +0800 Subject: Re: [RFC PATCH v2 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller To: Boris Brezillon CC: Yixun Lan , , Rob Herring , Neil Armstrong , Martin Blumenstingl , Richard Weinberger , , Marek Vasut , Jian Hu , Kevin Hilman , Carlo Caione , , Brian Norris , David Woodhouse , , Jerome Brunet References: <20180719094612.5833-1-yixun.lan@amlogic.com> <20180719094612.5833-3-yixun.lan@amlogic.com> <20180801235045.5b4d8211@bbrezillon> <42877a0d-9830-0626-3f64-e49a326eaa3c@amlogic.com> <20180817155608.5929b37a@bbrezillon> <96e538a5-1232-11f2-8b9e-5ddb09dcc2de@amlogic.com> <20180824144810.31c929a5@bbrezillon> From: Liang Yang Message-ID: Date: Tue, 28 Aug 2018 21:21:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20180824144810.31c929a5@bbrezillon> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.28.18.79] 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 Hi Boris, On 8/24/2018 8:48 PM, Boris Brezillon wrote: > On Wed, 22 Aug 2018 22:08:42 +0800 > Liang Yang wrote: > >>> You have to wait tWB, that's for sure. >>> >> we have a maximum 32 commands fifo. when command is written into >> NFC_REG_CMD, it doesn't mean that command is executing right now, maybe >> it is buffering on the queue.Assume one ERASE operation, when 2nd >> command(0xd0) is written into NFC_REG_CMD and then come into >> NAND_OP_WAITRDY_INSTR, if I read the RB status by register, it may be >> wrong because 0xd0 may not being executed. it is unusual unless >> buffering two many command. > > You should flush the queue and wait for it to empty at the end of > ->exec_op(). > >> so it seems that i still need to use nand_soft_waitrdy or wait cmd is >> executed somewhere. > > Don't you have a WAIT_FOR_RB instruction? What is NFC_CMD_RB for? Also, > NFC_CMD_IDLE seems to allow you to add an arbitrary delay, and that's > probably what you should use for tWB. > > em, I can wait for RB by reading the status from register now. but when calling nand_soft_waitrdy, i really met a problem. One *jiffies* is about 4ms. When programming, it pass 1ms to instr->ctx.waitrdy.timeout_ms and nand_soft_waitrdy will be only one *jiffies* to reach timeout. And then calling nand_soft_waitrdy maybe at the tail of 4ms interval, it may only wait 100us and next jiffies arrive. Is it correct? >