summaryrefslogtreecommitdiffstats
path: root/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch')
-rw-r--r--meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch69
1 files changed, 0 insertions, 69 deletions
diff --git a/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch b/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch
deleted file mode 100644
index 37b2807908..0000000000
--- a/meta/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch
+++ /dev/null
@@ -1,69 +0,0 @@
1Scan also the second OOB page for bad block information.
2
3board/neo1973/gta01/nand.c (board_nand_init): added board-specific badblock
4 pattern which sets NAND_BBT_SCAN2NDPAGE
5drivers/nand/nand_base.c (nand_block_bad): also consider the second page in a
6 block if NAND_BBT_SCAN2NDPAGE is set
7
8- Werner Almesberger <werner@openmoko.org>
9
10Index: u-boot/board/neo1973/gta01/nand.c
11===================================================================
12--- u-boot.orig/board/neo1973/gta01/nand.c
13+++ u-boot/board/neo1973/gta01/nand.c
14@@ -113,9 +113,23 @@
15 }
16
17
18+/* Derived from drivers/nand/nand_bbt.c:smallpage_flashbased */
19+
20+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
21+
22+static struct nand_bbt_descr badblock_pattern = {
23+ .options =
24+ NAND_BBT_SCANEMPTY | NAND_BBT_SCANALLPAGES | NAND_BBT_SCAN2NDPAGE,
25+ .offs = 5,
26+ .len = 1,
27+ .pattern = scan_ff_pattern
28+};
29+
30+
31 int board_nand_init(struct nand_chip *nand)
32 {
33 nand->read_otp = samsung_nand_read_otp;
34 nand->write_otp = samsung_nand_write_otp;
35+ nand->badblock_pattern = &badblock_pattern;
36 return s3c24x0_nand_init(nand);
37 }
38Index: u-boot/drivers/nand/nand_base.c
39===================================================================
40--- u-boot.orig/drivers/nand/nand_base.c
41+++ u-boot/drivers/nand/nand_base.c
42@@ -421,7 +421,7 @@
43 *
44 * Check, if the block is bad.
45 */
46-static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
47+static int nand_block_bad_page(struct mtd_info *mtd, loff_t ofs, int getchip)
48 {
49 int page, chipnr, res = 0;
50 struct nand_chip *this = mtd->priv;
51@@ -460,6 +460,18 @@
52 return res;
53 }
54
55+static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
56+{
57+ struct nand_chip *this = mtd->priv;
58+
59+ if (nand_block_bad_page(mtd, ofs, getchip))
60+ return 1;
61+ if (this->badblock_pattern->options & NAND_BBT_SCAN2NDPAGE &&
62+ nand_block_bad_page(mtd, ofs+(1 << this->page_shift), getchip))
63+ return 1;
64+ return 0;
65+}
66+
67 /**
68 * nand_default_block_markbad - [DEFAULT] mark a block bad
69 * @mtd: MTD device structure