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: 1022629 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pxqtFxPh"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="DbE8GHO8"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43ZjWz1gWgz9s55 for ; Thu, 10 Jan 2019 08:51:59 +1100 (AEDT) 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-5L; 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-Google-Smtp-Source: ALg8bN7k9jJGR1p/W0RKiNr0StfQ4967R23XjBBKiAsCHWI+TfrH/gkp5jjS8pNeCBb2hecxM2EEvA== 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+incoming=patchwork.ozlabs.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 Reviewed-by: Boris Brezillon Acked-by: Miquel Raynal --- drivers/mtd/nand/raw/fsmc_nand.c | 21 --------------------- 1 file changed, 21 deletions(-) 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; }