summaryrefslogtreecommitdiff
path: root/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch
diff options
context:
space:
mode:
authorMichael Lauer <mickey@vanille-media.de>2007-08-05 06:43:12 +0000
committerMichael Lauer <mickey@vanille-media.de>2007-08-05 06:43:12 +0000
commit2363582ba077eed1f858893927abfa7d65f78686 (patch)
treebc25f0cbc5e92c2840da8aee2bab9f2a22d6e417 /packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch
parent33b0859221ec2b755b1e1f9a69c5d19b0c2d824b (diff)
parent7a792e2f3fd515657da9dc0537a6e32a2cc06180 (diff)
merge of '192efb6d3bfaa24757749bea21bc0515b1017108'
and 'baf87732958baffc539a6e90858e6c2fe5972a1e'
Diffstat (limited to 'packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch')
-rw-r--r--packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch b/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch
new file mode 100644
index 0000000000..37b2807908
--- /dev/null
+++ b/packages/uboot/u-boot-mkimage-openmoko-native/bbt-scan-second.patch
@@ -0,0 +1,69 @@
+Scan also the second OOB page for bad block information.
+
+board/neo1973/gta01/nand.c (board_nand_init): added board-specific badblock
+ pattern which sets NAND_BBT_SCAN2NDPAGE
+drivers/nand/nand_base.c (nand_block_bad): also consider the second page in a
+ block if NAND_BBT_SCAN2NDPAGE is set
+
+- Werner Almesberger <werner@openmoko.org>
+
+Index: u-boot/board/neo1973/gta01/nand.c
+===================================================================
+--- u-boot.orig/board/neo1973/gta01/nand.c
++++ u-boot/board/neo1973/gta01/nand.c
+@@ -113,9 +113,23 @@
+ }
+
+
++/* Derived from drivers/nand/nand_bbt.c:smallpage_flashbased */
++
++static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
++
++static struct nand_bbt_descr badblock_pattern = {
++ .options =
++ NAND_BBT_SCANEMPTY | NAND_BBT_SCANALLPAGES | NAND_BBT_SCAN2NDPAGE,
++ .offs = 5,
++ .len = 1,
++ .pattern = scan_ff_pattern
++};
++
++
+ int board_nand_init(struct nand_chip *nand)
+ {
+ nand->read_otp = samsung_nand_read_otp;
+ nand->write_otp = samsung_nand_write_otp;
++ nand->badblock_pattern = &badblock_pattern;
+ return s3c24x0_nand_init(nand);
+ }
+Index: u-boot/drivers/nand/nand_base.c
+===================================================================
+--- u-boot.orig/drivers/nand/nand_base.c
++++ u-boot/drivers/nand/nand_base.c
+@@ -421,7 +421,7 @@
+ *
+ * Check, if the block is bad.
+ */
+-static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
++static int nand_block_bad_page(struct mtd_info *mtd, loff_t ofs, int getchip)
+ {
+ int page, chipnr, res = 0;
+ struct nand_chip *this = mtd->priv;
+@@ -460,6 +460,18 @@
+ return res;
+ }
+
++static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
++{
++ struct nand_chip *this = mtd->priv;
++
++ if (nand_block_bad_page(mtd, ofs, getchip))
++ return 1;
++ if (this->badblock_pattern->options & NAND_BBT_SCAN2NDPAGE &&
++ nand_block_bad_page(mtd, ofs+(1 << this->page_shift), getchip))
++ return 1;
++ return 0;
++}
++
+ /**
+ * nand_default_block_markbad - [DEFAULT] mark a block bad
+ * @mtd: MTD device structure