From patchwork Wed Mar 22 14:07:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95757 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233154obz; Wed, 22 Mar 2017 07:10:32 -0700 (PDT) X-Received: by 10.98.198.78 with SMTP id m75mr46369866pfg.160.1490191831995; Wed, 22 Mar 2017 07:10:31 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id u26si1979985pge.31.2017.03.22.07.10.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:10:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=IYv9SAVh5CTMzChI2WmvkJrozpb2wBNNi6cfg1ZwO+s=; b=jwe8j1hZ1JL/arF3GNiA+9TLKd 7aLC+EYV8FmiX4DcIA958gxc1XDxMOEh1M0OA4bfRKzUXOl41H9R/GGalO5dDQYeYy5mTNJPd6CpR CQQJJ62eBfbdv0fqw6AsKQeltjBSyPygQs4lxan+J/vUHhNdJzzGuiWD9XRGyq5xGgwvqgMpEff93 GrUngk1NHJmV2vSsQmcfiMPbU9OY1kdhXSICY93w7QwwOnmdpyYGNqkVhv7to+AJgOBbCL9TBZJp1 nqsENSTXmga8Z5aG7IgGYU436pU/okgzqhzT3d5PYjsyKvuUnMps70O2ZvX5ZQnYaB8LAVcoLExAV wak964dA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgy1-0008Ix-SG; Wed, 22 Mar 2017 14:10:25 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgwz-0005uE-1y for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:29 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDK010154; Wed, 22 Mar 2017 23:08:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDK010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191704; bh=K5pAGjBBkTdjVGiDIObZj3HixB3zRpLnJkyh+7jwstc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkMnUgzg2DZ6JDuxWcMAJdDPK4vgOvo1gyGqHLwFBtx4rWyMjMNXJG2SWB4Z1H6L8 A88b55RIg22DRzmOQQuFxnzv7yUIitoD5SfWaADPGOsQi9En+XtiqZ6bTIHkJhEqUU 1elEs/IOz+/V6ECPkOucSB10MiPatBizdUVJ3W7xU5bQ0dtqHkEUC2NCrstl/EBZgu M5fCg8UY7uI2jEfCP60StujMFq6S3TM2qeCjhwBCBsd8mYNkh+WAnjfhZ6Yi+vJVVF XxIVfY96kY8U/onHDos+EmjE0WGhHnyoN566ky2dFfQX+Vc4HvvyFBynk9l0MNKHSi iKY6YnkBreLmA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 01/53] mtd: nand: allow to set only one of ECC size and ECC strength from DT Date: Wed, 22 Mar 2017 23:07:08 +0900 Message-Id: <1490191680-14481-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070921_612702_4C21456C X-CRM114-Status: GOOD ( 11.04 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Currently, it is valid to specify both "nand-ecc-step-size" and "nand-ecc-strength", but not allowed to set only one of them. This requirement has a conflict with "nand-ecc-maximize"; this flag is used when you want the driver to choose the best ECC strength. If "nand-ecc-maximize" is set, "nand-ecc-strength" is very likely to be unset. It would be possible to make the if-conditional more complex by adding the check for the NAND_ECC_MAXIMIZE flag, but I chose to drop the check entirely. I thought of the situation where the hardware has a fixed ECC step size (so it can be hard-coded in the driver), whereas the ECC strength is configurable by software. In that case, we may want to only set "nand-ecc-strength" (or "nand-ecc-maximize") in DT. Signed-off-by: Masahiro Yamada --- The Denali NAND is the case. The ecc.size is fixed when the RTL is delivered, while the driver can choose ecc.strength from some supported values. For Intel and Altera, available ecc.strength are 8, 15. For Socionext UniPhier, available ecc.strength are 8, 16, 24. Changes in v2: None drivers/mtd/nand/nand_base.c | 6 ------ 1 file changed, 6 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index b0524f8..a3c0f47 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4333,12 +4333,6 @@ static int nand_dt_init(struct nand_chip *chip) ecc_strength = of_get_nand_ecc_strength(dn); ecc_step = of_get_nand_ecc_step_size(dn); - if ((ecc_step >= 0 && !(ecc_strength >= 0)) || - (!(ecc_step >= 0) && ecc_strength >= 0)) { - pr_err("must set both strength and step size in DT\n"); - return -EINVAL; - } - if (ecc_mode >= 0) chip->ecc.mode = ecc_mode; From patchwork Wed Mar 22 14:07:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95771 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp260549qgd; Wed, 22 Mar 2017 07:16:29 -0700 (PDT) X-Received: by 10.99.161.17 with SMTP id b17mr44207028pgf.72.1490192189560; Wed, 22 Mar 2017 07:16:29 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id a5si1972103pgg.258.2017.03.22.07.16.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:16:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EGMOIJ9UaHISLHpncgeU+6pRUTGr/+gUitkdInJ6Gno=; b=lcwj7z1blpYQ1lrzvOuUFxp100 pqdYR2DjT09O2+X9k9MN5AAhvGFCXF+q1aUYFjegit7hGKWTrK5Se/Iq5nezoYElLtpcRLXAvmvvk VfIXUmrvIr3ekeKQIO8kSdsVy7fibb/BrtOV7a6V+gjYIkbZB5Cvac/5dmFLLp9BVMQ2MMblCpt8K 32zpo/4LuKH5ki+mpIWsiY9YwOMleRVkuIE3xVVJmiiBX12BOUnx4DWp5PDGgcWxECL9YCPq8yfWn l46qows+1Sx3jk1uM4ArG/3lZTPw1NdURkP0DP+ZSan9Vp4gZAm9CcYJW/P00WoC5rgPLbsj6EOrg D7lMe76Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqh3p-0006uk-0G; Wed, 22 Mar 2017 14:16:25 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgwz-0005uF-1x for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:25 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDL010154; Wed, 22 Mar 2017 23:08:24 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDL010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191706; bh=aC+G4L1ivWCzubp/gZ1RMNCmminZYxtmKyRD5jPgu2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1sIZKG6kbj5WqaoDkWexBPnERx4MB+KYz5Wa/eTTUKFtfTQFCGvBn974t07KkM8ek noMG8aZ9KDxZu5D1jhRsdMwbsJUQ+Xg73uapiwnWTstB4qpaTFjeVCB0bvO6YjLGQA zLo3fjAnPV0mp8/ZyWwaix7X5YJBhuxNcZa8Sqetii+Bd5zPl9Z0b5Um6QsSav35Ww 4FyRMZujC8uDUXMBSrpzbRU9oGc63Kh2Tn/EAxQosIj4ihXdaVi019OIpqXUdeEGbD WjUVSm+fZ+3AT9nwVh6e9tzP6yFsx75xZB9JHGgPgyNRduC89jeGgUIXh1BAHgJJAC PdEkedC8Ve4yw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 02/53] mtd: nand: use read_oob() instead of cmdfunc() for bad block check Date: Wed, 22 Mar 2017 23:07:09 +0900 Message-Id: <1490191680-14481-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070921_644827_C2CD4A8E X-CRM114-Status: GOOD ( 13.55 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The nand_default_block_markbad() and scan_block_fast() use high level APIs to get access to the BBM. On the other hand, nand_block_bad (the default implementation of ->block_bad) calls the lower level ->cmdfunc hook. This prevents drivers from using ->ecc.read_oob() even if optimized read operation is implemented. Besides, some NAND controllers may protect the BBM with ECC. Signed-off-by: Masahiro Yamada --- Changes in v2: - Error out immediately if the first page access fails - Use for() {} instead of do {} while() - Update git-log drivers/mtd/nand/nand_base.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index a3c0f47..807398d 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -354,40 +354,32 @@ static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len) */ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs) { - int page, res = 0, i = 0; + int page, page_end, res; struct nand_chip *chip = mtd_to_nand(mtd); - u16 bad; + u8 bad; if (chip->bbt_options & NAND_BBT_SCANLASTPAGE) ofs += mtd->erasesize - mtd->writesize; page = (int)(ofs >> chip->page_shift) & chip->pagemask; + page_end = page + (chip->bbt_options & NAND_BBT_SCAN2NDPAGE ? 2 : 1); - do { - if (chip->options & NAND_BUSWIDTH_16) { - chip->cmdfunc(mtd, NAND_CMD_READOOB, - chip->badblockpos & 0xFE, page); - bad = cpu_to_le16(chip->read_word(mtd)); - if (chip->badblockpos & 0x1) - bad >>= 8; - else - bad &= 0xFF; - } else { - chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos, - page); - bad = chip->read_byte(mtd); - } + for (; page < page_end; page++) { + res = chip->ecc.read_oob(mtd, chip, page); + if (res) + return res; + + bad = chip->oob_poi[chip->badblockpos]; if (likely(chip->badblockbits == 8)) res = bad != 0xFF; else res = hweight8(bad) < chip->badblockbits; - ofs += mtd->writesize; - page = (int)(ofs >> chip->page_shift) & chip->pagemask; - i++; - } while (!res && i < 2 && (chip->bbt_options & NAND_BBT_SCAN2NDPAGE)); + if (res) + return res; + } - return res; + return 0; } /** From patchwork Wed Mar 22 14:07:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95772 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp260668qgd; Wed, 22 Mar 2017 07:16:41 -0700 (PDT) X-Received: by 10.84.212.8 with SMTP id d8mr56346721pli.152.1490192201128; Wed, 22 Mar 2017 07:16:41 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id v198si1976320pgb.216.2017.03.22.07.16.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:16:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=22wiIQKooSFSHh/B4+rz341BmnfhvTholPQ9CE2t3qM=; b=pZXnq7WePdeCKZmVxmWDaSarD0 LF2KMWpKZrYxi28KXA/mJdxHAKXj3ZPOdCFf9HGU8Gu4cmGmXF/GdLegsl824y3nC+NB8gbmqU1Xq 7gD0sLJy0wmzW75h2uxeH2Y5/nBvJpjDg102GGWp110T7nEwLCgqHlhYf6ubpCh485R7IsYYyJ48b PbZCHiNPzHUILOPCvao9tNJnh7rljQjo/D0EDKSf9QY884vy1Vv+Al/yhqweFurJd1lSKMNAMyrDP 5qQ2Glxt9tc0Q5jbPxKYW+frF2e9Yj4Bwx3B2ZqIjbkj9m/ncPust3JwMbUkqqIAosaOkXxBhsHOT C7qDXLDw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqh3z-0007Br-Pb; Wed, 22 Mar 2017 14:16:35 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgwz-0005uG-1v for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:27 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDM010154; Wed, 22 Mar 2017 23:08:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDM010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191707; bh=AgQh8cQ7AIUaLNdb66J9JNb3uPC28UDXxgRvfI70kZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qY9ja5fWt5yt1aZMOHG7m3D45JsqaQLrGHDsMRW0Q8SOgjaO9+sI1XitvAvzCDnki dxSDhm7Tjk7fsAOUk6y+I1FgUobKiBCVWcz+DO+f7GOO46xTrTC2c7Rgg1Bz+fuWbm dJgY0RltxTxbEXB0RBKaHE3BdkxnqZJrqsSa1epKxz6JVNt6b9iXLJ1OHrnLC6JfMl NTpq1kCDxRRVxlqaKmTnzLUZnXx8xgpuqle+B0MqDbcURtNnK4gZZbgwAL+RUt3AMX 4rL1/043LO5gDxhIz1qlzQlKGH0lEOFwGwU19bH6HTCVQeqOGwmkm9QNlP+/Du2wIE JrXb44ZEi+8hQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 03/53] mtd: nand: denali: remove unused CONFIG option and macros Date: Wed, 22 Mar 2017 23:07:10 +0900 Message-Id: <1490191680-14481-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070921_709705_9CA5D33C X-CRM114-Status: GOOD ( 12.86 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org All of these macros are not used at all. CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR is not used for anything but defining SCRATCH_REG_ADDR. The config option should go away as well. I am removing some register macros. They are not used, and do not exist in recent IP versions. Signed-off-by: Masahiro Yamada --- Changes in v2: - Remove more unused macros drivers/mtd/nand/Kconfig | 11 ------ drivers/mtd/nand/denali.c | 5 --- drivers/mtd/nand/denali.h | 99 ----------------------------------------------- 3 files changed, 115 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 6d4d567..817558b 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -60,17 +60,6 @@ config MTD_NAND_DENALI_DT Enable the driver for NAND flash on platforms using a Denali NAND controller as a DT device. -config MTD_NAND_DENALI_SCRATCH_REG_ADDR - hex "Denali NAND size scratch register address" - default "0xFF108018" - depends on MTD_NAND_DENALI_PCI - help - Some platforms place the NAND chip size in a scratch register - because (some versions of) the driver aren't able to automatically - determine the size of certain chips. Set the address of the - scratch register here to enable this feature. On Intel Moorestown - boards, the scratch register is at 0xFF108018. - config MTD_NAND_GPIO tristate "GPIO assisted NAND Flash driver" depends on GPIOLIB || COMPILE_TEST diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 73b9d4e..f993e13 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -91,11 +91,6 @@ static inline struct denali_nand_info *mtd_to_denali(struct mtd_info *mtd) #define DENALI_READ 0 #define DENALI_WRITE 0x100 -/* types of device accesses. We can issue commands and get status */ -#define COMMAND_CYCLE 0 -#define ADDR_CYCLE 1 -#define STATUS_CYCLE 2 - /* * this is a helper macro that allows us to * format the bank into the proper bits for the controller diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index ea22191..c4f3a68 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h @@ -257,26 +257,6 @@ #define ERR_PAGE_ADDR(__bank) (0x440 + ((__bank) * 0x50)) #define ERR_BLOCK_ADDR(__bank) (0x450 + ((__bank) * 0x50)) -#define DATA_INTR 0x550 -#define DATA_INTR__WRITE_SPACE_AV 0x0001 -#define DATA_INTR__READ_DATA_AV 0x0002 - -#define DATA_INTR_EN 0x560 -#define DATA_INTR_EN__WRITE_SPACE_AV 0x0001 -#define DATA_INTR_EN__READ_DATA_AV 0x0002 - -#define GPREG_0 0x570 -#define GPREG_0__VALUE 0xffff - -#define GPREG_1 0x580 -#define GPREG_1__VALUE 0xffff - -#define GPREG_2 0x590 -#define GPREG_2__VALUE 0xffff - -#define GPREG_3 0x5a0 -#define GPREG_3__VALUE 0xffff - #define ECC_THRESHOLD 0x600 #define ECC_THRESHOLD__VALUE 0x03ff @@ -331,69 +311,15 @@ #define CHNL_ACTIVE__CHANNEL2 0x0004 #define CHNL_ACTIVE__CHANNEL3 0x0008 -#define ACTIVE_SRC_ID 0x800 -#define ACTIVE_SRC_ID__VALUE 0x00ff - -#define PTN_INTR 0x810 -#define PTN_INTR__CONFIG_ERROR 0x0001 -#define PTN_INTR__ACCESS_ERROR_BANK0 0x0002 -#define PTN_INTR__ACCESS_ERROR_BANK1 0x0004 -#define PTN_INTR__ACCESS_ERROR_BANK2 0x0008 -#define PTN_INTR__ACCESS_ERROR_BANK3 0x0010 -#define PTN_INTR__REG_ACCESS_ERROR 0x0020 - -#define PTN_INTR_EN 0x820 -#define PTN_INTR_EN__CONFIG_ERROR 0x0001 -#define PTN_INTR_EN__ACCESS_ERROR_BANK0 0x0002 -#define PTN_INTR_EN__ACCESS_ERROR_BANK1 0x0004 -#define PTN_INTR_EN__ACCESS_ERROR_BANK2 0x0008 -#define PTN_INTR_EN__ACCESS_ERROR_BANK3 0x0010 -#define PTN_INTR_EN__REG_ACCESS_ERROR 0x0020 - -#define PERM_SRC_ID(__bank) (0x830 + ((__bank) * 0x40)) -#define PERM_SRC_ID__SRCID 0x00ff -#define PERM_SRC_ID__DIRECT_ACCESS_ACTIVE 0x0800 -#define PERM_SRC_ID__WRITE_ACTIVE 0x2000 -#define PERM_SRC_ID__READ_ACTIVE 0x4000 -#define PERM_SRC_ID__PARTITION_VALID 0x8000 - -#define MIN_BLK_ADDR(__bank) (0x840 + ((__bank) * 0x40)) -#define MIN_BLK_ADDR__VALUE 0xffff - -#define MAX_BLK_ADDR(__bank) (0x850 + ((__bank) * 0x40)) -#define MAX_BLK_ADDR__VALUE 0xffff - -#define MIN_MAX_BANK(__bank) (0x860 + ((__bank) * 0x40)) -#define MIN_MAX_BANK__MIN_VALUE 0x0003 -#define MIN_MAX_BANK__MAX_VALUE 0x000c - - -/* ffsdefs.h */ -#define CLEAR 0 /*use this to clear a field instead of "fail"*/ -#define SET 1 /*use this to set a field instead of "pass"*/ #define FAIL 1 /*failed flag*/ #define PASS 0 /*success flag*/ -#define ERR -1 /*error flag*/ - -/* lld.h */ -#define GOOD_BLOCK 0 -#define DEFECTIVE_BLOCK 1 -#define READ_ERROR 2 #define CLK_X 5 #define CLK_MULTI 4 -/* KBV - Updated to LNW scratch register address */ -#define SCRATCH_REG_ADDR CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR -#define SCRATCH_REG_SIZE 64 - -#define GLOB_HWCTL_DEFAULT_BLKS 2048 - #define SUPPORT_15BITECC 1 #define SUPPORT_8BITECC 1 -#define CUSTOM_CONF_PARAMS 0 - #define ONFI_BLOOM_TIME 1 #define MODE5_WORKAROUND 0 @@ -403,31 +329,6 @@ #define MODE_10 0x08000000 #define MODE_11 0x0C000000 - -#define DATA_TRANSFER_MODE 0 -#define PROTECTION_PER_BLOCK 1 -#define LOAD_WAIT_COUNT 2 -#define PROGRAM_WAIT_COUNT 3 -#define ERASE_WAIT_COUNT 4 -#define INT_MONITOR_CYCLE_COUNT 5 -#define READ_BUSY_PIN_ENABLED 6 -#define MULTIPLANE_OPERATION_SUPPORT 7 -#define PRE_FETCH_MODE 8 -#define CE_DONT_CARE_SUPPORT 9 -#define COPYBACK_SUPPORT 10 -#define CACHE_WRITE_SUPPORT 11 -#define CACHE_READ_SUPPORT 12 -#define NUM_PAGES_IN_BLOCK 13 -#define ECC_ENABLE_SELECT 14 -#define WRITE_ENABLE_2_READ_ENABLE 15 -#define ADDRESS_2_DATA 16 -#define READ_ENABLE_2_WRITE_ENABLE 17 -#define TWO_ROW_ADDRESS_CYCLES 18 -#define MULTIPLANE_ADDRESS_RESTRICT 19 -#define ACC_CLOCKS 20 -#define READ_WRITE_ENABLE_LOW_COUNT 21 -#define READ_WRITE_ENABLE_HIGH_COUNT 22 - #define ECC_SECTOR_SIZE 512 struct nand_buf { From patchwork Wed Mar 22 14:07:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95752 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp232702obz; Wed, 22 Mar 2017 07:09:33 -0700 (PDT) X-Received: by 10.84.231.135 with SMTP id g7mr34888805plk.12.1490191773088; Wed, 22 Mar 2017 07:09:33 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id r17si1940800pgg.388.2017.03.22.07.09.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:09:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hifJ66O6o3bJsC2wyKTzaYyKMmuSU05XsZaI3M5W+EE=; b=n70B4vzFoaUNGL3icA5o4VUCrh LlJMlYAVgFRDpmBTic2OjW2dyWUA1uAWwGcZoAzBoG6sX2Bn7HNjk220p/kDdKqxhqSSlWe8xzeTr kqAAhr4OMnc5eSSOo4tmzER9XoQS70vf4Y+1Sn8ivzsB2zkfKzzLRq2oFtzI7ROGSr98GY1HJ4Pfj AzGwOLImbVIL9YAJn7nV01fqkq70bseTLuKW50ZzJPAD+aQz2aOraKfH8moFYajz8rX398018B3WP iqaP3ebCsqrFWAfQVdyVR5ZjixYTRbdDr5PUz9BEdrZTKKcHd+6yMr+6bjPuKXMT+piIZESIBfC+F 1GL5s0ZA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgx5-00064A-4V; Wed, 22 Mar 2017 14:09:27 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgwz-0005uH-1w for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:25 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDN010154; Wed, 22 Mar 2017 23:08:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDN010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191708; bh=kVnKMF1bU+yPNN1ErYOgKoEpFhCR98uosgBtITbRHQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IjaNMnS8H6mynOQfkgjqPfizNkXTLcLyFxpjB0XSoyUEJVps6+rdhKcw//P9JHIZE K5PKfqmuK1eQtpqqXohaf40eC2tuzFMJ6Xpqt5r2PdYKDQZGibn03FFxNJ8RdqVpVg TA6sbtf5VXH/+UzAERIfvrn6LjDalcXovQG4sgjFhBi3ASI6qV94lhw+Y+dZxDDgeG kQ8zW9OZy9FhEV2VObGQWRcZNywDKDGRHnVOcZ8buhBpGlKNkqbujv1REcmuktoXLT 1tzvS6x6JaYh64bIvbble2HFVS6F0ao/qtox1GqmqBuisjEKRlTtVTxEORUbZhNF1R kHHnDHHvrkgyA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 04/53] mtd: nand: denali: remove redundant define of BANK(x) Date: Wed, 22 Mar 2017 23:07:11 +0900 Message-Id: <1490191680-14481-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070921_674328_23B14127 X-CRM114-Status: UNSURE ( 7.75 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org This macro is defined twice in denali.c (around line 98 and line 651), so remove the second one. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali.c | 1 - 1 file changed, 1 deletion(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index f993e13..c9806e6 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -648,7 +648,6 @@ static irqreturn_t denali_isr(int irq, void *dev_id) spin_unlock(&denali->irq_lock); return result; } -#define BANK(x) ((x) << 24) static uint32_t wait_for_irq(struct denali_nand_info *denali, uint32_t irq_mask) { From patchwork Wed Mar 22 14:07:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95754 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp232940obz; Wed, 22 Mar 2017 07:10:03 -0700 (PDT) X-Received: by 10.98.15.145 with SMTP id 17mr35177506pfp.183.1490191803640; Wed, 22 Mar 2017 07:10:03 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id p6si1947822pgd.368.2017.03.22.07.10.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:10:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=aiUQYQQOT+18hZdecTbWo0frJguOFMJuZxnVoyShHCw=; b=Y/z4TYSL9u38LCaN9y/MV8WURR rLPAnzf3RAxjKZhWaE2lJ9QJBS0Fgqsc8h+JovnKhS2++tSMk+2Hd2ZfMtoYGzS4Vm7HN86qwYEMO cfFMju1XVgDS6e8QS4BOHeRFc9wwBjzn+XUd1fYMQfM0L/0sbxTmul+QcMzvlkxPO+HuPeJK+sxQM I2E37iPkX6I+fhFX0ucpU4ntYtZNRnc54kFvtu/iMKzn90pCrUdXktKJNKP0A1psRW/VW15k3K2wq DGGvQodm3ebmLdgIUaKSOcMUUlOrUQm1JVcs19nn3Hztzwra2cZxBL1aV8TNGFpRD9vj6AIdvlF16 C+QUE7DQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxZ-0006b7-Qm; Wed, 22 Mar 2017 14:09:57 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgx3-0005xA-N7 for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:30 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDO010154; Wed, 22 Mar 2017 23:08:29 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDO010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191710; bh=M22zm3PWk0stckUN7PtyKOfWrIezQpbscJWx9KlHXuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EoQK8r7VBPPPMlKQk9ehVOOBlbdwRz+pCXI64gFCH4uIB6Yg/SGLr9RrgicB60FKF kJYW2FrRDDkCouBhazc7aOunsfyLuVpNzwLwuIGUUvILmjounSJXif3CBRVzT4Ye/0 27jTUGeyn7ygeQDhnZvluUpPksaZ8JkuuG+uKfjWuB1dhd2xk3LOC43A+fx6Pzc9lB J0/No5bZzr1OPvgI38EK9vS/gs6H3S70ofp3rFknnpG7xERc1kycROdm2xWUkMDiez EovDjRD9PdDmh27xEg01zxD9CZBPoapALWdODpxSHRwfxv2u3ukzPBpwSm0tFwj99g 3EQ151vY15vSg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 05/53] mtd: nand: denali: remove more unused struct members Date: Wed, 22 Mar 2017 23:07:12 +0900 Message-Id: <1490191680-14481-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070926_148880_15A97006 X-CRM114-Status: UNSURE ( 7.78 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org These members are not used at all. Signed-off-by: Masahiro Yamada --- Changes in v2: - Add git description drivers/mtd/nand/denali.h | 2 -- 1 file changed, 2 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index c4f3a68..6573ea5 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h @@ -350,7 +350,6 @@ struct denali_nand_info { struct nand_buf buf; struct device *dev; int total_used_banks; - uint32_t block; /* stored for future use */ uint16_t page; void __iomem *flash_reg; /* Mapped io reg base address */ void __iomem *flash_mem; /* Mapped io reg base address */ @@ -359,7 +358,6 @@ struct denali_nand_info { struct completion complete; spinlock_t irq_lock; uint32_t irq_status; - int irq_debug_array[32]; int irq; uint32_t devnum; /* represent how many nands connected */ From patchwork Wed Mar 22 14:07:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95753 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp232826obz; Wed, 22 Mar 2017 07:09:47 -0700 (PDT) X-Received: by 10.84.173.4 with SMTP id o4mr56519515plb.106.1490191787190; Wed, 22 Mar 2017 07:09:47 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id p17si1974878pgi.67.2017.03.22.07.09.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:09:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=cFiKhxZcc3DkqABmDBl72SEMaNolQgZ3BZauZ6mJuTU=; b=X6hpvrErayt+/RS3Hlq3VrwFqF lYKtxCdJjS1ktk9GLZPP2m3j6tEhXq7Kw28zkN6IYDkcxyvGMqBn2+UiqF1ZGfuX/0XNQNI69yGAl dimt0UosqxngTYOrNlGHbOpG44rAbWx0PuY+nUi7d+7DXYJRSpRVVLYwol7zH44pxHur5zEfoElRk cT+Zn5f5lLx4IDZOONVmIa5QW3FM1kB6b+Vv8DY8H8rSCu7dcTkqG32VtxqYo5B9EA0B9lBBNG6ZL 0gCR4riqBkbfDUvh45F6/3nvVMcD/cj+8SR4QNu6I50DpFN5tb9jzi2bP4lu215OZdhaX0/IKU7vz yXaseOGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxL-0006Kv-Rd; Wed, 22 Mar 2017 14:09:43 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgx3-0005xD-N9 for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:27 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDS010154; Wed, 22 Mar 2017 23:08:35 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDS010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191717; bh=6+m75OZlPBI+hfQ0sp61KS0/EN+hKn2K4d9pI5zhNHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OVC0aQ7rmOBqztL+5lSoeKyPfsBLMhRldYG8ZniEsIg3pm2uZW/bFb+gmwRlzUj03 tYbfJzV80AO+ar3lYooJGHeW8jCVDD4p0iNo6ASHUIEEsyR1bVlIMxpbTXjN3JXPT4 9Fi6Feizk2GScVBJwvPibzmlhkxkpLSJAPXaenVYO6z0CpGBr+VI5WMSXQ+Mk68rHb KUXjNGP+e+xc1IrtYfa4xGJa9e6m+xYBKO2N06hDK6kdoPPs2iy/JuOUOuVE4yDwim sR0m3THuMqa4Y/Byoj1+qdb+TVSTlycsjpVGM5bpjBrbKwmtvrwaGJrzVrsIrAvj1d QAeiUOmYbtbQw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 09/53] mtd: nand: denali: use int where no reason to use fixed width variable Date: Wed, 22 Mar 2017 23:07:16 +0900 Message-Id: <1490191680-14481-10-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070926_131686_4D8CC17C X-CRM114-Status: UNSURE ( 9.31 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The page number is generally stored in an integer type variable. The uint16_t does not have enough width. I see no reason to use uint32_t for other members, either. Just use int. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index eed001d..7b2d785 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h @@ -325,7 +325,7 @@ struct denali_nand_info { struct nand_buf buf; struct device *dev; int total_used_banks; - uint16_t page; + int page; void __iomem *flash_reg; /* Register Interface */ void __iomem *flash_mem; /* Host Data/Command Interface */ @@ -335,9 +335,9 @@ struct denali_nand_info { uint32_t irq_status; int irq; - uint32_t devnum; /* represent how many nands connected */ - uint32_t bbtskipbytes; - uint32_t max_banks; + int devnum; /* represent how many nands connected */ + int bbtskipbytes; + int max_banks; unsigned int caps; }; From patchwork Wed Mar 22 14:07:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95755 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233033obz; Wed, 22 Mar 2017 07:10:18 -0700 (PDT) X-Received: by 10.98.96.65 with SMTP id u62mr46989360pfb.219.1490191817597; Wed, 22 Mar 2017 07:10:17 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id b31si1954063pli.254.2017.03.22.07.10.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:10:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=zafh2ykx1rRX+t4kuGwsUSKFheJv1jW+5Zs9iGoktmE=; b=Z0rg/CAGJOCD1PuKLZWnzoeq16 N9g0ICU2L8q7h0snV8qt+9jvy+Pn7G0eWtf2sGpGM5U6NsGlAy1CTxO3nu21t5eCc9a16DtHk1vTD rJyD0WvzfUQSdfYnbYDtzPhiPHlZaN+b6q/W78VNdeUNQgMO+gQ/qJUNxpfMx583hBdKVtfInb6JA wCDxTEovAk0sEGzuf7iq69fOANDCw0uZP3diPAqFrHHoTLEkBUrQohCAy2Mk6irG9gEQJ3c2/xOuQ 3E1eD1LJiCsCIDgQC91tWYUIaA2PwbmiR9U4kD/Imbk7LXXGOWD0hQPqlnlV9BrLyyw8i7nia52gv qSwVKZGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxq-00083z-Hj; Wed, 22 Mar 2017 14:10:14 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgx3-0005xG-OS for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:28 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDV010154; Wed, 22 Mar 2017 23:08:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDV010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191721; bh=bIjoQT1mwHplizobDSyXhZ4bT5hlB/Yxmrw0Og+ZLJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bn9oLcmronCGJAzpV2vY3/9pvR2M6M/sCiJfwHLOHXDORXcVziP16muw+V/YsvQ64 wXlgQYBNETTGJ4k/ODiEGQY1A6wU9h8YkHJWZjW2oHDE0BkZx+4zkn9+36W0eV2jZO A2JPUR6DSewSf0R8SbDLkkzYTg8xEdg061n0D6rOedkc+BpqkzLQ7kg4Xau2EK9sMv KDHyFAJ7+5734gN0HaUMU0ycIOfamtnp9wlvSaP+ehfZkg3SMQaDs/4c1lBjsRitxh ovOo+M2hkxnXdWGZnjOJ+UnerJMMkuvjpoPGdtOaC0rKOTgcye3L8974ksn4iHI6NL jkSkR4ugWWoOA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 12/53] mtd: nand: denali: support HW_ECC_FIXUP capability Date: Wed, 22 Mar 2017 23:07:19 +0900 Message-Id: <1490191680-14481-13-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070926_163158_DF90803A X-CRM114-Status: GOOD ( 19.99 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Some old versions of the Denali IP (perhaps used only for Intel?) detects ECC errors and provides correct data via a register, but does not touch the transferred data. So, the software must fixup the data in the buffer according to the provided ECC correction information. Newer versions perform ECC correction before transferring the data. No more software intervention is needed. The ECC_ERROR_ADDRESS and ECC_CORRECTION_INFO registers were deprecated. Instead, the number of corrected bit-flips can be read from the ECC_COR_INFO register. When an uncorrectable ECC error happens, a status flag is set to the INTR_STATUS and ECC_COR_INFO registers. As is often the case with this IP, the register view of INTR_STATUS had broken compatibility. For older versions (SW ECC fixup): bit 0: ECC_TRANSACTION_DONE bit 1: ECC_ERR For newer versions (HW ECC fixup): bit 0: ECC_UNCOR_ERR bit 1: Reserved Due to this difference, the irq_mask must be fixed too. The comment block in handle_ecc() has been moved to the common part because the comment applies to both cases. The existing handle_ecc() has been renamed to denali_sw_ecc_fixup() for clarification. The U-Boot port of this driver already supports the HW ECC fixup. I borrowed the comment "Some versions of ..." in denali.h from U-Boot. Signed-off-by: Masahiro Yamada --- Changes in v2: - Change the capability prefix DENALI_CAPS_ -> DENALI_CAP_ drivers/mtd/nand/denali.c | 52 ++++++++++++++++++++++++++++++++++++----------- drivers/mtd/nand/denali.h | 14 +++++++++++++ 2 files changed, 54 insertions(+), 12 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 608fe6f..91f0def 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -883,6 +883,32 @@ static void read_oob_data(struct mtd_info *mtd, uint8_t *buf, int page) } } +static int denali_hw_ecc_fixup(struct mtd_info *mtd, + struct denali_nand_info *denali) +{ + int bank = denali->flash_bank; + uint32_t ecc_cor; + unsigned int max_bitflips; + + ecc_cor = ioread32(denali->flash_reg + ECC_COR_INFO(bank)); + ecc_cor >>= ECC_COR_INFO__SHIFT(bank); + + if (ecc_cor & ECC_COR_INFO__UNCOR_ERR) + return -EBADMSG; + + max_bitflips = ecc_cor & ECC_COR_INFO__MAX_ERRORS; + + /* + * The register holds the maximum of the number of corrected bitflips + * per sector. This can be returned from ecc->read_page() as-is. + * Unfortunately, we can not know the total number of corrected bits + * in the page. mtd->ecc_stats.corrected is compromised here. + */ + mtd->ecc_stats.corrected += max_bitflips; + + return max_bitflips; +} + #define ECC_SECTOR_SIZE 512 #define ECC_SECTOR(x) (((x) & ECC_ERROR_ADDRESS__SECTOR_NR) >> 12) @@ -892,8 +918,8 @@ static void read_oob_data(struct mtd_info *mtd, uint8_t *buf, int page) #define ECC_ERR_DEVICE(x) (((x) & ERR_CORRECTION_INFO__DEVICE_NR) >> 8) #define ECC_LAST_ERR(x) ((x) & ERR_CORRECTION_INFO__LAST_ERR_INFO) -static int handle_ecc(struct mtd_info *mtd, - struct denali_nand_info *denali, uint8_t *buf) +static int denali_sw_ecc_fixup(struct mtd_info *mtd, + struct denali_nand_info *denali, uint8_t *buf) { unsigned int bitflips = 0; unsigned int max_bitflips = 0; @@ -921,11 +947,6 @@ static int handle_ecc(struct mtd_info *mtd, bitflips = 0; if (ECC_ERROR_UNCORRECTABLE(err_cor_info)) { - /* - * if the error is not correctable, need to look at the - * page to see if it is an erased page. if so, then - * it's not a real ECC error - */ ret = -EBADMSG; } else if (err_byte < ECC_SECTOR_SIZE) { /* @@ -1105,12 +1126,12 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip, uint8_t *buf, int oob_required, int page) { struct denali_nand_info *denali = mtd_to_denali(mtd); - dma_addr_t addr = denali->buf.dma_buf; size_t size = mtd->writesize + mtd->oobsize; - uint32_t irq_status; - uint32_t irq_mask = INTR__ECC_TRANSACTION_DONE | INTR__ECC_ERR; + uint32_t irq_mask = denali->caps & DENALI_CAP_HW_ECC_FIXUP ? + INTR__DMA_CMD_COMP | INTR__ECC_UNCOR_ERR : + INTR__ECC_TRANSACTION_DONE | INTR__ECC_ERR; int stat = 0; if (page != denali->page) { @@ -1135,11 +1156,18 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip, memcpy(buf, denali->buf.buf, mtd->writesize); - if (irq_status & INTR__ECC_ERR) - stat = handle_ecc(mtd, denali, buf); + if (denali->caps & DENALI_CAP_HW_ECC_FIXUP) + stat = denali_hw_ecc_fixup(mtd, denali); + else if (irq_status & INTR__ECC_ERR) + stat = denali_sw_ecc_fixup(mtd, denali, buf); denali_enable_dma(denali, false); if (stat == -EBADMSG) { + /* + * If the error is not correctable, need to look at the page to + * see if it is an erased page. If so, then it's not a real ECC + * error. + */ read_oob_data(mtd, chip->oob_poi, denali->page); stat = nand_check_erased_ecc_chunk( diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index 7b2d785..ed42b16 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h @@ -20,6 +20,7 @@ #ifndef __DENALI_H__ #define __DENALI_H__ +#include #include #define DEVICE_RESET 0x0 @@ -218,6 +219,13 @@ #define INTR_STATUS(__bank) (0x410 + ((__bank) * 0x50)) #define INTR_EN(__bank) (0x420 + ((__bank) * 0x50)) +/* + * Some versions of the IP have the ECC fixup handled in hardware. In this + * configuration we only get interrupted when the error is uncorrectable. + * Unfortunately this bit replaces INTR_STATUS__ECC_TRANSACTION_DONE from the + * old IP. + */ +#define INTR__ECC_UNCOR_ERR 0x0001 #define INTR__ECC_TRANSACTION_DONE 0x0001 #define INTR__ECC_ERR 0x0002 #define INTR__DMA_CMD_COMP 0x0004 @@ -259,6 +267,11 @@ #define ERR_CORRECTION_INFO__ERROR_TYPE 0x4000 #define ERR_CORRECTION_INFO__LAST_ERR_INFO 0x8000 +#define ECC_COR_INFO(bank) (0x650 + (bank) / 2 * 0x10) +#define ECC_COR_INFO__SHIFT(bank) ((bank) % 2 * 8) +#define ECC_COR_INFO__MAX_ERRORS 0x007f +#define ECC_COR_INFO__UNCOR_ERR 0x0080 + #define DMA_ENABLE 0x700 #define DMA_ENABLE__FLAG 0x0001 @@ -339,6 +352,7 @@ struct denali_nand_info { int bbtskipbytes; int max_banks; unsigned int caps; +#define DENALI_CAP_HW_ECC_FIXUP BIT(0) }; extern int denali_init(struct denali_nand_info *denali); From patchwork Wed Mar 22 14:07:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95775 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp261996qgd; Wed, 22 Mar 2017 07:19:25 -0700 (PDT) X-Received: by 10.98.22.87 with SMTP id 84mr47868685pfw.145.1490192365823; Wed, 22 Mar 2017 07:19:25 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id e70si1426065pfc.37.2017.03.22.07.19.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:19:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=dmw+YkURRbJm3VdTUJdq/8la5NsDsSQjHK50eBPVdCM=; b=QkMg0VO2GRwGJlr3Xf9hjTf94q R6+511asSK5ObthPPK5bBS1JdKNxmQdXz+kUZ9jSwEaSceIfecCV+LT6EA85EBhnpbYIv8+FjgsK/ vhCbuN21SbRw5Km5WTon3sBZBPDm4V2LdF+Ig4V4VQmpBXcESJd4cijr82IA8kJTnEG4ItonAEBO5 ELdsclMy8EnkKxF7W3oL/6j7ah58/rVvk0bIJYc5CmAqquqlq+g5zVPD/VzhTMoPCypf8CArSY4yO mbdy7JbNPPYgf1KI241pbyJhAfFBIPtgzbiF8WQ5GLWeJ6HndhgTyY9zbc0QhWttdZbaV7EwHIzMs F2XQYdPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqh6e-0001Ej-5P; Wed, 22 Mar 2017 14:19:20 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqh5d-00082C-VX for linux-mtd@bombadil.infradead.org; Wed, 22 Mar 2017 14:18:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bglpfXFek063mgot4aXMAWb6gQhcBaplpfasDr1oDxI=; b=CwrJ/s+RmfDulcMevjdWmUWui yjFJZX4id0Yh5SZ7FEzlAJrSnotpunG84fFMRaTvX3aucfdPkPbb+04zf+LgHTKGFRWaKdtodHNNl xXmw+NEeD2+WPsn64QQ0gWIpv/1oVRJXpscTIEK3sxXusB45+hCL1K7Vuxrx8oavcGgjNZtHyYgR9 bNkxi8bWZfj63u9DaJs+dORMTD8z4CcKTZYJA2ls5fEIMuij/MCQrjicPJ72SgF+G8wFln2ubUDJb fUqEKMyzRF9O220kVIDLBDtch1KUc25OmnZSoTKjjqNnrx6bOZJJ1uEkKYb4MWlv2Q5NE6NOh9M6D 0rzRexRdQ==; Received: from conuserg-07.nifty.com ([210.131.2.74]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxZ-0007so-12 for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:10:01 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDW010154; Wed, 22 Mar 2017 23:08:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDW010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191723; bh=bglpfXFek063mgot4aXMAWb6gQhcBaplpfasDr1oDxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KnPA5j3tMSwvJmSjvbAluRpWGcWCBRW6UyD+cvXipLtkBzPmEe/goG49dpLpPiLnA 7AWYkxDINGiuFHjSSi+d/e7oL9b637It8J4sf5GoDAhkG88TmAHmAjp71EyWBhomGe FIsxOTB7sJNOSebwKMcH1tYib4hRmuJ+O0CkouFCIvpTdOrZER8wb/HwTQZrZpm9y2 8HjmqkK5bf02qwlqx2bzY6Brkv1vUby3ZrlAlEhMpJ2wO+W4qXjq6s5UBtKbLwTMG/ Hs+lfphAQxqR+YP4zwFbqjChDVyAlYaEyFziAgEsVnFCWUfT+2xanMiXowChcZMs/O EA1WYWN6OUqjg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 13/53] mtd: nand: denali_dt: enable HW_ECC_FIXUP for Altera SOCFPGA variant Date: Wed, 22 Mar 2017 23:07:20 +0900 Message-Id: <1490191680-14481-14-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_140957_679827_3C1C4B2D X-CRM114-Status: GOOD ( 16.15 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Mark Rutland , Dinh Nguyen , devicetree@vger.kernel.org, Rob Herring , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org There are various customizable parameters, so several variants for this IP. A generic compatible like "denali,denali-nand-dt" is useless. Moreover, there are multiple things wrong with this string. (Refer to Rob's comment [1]) The denali_dt.c was split out and this compatible was added by Altera for the SOCFPGA port. So, replace it with a more specific string. The Denali IP on SOCFPGA incorporates the hardware ECC fixup feature. So, this capability should be associated with the compatible string. [1] https://lkml.org/lkml/2016/12/1/450 Signed-off-by: Masahiro Yamada --- Changes in v2: - Add caps flag to of_device_id data, not hard-code in driver code - Add Altera-specific compatible. Documentation/devicetree/bindings/mtd/denali-nand.txt | 5 +++-- drivers/mtd/nand/denali_dt.c | 14 ++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/Documentation/devicetree/bindings/mtd/denali-nand.txt b/Documentation/devicetree/bindings/mtd/denali-nand.txt index b04d03a..6f4ab4c 100644 --- a/Documentation/devicetree/bindings/mtd/denali-nand.txt +++ b/Documentation/devicetree/bindings/mtd/denali-nand.txt @@ -1,7 +1,8 @@ * Denali NAND controller Required properties: - - compatible : should be "denali,denali-nand-dt" + - compatible : should be one of the following: + "altr,socfpga-denali-nand" - for Altera SOCFPGA - reg : should contain registers location and length for data and reg. - reg-names: Should contain the reg names "nand_data" and "denali_reg" - interrupts : The interrupt number. @@ -15,7 +16,7 @@ Examples: nand: nand@ff900000 { #address-cells = <1>; #size-cells = <1>; - compatible = "denali,denali-nand-dt"; + compatible = "altr,socfpga-denali-nand"; reg = <0xff900000 0x100000>, <0xffb80000 0x10000>; reg-names = "nand_data", "denali_reg"; interrupts = <0 144 4>; diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c index 293ddb8..9577bfd 100644 --- a/drivers/mtd/nand/denali_dt.c +++ b/drivers/mtd/nand/denali_dt.c @@ -33,11 +33,17 @@ struct denali_dt_data { unsigned int caps; }; -static const struct of_device_id denali_nand_dt_ids[] = { - { .compatible = "denali,denali-nand-dt" }, - { /* sentinel */ } - }; +static const struct denali_dt_data denali_socfpga_data = { + .caps = DENALI_CAP_HW_ECC_FIXUP, +}; +static const struct of_device_id denali_nand_dt_ids[] = { + { + .compatible = "altr,socfpga-denali-nand", + .data = &denali_socfpga_data, + }, + { /* sentinel */ } +}; MODULE_DEVICE_TABLE(of, denali_nand_dt_ids); static u64 denali_dma_mask; From patchwork Wed Mar 22 14:07:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95759 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233314obz; Wed, 22 Mar 2017 07:10:53 -0700 (PDT) X-Received: by 10.99.1.132 with SMTP id 126mr42857828pgb.25.1490191853475; Wed, 22 Mar 2017 07:10:53 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id n188si1943374pga.361.2017.03.22.07.10.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:10:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=FCBWdIb70bocu5Dyyd9bkXC4KcNmp1T4M+z6rKnRP5g=; b=b9M4EEktDKDEXrF9K+5FW6VAPj sQsPist/YvQGhROaxo4UCirmIcPLTadS8R4LutoqzprD/dKHX8EdKI39Pcysam9PavyG2Gplsh+2H GVwpJ88+lBXXTC+Nl1aJkGDywKVMc1fZ82NySgHeZwEGp/cCRXN5mjTeTeB/2vvu4QlRKCjJ9kiAI uYR/Y8Pmppxmbg/778HCTno6+5q7Zn/ZlcmpHb0c79IqMGE1scSI4BFPucxynBuQxkkcQcWniS16R fMPu+Clb0ggAWiRNcLXpF0a06NFG3W136QCXXTCB9xCVG4LiC+O3cUxbc5EC4+mB+xKSNZWsxNykJ 1lQcb7CQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgyQ-0000NU-2w; Wed, 22 Mar 2017 14:10:50 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-00063A-Ms for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:44 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDX010154; Wed, 22 Mar 2017 23:08:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDX010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191724; bh=9SLvobft3NRln3CJ75gdFVjmMYflLyfuuo0womwkTgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=21UVxJ5SIzLYuUodeLAXxl+0anNQd6APuIAmB+NIUaUBgNUAkI2yxv4dfXbPDQism y7RkGt5hsuJo+JG74vTqutF50o8l6zeu+JNEj+Me2Hy8mtmb9uikdLhSaCwGBef02Z pqJvbM9oAJrjnwHKBaUk7ndPEO+n9to6MBo8JYNTZvFBiGBjDNFbqRLtEM3vvXBWhu HaqFh31f7ymgMRt77isyEy6KkL3iBVb4tY+5xscKhhfSpEoxt5Wv8NkmKzxgdoI9jj +IdOxj7Tl9Bslc2HfzshLy/5h9OACdz2JxMY+EWaNXW1KzD/lY+rA+JC2eFvB8+LoN EYLwFDoHcl99A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 14/53] mtd: nand: denali: support 64bit capable DMA engine Date: Wed, 22 Mar 2017 23:07:21 +0900 Message-Id: <1490191680-14481-15-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_299439_F0354CC6 X-CRM114-Status: GOOD ( 13.56 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The current driver only supports the DMA engine up to 32 bit physical address, but there also exists 64 bit capable DMA engine for this IP. The data DMA setup sequence is completely different, so I added the 64 bit DMA code as a new function denali_setup_dma64(). The 32 bit one has been renamed to denali_setup_dma32(). Signed-off-by: Masahiro Yamada --- Changes in v2: - Change the capability prefix DENALI_CAPS_ -> DENALI_CAP_ drivers/mtd/nand/denali.c | 39 +++++++++++++++++++++++++++++++++++---- drivers/mtd/nand/denali.h | 1 + 2 files changed, 36 insertions(+), 4 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 91f0def..513292f 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -999,8 +999,30 @@ static void denali_enable_dma(struct denali_nand_info *denali, bool en) ioread32(denali->flash_reg + DMA_ENABLE); } -/* setups the HW to perform the data DMA */ -static void denali_setup_dma(struct denali_nand_info *denali, int op) +static void denali_setup_dma64(struct denali_nand_info *denali, int op) +{ + uint32_t mode; + const int page_count = 1; + uint64_t addr = denali->buf.dma_buf; + + mode = MODE_10 | BANK(denali->flash_bank) | denali->page; + + /* DMA is a three step process */ + + /* + * 1. setup transfer type, interrupt when complete, + * burst len = 64 bytes, the number of pages + */ + index_addr(denali, mode, 0x01002000 | (64 << 16) | op | page_count); + + /* 2. set memory low address */ + index_addr(denali, mode, addr); + + /* 3. set memory high address */ + index_addr(denali, mode, addr >> 32); +} + +static void denali_setup_dma32(struct denali_nand_info *denali, int op) { uint32_t mode; const int page_count = 1; @@ -1023,6 +1045,14 @@ static void denali_setup_dma(struct denali_nand_info *denali, int op) index_addr(denali, mode | 0x14000, 0x2400); } +static void denali_setup_dma(struct denali_nand_info *denali, int op) +{ + if (denali->caps & DENALI_CAP_DMA_64BIT) + denali_setup_dma64(denali, op); + else + denali_setup_dma32(denali, op); +} + /* * writes a page. user specifies type, and this function handles the * configuration details. @@ -1492,8 +1522,9 @@ int denali_init(struct denali_nand_info *denali) goto failed_req_irq; } - /* Is 32-bit DMA supported? */ - ret = dma_set_mask(denali->dev, DMA_BIT_MASK(32)); + ret = dma_set_mask(denali->dev, + DMA_BIT_MASK(denali->caps & DENALI_CAP_DMA_64BIT ? + 64 : 32)); if (ret) { dev_err(denali->dev, "No usable DMA configuration\n"); goto failed_req_irq; diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index ed42b16..a8e8d68 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h @@ -353,6 +353,7 @@ struct denali_nand_info { int max_banks; unsigned int caps; #define DENALI_CAP_HW_ECC_FIXUP BIT(0) +#define DENALI_CAP_DMA_64BIT BIT(1) }; extern int denali_init(struct denali_nand_info *denali); From patchwork Wed Mar 22 14:07:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95773 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp261801qgd; Wed, 22 Mar 2017 07:19:02 -0700 (PDT) X-Received: by 10.98.18.66 with SMTP id a63mr46419130pfj.188.1490192342236; Wed, 22 Mar 2017 07:19:02 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id q87si1406310pfi.271.2017.03.22.07.19.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:19:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=YpEmrrGVoM0ZQBe5Sl2+ZSd4hJerp+rHfRznQZcgwzU=; b=tEj+q5kwfPOnHwK8e4PweHV6Sa uqDlHoRIbORb66dswTngzeLhbZmouvU8f5Y+d3ljByDyh6PUgi2ydCv5srNCGgZrmw1kJKm/7EbNU b7B9B2Y4YVYV1sCqOzdboyiHgyOFktOxhUR1JH1KzaUHE7cT91qngFrn3ne5zXPCaTqnEexV/K8d/ fUyZaJ8mKG6bjOJmCkcplX2nyTmcn+Zu35X3DWEMLovsiI6/pO8xOLRpwUFp5syWooXyi+4t4/huj pUjsOfbFq4xyORSPJfLU2qUrVLstxYBFd7sHHWLlhA5mK+BP70lFRUX01eQ32Da5yhpi+46xfv14S W4Kk+2jQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqh6H-0000lp-IM; Wed, 22 Mar 2017 14:18:57 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqh5d-00082r-GJ for linux-mtd@bombadil.infradead.org; Wed, 22 Mar 2017 14:18:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=k0OolJzglYZESV6rxKJganwnwaMw8DLMYS5PnlGJdLg=; b=HD1nefNRhgp90CEHvqlAN9Iws ViwkINY4a5DCRxIlbkqaJd3XSv8TssYghYXJEozDToJa41rpuNFP/VbFjYIuUt+ORJYXwKkjwTK9x QB0OilAIMjsodJdDhAqyAmpaj4ZWku8K0knfTkT2L2T0zLWclr8e7stHeCEwFyRCEba/OZsIYkJD6 oA4o7/Ns9/92DFUbUquwHESVQ9X8wDVbo90f0xYp68WNUIZEZ7XFN+9YDV9v+1XKvcrwaK7zT28MJ Y6hKpWz7yiCETuRXmUsmjcptLIhyKIN8iMYWpeg4Lp8peFiHeZi7J9vOLHW49omgKOuQx2FJ0wUi5 Nuwq/qKTQ==; Received: from conuserg-07.nifty.com ([210.131.2.74]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxZ-0007sp-13 for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:10:01 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDY010154; Wed, 22 Mar 2017 23:08:45 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDY010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191726; bh=k0OolJzglYZESV6rxKJganwnwaMw8DLMYS5PnlGJdLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L6s0kCGev3bs6Kv2FsueqM3W/KAyFw3PPXTtXiDhx7f3gXupvHz4ssZdhrqv5Vb5i 7RpFcSPDEJIWm81m4u8ufrN3m5ZLa73dxhmZnsxT97M4YusznjjLJwYWzsJvNlba3v qcKMYJ5X1ZNAHwsiKqNCBoK2iVSn4r49UHkbfwAn6eJbwo3hj4K64UQ0/nr254Yrof dddoaQur8Zf4E09GHtNIIrhXZSpGPxUJj/bnzxD4tyTS1dwCF9WNBohVKJBhN0G/5L Q6lueSLkqtdVyLVMUwCYV9UxCi9HExGUYgzzZgTwPV+tLWBtUmEhAGBcMS6W4DHtLA dbLb8V9s1QhvQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 15/53] mtd: nand: denali_dt: remove dma-mask DT property Date: Wed, 22 Mar 2017 23:07:22 +0900 Message-Id: <1490191680-14481-16-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_140957_676636_34F5522A X-CRM114-Status: GOOD ( 12.76 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Mark Rutland , Dinh Nguyen , devicetree@vger.kernel.org, Rob Herring , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The driver sets appropriate DMA mask. Delete the "dma-mask" DT property. See [1] for negative comments for this binding. [1] https://lkml.org/lkml/2016/2/8/57 Signed-off-by: Masahiro Yamada Acked-by: Rob Herring --- Changes in v2: None Documentation/devicetree/bindings/mtd/denali-nand.txt | 2 -- drivers/mtd/nand/denali_dt.c | 9 --------- 2 files changed, 11 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/Documentation/devicetree/bindings/mtd/denali-nand.txt b/Documentation/devicetree/bindings/mtd/denali-nand.txt index 6f4ab4c..e593bbe 100644 --- a/Documentation/devicetree/bindings/mtd/denali-nand.txt +++ b/Documentation/devicetree/bindings/mtd/denali-nand.txt @@ -6,7 +6,6 @@ Required properties: - reg : should contain registers location and length for data and reg. - reg-names: Should contain the reg names "nand_data" and "denali_reg" - interrupts : The interrupt number. - - dm-mask : DMA bit mask The device tree may optionally contain sub-nodes describing partitions of the address space. See partition.txt for more detail. @@ -20,5 +19,4 @@ nand: nand@ff900000 { reg = <0xff900000 0x100000>, <0xffb80000 0x10000>; reg-names = "nand_data", "denali_reg"; interrupts = <0 144 4>; - dma-mask = <0xffffffff>; }; diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c index 9577bfd..b8a8284 100644 --- a/drivers/mtd/nand/denali_dt.c +++ b/drivers/mtd/nand/denali_dt.c @@ -46,8 +46,6 @@ static const struct of_device_id denali_nand_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, denali_nand_dt_ids); -static u64 denali_dma_mask; - static int denali_dt_probe(struct platform_device *ofdev) { struct resource *denali_reg, *nand_data; @@ -83,13 +81,6 @@ static int denali_dt_probe(struct platform_device *ofdev) if (IS_ERR(denali->flash_mem)) return PTR_ERR(denali->flash_mem); - if (!of_property_read_u32(ofdev->dev.of_node, - "dma-mask", (u32 *)&denali_dma_mask)) { - denali->dev->dma_mask = &denali_dma_mask; - } else { - denali->dev->dma_mask = NULL; - } - dt->clk = devm_clk_get(&ofdev->dev, NULL); if (IS_ERR(dt->clk)) { dev_err(&ofdev->dev, "no clk available\n"); From patchwork Wed Mar 22 14:07:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95763 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233596obz; Wed, 22 Mar 2017 07:11:29 -0700 (PDT) X-Received: by 10.98.91.130 with SMTP id p124mr43948339pfb.165.1490191889848; Wed, 22 Mar 2017 07:11:29 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id q3si1987810plb.23.2017.03.22.07.11.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:11:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0WLD1+r4RZ521KvolW3fI8ShuxriOCenDc0saWZ5WIA=; b=YVVRXAv6pOVPmjjuMwszdjyw6L nwGxfnXYCUtkbI3o3Hu4V3ZP2nDPNIAvRI0qC/hrdva4YkScpTYQgaxNcdwbRTIodcRsQN8C488pJ xreq1hyNeIshUABvV7LhEHexR8krZPaVmfCToAy8woJlarRyIojj0rOBOKx+lfcdgUYJd+lbfz5Ja IsV4LOmbFlUTCnERNbpprwbgMe17boKEinJC7i5B9mXbQ5b+LwK6Ifj7Tbu/TnMe5fCrydlNc9ujD s78YeQbu8r/bR/1PAASQK8g+x3Dw6rWUiWlCDZW8nZ8N7vvkkCvzrxEx2F29abWhqfBHF56bShDA1 pGm4eQBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgz0-0001At-8S; Wed, 22 Mar 2017 14:11:26 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-00063C-Mr for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:45 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDZ010154; Wed, 22 Mar 2017 23:08:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDZ010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191727; bh=a3rLts1afFC85LO0vi5BLOJST+6mgDYfvjfvZDZ00Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BqPMJxkSzh3jm4gdwvSkfG8Sbrj1omM9eKLK6uAw8P13L3vz/jLef75q/Lr29y55Z cHt3yVr+Fmmw++d7iiCuSV53Pd7iAUgakCkYLLeC+o72GXRONfZ4hy/dU+UilKnubQ Cu3EOAsJK/L65POjhvUOWEuZ575nRM398lu8lIN3NuqSt8Pfj7kPozGS6d0g6CDd// wobbOXghFeEISVVAZ95O9H3V6jCg2fezmZ7imUWQS9AKrQgQYL9RMR5wSok1QMf1cm 74qt0SF2CPLzdEsxhx6vHOzsvZtSrOP34KmXGd2LHqdBrVCnJzdJjyy5VCtCa84dxU erdOKrTtz/tog== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 16/53] mtd: nand: denali_dt: use pdev instead of ofdev for platform_device Date: Wed, 22 Mar 2017 23:07:23 +0900 Message-Id: <1490191680-14481-17-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_215766_81D3C298 X-CRM114-Status: GOOD ( 11.08 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org "pdev" is much more often used to point a platform_device, so this will help the driver code look consistent across the kernel. While we are here, fix "line over 80 characters" coding style violations. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali_dt.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c index b8a8284..ada3863 100644 --- a/drivers/mtd/nand/denali_dt.c +++ b/drivers/mtd/nand/denali_dt.c @@ -46,7 +46,7 @@ static const struct of_device_id denali_nand_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, denali_nand_dt_ids); -static int denali_dt_probe(struct platform_device *ofdev) +static int denali_dt_probe(struct platform_device *pdev) { struct resource *denali_reg, *nand_data; struct denali_dt *dt; @@ -54,36 +54,38 @@ static int denali_dt_probe(struct platform_device *ofdev) struct denali_nand_info *denali; int ret; - dt = devm_kzalloc(&ofdev->dev, sizeof(*dt), GFP_KERNEL); + dt = devm_kzalloc(&pdev->dev, sizeof(*dt), GFP_KERNEL); if (!dt) return -ENOMEM; denali = &dt->denali; - data = of_device_get_match_data(&ofdev->dev); + data = of_device_get_match_data(&pdev->dev); if (data) denali->caps = data->caps; denali->platform = DT; - denali->dev = &ofdev->dev; - denali->irq = platform_get_irq(ofdev, 0); + denali->dev = &pdev->dev; + denali->irq = platform_get_irq(pdev, 0); if (denali->irq < 0) { - dev_err(&ofdev->dev, "no irq defined\n"); + dev_err(&pdev->dev, "no irq defined\n"); return denali->irq; } - denali_reg = platform_get_resource_byname(ofdev, IORESOURCE_MEM, "denali_reg"); - denali->flash_reg = devm_ioremap_resource(&ofdev->dev, denali_reg); + denali_reg = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "denali_reg"); + denali->flash_reg = devm_ioremap_resource(&pdev->dev, denali_reg); if (IS_ERR(denali->flash_reg)) return PTR_ERR(denali->flash_reg); - nand_data = platform_get_resource_byname(ofdev, IORESOURCE_MEM, "nand_data"); - denali->flash_mem = devm_ioremap_resource(&ofdev->dev, nand_data); + nand_data = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "nand_data"); + denali->flash_mem = devm_ioremap_resource(&pdev->dev, nand_data); if (IS_ERR(denali->flash_mem)) return PTR_ERR(denali->flash_mem); - dt->clk = devm_clk_get(&ofdev->dev, NULL); + dt->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(dt->clk)) { - dev_err(&ofdev->dev, "no clk available\n"); + dev_err(&pdev->dev, "no clk available\n"); return PTR_ERR(dt->clk); } clk_prepare_enable(dt->clk); @@ -92,7 +94,7 @@ static int denali_dt_probe(struct platform_device *ofdev) if (ret) goto out_disable_clk; - platform_set_drvdata(ofdev, dt); + platform_set_drvdata(pdev, dt); return 0; out_disable_clk: @@ -101,9 +103,9 @@ static int denali_dt_probe(struct platform_device *ofdev) return ret; } -static int denali_dt_remove(struct platform_device *ofdev) +static int denali_dt_remove(struct platform_device *pdev) { - struct denali_dt *dt = platform_get_drvdata(ofdev); + struct denali_dt *dt = platform_get_drvdata(pdev); denali_remove(&dt->denali); clk_disable_unprepare(dt->clk); From patchwork Wed Mar 22 14:07:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95767 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233766obz; Wed, 22 Mar 2017 07:11:56 -0700 (PDT) X-Received: by 10.84.238.9 with SMTP id u9mr56629028plk.174.1490191916320; Wed, 22 Mar 2017 07:11:56 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id r17si1979508pgi.61.2017.03.22.07.11.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:11:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=6FXARLLYWdmDWO34afhgDouskOD1mJmKtNAo9zpPkAY=; b=VH88eMssjVWo3K8WhG0pIGgESM 0viUWw07wZTts80cfPTHmybyHsy7ZjGxMGQ7j7b4TVg9qbMzCvTGq3bEWNLMCtOdNA/p1bEXRhXyY v7epLb90tqpxofsnUO77FD+b6UsZv6un8q3HeEirzZ74q49upZuoxpfJv1id/yG5IGqbkiLnH5Vxd TBLS70JymzQcHNgc/gd45aHOq0JofpQl/n+X6dtyAqL0gG7fHklT1G8KzvG2UonRiNiOA1M8jI1rm C6u6uTwBYnH7BfGjLiKArKBYY38cG8ODTwvWt3Kt0jhD4n85mDzwYHLZCQFE0dJpt3l2rOTpRNFZR wWeERHqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgzO-0001hI-5q; Wed, 22 Mar 2017 14:11:50 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-000637-Mo for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:52 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDa010154; Wed, 22 Mar 2017 23:08:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDa010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191729; bh=uTxP8uSgKDdcyWTVMZxtm2JF7W6b7or+g/XUZVmI6+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dIQoXSlxtqLHtUrNlAP/iNjHPS+9BpanoqyMp7PXtfJm3yV3OLAEFT+8KRftlXyF3 9RyN6FSEk/Y4CTaWH9kGshutogmxT3jY3fYgT9k8QgmfbBzNfGRXU9nZ2xsxANUFpL hFMDLZcdndGaW+e4O/rSUB+9e76FvjWrPo2bC73OxQECi8l3C6+S/ORvODacQWVMzG nYfhAsNqC4Nvw5K4B1eavNyqa2gdywjZE8HLf0XBBfyGXnVuSuB5JSFAVlHdvG8sCU 3F3emm16JPInKOTVCRlCbno/HqMxN2NVFuvLBozEH2UR0vGT6teOhtGCt98m8IdHLE eYYV1KSvE8fYw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 17/53] mtd: nand: denali: allow to override revision number Date: Wed, 22 Mar 2017 23:07:24 +0900 Message-Id: <1490191680-14481-18-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_296238_43D48B1C X-CRM114-Status: GOOD ( 18.24 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Commit 271707b1d817 ("mtd: nand: denali: max_banks calculation changed in revision 5.1") added a revision check to support the new max_banks encoding. Its git-log states "The encoding of max_banks changed in Denali revision 5.1". There are exceptional cases, for example, the revision register on some UniPhier SoCs says the IP is 5.0 but the max_banks is encoded in the new format. This IP updates the resister specification from time to time (often breaking the backward compatibility), but the revision number is not incremented correctly. The max_banks is not only the case that needs revision checking. Let's allow to override an incorrect revision number. Signed-off-by: Masahiro Yamada --- Changes in v2: - Replace the NEW_N_BANKS_FORMAT approach drivers/mtd/nand/denali.c | 19 +++++++++---------- drivers/mtd/nand/denali.h | 3 +-- drivers/mtd/nand/denali_dt.c | 5 ++++- 3 files changed, 14 insertions(+), 13 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 513292f..ff6af1d 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -449,17 +449,12 @@ static void find_valid_banks(struct denali_nand_info *denali) static void detect_max_banks(struct denali_nand_info *denali) { uint32_t features = ioread32(denali->flash_reg + FEATURES); - /* - * Read the revision register, so we can calculate the max_banks - * properly: the encoding changed from rev 5.0 to 5.1 - */ - u32 revision = MAKE_COMPARABLE_REVISION( - ioread32(denali->flash_reg + REVISION)); - if (revision < REVISION_5_1) - denali->max_banks = 2 << (features & FEATURES__N_BANKS); - else - denali->max_banks = 1 << (features & FEATURES__N_BANKS); + denali->max_banks = 1 << (features & FEATURES__N_BANKS); + + /* the encoding changed from rev 5.0 to 5.1 */ + if (denali->revision < 0x0501) + denali->max_banks <<= 1; } static uint16_t denali_nand_timing_set(struct denali_nand_info *denali) @@ -1348,6 +1343,10 @@ static void denali_cmdfunc(struct mtd_info *mtd, unsigned int cmd, int col, /* Initialization code to bring the device up to a known good state */ static void denali_hw_init(struct denali_nand_info *denali) { + if (!denali->revision) + denali->revision = + swab16(ioread32(denali->flash_reg + REVISION)); + /* * tell driver how many bit controller will skip before * writing ECC code in OOB, this register may be already diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index a8e8d68..58a8042 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h @@ -179,8 +179,6 @@ #define REVISION 0x370 #define REVISION__VALUE 0xffff -#define MAKE_COMPARABLE_REVISION(x) swab16((x) & REVISION__VALUE) -#define REVISION_5_1 0x00000501 #define ONFI_DEVICE_FEATURES 0x380 #define ONFI_DEVICE_FEATURES__VALUE 0x003f @@ -351,6 +349,7 @@ struct denali_nand_info { int devnum; /* represent how many nands connected */ int bbtskipbytes; int max_banks; + unsigned int revision; unsigned int caps; #define DENALI_CAP_HW_ECC_FIXUP BIT(0) #define DENALI_CAP_DMA_64BIT BIT(1) diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c index ada3863..df9ef36 100644 --- a/drivers/mtd/nand/denali_dt.c +++ b/drivers/mtd/nand/denali_dt.c @@ -30,6 +30,7 @@ struct denali_dt { }; struct denali_dt_data { + unsigned int revision; unsigned int caps; }; @@ -60,8 +61,10 @@ static int denali_dt_probe(struct platform_device *pdev) denali = &dt->denali; data = of_device_get_match_data(&pdev->dev); - if (data) + if (data) { + denali->revision = data->revision; denali->caps = data->caps; + } denali->platform = DT; denali->dev = &pdev->dev; From patchwork Wed Mar 22 14:07:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95769 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp258437qgd; Wed, 22 Mar 2017 07:12:08 -0700 (PDT) X-Received: by 10.99.173.69 with SMTP id y5mr44387915pgo.35.1490191928736; Wed, 22 Mar 2017 07:12:08 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id g17si1956486pgn.265.2017.03.22.07.12.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:12:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9Iv94UqRboK5yMrYinfzRCaZKaHtcfY5Asoug5TOWYA=; b=RhxDFRFr4nXW5Yg4xb41zZS+nX 7fFcp6Dwmq5e8D6ZcLyXCtLc5ye6T/fWC9kLnobpYaJjJifia5Nf6CLawVOzX7bylpDtA5PpaFDqa zKRSfEySae+NQVvfQfybFRh9F5VkoTWQfNvqUBsDP+zWey+gV7NWRjnkIZhO/DhskuxP9Lg41eVtq f4lq6o/LmxsrzwISsKMAkAD6TybO6OcJ/9J2Hst+pBPxHG8yp99Uz3uv8BKL6+Aies8IRBp6V6StX yyFk3z3A3NvfjfK0hbQbUrWttd/Y/SiXBGggIdk0vzEvGsWHVN5NDddb+3LO3YDnwH+TscpBnySK6 yu59jfRQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgza-0001wY-Vd; Wed, 22 Mar 2017 14:12:03 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-00063D-NC for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:53 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDb010154; Wed, 22 Mar 2017 23:08:49 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDb010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191730; bh=QZtC1PwWoPdhAms0pfDpaW1R8+f0pfBPDcJb0an838U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z1TTZIWDac5ntrF2nljwHko2m556Un36ZG5A0h2yPUiTl8/vcxzGvdSfbl5AmMM43 rd64c8ZDgEJFnYMX/LluOWexWu1pecEAY+ccmVgOxRwde92m+DbpeBs2vBtuUQquP8 Z8MCWXPt9hullLsCg0TfNdk1d12rWYk3/rtSttbUuzrDWdL4Pk7icjfZpKwkw7wX7c cEarCpZCfNZ8+SMj/z2PAGOvvGfeWJwxdQurx+jq1l/gjcePbklXZPWhl7XRG2swwj XJq005pcma7FVFdVbUsZ0G7FMs+WnQdWYWcfzxGL8PPA6SoVU+Rm9dttWRqWUz7D4A 1Aa731O+gic5Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 18/53] mtd: nand: denali: use nand_chip to hold frequently accessed data Date: Wed, 22 Mar 2017 23:07:25 +0900 Message-Id: <1490191680-14481-19-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_364692_CF0FA27E X-CRM114-Status: GOOD ( 12.17 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The denali_init() needs to setup a bunch of parameters of nand_chip. Replace denali->nand.(member) with chip->(member) for shorter code. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali.c | 68 +++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index ff6af1d..24c35a6 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1460,7 +1460,8 @@ static void denali_drv_init(struct denali_nand_info *denali) int denali_init(struct denali_nand_info *denali) { - struct mtd_info *mtd = nand_to_mtd(&denali->nand); + struct nand_chip *chip = &denali->nand; + struct mtd_info *mtd = nand_to_mtd(chip); int ret; if (denali->platform == INTEL_CE4100) { @@ -1497,10 +1498,10 @@ int denali_init(struct denali_nand_info *denali) mtd->name = "denali-nand"; /* register the driver with the NAND core subsystem */ - denali->nand.select_chip = denali_select_chip; - denali->nand.cmdfunc = denali_cmdfunc; - denali->nand.read_byte = denali_read_byte; - denali->nand.waitfunc = denali_waitfunc; + chip->select_chip = denali_select_chip; + chip->cmdfunc = denali_cmdfunc; + chip->read_byte = denali_read_byte; + chip->waitfunc = denali_waitfunc; /* * scan for NAND devices attached to the controller @@ -1544,17 +1545,16 @@ int denali_init(struct denali_nand_info *denali) * the real pagesize and anything necessery */ denali->devnum = ioread32(denali->flash_reg + DEVICES_CONNECTED); - denali->nand.chipsize <<= denali->devnum - 1; - denali->nand.page_shift += denali->devnum - 1; - denali->nand.pagemask = (denali->nand.chipsize >> - denali->nand.page_shift) - 1; - denali->nand.bbt_erase_shift += denali->devnum - 1; - denali->nand.phys_erase_shift = denali->nand.bbt_erase_shift; - denali->nand.chip_shift += denali->devnum - 1; + chip->chipsize <<= denali->devnum - 1; + chip->page_shift += denali->devnum - 1; + chip->pagemask = (chip->chipsize >> chip->page_shift) - 1; + chip->bbt_erase_shift += denali->devnum - 1; + chip->phys_erase_shift = chip->bbt_erase_shift; + chip->chip_shift += denali->devnum - 1; mtd->writesize <<= denali->devnum - 1; mtd->oobsize <<= denali->devnum - 1; mtd->erasesize <<= denali->devnum - 1; - mtd->size = denali->nand.numchips * denali->nand.chipsize; + mtd->size = chip->numchips * chip->chipsize; denali->bbtskipbytes *= denali->devnum; /* @@ -1564,29 +1564,29 @@ int denali_init(struct denali_nand_info *denali) */ /* Bad block management */ - denali->nand.bbt_td = &bbt_main_descr; - denali->nand.bbt_md = &bbt_mirror_descr; + chip->bbt_td = &bbt_main_descr; + chip->bbt_md = &bbt_mirror_descr; /* skip the scan for now until we have OOB read and write support */ - denali->nand.bbt_options |= NAND_BBT_USE_FLASH; - denali->nand.options |= NAND_SKIP_BBTSCAN; - denali->nand.ecc.mode = NAND_ECC_HW_SYNDROME; + chip->bbt_options |= NAND_BBT_USE_FLASH; + chip->options |= NAND_SKIP_BBTSCAN; + chip->ecc.mode = NAND_ECC_HW_SYNDROME; /* no subpage writes on denali */ - denali->nand.options |= NAND_NO_SUBPAGE_WRITE; + chip->options |= NAND_NO_SUBPAGE_WRITE; /* * Denali Controller only support 15bit and 8bit ECC in MRST, * so just let controller do 15bit ECC for MLC and 8bit ECC for * SLC if possible. * */ - if (!nand_is_slc(&denali->nand) && + if (!nand_is_slc(chip) && (mtd->oobsize > (denali->bbtskipbytes + ECC_15BITS * (mtd->writesize / ECC_SECTOR_SIZE)))) { /* if MLC OOB size is large enough, use 15bit ECC*/ - denali->nand.ecc.strength = 15; - denali->nand.ecc.bytes = ECC_15BITS; + chip->ecc.strength = 15; + chip->ecc.bytes = ECC_15BITS; iowrite32(15, denali->flash_reg + ECC_CORRECTION); } else if (mtd->oobsize < (denali->bbtskipbytes + ECC_8BITS * (mtd->writesize / @@ -1594,24 +1594,24 @@ int denali_init(struct denali_nand_info *denali) pr_err("Your NAND chip OOB is not large enough to contain 8bit ECC correction codes"); goto failed_req_irq; } else { - denali->nand.ecc.strength = 8; - denali->nand.ecc.bytes = ECC_8BITS; + chip->ecc.strength = 8; + chip->ecc.bytes = ECC_8BITS; iowrite32(8, denali->flash_reg + ECC_CORRECTION); } mtd_set_ooblayout(mtd, &denali_ooblayout_ops); - denali->nand.ecc.bytes *= denali->devnum; - denali->nand.ecc.strength *= denali->devnum; + chip->ecc.bytes *= denali->devnum; + chip->ecc.strength *= denali->devnum; /* override the default read operations */ - denali->nand.ecc.size = ECC_SECTOR_SIZE * denali->devnum; - denali->nand.ecc.read_page = denali_read_page; - denali->nand.ecc.read_page_raw = denali_read_page_raw; - denali->nand.ecc.write_page = denali_write_page; - denali->nand.ecc.write_page_raw = denali_write_page_raw; - denali->nand.ecc.read_oob = denali_read_oob; - denali->nand.ecc.write_oob = denali_write_oob; - denali->nand.erase = denali_erase; + chip->ecc.size = ECC_SECTOR_SIZE * denali->devnum; + chip->ecc.read_page = denali_read_page; + chip->ecc.read_page_raw = denali_read_page_raw; + chip->ecc.write_page = denali_write_page; + chip->ecc.write_page_raw = denali_write_page_raw; + chip->ecc.read_oob = denali_read_oob; + chip->ecc.write_oob = denali_write_oob; + chip->erase = denali_erase; ret = nand_scan_tail(mtd); if (ret) From patchwork Wed Mar 22 14:07:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95758 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233257obz; Wed, 22 Mar 2017 07:10:46 -0700 (PDT) X-Received: by 10.98.95.197 with SMTP id t188mr29748129pfb.150.1490191846151; Wed, 22 Mar 2017 07:10:46 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id u123si1954095pgc.280.2017.03.22.07.10.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:10:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=hI8ZoLDG2Qet5eqxBpKtyV2G12/DZ4kVMsmOD7Mx3nM=; b=Z1eMc7s2rSYwL68hJtBE0E24yi LBUsaWXeDXYXxNdTwpsxYWV+i7g8aeSkC0OXm80teszVgNSKv5v4Ssy9hEkDAeAHSUDVbXW/X/D4J YUz+096NOEgO78nUOKR8eptsuoRwQ1BFk1BPVQAZCMc6QuBCqxWghBMmdwehddmPOiFQoncu/XSlQ Lp9y2jbtsRfH5ofyIUE08EjNqfT+FvjQkviZXztyC6MmGM8jEVLyAlBOTPr6c66NPMsAY8f7BMHz/ Rk7YGMHW/QYN0DJWFy6NXexELEh76SuthiLzW4eM+SOWqfk4zuMuZ+f1DpW8A7sFeYomjusOLaayW KaP895aA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgyD-00006h-IQ; Wed, 22 Mar 2017 14:10:37 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-00063B-My for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:43 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDc010154; Wed, 22 Mar 2017 23:08:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDc010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191732; bh=rMa0lku6DEo0FOdbBMD5myFgjMBe4kX+PT3nhB+ETsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y4iemy+Nw7hva6d5RNQ38s6fZE0g7aPBm1stS7Uk0RCgpBq2PuSizw3U47+qYJJly p4EMRb6gj7N+CP/Pfo0sJMuj34czhCm4I3ZTIYnoqpbYdGbWky1WPLDbaMSm2u0kEC 6oOLEmEm7YcRz7QVrQC79/KLNbrXGMptPtMeBKP/ycSrsDbU8iQViJVbc96UCtief0 EkyladxG2y4O5XLwbMPKFVmMWQNhWKQIoYiZ+iuxBuDy0zfiLD7gAPnt6oNlB3ocPY FaY64ArlD5G/yt5LCzC5FRJt0C2v0i8kee21w6rbKE7HtZ/CJM7MCn8JQ/fhFYwZdE Fj/PpBfKHagPg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 19/53] mtd: nand: denali: call nand_set_flash_node() to set DT node Date: Wed, 22 Mar 2017 23:07:26 +0900 Message-Id: <1490191680-14481-20-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_211454_3ADD0952 X-CRM114-Status: UNSURE ( 8.86 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org This will allow nand_dt_init() to parse DT properties in the NAND controller device node. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 24c35a6..3badb1d 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1496,6 +1496,7 @@ int denali_init(struct denali_nand_info *denali) /* now that our ISR is registered, we can enable interrupts */ denali_set_intr_modes(denali, true); mtd->name = "denali-nand"; + nand_set_flash_node(chip, denali->dev->of_node); /* register the driver with the NAND core subsystem */ chip->select_chip = denali_select_chip; From patchwork Wed Mar 22 14:07:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95760 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233431obz; Wed, 22 Mar 2017 07:11:08 -0700 (PDT) X-Received: by 10.99.145.194 with SMTP id l185mr38699124pge.187.1490191868574; Wed, 22 Mar 2017 07:11:08 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id 65si1955255pla.275.2017.03.22.07.11.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:11:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Af06ZeHN3MWdvXpP7asyXEIZL6JXnCWMarxIR0LNbHg=; b=tjv22eo891xY1FGHfVociw0Qmb gTVb+u+2ohY+vArx3SFFGVaSxHUYIvgjkAQ6tSw35kzfrb7BTuj4KB3+eR5bS8aL7yum1EDOmYzMD OEcUR3g5//swFV5DDCQumgmHGt+EJAp+fBYV1EZUw0OIa9QKaWCpdx1x8C12DbE8pDyunV+T6sa1o +KVPnscn5ViL5ftbqZ7lHlB9okmjp+dpIz6Bm4y6F2bA/yLrMYLmUDlGSzUXzFtI3F4byvx+3x6SM cPlqJZ7dNe+GjRPn+w7P0je9kuRAyNWxI0iBKh9uu0jOh6G1ppQAFX6qV2RqT+MnuxxIQ8M3Zzy6Q nvldwY6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgyd-0000ek-9r; Wed, 22 Mar 2017 14:11:03 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-000639-Mq for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:45 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDd010154; Wed, 22 Mar 2017 23:08:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDd010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191734; bh=O8JPIucCF07Nakg4ppK7wT0JGjjUZzgayy+q5W5ewDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iLQA1HtdHR7vJ2poTN6E1SwvwOQoD1R7OO5MDjI0TrGePmjLsZ9Ie/Zuwc8e5Nk2H 0X3KUqtvh+nQihooRlky5F0Nbu6YnsJIQahIGOHpWR8yOn/cZVq97MiFNMP3Tmh6bL CkTWJSw8G/txuK1tO2k8HyAZ1BuFGY4LEakqsuDukFcsg732VKcPtwFIbV6yLjIWfE 7PogYPRnsNJ1xmUM4BF1io7JS+1OB3wFh4MEzXTGt80W4MRZvugRyerUggAmh/l2xi fDAiahSZHmNgg6FhEA1v27k1gnhtjX8M6cw+Y3AU5oNwC7rGKQts3+UEf4fOB7oc3s OZMkDe867I4WA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 20/53] mtd: nand: denali: do not set mtd->name Date: Wed, 22 Mar 2017 23:07:27 +0900 Message-Id: <1490191680-14481-21-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_223783_D39C9A72 X-CRM114-Status: UNSURE ( 8.15 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org This will be filled by nand_scan_ident() later. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali.c | 1 - 1 file changed, 1 deletion(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 3badb1d..1706975 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1495,7 +1495,6 @@ int denali_init(struct denali_nand_info *denali) /* now that our ISR is registered, we can enable interrupts */ denali_set_intr_modes(denali, true); - mtd->name = "denali-nand"; nand_set_flash_node(chip, denali->dev->of_node); /* register the driver with the NAND core subsystem */ From patchwork Wed Mar 22 14:07:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95761 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233519obz; Wed, 22 Mar 2017 07:11:17 -0700 (PDT) X-Received: by 10.99.123.75 with SMTP id k11mr32388984pgn.150.1490191877505; Wed, 22 Mar 2017 07:11:17 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id 1si1957514pgr.272.2017.03.22.07.11.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:11:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=eACR8uXHIF8Sqo6OpBMK9YjqAfK5NMf59zULKz67Pc0=; b=V6OS+tLVB4gxq43Ke6ANiOp+Ng Jud0ZkzV7qNqBduD9g4GAeGosifNev3P8/Med5I/GMouGwo9n7dTS9DzzO3BM2ud/ujOyLjbsLedv ONhPA1UOYSFX2vZrNgkHjJkmLcZJH10gaYw+pI7CANsAvyKeDMrdTexT8Bb21cPAx6Uyv1i+xOUBy 4XfO84UpR1+73LThunVnlCEec20Y49zb3hVRzLz/EEb2zB9cQ/gqWeG/Wd6H4u/dKpRpCX8OXjho2 emdJGVlIq2vJ8l05RkcyhBLbriPQGJq0huiM2P2kdnyiEJ8Yi+zQOxHuISI0SkBg3ZBC7OWWI/Xwn xsf3RhSg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgyo-0000v4-K7; Wed, 22 Mar 2017 14:11:14 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-000638-Mp for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:45 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDf010154; Wed, 22 Mar 2017 23:08:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDf010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191737; bh=G+AgR3Ob/63ow59ue1QR6E0QhLg1wbcp7WadF72jlqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icfLfMaoQMBBRUVjf7clHP78TdFQDpvqwY1C/PnFft1SSy11vDQr/D2g2r1EmBS2t 9fkxySEIQ3zXAHvMAs5GeJVWKoEasiO3mMk+oE7nQItYevqAfz8+o7aHfMuhbH3zvE 5DMgfgxuhGB9UUq+DlnFvT3zBUvNWcoeQ6p6tx6aodOp5HmdL6Ch4ZAOynJ5BayTRw JM5DNJt5c/0ZyDwYqrBEkYoPMg4TCZKCWdKlVEqvufAN4DWsMBIfuuVIhqtYtaZWga NHcsboMffng3A4HsDEwliXFT73SVqOcIJU4BBpiI+1uLtwhcRFlz9a8mpmH2oJqMpY Ivy+E6hjc2+1w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 22/53] mtd: nand: denali: simplify multi device fixup code Date: Wed, 22 Mar 2017 23:07:29 +0900 Message-Id: <1490191680-14481-23-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_208565_D4CA669E X-CRM114-Status: GOOD ( 13.27 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The available configuration of the IP bus width is x8 or x16, so the possible value for denali->devnum is 1 or 2. If the value is 1, there is nothing to do. Fixup parameters only when denali->devnum is 2. Signed-off-by: Masahiro Yamada --- Changes in v2: - Simplify the code given 1 or 2 is possible for denali->devnum drivers/mtd/nand/denali.c | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 4e63d57..abf8997 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1458,7 +1458,7 @@ static void denali_drv_init(struct denali_nand_info *denali) denali->irq_status = 0; } -static void denali_multidev_fixup(struct denali_nand_info *denali) +static int denali_multidev_fixup(struct denali_nand_info *denali) { struct nand_chip *chip = &denali->nand; struct mtd_info *mtd = nand_to_mtd(chip); @@ -1472,20 +1472,32 @@ static void denali_multidev_fixup(struct denali_nand_info *denali) */ denali->devnum = ioread32(denali->flash_reg + DEVICES_CONNECTED); - mtd->size <<= denali->devnum - 1; - mtd->erasesize <<= denali->devnum - 1; - mtd->writesize <<= denali->devnum - 1; - mtd->oobsize <<= denali->devnum - 1; - chip->chipsize <<= denali->devnum - 1; - chip->page_shift += denali->devnum - 1; - chip->phys_erase_shift += denali->devnum - 1; - chip->bbt_erase_shift += denali->devnum - 1; - chip->chip_shift += denali->devnum - 1; - chip->pagemask <<= denali->devnum - 1; - chip->ecc.size *= denali->devnum; - chip->ecc.bytes *= denali->devnum; - chip->ecc.strength *= denali->devnum; - denali->bbtskipbytes *= denali->devnum; + if (denali->devnum == 1) + return 0; + + if (denali->devnum != 2) { + dev_err(denali->dev, "unsupported number of devices %d\n", + denali->devnum); + return -EINVAL; + } + + /* 2 chips in parallel */ + mtd->size <<= 1; + mtd->erasesize <<= 1; + mtd->writesize <<= 1; + mtd->oobsize <<= 1; + chip->chipsize <<= 1; + chip->page_shift += 1; + chip->phys_erase_shift += 1; + chip->bbt_erase_shift += 1; + chip->chip_shift += 1; + chip->pagemask <<= 1; + chip->ecc.size <<= 1; + chip->ecc.bytes <<= 1; + chip->ecc.strength <<= 1; + denali->bbtskipbytes <<= 1; + + return 0; } int denali_init(struct denali_nand_info *denali) @@ -1623,7 +1635,9 @@ int denali_init(struct denali_nand_info *denali) chip->ecc.write_oob = denali_write_oob; chip->erase = denali_erase; - denali_multidev_fixup(denali); + ret = denali_multidev_fixup(denali); + if (ret) + goto failed_req_irq; ret = nand_scan_tail(mtd); if (ret) From patchwork Wed Mar 22 14:07:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95766 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp233697obz; Wed, 22 Mar 2017 07:11:44 -0700 (PDT) X-Received: by 10.84.213.130 with SMTP id g2mr40116620pli.53.1490191904610; Wed, 22 Mar 2017 07:11:44 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id a95si1984711pli.38.2017.03.22.07.11.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:11:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=kxUZr+lQE/23bWMVsWEaGMob3wWKCOm2hPnPDZDQOeI=; b=Z4A9eggTJ4jgt7NTU0SsIec7UO 1GqpBi0nMdQnEpYt03foyo4FVn1JT21Cr5Pbp5fjBZqVeZ8jnHhV0x6qumEmxlIBw3GB6bLFJ+pNI lMMsPeSZYM55fFUgm23H5zKC6dSYHXShbfdXaagDILbXxlBn8zN9iAimtBsE+sRzR3ElzPbphxth/ MW0j2YKrN0pcIv0i0LDSvljNy6yPMHgzz2WOWc73qRx9uBR9u2SPvzIqDhkNN2aCBty5vxMpYgcJf wiPLUJEZxhThE3tWD6Toh5YdAxir7QIbxn6oVEIDuX/ga/4qZF12LOtc7WIjqn1tiDBABrYsnSbgm TOP1ve0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqgzD-0001SM-1j; Wed, 22 Mar 2017 14:11:39 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxI-00063E-Mp for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:09:50 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDg010154; Wed, 22 Mar 2017 23:08:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDg010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191738; bh=lJjun7m07Up94XhckEfI9LGZQhK6861r5EIlvWfOCpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCPal1bfDyL2RcldgKgVfMGfO/5oK0EG5lFDyxUtPhxEgyPdYkgNbr7N2MrQI3aQ3 ScSwQBOca6OnGSGRyQJhVG91LOs1ilj6r1scxaVUtIhsJH4Ix13QwaMNP/GcGCbaka 1yvbH/MWVNn+y/01MGVpBWFYguTNqOxFLizaKCrWyD0OG53MHbUnGrwnuiyKd2J0oa fjuRRqO2dPLd7OD2U0ZcTWv0RAVdSzI1cxBHJnhnXebo/M3E/cCRY+EvreRpma7XVT YO1fhttfqOD/bQ/VFdOPeIqgWWmfrYbpguq5dAmUoiOZwMGSTVbqQwYpM4CImZmqKi UpPqA4sM/MpyA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 23/53] mtd: nand: denali: set DEVICES_CONNECTED 1 if not set Date: Wed, 22 Mar 2017 23:07:30 +0900 Message-Id: <1490191680-14481-24-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_070941_269294_F69A66E5 X-CRM114-Status: GOOD ( 11.36 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Currently, the driver expects DEVICE_CONNECTED is automatically set by the hardware, but this feature is disabled in some cases. In such cases, it is the software's responsibility to set up the DEVICES_CONNECTED register. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index abf8997..3da0a0e 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -1472,6 +1472,15 @@ static int denali_multidev_fixup(struct denali_nand_info *denali) */ denali->devnum = ioread32(denali->flash_reg + DEVICES_CONNECTED); + /* + * On some SoCs, DEVICES_CONNECTED is not auto-detected. + * For those, DEVICES_CONNECTED is left to 0. Set 1 if it is the case. + */ + if (denali->devnum == 0) { + denali->devnum = 1; + iowrite32(1, denali->flash_reg + DEVICES_CONNECTED); + } + if (denali->devnum == 1) return 0; From patchwork Wed Mar 22 14:07:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95774 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp261869qgd; Wed, 22 Mar 2017 07:19:10 -0700 (PDT) X-Received: by 10.99.101.67 with SMTP id z64mr45206710pgb.78.1490192350329; Wed, 22 Mar 2017 07:19:10 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id 92si1995163plc.124.2017.03.22.07.19.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 07:19:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ezxp7aymU8xuspjDB+n0HrSA6QJIKzNAXtU/p1mg/YI=; b=ONozmI6RZA5BxTwij+ULqGi4Gc TYzXHJ2WMw0NYeJiLWk3Um7Ew+5YnNxwUdtPApOHImNA4xMuCF8lWzlAGZYKzePXGqP1Yc6SP04Ji dhhNS4UKZRvO+QguaeGYRoua7QD1s+4i3SfYOopicbM7qTeloQ364gTAuTsc03MLTQCktbtVjY7xG vzBekiY2XChUiv5JdaTc6PU41KZT6+gmKThCOchPVRV2MZKjBCtfWDumfKIUSkB1CLQssAPYSp9ek cE+e04RfyJ7Y4XZLfxH0r/1t8DTkP3hBmATXzOrThztaty9KMvLM+h74Ls87IAnbxgl98LaPI0Axr GPqmSykg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cqh6T-00010b-2t; Wed, 22 Mar 2017 14:19:09 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqh5d-0007mZ-FV for linux-mtd@bombadil.infradead.org; Wed, 22 Mar 2017 14:18:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ETbm79CiIOZbgKFV5qv7tXWHCr+CVtF1sohZbi3+yhw=; b=MDOYIO+0efWUo24b9fpq5VJvW H/VzzHk4ry9216cTRFRlFObmbs6g7iRUGGlctoyyyGB/QG+/4/c76m0vmvip6g8YyWhPdnRDT71du NpQJZkDmikBOj5ybU4vaoVUPgLjVNM7IY5g+8aQfLZRhR1j8IAaabKS86xvH4/Sdbjvia80o4b43O 00N2nI1XRz4dbIotC5A8lGob797BaSHCKUxQ+SKgc/LbBVUfLijH/FG6W6jvOSQUB4O3QvsTLxTkk vqMHsh87JiRIyBWGtJ/Lz5U2OMvd4jHbpgI0ZWIAgEX0c66Hii0iimZfputKXsW/6MZJorxFMgHm/ mA5dP6vkA==; Received: from conuserg-07.nifty.com ([210.131.2.74]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cqgxk-0007tq-S4 for linux-mtd@lists.infradead.org; Wed, 22 Mar 2017 14:10:10 +0000 Received: from pug.jp.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id v2ME8LDh010154; Wed, 22 Mar 2017 23:08:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v2ME8LDh010154 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490191740; bh=ETbm79CiIOZbgKFV5qv7tXWHCr+CVtF1sohZbi3+yhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ClIVyXptmag6IdtB8IZBbrUU09cFssjkX+4mDMf5En4QqUPIOX4THCqohenuiZWVV tSsKbfK31/7URE59+V/UJ8MRbR0jBRsecVoHnna+bV+As7QVD3mLzBhCBhWtiICrF6 Wx7E4mjfT3IAYw6ARgqdltisNSJCoHPNqj1Js6fSM0iLbXXd+cONinkVcud9IY13jJ UjP8xtXMLsy1Iwgc/mcEImZb/vZJFsMvmH1U3R9Ll1jmHXuk1Ax6cWgnGmsovzIsfM 5Yx5zwk1naHpmgL5yUsELXHYY0azQQJURH3U7epBIoI6J7RThGXlUWqImX8Wedac7F hvUK3ddluj0Pw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v2 24/53] mtd: nand: denali: remove meaningless writes to read-only registers Date: Wed, 22 Mar 2017 23:07:31 +0900 Message-Id: <1490191680-14481-25-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_141009_381584_52193E40 X-CRM114-Status: GOOD ( 13.44 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Cyrille Pitchen , Jason Roberts , linux-kernel@vger.kernel.org, Dinh Nguyen , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , Enrico Jorns , David Woodhouse , Graham Moore MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The write accesses to LOGICAL_PAGE_{DATA,SPARE}_SIZE have no effect because the Denali User's Guide says these registers are read-only. The hardware automatically multiplies the main/spare size by the number of devices and update LOGICAL_PAGE_{DATA,SPARE}_SIZE. Signed-off-by: Masahiro Yamada --- Changes in v2: None drivers/mtd/nand/denali.c | 16 ---------------- 1 file changed, 16 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 3da0a0e..5e89709 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -342,8 +342,6 @@ static void get_samsung_nand_para(struct denali_nand_info *denali, static void get_toshiba_nand_para(struct denali_nand_info *denali) { - uint32_t tmp; - /* * Workaround to fix a controller bug which reports a wrong * spare area size for some kind of Toshiba NAND device @@ -351,10 +349,6 @@ static void get_toshiba_nand_para(struct denali_nand_info *denali) if ((ioread32(denali->flash_reg + DEVICE_MAIN_AREA_SIZE) == 4096) && (ioread32(denali->flash_reg + DEVICE_SPARE_AREA_SIZE) == 64)) { iowrite32(216, denali->flash_reg + DEVICE_SPARE_AREA_SIZE); - tmp = ioread32(denali->flash_reg + DEVICES_CONNECTED) * - ioread32(denali->flash_reg + DEVICE_SPARE_AREA_SIZE); - iowrite32(tmp, - denali->flash_reg + LOGICAL_PAGE_SPARE_SIZE); #if SUPPORT_15BITECC iowrite32(15, denali->flash_reg + ECC_CORRECTION); #elif SUPPORT_8BITECC @@ -366,22 +360,12 @@ static void get_toshiba_nand_para(struct denali_nand_info *denali) static void get_hynix_nand_para(struct denali_nand_info *denali, uint8_t device_id) { - uint32_t main_size, spare_size; - switch (device_id) { case 0xD5: /* Hynix H27UAG8T2A, H27UBG8U5A or H27UCG8VFA */ case 0xD7: /* Hynix H27UDG8VEM, H27UCG8UDM or H27UCG8V5A */ iowrite32(128, denali->flash_reg + PAGES_PER_BLOCK); iowrite32(4096, denali->flash_reg + DEVICE_MAIN_AREA_SIZE); iowrite32(224, denali->flash_reg + DEVICE_SPARE_AREA_SIZE); - main_size = 4096 * - ioread32(denali->flash_reg + DEVICES_CONNECTED); - spare_size = 224 * - ioread32(denali->flash_reg + DEVICES_CONNECTED); - iowrite32(main_size, - denali->flash_reg + LOGICAL_PAGE_DATA_SIZE); - iowrite32(spare_size, - denali->flash_reg + LOGICAL_PAGE_SPARE_SIZE); iowrite32(0, denali->flash_reg + DEVICE_WIDTH); #if SUPPORT_15BITECC iowrite32(15, denali->flash_reg + ECC_CORRECTION);