From patchwork Sat Jan 26 13:10:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 156678 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1477111jaa; Sat, 26 Jan 2019 05:11:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN6PDMCkSGKuqnvZdsn61RGvzWJLCWyBRuAwdEEBPdOs3IwJLK2zwRdJ2IYI3/TVehnAB9Fo X-Received: by 2002:a17:902:9691:: with SMTP id n17mr15410694plp.9.1548508293841; Sat, 26 Jan 2019 05:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548508293; cv=none; d=google.com; s=arc-20160816; b=1KNNPfbX/yaqpK3r26BjUGX14pW7NQYQABS7sLZNKf6ctF/2RA+AQbByzXAA1hMHCG R3BwNMUEU+fZYzY05iKzqAfGq+2f1VR2mwV6//OL+SYa7FkxIbqVoEAOlRPBiqs3dDPW y631iUEgWou0G7znWrsH1ALRjfxtq9QRzRT3gb4uwhqxY72A/fSRmYqKi1hI4p4Aosjz zn5NbrIFw3W1GjSoKEjMWr3CBtune41Q98XMsmQ0mT9sdJb+kgse8OeBLoeyajOmqxI3 Ekzwaaa4IpIU31qV7X/a/PMVQvYhnE/bJpOR9xTPF1eGP3JUWFiY+UUs+KqcBaYgZdwH Zteg== 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:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:dkim-signature; bh=jNaat2iFGIoAawO5LYSQms+YzOnhFCzZ132S/MukUGc=; b=S2gVnjbQiMNZ8NxrUniu6JliZ2IyB3amXWpJ//+Tr+36y4EbdfUgnZxun7AokZrfcU dPswPzRulJJLJOIVQOwNSoLAGL8i0d2zhfytJLFgGWf9L4owzpkTsvfts4RxHzZ1KRwr 2+EDe7RhfFvHUK1VsOpV1ZljtV7fDNbQSu8iiErayWN9cuRkpP9TNBNlKI6ybvy+lBML Qhf0EGv7pV2gmLRSUtyGxsfpF2OMWpZyKBRwdxn1mqegakg+Ez+qGtb1zz3RGqmQP54T kOXbGO5vN/vdvfsQIVsG8d36E+0fnlw1AKc335wkP3scPP4IqTuCdyiW3A5tSjZg6RWI Ne+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=dXvZiWfg; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PF0jWI4J; 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 c65si7430314pfe.202.2019.01.26.05.11.33 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 26 Jan 2019 05:11:33 -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=dXvZiWfg; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PF0jWI4J; 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: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=jNaat2iFGIoAawO5LYSQms+YzOnhFCzZ132S/MukUGc=; b=dXvZiWfgkkFWDb XuEuKFCFOJ7+H/oKwCRd8sha5DX9QntN5QVRVF7WT4kw4s3w0rRjNIUPLhbGrt2DjtmQAui98yQHp uYflUfnjRQqw3ZWX4+IgDYxyX2FGhw7Zt0mvSz97/sOt8E40AN89G5RQDH4er4+qYVqD80peaqkhS dn6SuP6VXxo+Bc7h97O5x3qfqhpB54jegoly5A2uFfQCd1A6nAXu6M93R2ChzL0fH4JD0rJZ3W25Q 4VdC5EvZi3lGA5LkkfLLqOTY7oyy53VwU9dV7lK2bC01zyv5lUWxVlvIByyP1E3/So7bsncmJtPHE GGKs7VRczAHLWZqjCpTw==; 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 1gnNk2-0003rf-1P; Sat, 26 Jan 2019 13:11:22 +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 1gnNjq-0003gE-EU for linux-mtd@lists.infradead.org; Sat, 26 Jan 2019 13:11:11 +0000 Received: by mail-lj1-x243.google.com with SMTP id s5-v6so10549141ljd.12 for ; Sat, 26 Jan 2019 05:11:10 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=C/3TY6rq/0PZRVa0c05fWF4DRikwplDxAw+KXls7E4o=; b=PF0jWI4JGa7MljDBKfcZ3OLncwcKdnFTYk4oThgzI2HVPi04fE51hJJKeV4isxJ3nU HNeRz887zKi/VT2pdj5cU1TeYEu7ZzzjtAoNyHWekkVOzhTDbZ8b2QAgkEWfB4Ukk687 frN3FCracex0vBbf7Ead2sVV8TiHJNVZ4X/vQ= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=C/3TY6rq/0PZRVa0c05fWF4DRikwplDxAw+KXls7E4o=; b=gGCnCgtQay6CF9eLhk9HMx7eRJDtt/S31YdPiGEuIUOmGhkfqUuB/6axuPqWWK65HY WG5Iqj41xV6G4X4781yKG7IyAaZeu7DN+8ZHV3qkJZxiSvO3bH7Ri/O5eQRR8pQSc0tU /P9EHaHUwosli8yU6U26BP6p1drzzgkbrOnNerXiB7J6HKkNj4dJFY3SNI/fsG9B0VLi sH5sM1xe0hp3X2yujm6K+xYjsqwk6R5Hnd02T0i1zpkI8W1OtAn85UNufYiKIOIrR7qd 8d1BS1GyjpFP6Dbsr9dTU9J+ibH3wmI94p6es3+YFiF3yk2z7Vl1/75isAd0Lxb4oyEb JMEQ== X-Gm-Message-State: AJcUukcthbERss/wLRCVB7pIDwkmN7YAwpNgFmK5QqmwABZAf5bjIt7E JPccXw6i2V6rYQbc5hd2BAEhP1J5XkQ= X-Received: by 2002:a2e:2d11:: with SMTP id t17-v6mr11994173ljt.159.1548508268449; Sat, 26 Jan 2019 05:11:08 -0800 (PST) Received: from linux.local (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id s127sm2109390lfe.8.2019.01.26.05.11.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 26 Jan 2019 05:11:07 -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 v2] mtd: rawnand: fsmc: Disable NAND on remove() Date: Sat, 26 Jan 2019 14:10:56 +0100 Message-Id: <20190126131056.11364-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190126131056.11364-1-linus.walleij@linaro.org> References: <20190126131056.11364-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190126_051110_485797_C679C5D8 X-CRM114-Status: GOOD ( 17.02 ) 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 Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from 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 , Miquel Raynal Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.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. Cc: Miquel Raynal Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Break out NAND bank disable code into its own function. --- drivers/mtd/nand/raw/fsmc_nand.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c index 4050843dd35e..6c7ca41354be 100644 --- a/drivers/mtd/nand/raw/fsmc_nand.c +++ b/drivers/mtd/nand/raw/fsmc_nand.c @@ -965,6 +965,19 @@ static const struct nand_controller_ops fsmc_nand_controller_ops = { .setup_data_interface = fsmc_setup_data_interface, }; +/** + * fsmc_nand_disable() - Disables the NAND bank + * @host: The instance to disable + */ +static void fsmc_nand_disable(struct fsmc_nand_data *host) +{ + u32 val; + + val = readl(host->regs_va + FSMC_PC); + val &= ~FSMC_ENABLE; + writel(val, host->regs_va + FSMC_PC); +} + /* * fsmc_nand_probe - Probe function * @pdev: platform device structure @@ -1120,6 +1133,7 @@ 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: + fsmc_nand_disable(host); clk_disable_unprepare(host->clk); return ret; @@ -1134,6 +1148,7 @@ static int fsmc_nand_remove(struct platform_device *pdev) if (host) { nand_release(&host->nand); + fsmc_nand_disable(host); if (host->mode == USE_DMA_ACCESS) { dma_release_channel(host->write_dma_chan);