From patchwork Tue Jun 13 13:45:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 105347 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp414877qgd; Tue, 13 Jun 2017 06:49:36 -0700 (PDT) X-Received: by 10.99.126.90 with SMTP id o26mr31074035pgn.8.1497361775993; Tue, 13 Jun 2017 06:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497361775; cv=none; d=google.com; s=arc-20160816; b=et0HyMUnYewscR/yHLL/uyTdI4g+dD9E7f6U5gg2lwsStqQoto//pDkyMZZ+Wrjur/ 2Uosz3FEL95y14dGoqCwcYpyf+Cda8VxwB/2fPKcH+WEyGyt/xnAdXzEgo5XuicYb24M tAxMm7lLMt5/2tB+ZdkdCeuPSg+Xegi7+5tig/g3vG80l+QyySbm9sZsExJxBxZg6t2T CeQKYeKh0+7q/rZMeTgq7Ux2AwY+gBU/cv/+DXk5cZJzvXnbpNR908mqJqEDeMrpy4Pm 5Huhpneag7zA3uX8PRFwp7/XVUR1ql5/iBE7aS6/PwHMcJtxN1dNvk8/ZDQpuDF1Cbih 5t+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature :arc-authentication-results; bh=41dzvdBntEgxVV6LjAOXGJtNep6+icjjs/DIYYKOW74=; b=OaQKCOzK45xEdjHXOj8rWvgniHiFrQcCKqqAKLfL02eVv+3QvX9517/uWyhEDKK4+p //yBYc8JN3jb3GSpuFLR+JH4mSF0Um5gTXpwNhCwbwtQuWmRGVEt4jley7MKpiPD97I/ N+XgBrVZud9bc6g0eeAo9wJ8x9S69XGPndYHf8kZRZkJ0xjbzb70CELQVqTvfgfnBnLH 1zpGlgMbmAiRNpB+9zDC568zr1bm4ajFOhWaMIkuWJU4wLijFiVLWS8/cbaLp4yFqicq zArunpj3St0fZrk8nyn4yVaWJdx0yIgpu7ZINcNZERg7ftCJzsqaLFe1L2bJ9v9KvZSz 0F0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id l20si9968658pli.547.2017.06.13.06.49.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 06:49:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=41dzvdBntEgxVV6LjAOXGJtNep6+icjjs/DIYYKOW74=; b=HjWKm2X/kd0LOWfbeEXODWYKb4 f3TgwpiJYGY6odnceMuFjN8ynRDCU86+03RLhXuDbduTXT/YyaHayt/6Fuz1y7o0uH20Z7Aj6+BBq S5nrUZ1ugqDOpwPgygiUG6bTTRGMplQ6QBW2j6wLPpDYKW5XBW7uV7NSNnbYmwpuzeD+W0jBCh15/ dowyXmPuH2IEwGzlWSKg2utbUQl0l5bUz/jyrhA4UZQsiV7uO+FcvM9OagwkAab7XG14UIb4BtF3G AWxkXTRm8K0bz9gIOFVUverjSwM9rO0rZBzS5gMQIZ6fPRiJRu7tubvIe1I+8dDgGORLYyCkzkDQ1 fWJQiBtQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKmCN-0000i6-19; Tue, 13 Jun 2017 13:49:35 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKmA8-0006VC-I2 for linux-mtd@lists.infradead.org; Tue, 13 Jun 2017 13:47:20 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v5DDjxil031338; Tue, 13 Jun 2017 22:46:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v5DDjxil031338 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1497361565; bh=1oA7UHMnOrgNr9/+F/ngUuEMTieAtrSa7hPMrMiDjoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=11EnhADuAFfSs3UJr3PPuyaTJgxmnoWNXMQ/a4eaV8v0Xn4J4feZ236k/Z6wjyNaR RNeYlJ6zA/3CQViQUkIZpawBeNIUYizpvECgQADH1xTUGVHP2cgFVN7aiGUTZoFrJz rDLiIiU32LbBS1He4eJrtwFwdpM6YBX4JBbYCivFdNwR7L+04I9/zLdgAZm7AXDvCM pVRLVw1zDN5lgE5h/RCQPwHXH9s+yGtG8LahXU4Kl8HQHYZfvFO3TybHtWIo62pzse Yjfci3IZ42hoNNcgL+pXQ0IawP1WDIhyalpz0evZoYdMv/iB+dTp0NttmMUMyFDrm5 2raQdagAMoDxw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v7 02/16] mtd: nand: denali: remove unneeded find_valid_banks() Date: Tue, 13 Jun 2017 22:45:36 +0900 Message-Id: <1497361550-8115-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497361550-8115-1-git-send-email-yamada.masahiro@socionext.com> References: <1497361550-8115-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170613_064716_911623_E281477E X-CRM114-Status: GOOD ( 16.66 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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 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: Boris Brezillon , Cyrille Pitchen , Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Dinh Nguyen , linux-kernel@vger.kernel.org, Enrico Jorns , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org The function find_valid_banks() issues the Read ID (0x90) command, then compares the first byte (Manufacturer ID) of each bank with the one of bank0. This is equivalent to what nand_scan_ident() does. The number of chips is detected there, so this is unneeded. What is worse for find_valid_banks() is that, if multiple chips are connected to INTEL_CE4100 platform, it crashes the kernel by BUG(). This is what we should avoid. This function is just harmful and unneeded. Signed-off-by: Masahiro Yamada --- Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - Newly added drivers/mtd/nand/denali.c | 47 ----------------------------------------------- drivers/mtd/nand/denali.h | 1 - 2 files changed, 48 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 7133a33b4ad3..122df4c6126d 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -338,51 +338,6 @@ static void get_samsung_nand_para(struct denali_nand_info *denali, } /* - * determines how many NAND chips are connected to the controller. Note for - * Intel CE4100 devices we don't support more than one device. - */ -static void find_valid_banks(struct denali_nand_info *denali) -{ - uint32_t id[denali->max_banks]; - int i; - - denali->total_used_banks = 1; - for (i = 0; i < denali->max_banks; i++) { - index_addr(denali, MODE_11 | (i << 24) | 0, 0x90); - index_addr(denali, MODE_11 | (i << 24) | 1, 0); - index_addr_read_data(denali, MODE_11 | (i << 24) | 2, &id[i]); - - dev_dbg(denali->dev, - "Return 1st ID for bank[%d]: %x\n", i, id[i]); - - if (i == 0) { - if (!(id[i] & 0x0ff)) - break; /* WTF? */ - } else { - if ((id[i] & 0x0ff) == (id[0] & 0x0ff)) - denali->total_used_banks++; - else - break; - } - } - - if (denali->platform == INTEL_CE4100) { - /* - * Platform limitations of the CE4100 device limit - * users to a single chip solution for NAND. - * Multichip support is not enabled. - */ - if (denali->total_used_banks != 1) { - dev_err(denali->dev, - "Sorry, Intel CE4100 only supports a single NAND device.\n"); - BUG(); - } - } - dev_dbg(denali->dev, - "denali->total_used_banks: %d\n", denali->total_used_banks); -} - -/* * Use the configuration feature register to determine the maximum number of * banks that the hardware supports. */ @@ -439,8 +394,6 @@ static uint16_t denali_nand_timing_set(struct denali_nand_info *denali) ioread32(denali->flash_reg + RDWR_EN_HI_CNT), ioread32(denali->flash_reg + CS_SETUP_CNT)); - find_valid_banks(denali); - /* * If the user specified to override the default timings * with a specific ONFI mode, we apply those changes here. diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h index 352d8328b94a..0e4a8965f6f1 100644 --- a/drivers/mtd/nand/denali.h +++ b/drivers/mtd/nand/denali.h @@ -326,7 +326,6 @@ struct denali_nand_info { int platform; struct nand_buf buf; struct device *dev; - int total_used_banks; int page; void __iomem *flash_reg; /* Register Interface */ void __iomem *flash_mem; /* Host Data/Command Interface */