From patchwork Wed Jan 9 21:51:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 155094 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1186114jaa; Wed, 9 Jan 2019 13:52:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN4J+S74SRAIMRlUGRgQMqO8LE7DFGFX9Iw6W1aONsDBigSgweWTIrkj1Z4E2nuMYNJj0NjL X-Received: by 2002:a17:902:1005:: with SMTP id b5mr2719186pla.310.1547070720080; Wed, 09 Jan 2019 13:52:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547070720; cv=none; d=google.com; s=arc-20160816; b=iKHkudg7iAb2jqK4uB1Z0AZXBKo62pIol8DudUWWFWVEEWZu8CDAeM/3R3hBvzR4rc fEKNbaxMxmpMLIUIEaCnhFMd25IXht/TS/QZg5vK19kV2tbjIkv26WwUlqNu0dAsWkDs WCyIflZfMtTLCtxLH12b5sGdUj29w4kVMkWVWbsrqgIq4GBGK6W4Q++MMaVJim+f4BYn jAfAuS4MVjB+4IE4BVVr5/PWPb4w544wemImZ+1vcEF3vcsnI94nZ7TDQzRK944MzWjj h93Hi2V220qbERZu11x52FtjT/4VxkgdGLp2Xb/Q1Dfg/43vV6IqXfdNj5YEe3tgDYqS n1ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :dkim-signature:dkim-signature; bh=re79cVESEzzvlX4SQUPuGg6pRbziPvfS6g4gsIxnv0o=; b=SSDI//00cUSpPYTD0fqs3u00vw6jXUyMpK6yjzcG4k3H0xKJ9OpBkRUcmxdMwzBluS yvsqW0YdKBaAThcwpIS7oteUOB1TdfstqfiCjllSD/FXhP8VrA6mGmJDfysASxLIDFK8 v4oHSjyLHyaJ4VK4nZ2vbHslnZq59lPzSBF3oAbdxsQY2PLOrYVXsbCpInlEH+hKRpQF 9wx7JfqTHC/5nH4bNRcd0mlft9jx4hJv2+Hoy88lA2nSPu1w/2Ur6ZHAb5WvCBJn33rD WtgX38hNMbfegJSJoQAjblkOY1XJplImqPkeJ/tLYV9dxcY5n1ml+1UGWM2Mci+aq8/J mxiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=pxqtFxPh; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DbE8GHO8; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id r12si6520648pgl.350.2019.01.09.13.52.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Jan 2019 13:52:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=pxqtFxPh; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DbE8GHO8; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=re79cVESEzzvlX4SQUPuGg6pRbziPvfS6g4gsIxnv0o=; b=pxqtFxPhf0+lXI noEcmowLgEimJczx/MRODhNAAj0VFpR4YvYTRvnLwDNxjwWOsIVjN1Sh0LCjhPWipwzsJogj6/uMu QQYs8VOjCtBSN9q+EPZyOzQLZl26uhmAHNeo7ry7O5W6dkV6R/5C70GrZmmR3Yxv9enNLA3AMCnZZ mcSf4bwf2obczbRIFYkeuf5Fk5BdT90yYdCwNzQ1BDLc1U1EZcewGaU51D/hCLmsT9jyy+X5RvWYn 960Tjv4Jv4yM6DnIMBLOm/yA6v5fxWWtdsypXbxhkjTy/jdftv4vwWn9yjUIo7D6XdkfWn6vJVdeO 76Yvj4IDcF9X+BdvBVWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghLlS-0003hu-3m; Wed, 09 Jan 2019 21:51:54 +0000 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1ghLlO-0003hP-VF for linux-mtd@lists.infradead.org; Wed, 09 Jan 2019 21:51:52 +0000 Received: by mail-lj1-x243.google.com with SMTP id g11-v6so7854372ljk.3 for ; Wed, 09 Jan 2019 13:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xnDKAde8TK3ZQK5pkVpLN473t876P1GyPhSOZ6bOoSA=; b=DbE8GHO8H3pFCRmrYMtZtIaDVZMacWa4P6cHlZmLIvvqOgZBzKKGZpjWmSnYy4cOSH uf73kGyLwiyd4EVi8gYCnugW7RdkmMT11GxESJGCkI0h+ZsWQakbZk4jJ9V+0GB7od+o emL/ZIdb5iYC2Oth1JwERzDGBZUUdXT0TwesE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xnDKAde8TK3ZQK5pkVpLN473t876P1GyPhSOZ6bOoSA=; b=r6qZWhEXJ9XX+5r5zDOENl5xYWd9qR76ttYTrfL8ItVPPvMvADs2bMhX2+iqrW36Oy lwo17d8gAu1ROqIFz2qUcK2SiLWUJDltKE61EeKulzPTL3Mtd7MWUlFEAaq/bDORk85N ZF2dU+ge/PAPbfOT8WrqzbImC1KO+ASDKHXnu0auXSEix6o1gtYqCP0kxv6Amq4EqRXY dLqNNh6w9k5V7Q/X0WawroT6WDjJjteZMPZf+G+dQ9DOVVbGYZNzuNu4tDxVjzN0w4g/ LWPe31uNvzBwUnZ+hCzZXHqUEaT9ujjh0eUfCsm1/7nYREszReVkBk/l8DKRHg/aYdnN cksA== X-Gm-Message-State: AJcUukcd4T9vXmcJvI5GBBtob259nJxhb0rJxmB5Tgiz1Y3Wy6hm1pPR bjuTKW+UzGfDAG57aH20jw5x6Q== X-Received: by 2002:a2e:9457:: with SMTP id o23-v6mr4822495ljh.7.1547070708276; Wed, 09 Jan 2019 13:51:48 -0800 (PST) Received: from localhost.bredbandsbolaget (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id s20sm13615123lfb.51.2019.01.09.13.51.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 Jan 2019 13:51:47 -0800 (PST) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH] mtd: rawnand: fsmc: Keep bank enable bit set Date: Wed, 9 Jan 2019 22:51:44 +0100 Message-Id: <20190109215144.15749-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190109_135151_018065_22D93764 X-CRM114-Status: GOOD ( 16.01 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: Linus Walleij Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Hammering the "bank enable" (PBKEN) bit on and off between every command crashes the Nomadik NHK15 with this message: Scanning device for bad blocks Unhandled fault: external abort on non-linefetch (0x008) at 0xcc95e000 pgd = (ptrval) [cc95e000] *pgd=0b808811, *pte=40000653, *ppte=40000552 Internal error: : 8 [#1] PREEMPT ARM Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.20.0-rc2+ #72 Hardware name: Nomadik STn8815 PC is at fsmc_exec_op+0x194/0x204 (...) After a discussion we (me and Boris Brezillion) start to suspect that this bit does not immediately control the chip select line at all, it rather enables access to the bank and the hardware will drive the CS autonomously. If there is a NAND chip connected, we should keep this enabled. As fsmc_nand_setup() sets this bit, we can simply remove the offending code. Fixes: 550b9fc4e3af ("mtd: rawnand: fsmc: Stop implementing ->select_chip()") Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/fsmc_nand.c | 21 --------------------- 1 file changed, 21 deletions(-) -- 2.19.2 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ Reviewed-by: Boris Brezillon Acked-by: Miquel Raynal diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c index 325b4414dccc..c9149a37f8f0 100644 --- a/drivers/mtd/nand/raw/fsmc_nand.c +++ b/drivers/mtd/nand/raw/fsmc_nand.c @@ -593,23 +593,6 @@ static void fsmc_write_buf_dma(struct fsmc_nand_data *host, const u8 *buf, dma_xfer(host, (void *)buf, len, DMA_TO_DEVICE); } -/* fsmc_select_chip - assert or deassert nCE */ -static void fsmc_ce_ctrl(struct fsmc_nand_data *host, bool assert) -{ - u32 pc = readl(host->regs_va + FSMC_PC); - - if (!assert) - writel_relaxed(pc & ~FSMC_ENABLE, host->regs_va + FSMC_PC); - else - writel_relaxed(pc | FSMC_ENABLE, host->regs_va + FSMC_PC); - - /* - * nCE line changes must be applied before returning from this - * function. - */ - mb(); -} - /* * fsmc_exec_op - hook called by the core to execute NAND operations * @@ -627,8 +610,6 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, pr_debug("Executing operation [%d instructions]:\n", op->ninstrs); - fsmc_ce_ctrl(host, true); - for (op_id = 0; op_id < op->ninstrs; op_id++) { instr = &op->instrs[op_id]; @@ -686,8 +667,6 @@ static int fsmc_exec_op(struct nand_chip *chip, const struct nand_operation *op, } } - fsmc_ce_ctrl(host, false); - return ret; }