mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 5/8] mtd: nand-mxs: pass mtd_info to mxs_nand_get_mark_offset()
Date: Mon,  5 Aug 2019 14:20:12 +0200	[thread overview]
Message-ID: <20190805122015.19220-6-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20190805122015.19220-1-s.hauer@pengutronix.de>

struct mtd_info * contains everything mxs_nand_get_mark_offset() needs,
so pass this pointer rather than several integer arguments.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/nand_mxs.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index 92d78db6c9..2b2e80d4c5 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -287,9 +287,9 @@ static uint32_t mxs_nand_aux_status_offset(void)
 	return (MXS_NAND_METADATA_SIZE + 0x3) & ~0x3;
 }
 
-static inline uint32_t mxs_nand_get_mark_offset(uint32_t page_data_size,
-						uint32_t ecc_strength)
+static uint32_t mxs_nand_get_mark_offset(struct mtd_info *mtd)
 {
+	struct nand_chip *chip = mtd->priv;
 	uint32_t chunk_data_size_in_bits;
 	uint32_t chunk_ecc_size_in_bits;
 	uint32_t chunk_total_size_in_bits;
@@ -298,13 +298,13 @@ static inline uint32_t mxs_nand_get_mark_offset(uint32_t page_data_size,
 	uint32_t block_mark_bit_offset;
 
 	chunk_data_size_in_bits = MXS_NAND_CHUNK_DATA_CHUNK_SIZE * 8;
-	chunk_ecc_size_in_bits  = mxs_nand_ecc_size_in_bits(ecc_strength);
+	chunk_ecc_size_in_bits  = mxs_nand_ecc_size_in_bits(chip->ecc.strength);
 
 	chunk_total_size_in_bits =
 			chunk_data_size_in_bits + chunk_ecc_size_in_bits;
 
 	/* Compute the bit offset of the block mark within the physical page. */
-	block_mark_bit_offset = page_data_size * 8;
+	block_mark_bit_offset = mtd->writesize * 8;
 
 	/* Subtract the metadata bits. */
 	block_mark_bit_offset -= MXS_NAND_METADATA_SIZE * 8;
@@ -353,8 +353,7 @@ static int mxs_nand_calc_geo(struct mtd_info *mtd)
 	chip->ecc.bytes = DIV_ROUND_UP(13 * chip->ecc.strength, 8);
 	chip->ecc.size = MXS_NAND_CHUNK_DATA_CHUNK_SIZE;
 
-	nand_info->bb_mark_bit_offset = mxs_nand_get_mark_offset(mtd->writesize,
-								 chip->ecc.strength);
+	nand_info->bb_mark_bit_offset = mxs_nand_get_mark_offset(mtd);
 
 	return 0;
 }
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-08-05 12:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05 12:20 [PATCH 0/8] mtd: nand-mxs: Make ecc strength configurable via device tree Sascha Hauer
2019-08-05 12:20 ` [PATCH 1/8] mtd: nand-mxs: consistently rename struct nand_chip * to "chip" Sascha Hauer
2019-08-05 12:20 ` [PATCH 2/8] mtd: nand-mxs: calculate ecc_strength only once Sascha Hauer
2019-08-05 12:20 ` [PATCH 3/8] mtd: nand-mxs: Make locally used variable static Sascha Hauer
2019-08-05 12:20 ` [PATCH 4/8] mtd: nand-mxs: change API between NAND driver and fcb code Sascha Hauer
2019-08-05 12:20 ` Sascha Hauer [this message]
2019-08-05 12:20 ` [PATCH 6/8] mtd: nand-mxs: inline only once used function Sascha Hauer
2019-08-05 12:20 ` [PATCH 7/8] mtd: nand: Add function to parse device tree properties Sascha Hauer
2019-08-05 12:20 ` [PATCH 8/8] mtd: nand-mxs: Make ecc strength configurable via device tree Sascha Hauer

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=20190805122015.19220-6-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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