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: 156047 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3706231jaa; Fri, 18 Jan 2019 13:06:37 -0800 (PST) X-Google-Smtp-Source: ALg8bN7aajP5wg6Zc4hzdPQV2DlBaupU905fW07bnSBHF9CFmAzhekEG6O2hX01XtGs9ZjVKWBVa X-Received: by 2002:a63:2b82:: with SMTP id r124mr4311096pgr.300.1547845597550; Fri, 18 Jan 2019 13:06:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547845597; cv=none; d=google.com; s=arc-20160816; b=Nrq/lAc9htv6Cz63Yn/LWoOvU2LCnpWR3sLPOJF2UOkiVkANmZvJClMGxxU2UJ9ssu mF7tIeiXB+iRthYC7nj9Fis13zyqgm8pAkmuYo4TPcFt7OsS5skI/JOyagKJid/sJ+vF 8tmapW5Z7HAfxUzRDWOFpuxp1zowz3zYN0BKkPB1iyfbPg2rAYIbQfui5C7qD+3qkRQw FChtCXvH41JDVBW+2Bt0GxZmXenqKcgnQLK+O2xImWLOQqsBxnLbHNPrEKNVj3rWmXzV iaRTSkejGK4UmvxpIDDisTqxF8ltGIAZrULDhRX794EcIiBIHWn4VNEbVr0dgdT738+X +s6A== 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=v8tzMGMxNnRMS/e8q/SawHdBxSnFPXjUk0c6an1lv58=; b=R1SryX5NYtm8SANuLZTlPWkU9Vo0s6En+bBHwlSFmMXwU1M8c65FCasMMG2+ny2CAs zCgvsPlbYxWnbd0DZtUEEh9ZgMAIMJK8ARTN4U19yhOslp9EHZUdhak56XuFOMFIHCNL 0qoGs1xZmhGhsAALD8hyhI+do3FdmVl+V2pEdduP2mdkhTQloZeWLVl25UbJX5Ullo0z G4GRiX3Fed7VoRCtnP6SpzY08TZLK6qbgZ6Rb03Mez7O5M6wCfOLGRH2ITQgIGeRoh0/ CmKCecu+Kf0vsFGn3RzL7gkwxErj7fIgzABZMPbbYkm0vAPDbAOKFkOXnb0cpP5wXg/h sYtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=FE7DUk0r; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CNxuoiZC; 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 p4si917722pgm.342.2019.01.18.13.06.37 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 13:06:37 -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=FE7DUk0r; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CNxuoiZC; 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=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 1gkbLQ-0005Bu-0g; Fri, 18 Jan 2019 21:06:28 +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-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+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. Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/fsmc_nand.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.19.2 ______________________________________________________ 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..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);