From patchwork Fri Jan 18 21:06:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1027743 X-Patchwork-Delegate: miquel.raynal@bootlin.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="eRJ8Ib/M"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Kc/iWEoU"; 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 43hD5C6lXnz9sCh for ; Sat, 19 Jan 2019 08:06:23 +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=OFsDt9LkKYTfZ5Vr+/tbcNmQXEls0RK6LYL3sqO9ALc=; b=eRJ8Ib/M/HhcZ2 v3iOQG6NInvAg4MSa5R+ZA98zTHVTKA2dPbFERoeaJVvDtmHWdSBEZ4RhqkX/LgfQudbgnPc8rbjp gof7293yUR98Z9YLAOafaFSQ8lqJko7pGszPVZkn6qGmLjz9wQc8NYVYUWAIpQAep/pvd3E5XBrp6 KR0mc1mDp30eATWUuj/8qwaUuqyJ7CsLwFvY4TeuU1Lti9+0S8ILgciUHHO91iRObUjlU+Se97y9y 8vFjYilhxhhsgkkpNX2dy4ssKgzuxdMbZWc5OiRExRYy9z4K6eyLbPRcfV/4gvgJSRMHHdtJe/w3g b3/CVYL1YuFJcHCWcUUg==; 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 1gkbLE-00050b-17; Fri, 18 Jan 2019 21:06:16 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkbLB-000502-6E for linux-mtd@lists.infradead.org; Fri, 18 Jan 2019 21:06:14 +0000 Received: by mail-lj1-x241.google.com with SMTP id k15-v6so12757476ljc.8 for ; Fri, 18 Jan 2019 13:06:12 -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=7jX5zdy+b8YE7tC69x5iiWFVbJ0EmPYf9FF8/dNUZV0=; b=Kc/iWEoUpCt2hd+UpbSktEIiuf2h8BtfaPSAyfUun0NiwpgcgI5BOw3TPTRiZBke9X Z0NPRLFqZ+uEsKK4Z/dxO8zt8ZG9RRzPukqrD885R/2nSAHVp+/WspnXztdApOP933Tk AIYhxAlu25Ia3FqhhQDn9d6ikOAyYUn9R7akc= 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=7jX5zdy+b8YE7tC69x5iiWFVbJ0EmPYf9FF8/dNUZV0=; b=r6nWLsGKoUXC1tNCJvSNPkLpsnH54FtZj/IJ424/JSIBtOEi1FYYxue+sHrcNdsTs1 e5VMjkvhDc6S/PhKD/tk/kyBXNz1zCpDo2T9LWi3+0Y3NOAFt/SL3ro4nphrJXtDYeeW CBNvFyuCVz8N+F0LpYIW5YCY079t7YNMcqJ8wJPbvKrphupnbxXi42YUb0zD0pQPf3zU Aq/4wPyepyfx9qNyTBmlqLh8sY/HB8A5x1vj9O9ID/oJtWQos1LWpgf+oJZsCGHHSJl3 cjD0kTUgzW5uHvyrL+j10fzmCyd51StAxoXFwcojnV6uiBQAHvhkYVrrMjrLiWJHZSYQ x2jw== X-Gm-Message-State: AJcUukdcu3XmNGgs6rcF/xzEtH628a+9EPMNCo3JI1NpBl2zA+GrXwdb IxhQom68Vjgr9zIKYmXCxXZHEw== X-Google-Smtp-Source: ALg8bN7iaVCknBoRiGNhqvbW4ixG+J0Cbrqk/ATCRL+BDTMsumXrAr9bdgBvV1/Pcc2sSSevu/ex+w== X-Received: by 2002:a2e:4218:: with SMTP id p24-v6mr12982091lja.58.1547845570980; Fri, 18 Jan 2019 13:06:10 -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 k68-v6sm923993ljb.35.2019.01.18.13.06.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:06:09 -0800 (PST) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 1/2] mtd: rawnand: fsmc: Reset NAND timings on resume() Date: Fri, 18 Jan 2019 22:06:04 +0100 Message-Id: <20190118210604.8231-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-20190118_130613_238208_1E37E4E7 X-CRM114-Status: GOOD ( 13.92 ) 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:241 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_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.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: Linus Walleij Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When we go through a suspend/resume cycle the NAND timings may have been lost so reset the chip. This hardware will autonomously enable/disable the chip selects depending on what memory is accessed and chip selects are not software controlled, so we only lass chip select "0" for "all chips". Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/fsmc_nand.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c index c9149a37f8f0..4050843dd35e 100644 --- a/drivers/mtd/nand/raw/fsmc_nand.c +++ b/drivers/mtd/nand/raw/fsmc_nand.c @@ -1164,6 +1164,7 @@ static int fsmc_nand_resume(struct device *dev) clk_prepare_enable(host->clk); if (host->dev_timings) fsmc_nand_setup(host, host->dev_timings); + nand_reset(&host->nand, 0); } return 0; From patchwork Fri Jan 18 21:06:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 1027744 X-Patchwork-Delegate: miquel.raynal@bootlin.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="FE7DUk0r"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="CNxuoiZC"; 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 43hD5Q0TGXz9sCh for ; Sat, 19 Jan 2019 08:06:34 +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=v8tzMGMxNnRMS/e8q/SawHdBxSnFPXjUk0c6an1lv58=; b=FE7DUk0rQB7iZM D+oMM7Wvq260tr5wmu4GJocqGD6+CvAUK8TWcJVI6Bms9pubbYWIqRFdiW7TESXaKh8JaFhRm7HT7 qAB3AoFtrfI2QBBWhdmop3ucMeWj/Hf2Z/8KE9bPOzj/GqutssCCNqX+CrIGm6Bc9aWydyllw/V0D nXYM7oOb4gQz5s2n/dHIrJfWHKj+ViqvNDgbMYAblS6biMQurTPQlapiNl5Vj8KZU6PIY5IkUWAKY gyM284iiGE7zISFwcy4bxSK2SKUtDBAxMk4HMutsOxk6roxeb80kVHa+gKOm+hZbRUzNhJOM6MAX1 iTKdBtlIcWiW/Tsb/OSw==; 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 1gkbLP-0005Bu-NK; Fri, 18 Jan 2019 21:06:27 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkbLI-00052W-1Z for linux-mtd@lists.infradead.org; Fri, 18 Jan 2019 21:06:25 +0000 Received: by mail-lj1-x244.google.com with SMTP id c19-v6so12787361lja.5 for ; Fri, 18 Jan 2019 13:06:19 -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=K5lyavPbDV0iJg1W50ZkDSeB+HjlRIbMOn2Z/gYczK4=; b=CNxuoiZC9gW/DXv+uu9yBig9/tj07y5XzfBDdYCHBmDaYvzfWerjTrnOhy9UqR8/kl waP7Y+1aixaI6BGvL8yEpXbG2HI8aMxqYNGaTnnyag8DhnBVL34z1cX2lx+oHankrkLO qliPCEqMOjqV2oxRRz+gJZvYNnQWQTLaSSM5Y= 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=K5lyavPbDV0iJg1W50ZkDSeB+HjlRIbMOn2Z/gYczK4=; b=CYRXz+R2VzhcB3IjWcmAjmXqZoyuTt7nYanVIJUNJZuEb1tAebWB2mOGnLpeTrTZWs 3+s+qwm37k1YIno4hyTMyrvKZg4U0fC7IZet8z2baW3fykvtmECaqhTYs+YPsGN8rfhF tziNtB2GK2uoEeQ+VfxUkZ38/BGbsXWhixD9dD6OMAsClv+XecS3mSm0rgl+8Iv47eGu eSA/QC4MMj+HeUSYVfiVIwuwsjQCE+IBSCxaP/AoXbFropaBdlnuCzuUm4s6kpZpWRQJ +xFY/DS1FZYJsX8Ghuced5uxDUO40sCokvBvzSZVOVz7TAeMS8k4RYBh4r/s19EGhIE6 XQeg== X-Gm-Message-State: AJcUukelSHzjVg7oMEjQPsS1lUDDVUNJBs1liiChf0s1H6dKks/Ntltz loWiWfYwd/29C05uR8CMm+Ps2Q== X-Google-Smtp-Source: ALg8bN6FWyNLUzWlyeLIeDc1ELecVbmbOQFVllEC/cR+vghCcRZp7QhNOn4FgfMzV0+gQwXHMC0K9w== X-Received: by 2002:a2e:7f04:: with SMTP id a4-v6mr14043495ljd.156.1547845577941; Fri, 18 Jan 2019 13:06:17 -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 u21-v6sm914310lju.46.2019.01.18.13.06.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:06:16 -0800 (PST) From: Linus Walleij To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Subject: [PATCH 2/2] mtd: rawnand: fsmc: Disable NAND on remove() Date: Fri, 18 Jan 2019 22:06:15 +0100 Message-Id: <20190118210615.8286-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-20190118_130620_709496_17A0B35B X-CRM114-Status: GOOD ( 14.73 ) 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:244 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_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.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: Linus Walleij Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This disables the NAND on remove() and the errorpath, making sure the chipselect gets deasserted when the NAND is not in use. Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/fsmc_nand.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c index 4050843dd35e..118b1b1cd8da 100644 --- a/drivers/mtd/nand/raw/fsmc_nand.c +++ b/drivers/mtd/nand/raw/fsmc_nand.c @@ -979,6 +979,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) dma_cap_mask_t mask; int ret = 0; u32 pid; + u32 val; int i; /* Allocate memory for the device structure (and zero it) */ @@ -1120,6 +1121,9 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) if (host->mode == USE_DMA_ACCESS) dma_release_channel(host->read_dma_chan); disable_clk: + val = readl(host->regs_va + FSMC_PC); + val &= ~FSMC_ENABLE; + writel(val, host->regs_va + FSMC_PC); clk_disable_unprepare(host->clk); return ret; @@ -1131,10 +1135,15 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) static int fsmc_nand_remove(struct platform_device *pdev) { struct fsmc_nand_data *host = platform_get_drvdata(pdev); + u32 val; if (host) { nand_release(&host->nand); + val = readl(host->regs_va + FSMC_PC); + val &= ~FSMC_ENABLE; + writel(val, host->regs_va + FSMC_PC); + if (host->mode == USE_DMA_ACCESS) { dma_release_channel(host->write_dma_chan); dma_release_channel(host->read_dma_chan);