From patchwork Thu May 1 09:56:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 29460 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7197D203F3 for ; Thu, 1 May 2014 09:57:43 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf12447895oah.5 for ; Thu, 01 May 2014 02:57:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=UBlx5++LrwJYkMnrZRGzCoveI7I6dJ1zZDdv98XJbwU=; b=c1LkPqW+nxFLbN308mPe78x86SFpdrf0exrLpJIhZtku+6QPTSetKIyqLlrVXtUmrc 3UvTCnZIsFsrIFTPryaIkUnp42U6lMdOIVAKqlLKkPxDZ4SOOaoMc+RXKF4jYV2URG1X 33QnYwH0lvfkCW45MGjRF1uoaRIU4c4MLB908tJHoKeyoPkWoApXP4+DC3LU7APLAJom aPzv8C8BpOPnHx6CgJR+XMZS9+lBd+AeR0AznfC8D6FaKEdmOE0bT9Ehf1WJbcycton9 4NRtSMlI9sH5lxk8fvWBc8rKPHtAvQFFtOkr+XTCB0iwHOudoFTQNNuDyEJEaLnK0cfQ 8ixQ== X-Gm-Message-State: ALoCoQn72X0bzPAdqpajQbYYBY21haYIJ3B9QlvzvLTSNTZN9ppcUNv4GTsPD5ALewi5FaoEKGSY X-Received: by 10.43.18.133 with SMTP id qg5mr4553927icb.13.1398938263063; Thu, 01 May 2014 02:57:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.212 with SMTP id z78ls968507qgz.93.gmail; Thu, 01 May 2014 02:57:42 -0700 (PDT) X-Received: by 10.221.55.133 with SMTP id vy5mr8114457vcb.17.1398938262916; Thu, 01 May 2014 02:57:42 -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 xt2si5968910vcb.33.2014.05.01.02.57.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:42 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id oz11so3603618veb.6 for ; Thu, 01 May 2014 02:57:42 -0700 (PDT) X-Received: by 10.58.1.97 with SMTP id 1mr8403623vel.23.1398938262849; Thu, 01 May 2014 02:57:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp12920vcb; Thu, 1 May 2014 02:57:42 -0700 (PDT) X-Received: by 10.194.77.148 with SMTP id s20mr8152934wjw.31.1398938261851; Thu, 01 May 2014 02:57:41 -0700 (PDT) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx.google.com with ESMTPS id ko5si10556995wjc.4.2014.05.01.02.57.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:41 -0700 (PDT) Received-SPF: none (google.com: lee.jones@linaro.org does not designate permitted sender hosts) client-ip=209.85.212.172; Received: by mail-wi0-f172.google.com with SMTP id hi2so407707wib.11 for ; Thu, 01 May 2014 02:57:41 -0700 (PDT) X-Received: by 10.180.91.161 with SMTP id cf1mr1438458wib.49.1398938261359; Thu, 01 May 2014 02:57:41 -0700 (PDT) Received: from lee--X1.home (host109-148-238-223.range109-148.btcentralplus.com. [109.148.238.223]) by mx.google.com with ESMTPSA id bj5sm2696494wib.3.2014.05.01.02.57.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 May 2014 02:57:40 -0700 (PDT) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: computersforpeace@gmail.com, linux-mtd@lists.infradead.org, kernel@stlinux.com, Lee Jones Subject: [PATCH 17/47] mtd: nand: stm_nand_bch: derive some working variables for latter use Date: Thu, 1 May 2014 10:56:24 +0100 Message-Id: <1398938214-17847-18-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398938214-17847-1-git-send-email-lee.jones@linaro.org> References: <1398938214-17847-1-git-send-email-lee.jones@linaro.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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 a1c25d0..8302273 100644 --- a/drivers/mtd/nand/stm_nand_bch.c +++ b/drivers/mtd/nand/stm_nand_bch.c @@ -930,6 +930,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; }