r3749 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Fri Dec 28 08:16:27 CET 2007


Author: werner
Date: 2007-12-28 08:16:20 +0100 (Fri, 28 Dec 2007)
New Revision: 3749

Removed:
   trunk/src/target/u-boot/patches/bbt-scan-second.patch
Modified:
   trunk/src/target/u-boot/patches/neo1973-gsmver.patch
   trunk/src/target/u-boot/patches/uboot-gta02.patch
   trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
Log:
Support board-specific NAND initialization, and use this to make "nand
createbbt" on GTA02 more efficient. (Run time decreases from about 145 seconds
to less than ten.)

uboot-s3c2410-nand.patch:
- cpu/arm920t/s3c24x0/nand.c (s3c2410_nand_enable_hwecc): is only used in this
  file and therefore should be "static"
- cpu/arm920t/s3c24x0/nand.c (board_nand_init): renamed to __board_nand_init
  and added weak alias, so that we can have board-specific NAND initialization
- include/s3c24x0.h (__board_nand_init): added prototype

uboot-gta02.patch:
- board/neo1973/gta02/Makefile: added nand.o to OBJS, wrapped overlong line
- board/neo1973/gta02/nand.c: override board_nand_init

neo1973-gsmver.patch:
- board/neo1973/gta02/Makefile: updated for nand.o addition

bbt-scan-second.patch:
- removed. The use of a "weak" symbol makes the mechanism more compact.
  Furthermore, since the default is NAND_BBT_SCANALLPAGES anyway, this patch
  didn't accomplish anything for GTA01.

  The change to nand_block_bad in drivers/nand/nand_base.c is conceptually
  sound if we assume that nand_block_bad should indicate all bad blocks also in
  the absence of a bad block table. However, since we have a bad block table on
  all OpenMoko devices, this issue does not arise.



Deleted: trunk/src/target/u-boot/patches/bbt-scan-second.patch
===================================================================
--- trunk/src/target/u-boot/patches/bbt-scan-second.patch	2007-12-28 06:04:05 UTC (rev 3748)
+++ trunk/src/target/u-boot/patches/bbt-scan-second.patch	2007-12-28 07:16:20 UTC (rev 3749)
@@ -1,69 +0,0 @@
-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 at 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

Modified: trunk/src/target/u-boot/patches/neo1973-gsmver.patch
===================================================================
--- trunk/src/target/u-boot/patches/neo1973-gsmver.patch	2007-12-28 06:04:05 UTC (rev 3748)
+++ trunk/src/target/u-boot/patches/neo1973-gsmver.patch	2007-12-28 07:16:20 UTC (rev 3749)
@@ -10,7 +10,7 @@
 ===================================================================
 --- u-boot.orig/board/neo1973/common/cmd_neo1973.c
 +++ u-boot/board/neo1973/common/cmd_neo1973.c
-@@ -77,8 +77,10 @@
+@@ -85,8 +85,10 @@
  			goto out_help;
  		if (!strcmp(argv[2], "on"))
  			neo1973_gsm(1);
@@ -22,9 +22,9 @@
  	} else if (!strcmp(argv[1], "gps")) {
  		if (argc < 3)
  			goto out_help;
-@@ -121,7 +123,7 @@
- 	"neo1973 charger off - disable charging\n"
+@@ -130,7 +132,7 @@
  	"neo1973 backlight (on|off) - switch backlight on or off\n"
+ 	"neo1973 led num (on|off) - switch LED number 'num' on or off\n"
  	"neo1973 vibrator (on|off) - switch vibrator on or off\n"
 -	"neo1973 gsm (on|off) - switch GSM Modem on or off\n"
 +	"neo1973 gsm (on|off|version) - switch GSM Modem on/off or print firmware version\n"
@@ -133,12 +133,11 @@
 ===================================================================
 --- u-boot.orig/board/neo1973/gta02/Makefile
 +++ u-boot/board/neo1973/gta02/Makefile
-@@ -25,7 +25,7 @@
- 
+@@ -26,6 +26,7 @@
  LIB	= lib$(BOARD).a
  
--OBJS	:= gta02.o pcf50633.o ../common/cmd_neo1973.o ../common/jbt6k74.o ../common/udc.o ../common/bootmenu.o
-+OBJS	:= gta02.o pcf50633.o ../common/cmd_neo1973.o ../common/gsmver.o ../common/jbt6k74.o ../common/udc.o ../common/bootmenu.o
+ OBJS	:= gta02.o pcf50633.o nand.o ../common/cmd_neo1973.o \
++	   ../common/gsmver.o \
+ 	   ../common/jbt6k74.o ../common/udc.o ../common/bootmenu.o
  SOBJS	:= ../common/lowlevel_init.o
  
- .PHONY:	all

Modified: trunk/src/target/u-boot/patches/uboot-gta02.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-gta02.patch	2007-12-28 06:04:05 UTC (rev 3748)
+++ trunk/src/target/u-boot/patches/uboot-gta02.patch	2007-12-28 07:16:20 UTC (rev 3749)
@@ -4,7 +4,7 @@
 ===================================================================
 --- u-boot.orig/Makefile
 +++ u-boot/Makefile
-@@ -2250,6 +2250,13 @@
+@@ -2253,6 +2253,13 @@
  sbc2410x_config: unconfig
  	@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
  
@@ -22,7 +22,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/board/neo1973/gta02/Makefile
-@@ -0,0 +1,64 @@
+@@ -0,0 +1,65 @@
 +#
 +# (C) Copyright 2000, 2001, 2002
 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
@@ -50,7 +50,8 @@
 +
 +LIB	= lib$(BOARD).a
 +
-+OBJS	:= gta02.o pcf50633.o ../common/cmd_neo1973.o ../common/jbt6k74.o ../common/udc.o ../common/bootmenu.o
++OBJS	:= gta02.o pcf50633.o nand.o ../common/cmd_neo1973.o \
++	   ../common/jbt6k74.o ../common/udc.o ../common/bootmenu.o
 +SOBJS	:= ../common/lowlevel_init.o
 +
 +.PHONY:	all
@@ -2345,3 +2346,55 @@
 +};
 +
 +#endif /* _GLAMO_REGS_H */
+Index: u-boot/board/neo1973/gta02/nand.c
+===================================================================
+--- /dev/null
++++ u-boot/board/neo1973/gta02/nand.c
+@@ -0,0 +1,47 @@
++/*
++ * nand.c - Board-specific NAND setup
++ *
++ * Copyright (C) 2007 by OpenMoko, Inc.
++ * Written by Werner Almesberger <werner at openmoko.org>
++ * 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
++ */
++
++
++#include "config.h" /* nand.h needs NAND_MAX_CHIPS */
++#include "linux/mtd/mtd.h"
++#include "linux/mtd/nand.h"
++#include "s3c2440.h"
++
++
++/* Derived from drivers/nand/nand_bbt.c:largepage_flashbased */
++
++static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
++
++static struct nand_bbt_descr badblock_pattern = {
++	.options = NAND_BBT_SCAN2NDPAGE,
++	.offs = 0,
++	.len = 1,
++	.pattern = scan_ff_pattern
++};
++
++
++int board_nand_init(struct nand_chip *nand)
++{
++	nand->badblock_pattern = &badblock_pattern;
++	return __board_nand_init(nand);
++}

Modified: trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch	2007-12-28 06:04:05 UTC (rev 3748)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch	2007-12-28 07:16:20 UTC (rev 3749)
@@ -19,7 +19,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/cpu/arm920t/s3c24x0/nand.c
-@@ -0,0 +1,179 @@
+@@ -0,0 +1,183 @@
 +/*
 + * (C) Copyright 2006 OpenMoko, Inc.
 + * Author: Harald Welte <laforge at openmoko.org>
@@ -113,7 +113,7 @@
 +}
 +
 +#ifdef CONFIG_S3C2410_NAND_HWECC
-+void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
++static void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
 +{
 +	DEBUGN("s3c2410_nand_enable_hwecc(%p, %d)\n", mtd ,mode);
 +	NFCONF |= S3C2410_NFCONF_INITECC;
@@ -144,7 +144,11 @@
 +}
 +#endif
 +
-+int board_nand_init(struct nand_chip *nand)
++
++int board_nand_init(void) __attribute__((weak, alias("__board_nand_init")));
++
++
++int __board_nand_init(struct nand_chip *nand)
 +{
 +	u_int32_t cfg;
 +	u_int8_t tacls, twrph0, twrph1;
@@ -199,3 +203,14 @@
 + #error "U-Boot legacy NAND support not available for S3C2410"
 +#endif
 +#endif
+Index: u-boot/include/s3c24x0.h
+===================================================================
+--- u-boot.orig/include/s3c24x0.h
++++ u-boot/include/s3c24x0.h
+@@ -1132,4 +1132,6 @@
+ 
+ #endif
+ 
++int __board_nand_init(struct nand_chip *nand);
++
+ #endif /*__S3C24X0_H__*/





More information about the commitlog mailing list