From patchwork Tue Mar 25 08:19:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 26999 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f200.google.com (mail-yk0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C96EF20062 for ; Tue, 25 Mar 2014 08:40:21 +0000 (UTC) Received: by mail-yk0-f200.google.com with SMTP id q9sf771514ykb.3 for ; Tue, 25 Mar 2014 01:40:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=UKkk5NjCsj35chJdbTy71zgA+/vaHsNQbv+rC23UGRs=; b=iGMb8LA/rqjpRMQSmQHhN7bQIYbch9ZuRSi49erK5egw79BomykQktSCbmsZvh6gUx ZqiTTO16wTnfLUfdki/uyUultkOl5pvgWBGa50CQ0uSkG7DrxkLz+du3DlYOP59Qjf6Q QJiP4p0moYhKsyfqN+ux/KSdDh7bAzTBS2YsfURPpHF+KSg00EztSXohVFSp1mAmuYlI tQJvhELb/I4FPTsPxPxKG7BXf/bKvgcYFSE82XDq6iji488K2Izie028EJPuU7jWfH4I CvL8p+rRyzDSVmdybIbgMWufPWe8CXCko2kmOuNFo+rvVNzRKmqseAcasPQfBrobLWqM YIsw== X-Gm-Message-State: ALoCoQmLo49gcI5ANthbPSH/0MoqiSWWtLc3Yy+sAgCa3hiiXUE1as2qh7fXzYL9w3ig7aRybDOW X-Received: by 10.58.111.202 with SMTP id ik10mr17858623veb.4.1395736821564; Tue, 25 Mar 2014 01:40:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.42.20 with SMTP id b20ls151182qga.5.gmail; Tue, 25 Mar 2014 01:40:21 -0700 (PDT) X-Received: by 10.58.152.142 with SMTP id uy14mr22029679veb.4.1395736821456; Tue, 25 Mar 2014 01:40:21 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id la9si3593713veb.38.2014.03.25.01.40.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:40:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so145909veb.20 for ; Tue, 25 Mar 2014 01:40:21 -0700 (PDT) X-Received: by 10.52.164.237 with SMTP id yt13mr23984048vdb.18.1395736821341; Tue, 25 Mar 2014 01:40:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp286344vck; Tue, 25 Mar 2014 01:40:20 -0700 (PDT) X-Received: by 10.180.105.65 with SMTP id gk1mr22003586wib.12.1395736819951; Tue, 25 Mar 2014 01:40:19 -0700 (PDT) Received: from casper.infradead.org (casper.infradead.org. [85.118.1.10]) by mx.google.com with ESMTPS id en20si12273349wic.72.2014.03.25.01.40.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 01:40:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 85.118.1.10 as permitted sender) client-ip=85.118.1.10; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMt3-00086Q-Tl; Tue, 25 Mar 2014 08:39:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMsX-0003Ku-La; Tue, 25 Mar 2014 08:38:37 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMrS-00036r-I1 for linux-mtd@merlin.infradead.org; Tue, 25 Mar 2014 08:37:30 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSMbd-0007X3-71 for linux-mtd@lists.infradead.org; Tue, 25 Mar 2014 08:21:10 +0000 Received: by mail-wi0-f177.google.com with SMTP id cc10so339978wib.4 for ; Tue, 25 Mar 2014 01:20:48 -0700 (PDT) X-Received: by 10.180.107.136 with SMTP id hc8mr21581686wib.11.1395735648323; Tue, 25 Mar 2014 01:20:48 -0700 (PDT) Received: from lee--X1.home (host109-148-113-193.range109-148.btcentralplus.com. [109.148.113.193]) by mx.google.com with ESMTPSA id k4sm5567676wib.19.2014.03.25.01.20.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Mar 2014 01:20:47 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC 16/47] mtd: nand: stm_nand_bch: derive some working variables for latter use Date: Tue, 25 Mar 2014 08:19:33 +0000 Message-Id: <1395735604-26706-17-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> References: <1395735604-26706-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140325_082109_324532_760484A4 X-CRM114-Status: UNSURE ( 7.92 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-2.6 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: angus.clark@st.com, kernel@stlinux.com, lee.jones@linaro.org, linux-mtd@lists.infradead.org, pekon@ti.com, computersforpeace@gmail.com, dwmw2@infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lee.jones@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 A few of the working variables can either be taken or derived from existing knowledge about the connected chip. Rather than attempt to provide each specification manually, here we make assumptions based on information already obtained. Signed-off-by: Lee Jones --- drivers/mtd/nand/stm_nand_bch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/nand/stm_nand_bch.c b/drivers/mtd/nand/stm_nand_bch.c index 93fe835..f5a3e80 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -783,6 +783,15 @@ static int stm_nand_bch_probe(struct platform_device *pdev) return -EINVAL; } + /* Derive some working variables */ + nandi->sectors_per_page = mtd->writesize / NANDI_BCH_SECTOR_SIZE; + nandi->blocks_per_device = mtd->size >> chip->phys_erase_shift; + nandi->page_shift = chip->page_shift; + nandi->block_shift = chip->phys_erase_shift; + nandi->extra_addr = ((chip->chipsize >> nandi->page_shift) > + 0x10000) ? true : false; + mtd->writebufsize = mtd->writesize; + return 0; }