--- Begin Message ---
Author: werner
Date: 2007-05-22 09:40:06 +0200 (Tue, 22 May 2007)
New Revision: 2053
Added:
trunk/src/target/u-boot/patches/bbt-scan-second.patch
Modified:
trunk/src/target/u-boot/patches/unbusy-i2c.patch
Log:
unbusy-i2c.patch: updated for u-boot reorganization
bbt-scan-second.patch: updated for u-boot reorganization
Added: trunk/src/target/u-boot/patches/bbt-scan-second.patch
===================================================================
--- trunk/src/target/u-boot/patches/bbt-scan-second.patch 2007-05-21
23:47:12 UTC (rev 2052)
+++ trunk/src/target/u-boot/patches/bbt-scan-second.patch 2007-05-22
07:40:06 UTC (rev 2053)
@@ -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 <[EMAIL PROTECTED]>
+
+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
Modified: trunk/src/target/u-boot/patches/unbusy-i2c.patch
===================================================================
--- trunk/src/target/u-boot/patches/unbusy-i2c.patch 2007-05-21 23:47:12 UTC
(rev 2052)
+++ trunk/src/target/u-boot/patches/unbusy-i2c.patch 2007-05-22 07:40:06 UTC
(rev 2053)
@@ -1,16 +1,16 @@
-board/neo1973/neo1973.c: added logic to detect pending PMU interrupts
-board/neo1973/neo1973.c (neo1973_new_second, neo1973_on_key_pressed): only poll
- PMU if there is a pending interrupt
-board/neo1973/pcf50606.c (pcf50606_initial_regs): cleared (unmasked) SECONDM in
- INT1M
+board/neo1973/gta01/gta01.c: added logic to detect pending PMU interrupts
+board/neo1973/gta01/gta01.c (neo1973_new_second, neo1973_on_key_pressed): only
+ poll PMU if there is a pending interrupt
+board/neo1973/gta01/pcf50606.c (pcf50606_initial_regs): cleared (unmasked)
+ SECONDM in INT1M
- Werner Almesberger <[EMAIL PROTECTED]>
-Index: u-boot/board/neo1973/neo1973.c
+Index: u-boot/board/neo1973/gta01/gta01.c
===================================================================
---- u-boot.orig/board/neo1973/neo1973.c
-+++ u-boot/board/neo1973/neo1973.c
-@@ -374,19 +374,64 @@ void neo1973_vibrator(int on)
+--- u-boot.orig/board/neo1973/gta01/gta01.c
++++ u-boot/board/neo1973/gta01/gta01.c
+@@ -375,19 +375,60 @@
#endif
}
@@ -19,10 +19,6 @@
+ S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
+
+#if defined(CONFIG_ARCH_GTA01B_v4)
-+ /*
-+ * @@@FIXME: Untested and probably doesn't work. We have to check for
-+ * the presence of EINT9 instead.
-+ */
+ return !(gpio->GPGDAT & (1 << 1)); /* EINT9/GPG1 */
+#else
+ return !(gpio->GPGDAT & (1 << 8)); /* EINT16/GPG8 */
@@ -77,10 +73,10 @@
if (gpio->GPFDAT & (1 << 6))
return 0;
return 1;
-Index: u-boot/board/neo1973/pcf50606.c
+Index: u-boot/board/neo1973/gta01/pcf50606.c
===================================================================
---- u-boot.orig/board/neo1973/pcf50606.c
-+++ u-boot/board/neo1973/pcf50606.c
+--- u-boot.orig/board/neo1973/gta01/pcf50606.c
++++ u-boot/board/neo1973/gta01/pcf50606.c
@@ -6,7 +6,7 @@
const u_int8_t pcf50606_initial_regs[__NUM_PCF50606_REGS] = {
[PCF50606_REG_OOCS] = 0x00,
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2007-05-22 10:33:09 +0200 (Tue, 22 May 2007)
New Revision: 2054
Modified:
trunk/src/target/u-boot/patches/nand-otp.patch
Log:
nand-otp.patch: updated for u-boot reorganization
Modified: trunk/src/target/u-boot/patches/nand-otp.patch
===================================================================
--- trunk/src/target/u-boot/patches/nand-otp.patch 2007-05-22 07:40:06 UTC
(rev 2053)
+++ trunk/src/target/u-boot/patches/nand-otp.patch 2007-05-22 08:33:09 UTC
(rev 2054)
@@ -1,20 +1,139 @@
-Index: u-boot/board/neo1973/Makefile
+Index: u-boot/common/cmd_nand.c
===================================================================
---- u-boot.orig/board/neo1973/Makefile
-+++ u-boot/board/neo1973/Makefile
-@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
+--- u-boot.orig/common/cmd_nand.c
++++ u-boot/common/cmd_nand.c
+@@ -392,6 +392,14 @@
+ else
+ ret = nand->write_oob(nand, off, size, &size,
+ (u_char *) addr);
++ } else if (s != NULL && !strcmp(s, ".otp")) {
++ /* read out-of-band data */
++ if (read)
++ ret = nand->read_otp(nand, off, size, &size,
++ (u_char *) addr);
++ else
++ ret = nand->write_otp(nand, off, size, &size,
++ (u_char *) addr);
+ } else {
+ if (read)
+ ret = nand_read(nand, off, &size, (u_char
*)addr);
+@@ -527,8 +535,9 @@
+ "nand - NAND sub-system\n",
+ "info - show available NAND devices\n"
+ "nand device [dev] - show or set current device\n"
+- "nand read[.jffs2] - addr off|partition size\n"
+- "nand write[.jffs2] - addr off|partiton size - read/write `size'
bytes starting\n"
++ "nand read[.jffs2, .oob, .otp] addr off|partition size\n"
++ "nand write[.jffs2, .oob, .otp] addr off|partiton size\n"
++ " - read/write `size' bytes starting\n"
+ " at offset `off' to/from memory address `addr'\n"
+ "nand erase [clean] [off size] - erase `size' bytes from\n"
+ " offset `off' (entire device if not specified)\n"
+Index: u-boot/cpu/arm920t/s3c24x0/nand.c
+===================================================================
+--- u-boot.orig/cpu/arm920t/s3c24x0/nand.c
++++ u-boot/cpu/arm920t/s3c24x0/nand.c
+@@ -205,7 +205,7 @@
+ }
+ #endif
+-int board_nand_init(struct nand_chip *nand)
++int s3c24x0_nand_init(struct nand_chip *nand)
+ {
+ u_int32_t cfg;
+ u_int8_t tacls, twrph0, twrph1;
+Index: u-boot/drivers/nand/nand_base.c
+===================================================================
+--- u-boot.orig/drivers/nand/nand_base.c
++++ u-boot/drivers/nand/nand_base.c
+@@ -2042,6 +2042,32 @@
+ }
+ #endif
+
++/*
++ * See nand_read_oob and nand_write_oob
++ */
++
++static int nand_read_otp(struct mtd_info *mtd, loff_t from, size_t len,
++ size_t *retlen, u_char *buf)
++{
++ struct nand_chip *this = mtd->priv;
++
++ if (!this->read_otp)
++ return -ENOSYS;
++ return this->read_otp(mtd, from, len, retlen, buf);
++
++}
++
++static int nand_write_otp(struct mtd_info *mtd, loff_t to, size_t len,
++ size_t *retlen, const u_char *buf)
++{
++ struct nand_chip *this = mtd->priv;
++
++ if (!this->write_otp)
++ return -ENOSYS;
++ return this->write_otp(mtd, to, len, retlen, buf);
++}
++
++
+ /**
+ * single_erease_cmd - [GENERIC] NAND standard block erase command function
+ * @mtd: MTD device structure
+@@ -2613,6 +2639,8 @@
+ mtd->write_ecc = nand_write_ecc;
+ mtd->read_oob = nand_read_oob;
+ mtd->write_oob = nand_write_oob;
++ mtd->read_otp = nand_read_otp;
++ mtd->write_otp = nand_write_otp;
+ /* XXX U-BOOT XXX */
+ #if 0
+ mtd->readv = NULL;
+Index: u-boot/include/linux/mtd/mtd.h
+===================================================================
+--- u-boot.orig/include/linux/mtd/mtd.h
++++ u-boot/include/linux/mtd/mtd.h
+@@ -95,6 +95,9 @@
+ int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t
*retlen, u_char *buf);
+ int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t
*retlen, const u_char *buf);
+
++ int (*read_otp) (struct mtd_info *mtd, loff_t from, size_t len, size_t
*retlen, u_char *buf);
++ int (*write_otp) (struct mtd_info *mtd, loff_t to, size_t len, size_t
*retlen, const u_char *buf);
++
+ /*
+ * Methods to access the protection register area, present in some
+ * flash devices. The user data is one time programmable but the
+Index: u-boot/include/linux/mtd/nand.h
+===================================================================
+--- u-boot.orig/include/linux/mtd/nand.h
++++ u-boot/include/linux/mtd/nand.h
+@@ -307,6 +307,10 @@
+ void (*enable_hwecc)(struct mtd_info *mtd, int mode);
+ void (*erase_cmd)(struct mtd_info *mtd, int page);
+ int (*scan_bbt)(struct mtd_info *mtd);
++ int (*read_otp)(struct mtd_info *mtd, loff_t from,
++ size_t len, size_t *retlen, u_char *buf);
++ int (*write_otp) (struct mtd_info *mtd, loff_t to,
++ size_t len, size_t *retlen, const u_char *buf);
+ int eccmode;
+ int eccsize;
+ int eccbytes;
+Index: u-boot/board/neo1973/gta01/Makefile
+===================================================================
+--- u-boot.orig/board/neo1973/gta01/Makefile
++++ u-boot/board/neo1973/gta01/Makefile
+@@ -25,7 +25,7 @@
+
LIB = lib$(BOARD).a
--OBJS := neo1973.o pcf50606.o cmd_neo1973.o jbt6k74.o udc.o bootmenu.o
-+OBJS := neo1973.o pcf50606.o cmd_neo1973.o jbt6k74.o udc.o bootmenu.o nand.o
- SOBJS := lowlevel_init.o
+-OBJS := gta01.o pcf50606.o ../common/cmd_neo1973.o ../common/jbt6k74.o
../common/udc.o ../common/bootmenu.o
++OBJS := gta01.o pcf50606.o nand.o ../common/cmd_neo1973.o
../common/jbt6k74.o ../common/udc.o ../common/bootmenu.o
+ SOBJS := ../common/lowlevel_init.o
.PHONY: all
-Index: u-boot/board/neo1973/nand.c
+Index: u-boot/board/neo1973/gta01/nand.c
===================================================================
--- /dev/null
-+++ u-boot/board/neo1973/nand.c
++++ u-boot/board/neo1973/gta01/nand.c
@@ -0,0 +1,121 @@
+/*
+ * nand.c - Board-specific NAND setup
@@ -137,122 +256,47 @@
+ nand->write_otp = samsung_nand_write_otp;
+ return s3c24x0_nand_init(nand);
+}
-Index: u-boot/common/cmd_nand.c
+Index: u-boot/board/neo1973/gta02/nand.c
===================================================================
---- u-boot.orig/common/cmd_nand.c
-+++ u-boot/common/cmd_nand.c
-@@ -392,6 +392,14 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
- else
- ret = nand->write_oob(nand, off, size, &size,
- (u_char *) addr);
-+ } else if (s != NULL && !strcmp(s, ".otp")) {
-+ /* read out-of-band data */
-+ if (read)
-+ ret = nand->read_otp(nand, off, size, &size,
-+ (u_char *) addr);
-+ else
-+ ret = nand->write_otp(nand, off, size, &size,
-+ (u_char *) addr);
- } else {
- if (read)
- ret = nand_read(nand, off, &size, (u_char
*)addr);
-@@ -527,8 +535,9 @@ U_BOOT_CMD(nand, 5, 1, do_nand,
- "nand - NAND sub-system\n",
- "info - show available NAND devices\n"
- "nand device [dev] - show or set current device\n"
-- "nand read[.jffs2] - addr off|partition size\n"
-- "nand write[.jffs2] - addr off|partiton size - read/write `size'
bytes starting\n"
-+ "nand read[.jffs2, .oob, .otp] addr off|partition size\n"
-+ "nand write[.jffs2, .oob, .otp] addr off|partiton size\n"
-+ " - read/write `size' bytes starting\n"
- " at offset `off' to/from memory address `addr'\n"
- "nand erase [clean] [off size] - erase `size' bytes from\n"
- " offset `off' (entire device if not specified)\n"
-Index: u-boot/cpu/arm920t/s3c24x0/nand.c
-===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/nand.c
-+++ u-boot/cpu/arm920t/s3c24x0/nand.c
-@@ -167,7 +167,7 @@ int s3c2410_nand_correct_data(struct mtd
- }
- #endif
-
--int board_nand_init(struct nand_chip *nand)
-+int s3c24x0_nand_init(struct nand_chip *nand)
- {
- u_int32_t cfg;
- u_int8_t tacls, twrph0, twrph1;
-Index: u-boot/drivers/nand/nand_base.c
-===================================================================
---- u-boot.orig/drivers/nand/nand_base.c
-+++ u-boot/drivers/nand/nand_base.c
-@@ -2042,6 +2042,32 @@ out:
- }
- #endif
-
+--- /dev/null
++++ u-boot/board/neo1973/gta02/nand.c
+@@ -0,0 +1,39 @@
+/*
-+ * See nand_read_oob and nand_write_oob
++ * nand.c - Board-specific NAND setup
++ *
++ * Copyright (C) 2007 by OpenMoko, Inc.
++ * Written by Werner Almesberger <[EMAIL PROTECTED]>
++ * All Rights Reserved
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of
++ * the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ * MA 02111-1307 USA
+ */
+
-+static int nand_read_otp(struct mtd_info *mtd, loff_t from, size_t len,
-+ size_t *retlen, u_char *buf)
-+{
-+ struct nand_chip *this = mtd->priv;
+
-+ if (!this->read_otp)
-+ return -ENOSYS;
-+ return this->read_otp(mtd, from, len, retlen, buf);
++#include "config.h" /* nand.h needs NAND_MAX_CHIPS */
++#include "linux/mtd/mtd.h"
++#include "linux/mtd/nand.h"
+
-+}
+
-+static int nand_write_otp(struct mtd_info *mtd, loff_t to, size_t len,
-+ size_t *retlen, const u_char *buf)
-+{
-+ struct nand_chip *this = mtd->priv;
++int s3c24x0_nand_init(struct nand_chip *nand);
+
-+ if (!this->write_otp)
-+ return -ENOSYS;
-+ return this->write_otp(mtd, to, len, retlen, buf);
-+}
+
++/* Add OTP et al later */
+
- /**
- * single_erease_cmd - [GENERIC] NAND standard block erase command function
- * @mtd: MTD device structure
-@@ -2613,6 +2639,8 @@ int nand_scan (struct mtd_info *mtd, int
- mtd->write_ecc = nand_write_ecc;
- mtd->read_oob = nand_read_oob;
- mtd->write_oob = nand_write_oob;
-+ mtd->read_otp = nand_read_otp;
-+ mtd->write_otp = nand_write_otp;
- /* XXX U-BOOT XXX */
- #if 0
- mtd->readv = NULL;
-Index: u-boot/include/linux/mtd/mtd.h
-===================================================================
---- u-boot.orig/include/linux/mtd/mtd.h
-+++ u-boot/include/linux/mtd/mtd.h
-@@ -95,6 +95,9 @@ struct mtd_info {
- int (*read_oob) (struct mtd_info *mtd, loff_t from, size_t len, size_t
*retlen, u_char *buf);
- int (*write_oob) (struct mtd_info *mtd, loff_t to, size_t len, size_t
*retlen, const u_char *buf);
-
-+ int (*read_otp) (struct mtd_info *mtd, loff_t from, size_t len, size_t
*retlen, u_char *buf);
-+ int (*write_otp) (struct mtd_info *mtd, loff_t to, size_t len, size_t
*retlen, const u_char *buf);
+
- /*
- * Methods to access the protection register area, present in some
- * flash devices. The user data is one time programmable but the
-Index: u-boot/include/linux/mtd/nand.h
-===================================================================
---- u-boot.orig/include/linux/mtd/nand.h
-+++ u-boot/include/linux/mtd/nand.h
-@@ -307,6 +307,10 @@ struct nand_chip {
- void (*enable_hwecc)(struct mtd_info *mtd, int mode);
- void (*erase_cmd)(struct mtd_info *mtd, int page);
- int (*scan_bbt)(struct mtd_info *mtd);
-+ int (*read_otp)(struct mtd_info *mtd, loff_t from,
-+ size_t len, size_t *retlen, u_char *buf);
-+ int (*write_otp) (struct mtd_info *mtd, loff_t to,
-+ size_t len, size_t *retlen, const u_char *buf);
- int eccmode;
- int eccsize;
- int eccbytes;
++int board_nand_init(struct nand_chip *nand)
++{
++ return s3c24x0_nand_init(nand);
++}
--- End Message ---