Skip to content

Commit

Permalink
mtd: mxc_nand: fix 2KiB pagesize NAND on i.MX27
Browse files Browse the repository at this point in the history
This patch allows i.MX27 to support 2KiB pagesize NAND flash.
We are using a 1.8V NAND flash which datasheet (unfortunately only
available under NDA) says :
Page size: x8: 2,112 bytes (2,048 + 64 bytes).
Without this patch, all sectors are marked as bad eraseblock.

Signed-off-by: Eric Benard <ebenard@eukrea.com>
Acked-by : Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
Eric Benard authored and David Woodhouse committed Sep 19, 2009
1 parent 64da392 commit 71b7d0d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion drivers/mtd/nand/mxc_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,17 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
}
}

/* Define some generic bad / good block scan pattern which are used
* while scanning a device for factory marked good / bad blocks. */
static uint8_t scan_ff_pattern[] = { 0xff, 0xff };

static struct nand_bbt_descr smallpage_memorybased = {
.options = NAND_BBT_SCAN2NDPAGE,
.offs = 5,
.len = 1,
.pattern = scan_ff_pattern
};

static int __init mxcnd_probe(struct platform_device *pdev)
{
struct nand_chip *this;
Expand Down Expand Up @@ -973,7 +984,10 @@ static int __init mxcnd_probe(struct platform_device *pdev)
goto escan;
}

host->pagesize_2k = (mtd->writesize == 2048) ? 1 : 0;
if (mtd->writesize == 2048) {
host->pagesize_2k = 1;
this->badblock_pattern = &smallpage_memorybased;
}

if (this->ecc.mode == NAND_ECC_HW) {
switch (mtd->oobsize) {
Expand Down

0 comments on commit 71b7d0d

Please sign in to comment.