summaryrefslogtreecommitdiffstats
path: root/common/imx-bbu-nand-fcb.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-08-15 10:58:11 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-08-15 10:58:11 +0200
commita6aab0ebab471e91beb4e14c2d305b326ac18928 (patch)
tree44411e6dbed5e1c1f9999ae9827d678a5a88cdcb /common/imx-bbu-nand-fcb.c
parenta0b3119905e16d7610f950d0fd04a8689979be2e (diff)
parent6b309a2f91dca742a05a53922ff70970f28b428d (diff)
downloadbarebox-a6aab0ebab471e91beb4e14c2d305b326ac18928.tar.gz
barebox-a6aab0ebab471e91beb4e14c2d305b326ac18928.tar.xz
Merge branch 'for-next/mtd-gpmi-nand'
Diffstat (limited to 'common/imx-bbu-nand-fcb.c')
-rw-r--r--common/imx-bbu-nand-fcb.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c
index a62e2a2975..bb6dd1d4e9 100644
--- a/common/imx-bbu-nand-fcb.c
+++ b/common/imx-bbu-nand-fcb.c
@@ -486,15 +486,22 @@ err:
static int fcb_create(struct imx_nand_fcb_bbu_handler *imx_handler,
struct fcb_block *fcb, struct mtd_info *mtd)
{
+ int ecc_strength;
+ int bb_mark_bit_offset;
+ int ret;
+
fcb->FingerPrint = 0x20424346;
fcb->Version = 0x01000000;
fcb->PageDataSize = mtd->writesize;
fcb->TotalPageSize = mtd->writesize + mtd->oobsize;
fcb->SectorsPerBlock = mtd->erasesize / mtd->writesize;
+ ret = mxs_nand_get_geo(&ecc_strength, &bb_mark_bit_offset);
+ if (ret)
+ return ret;
+
/* Divide ECC strength by two and save the value into FCB structure. */
- fcb->EccBlock0EccType =
- mxs_nand_get_ecc_strength(mtd->writesize, mtd->oobsize) >> 1;
+ fcb->EccBlock0EccType = ecc_strength >> 1;
fcb->EccBlockNEccType = fcb->EccBlock0EccType;
fcb->EccBlock0Size = 0x00000200;
@@ -505,8 +512,8 @@ static int fcb_create(struct imx_nand_fcb_bbu_handler *imx_handler,
/* DBBT search area starts at second page on first block */
fcb->DBBTSearchAreaStartAddress = 1;
- fcb->BadBlockMarkerByte = mxs_nand_mark_byte_offset(mtd);
- fcb->BadBlockMarkerStartBit = mxs_nand_mark_bit_offset(mtd);
+ fcb->BadBlockMarkerByte = bb_mark_bit_offset >> 3;
+ fcb->BadBlockMarkerStartBit = bb_mark_bit_offset & 0x7;
fcb->BBMarkerPhysicalOffset = mtd->writesize;