Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1715877imm; Fri, 8 Jun 2018 23:46:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKRNqgo834pxHMDBtgu7XJlsXCsCJZt4ivE2fiodF5A/sXe/xkmuj8LYPnvFrT24jwQe98i X-Received: by 2002:a17:902:7c84:: with SMTP id y4-v6mr9782455pll.262.1528526818740; Fri, 08 Jun 2018 23:46:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528526818; cv=none; d=google.com; s=arc-20160816; b=eu+1T1LmS39AjEQV1dpOWxDgF8bSdVfa5F8XPV5euqrnWQZcmwn1Ca3g4tvVslzEEO n+52U5lNVCOYu4hKZj4T8yAwumbbNlqLj393Zqx0kQcen1iDy+F0OvFLQu6X61KqXGOn WGHqG/InOUCAM8d6AbvafK058TomfQF+lg40kJ8fAuYZK7573/RPZ+/QovRIlQFIHVjh 1EZLYI9xitw+8WgOuiQExqc6toU9Gp3/eylHbD3ig6VSN06JbgpaFXcKHVv/8nUebHNf 07OHF9/5j5dS6h65WcngNV22v5EVupdnzyaB6+/JrRKWmKN8AiKc9TtzF9e7EjSwv9eq t54g== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=liQIe9hdUISE/KGyBLtyVPr7BhLM5HVQvmNzyl8bg/8=; b=vOO9f8nofhB9L3TpHOPXChSRTev7gy9SzSB4i44/3OmgeZ5RwjjVRJoXA7wQLQ/+Kl MOwVTDTX8Xb32pIt3uf9MvobB6AnsO8aX/HL/WVgCsXLJRl4TFXOIGGyjOyXVAVwQAZC VJXdYN6XOhUhbZ0BbxCQPVJ3Yljh35iJ+sRgyPQKMTfOfHF/iGzi4nWddWZodSUgezKl vm6HU6Q/2BxUKvrM6CWYJjSV7kMZ3HeQUQ5D7a4JD8oSm+Y1IRmL7LUd93GHpSIodCEd JY1wqsUvF4k83phvwhkorYhb9SMf9sO2BaAivzaPrrHkU6wBkryuiVwSj4CokJjsjJ2G XUrA== 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 z17-v6si14626339pfn.160.2018.06.08.23.46.44; Fri, 08 Jun 2018 23:46:58 -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 S1753178AbeFIGqT (ORCPT + 99 others); Sat, 9 Jun 2018 02:46:19 -0400 Received: from mail.bootlin.com ([62.4.15.54]:50692 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753157AbeFIGqS (ORCPT ); Sat, 9 Jun 2018 02:46:18 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id EE7F7207C0; Sat, 9 Jun 2018 08:46:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 622DD20702; Sat, 9 Jun 2018 08:46:15 +0200 (CEST) Date: Sat, 9 Jun 2018 08:46:15 +0200 From: Boris Brezillon To: Stefan Agner Cc: mark.rutland@arm.com, benjamin.lindqvist@endian.se, pgaikwad@nvidia.com, dev@lynxeye.de, mirza.krak@gmail.com, richard@nod.at, pdeschrijver@nvidia.com, linux-kernel@vger.kernel.org, krzk@kernel.org, jonathanh@nvidia.com, marek.vasut@gmail.com, devicetree@vger.kernel.org, robh+dt@kernel.org, thierry.reding@gmail.com, marcel@ziswiler.com, miquel.raynal@bootlin.com, linux-tegra@vger.kernel.org, linux-mtd@lists.infradead.org, Dmitry Osipenko , computersforpeace@gmail.com, dwmw2@infradead.org Subject: Re: [PATCH v3 4/6] mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver Message-ID: <20180609084615.6fba31ec@bbrezillon> In-Reply-To: <20180609084157.0c2f12e6@bbrezillon> References: <20180531221637.6017-1-stefan@agner.ch> <20180531221637.6017-5-stefan@agner.ch> <20180609075256.725354d6@bbrezillon> <792ee71847f6f4752b8bcba65d22bf81@agner.ch> <20180609084157.0c2f12e6@bbrezillon> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 9 Jun 2018 08:41:57 +0200 Boris Brezillon wrote: > On Sat, 09 Jun 2018 08:23:51 +0200 > Stefan Agner wrote: > > > On 09.06.2018 07:52, Boris Brezillon wrote: > > > On Fri, 08 Jun 2018 23:51:01 +0200 > > > Stefan Agner wrote: > > > > > > > > >> > > > >> > void tegra_nand_controller_reset(struct tegra_nand_controller *ctrl) > > >> > { > > >> > int err; > > >> > > > >> > disable_irq(ctrl->irq); > > >> > > > >> > err = reset_control_reset(ctrl->rst); > > >> > if (err) { > > >> > dev_err(ctrl->dev, "Failed to reset HW: %d\n", err); > > >> > msleep(HW_TIMEOUT); > > >> > } > > >> > > > >> > writel_relaxed(NAND_CMD_STATUS, ctrl->regs + HWSTATUS_CMD); > > >> > writel_relaxed(HWSTATUS_MASK, ctrl->regs + HWSTATUS_MASK); > > >> > writel_relaxed(INT_MASK, ctrl->regs + ISR); > > >> > > >> If we do a controller reset, there is much more state than that which > > >> needs to be restored. A lot of it is not readily available currently > > >> (timing, ECC settings...) > > > > > > This is actually a good test to detect what is not properly initialized > > > by the driver. Timings should be configured correctly through > > > ->setup_data_interface(). ECC engine should be disabled by default and > > > only enabled when ->{read,write}_page() is called. > > > > > > > Is setup_data_interface guaranteed to be called after a failed > > ->exec_op()/{read,write}_page()? > > No. Maybe I misunderstood when tegra_nand_controller_reset() was > supposed to be called. That's something I would call only once, early > in the probe function, so that the controller is placed in a well-known > state before we start using it. Definitely not something you should > call after each error. Note that if you really want to reset the controller after an error, you should also iterate over all chips and call nand_reset() on them.