From patchwork Sun Jun 19 15:01:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 637698 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rXcgp5Lnjz9t0Z for ; Mon, 20 Jun 2016 01:03:34 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=aosc.xyz header.i=@aosc.xyz header.b=WUTkZj/X; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bEeEw-0000ub-3s; Sun, 19 Jun 2016 15:02:22 +0000 Received: from forward10m.cmail.yandex.net ([5.255.216.203]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bEeEk-0000jM-Mw; Sun, 19 Jun 2016 15:02:12 +0000 Received: from smtp3m.mail.yandex.net (smtp3m.mail.yandex.net [IPv6:2a02:6b8:0:2519::125]) by forward10m.cmail.yandex.net (Yandex) with ESMTP id AED9A21564; Sun, 19 Jun 2016 18:01:45 +0300 (MSK) Received: from smtp3m.mail.yandex.net (localhost [127.0.0.1]) by smtp3m.mail.yandex.net (Yandex) with ESMTP id 9E2A027A01BF; Sun, 19 Jun 2016 18:01:43 +0300 (MSK) Received: by smtp3m.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id XkNuwFax3w-1b50HHZk; Sun, 19 Jun 2016 18:01:42 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aosc.xyz; s=mail; t=1466348503; bh=K72BluW+SEoLjpFwiw7ZoRjpm9ZlHjys8890m2rMPPw=; h=From:To:Cc:Subject:Date:Message-Id:X-Mailer; b=WUTkZj/XWYSHXSPTFgRBowbnrEDAMF6AyrvZ6pXV/NLLDfGCXqjtsNaPCZtWHIkw1 ilIVkWEFyDJ7zr7YC/bscuOuxxlTcY9b4POKIvthoAnOi2mTRR/TwCSmrbX2Oq+lmU t+hMneWr7CIBK3p8fKbdSE1jMsPb6Yab2HMIfIOk= Authentication-Results: smtp3m.mail.yandex.net; dkim=pass header.i=@aosc.xyz X-Yandex-ForeignMX: FR X-Yandex-Suid-Status: 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 0, 1 1130000036118848 From: Icenowy Zheng To: maxime.ripard@free-electrons.com, wens@csie.org, boris.brezillon@free-electrons.com Subject: [PATCH v3 2/2] mtd: nand: sunxi: add reset line support Date: Sun, 19 Jun 2016 23:01:28 +0800 Message-Id: <20160619150128.44443-1-icenowy@aosc.xyz> X-Mailer: git-send-email 2.9.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160619_080210_965102_C65D9ADC X-CRM114-Status: GOOD ( 10.79 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [5.255.216.203 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [5.255.216.203 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, richard@nod.at, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, robh+dt@kernel.org, linux-mtd@lists.infradead.org, Icenowy Zheng , computersforpeace@gmail.com, dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The NAND controller on some sun8i chips needs its reset line to be deasserted before they can enter working state. This commit added the reset line process to the driver. Signed-off-by: Icenowy Zheng --- Changes in v1: - Corrected the error checking code of reset line. Changes in v2: - Corrected a more serious error brought in the "fix" of v1. drivers/mtd/nand/sunxi_nand.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c index a83a690..8fb5899 100644 --- a/drivers/mtd/nand/sunxi_nand.c +++ b/drivers/mtd/nand/sunxi_nand.c @@ -39,6 +39,7 @@ #include #include #include +#include #define NFC_REG_CTL 0x0000 #define NFC_REG_ST 0x0004 @@ -269,6 +270,7 @@ struct sunxi_nfc { void __iomem *regs; struct clk *ahb_clk; struct clk *mod_clk; + struct reset_control *reset; unsigned long assigned_cs; unsigned long clk_rate; struct list_head chips; @@ -1871,6 +1873,20 @@ static int sunxi_nfc_probe(struct platform_device *pdev) if (ret) goto out_ahb_clk_unprepare; + nfc->reset = devm_reset_control_get_optional(dev, "ahb"); + + if (!IS_ERR(nfc->reset)) { + ret = reset_control_deassert(nfc->reset); + if (ret) { + dev_err(dev, "reset err %d\n", ret); + goto out_mod_clk_unprepare; + } + } + else { + if (PTR_ERR(nfc->reset) != -ENOENT) + return PTR_ERR(nfc->reset); + } + ret = sunxi_nfc_rst(nfc); if (ret) goto out_mod_clk_unprepare;