linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Piotr Sroka <piotrs@cadence.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
	Richard Weinberger <richard@nod.at>,
	linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
	linux-mtd@lists.infradead.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Kazuhiro Kasai <kasai.kazuhiro@socionext.com>,
	Piotr Sroka <piotrs@cadence.com>
Subject: [PATCH 2/4] mtd: rawnand: cadence: fix calculating avaialble oob size
Date: Mon, 10 Feb 2020 10:55:26 +0100	[thread overview]
Message-ID: <1581328530-29966-2-git-send-email-piotrs@cadence.com> (raw)
In-Reply-To: <1581328530-29966-1-git-send-email-piotrs@cadence.com>

Previously ecc_sector size was used for calculation but its value
was not yet known.

Signed-off-by: Piotr Sroka <piotrs@cadence.com>
---
 drivers/mtd/nand/raw/cadence-nand-controller.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/cadence-nand-controller.c b/drivers/mtd/nand/raw/cadence-nand-controller.c
index 5063a8b493a4..2ebfd0934739 100644
--- a/drivers/mtd/nand/raw/cadence-nand-controller.c
+++ b/drivers/mtd/nand/raw/cadence-nand-controller.c
@@ -2595,7 +2595,7 @@ int cadence_nand_attach_chip(struct nand_chip *chip)
 {
 	struct cdns_nand_ctrl *cdns_ctrl = to_cdns_nand_ctrl(chip->controller);
 	struct cdns_nand_chip *cdns_chip = to_cdns_nand_chip(chip);
-	u32 ecc_size = cdns_chip->sector_count * chip->ecc.bytes;
+	u32 ecc_size;
 	struct mtd_info *mtd = nand_to_mtd(chip);
 	int ret;
 
@@ -2634,6 +2634,7 @@ int cadence_nand_attach_chip(struct nand_chip *chip)
 	/* Error correction configuration. */
 	cdns_chip->sector_size = chip->ecc.size;
 	cdns_chip->sector_count = mtd->writesize / cdns_chip->sector_size;
+	ecc_size = cdns_chip->sector_count * chip->ecc.bytes;
 
 	cdns_chip->avail_oob_size = mtd->oobsize - ecc_size;
 
-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-02-10  9:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10  9:55 [PATCH 1/4] mtd: rawnand: cadence: get meta data size from registers Piotr Sroka
2020-02-10  9:55 ` Piotr Sroka [this message]
2020-02-18 10:45   ` [PATCH 2/4] mtd: rawnand: cadence: fix calculating avaialble oob size Miquel Raynal
2020-03-10 18:29   ` Miquel Raynal
2020-03-11  7:17     ` Miquel Raynal
2020-02-10  9:55 ` [PATCH 3/4] mtd: rawnand: cadence: change bad block marker size Piotr Sroka
2020-02-18 10:47   ` Miquel Raynal
2020-03-10 18:29   ` Miquel Raynal
2020-02-10  9:55 ` [PATCH 4/4] mtd: rawnand: cadence: reinit complete before execute command Piotr Sroka
2020-02-18 10:48   ` Miquel Raynal
2020-03-10 18:29   ` Miquel Raynal
2020-03-10 18:29 ` [PATCH 1/4] mtd: rawnand: cadence: get meta data size from registers Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1581328530-29966-2-git-send-email-piotrs@cadence.com \
    --to=piotrs@cadence.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=kasai.kazuhiro@socionext.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).