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

laforge at sita.openmoko.org laforge at sita.openmoko.org
Fri Feb 16 23:59:10 CET 2007


Author: laforge
Date: 2007-02-16 23:59:07 +0100 (Fri, 16 Feb 2007)
New Revision: 1022

Added:
   trunk/src/target/u-boot/patches/uboot-cramfs_but_no_jffs2.patch
   trunk/src/target/u-boot/patches/uboot-dfu.patch
   trunk/src/target/u-boot/patches/uboot-s3c2410-mmc.patch
   trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
Removed:
   trunk/src/target/u-boot/patches/s3c2410-nand_badblock_skip.patch
   trunk/src/target/u-boot/patches/s3c2410-nand_bbt.patch
   trunk/src/target/u-boot/patches/uboot-gta01b_v2.patch
   trunk/src/target/u-boot/patches/uboot-gta01bv3.patch
   trunk/src/target/u-boot/patches/uboot-gta01v4.patch
   trunk/src/target/u-boot/patches/uboot-neo1973-jbt6k74.patch
   trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch
Modified:
   trunk/src/target/u-boot/patches/bbt-create-optional.patch
   trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch
   trunk/src/target/u-boot/patches/env_nand_oob.patch
   trunk/src/target/u-boot/patches/nand-createbbt.patch
   trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch
   trunk/src/target/u-boot/patches/series
   trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch
   trunk/src/target/u-boot/patches/uboot-20061030-qt2410.patch
   trunk/src/target/u-boot/patches/uboot-bbt-quiet.patch
   trunk/src/target/u-boot/patches/uboot-cmd_s3c2410.patch
   trunk/src/target/u-boot/patches/uboot-s3c2410-warnings-fix.patch
   trunk/src/target/u-boot/patches/uboot-s3c2410_udc.patch
   trunk/src/target/u-boot/patches/uboot-strtoul.patch
Log:
major restructuring of u-boot quilt patches, make them ready
for upstream submission.
* merge all GTA01 revisions into one big Neo1973 patch
* merge jbt6k74 and pcf50606 drivers into Neo1973 patch
* reorder patches to a more logical (rather devel history) order


Modified: trunk/src/target/u-boot/patches/bbt-create-optional.patch
===================================================================
--- trunk/src/target/u-boot/patches/bbt-create-optional.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/bbt-create-optional.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -9,11 +9,11 @@
 - Werner Almesberger <werner at openmoko.org>
 
 
-Index: u-boot.git/cpu/arm920t/s3c24x0/nand.c
+Index: u-boot/cpu/arm920t/s3c24x0/nand.c
 ===================================================================
---- u-boot.git.orig/cpu/arm920t/s3c24x0/nand.c
-+++ u-boot.git/cpu/arm920t/s3c24x0/nand.c
-@@ -190,7 +190,7 @@ void board_nand_init(struct nand_chip *n
+--- u-boot.orig/cpu/arm920t/s3c24x0/nand.c	2007-02-16 23:53:29.000000000 +0100
++++ u-boot/cpu/arm920t/s3c24x0/nand.c	2007-02-16 23:53:54.000000000 +0100
+@@ -169,7 +169,7 @@
  
  	nand->eccmode = NAND_ECC_SOFT;
  #ifdef CONFIG_S3C2410_NAND_BBT
@@ -22,11 +22,11 @@
  #else
  	nand->options = 0;
  #endif
-Index: u-boot.git/drivers/nand/nand_bbt.c
+Index: u-boot/drivers/nand/nand_bbt.c
 ===================================================================
---- u-boot.git.orig/drivers/nand/nand_bbt.c
-+++ u-boot.git/drivers/nand/nand_bbt.c
-@@ -680,7 +680,8 @@ static int check_create (struct mtd_info
+--- u-boot.orig/drivers/nand/nand_bbt.c	2007-02-16 23:53:36.000000000 +0100
++++ u-boot/drivers/nand/nand_bbt.c	2007-02-16 23:53:54.000000000 +0100
+@@ -678,7 +678,8 @@
  		}
  create:
  		/* Create the bad block table by scanning the device ? */
@@ -36,11 +36,11 @@
  			continue;
  
  		/* Create the table in memory by scanning the chip(s) */
-Index: u-boot.git/include/linux/mtd/nand.h
+Index: u-boot/include/linux/mtd/nand.h
 ===================================================================
---- u-boot.git.orig/include/linux/mtd/nand.h
-+++ u-boot.git/include/linux/mtd/nand.h
-@@ -187,7 +187,8 @@ extern int nand_read_raw (struct mtd_inf
+--- u-boot.orig/include/linux/mtd/nand.h	2007-02-16 23:53:08.000000000 +0100
++++ u-boot/include/linux/mtd/nand.h	2007-02-16 23:53:54.000000000 +0100
+@@ -187,7 +187,8 @@
   * This can only work if we have the ecc bytes directly behind the
   * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */
  #define NAND_HWECC_SYNDROME	0x00020000

Modified: trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch
===================================================================
--- trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/dynpart-absorb-bad.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,8 +1,8 @@
 Index: u-boot/drivers/nand/nand_bbt.c
 ===================================================================
---- u-boot.orig/drivers/nand/nand_bbt.c
-+++ u-boot/drivers/nand/nand_bbt.c
-@@ -1064,6 +1064,15 @@ int nand_isbad_bbt (struct mtd_info *mtd
+--- u-boot.orig/drivers/nand/nand_bbt.c	2007-02-16 23:53:57.000000000 +0100
++++ u-boot/drivers/nand/nand_bbt.c	2007-02-16 23:54:02.000000000 +0100
+@@ -1062,6 +1062,15 @@
  static unsigned int part_size[] = { 0x30000, 0x4000, 0x200000, 0x130000, 0x3c9c000 };
  static char *part_names[] = { "u-boot", "u-boot_env", "kernel", "splash", "rootfs" };
  
@@ -18,7 +18,7 @@
  int nand_create_mtd_dynpart(struct mtd_info *mtd)
  {
  	struct nand_chip *this = mtd->priv;
-@@ -1082,11 +1091,22 @@ int nand_create_mtd_dynpart(struct mtd_i
+@@ -1080,11 +1089,22 @@
  		unsigned int bb_delta = 0;
  		unsigned int offs = 0;
  		char mtdpart[32];

Modified: trunk/src/target/u-boot/patches/env_nand_oob.patch
===================================================================
--- trunk/src/target/u-boot/patches/env_nand_oob.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/env_nand_oob.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -15,10 +15,10 @@
 
 Signed-off-by: Harald Welte <laforge at openmoko.org>
 
-Index: u-boot.git/common/env_nand.c
+Index: u-boot/common/env_nand.c
 ===================================================================
---- u-boot.git.orig/common/env_nand.c	2007-02-05 19:51:44.000000000 +0100
-+++ u-boot.git/common/env_nand.c	2007-02-05 20:03:11.000000000 +0100
+--- u-boot.orig/common/env_nand.c	2007-02-16 23:53:09.000000000 +0100
++++ u-boot/common/env_nand.c	2007-02-16 23:53:34.000000000 +0100
 @@ -271,6 +271,33 @@
  	ulong total;
  	int ret;
@@ -53,10 +53,10 @@
  	total = CFG_ENV_SIZE;
  	ret = nand_read(&nand_info[0], CFG_ENV_OFFSET, &total, (u_char*)env_ptr);
    	if (ret || total != CFG_ENV_SIZE)
-Index: u-boot.git/common/environment.c
+Index: u-boot/common/environment.c
 ===================================================================
---- u-boot.git.orig/common/environment.c	2007-02-05 19:51:44.000000000 +0100
-+++ u-boot.git/common/environment.c	2007-02-05 19:51:46.000000000 +0100
+--- u-boot.orig/common/environment.c	2007-02-16 23:53:09.000000000 +0100
++++ u-boot/common/environment.c	2007-02-16 23:53:34.000000000 +0100
 @@ -29,6 +29,12 @@
  #undef	__ASSEMBLY__
  #include <environment.h>
@@ -70,10 +70,10 @@
  /*
   * Handle HOSTS that have prepended
   * crap on symbol names, not TARGETS.
-Index: u-boot.git/include/environment.h
+Index: u-boot/include/environment.h
 ===================================================================
---- u-boot.git.orig/include/environment.h	2007-02-05 19:51:44.000000000 +0100
-+++ u-boot.git/include/environment.h	2007-02-05 19:51:46.000000000 +0100
+--- u-boot.orig/include/environment.h	2007-02-16 23:53:09.000000000 +0100
++++ u-boot/include/environment.h	2007-02-16 23:53:34.000000000 +0100
 @@ -70,6 +70,10 @@
  #endif	/* CFG_ENV_IS_IN_FLASH */
  
@@ -93,11 +93,11 @@
  #endif /* CFG_ENV_IS_IN_NAND */
  
  
-Index: u-boot.git/include/configs/neo1973.h
+Index: u-boot/include/configs/neo1973.h
 ===================================================================
---- u-boot.git.orig/include/configs/neo1973.h	2007-02-05 19:51:44.000000000 +0100
-+++ u-boot.git/include/configs/neo1973.h	2007-02-05 20:04:12.000000000 +0100
-@@ -196,7 +196,7 @@
+--- u-boot.orig/include/configs/neo1973.h	2007-02-16 23:53:33.000000000 +0100
++++ u-boot/include/configs/neo1973.h	2007-02-16 23:53:34.000000000 +0100
+@@ -197,7 +197,7 @@
  
  #define	CFG_ENV_IS_IN_NAND	1
  #define CFG_ENV_SIZE		0x4000		/* 16k Total Size of Environment Sector */
@@ -106,10 +106,10 @@
  
  #define NAND_MAX_CHIPS		1
  #define CFG_NAND_BASE		0x4e000000
-Index: u-boot.git/common/Makefile
+Index: u-boot/common/Makefile
 ===================================================================
---- u-boot.git.orig/common/Makefile	2007-02-05 19:51:44.000000000 +0100
-+++ u-boot.git/common/Makefile	2007-02-05 19:51:46.000000000 +0100
+--- u-boot.orig/common/Makefile	2007-02-16 23:53:15.000000000 +0100
++++ u-boot/common/Makefile	2007-02-16 23:53:34.000000000 +0100
 @@ -32,7 +32,7 @@
  	  cmd_bdinfo.o cmd_bedbug.o cmd_bmp.o cmd_boot.o cmd_bootm.o \
  	  cmd_cache.o cmd_console.o \
@@ -119,10 +119,10 @@
  	  cmd_fat.o cmd_fdc.o cmd_fdos.o cmd_flash.o cmd_fpga.o \
  	  cmd_i2c.o cmd_ide.o cmd_immap.o cmd_itest.o cmd_jffs2.o \
  	  cmd_load.o cmd_log.o \
-Index: u-boot.git/common/cmd_dynenv.c
+Index: u-boot/common/cmd_dynenv.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/common/cmd_dynenv.c	2007-02-05 19:53:09.000000000 +0100
++++ u-boot/common/cmd_dynenv.c	2007-02-16 23:53:34.000000000 +0100
 @@ -0,0 +1,85 @@
 +/*
 + * (C) Copyright 2006-2007 OpenMoko, Inc.

Modified: trunk/src/target/u-boot/patches/nand-createbbt.patch
===================================================================
--- trunk/src/target/u-boot/patches/nand-createbbt.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/nand-createbbt.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -9,11 +9,11 @@
 - Werner Almesberger <werner at openmoko.org>
 
 
-Index: u-boot.git/common/cmd_nand.c
+Index: u-boot/common/cmd_nand.c
 ===================================================================
---- u-boot.git.orig/common/cmd_nand.c
-+++ u-boot.git/common/cmd_nand.c
-@@ -163,6 +163,17 @@ out:
+--- u-boot.orig/common/cmd_nand.c	2007-02-16 23:53:28.000000000 +0100
++++ u-boot/common/cmd_nand.c	2007-02-16 23:53:57.000000000 +0100
+@@ -163,6 +163,17 @@
  	return 0;
  }
  
@@ -31,7 +31,7 @@
  int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  {
  	int i, dev, ret;
-@@ -228,7 +239,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
+@@ -228,7 +239,8 @@
  	    strncmp(cmd, "read", 4) != 0 && strncmp(cmd, "write", 5) != 0 &&
  	    strcmp(cmd, "scrub") != 0 && strcmp(cmd, "markbad") != 0 &&
  	    strcmp(cmd, "biterr") != 0 &&
@@ -41,7 +41,7 @@
  		goto usage;
  
  	/* the following commands operate on the current device */
-@@ -283,13 +295,23 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
+@@ -283,13 +295,23 @@
  			     "are sure of what you are doing!\n"
  			     "\nReally scrub this NAND flash? <y/N>\n");
  
@@ -66,7 +66,7 @@
  		ret = nand_erase_opts(nand, &opts);
  		printf("%s\n", ret ? "ERROR" : "OK");
  
-@@ -458,6 +480,33 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
+@@ -458,6 +480,33 @@
  		return 0;
  	}
  
@@ -100,7 +100,7 @@
  usage:
  	printf("Usage:\n%s\n", cmdtp->usage);
  	return 1;
-@@ -478,7 +527,8 @@ U_BOOT_CMD(nand, 5, 1, do_nand,
+@@ -478,7 +527,8 @@
  	"nand markbad off - mark bad block at offset (UNSAFE)\n"
  	"nand biterr off - make a bit error at offset (UNSAFE)\n"
  	"nand lock [tight] [status] - bring nand to lock state or display locked pages\n"
@@ -110,11 +110,11 @@
  
  static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
  			   ulong offset, ulong addr, char *cmd)
-Index: u-boot.git/drivers/nand/nand_bbt.c
+Index: u-boot/drivers/nand/nand_bbt.c
 ===================================================================
---- u-boot.git.orig/drivers/nand/nand_bbt.c
-+++ u-boot.git/drivers/nand/nand_bbt.c
-@@ -797,7 +797,8 @@ int nand_scan_bbt (struct mtd_info *mtd,
+--- u-boot.orig/drivers/nand/nand_bbt.c	2007-02-16 23:53:54.000000000 +0100
++++ u-boot/drivers/nand/nand_bbt.c	2007-02-16 23:53:57.000000000 +0100
+@@ -795,7 +795,8 @@
  
  	len = mtd->size >> (this->bbt_erase_shift + 2);
  	/* Allocate memory (2bit per block) */

Modified: trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch
===================================================================
--- trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/nand-dynamic_partitions.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -17,9 +17,9 @@
 
 Index: u-boot/drivers/nand/nand_bbt.c
 ===================================================================
---- u-boot.orig/drivers/nand/nand_bbt.c
-+++ u-boot/drivers/nand/nand_bbt.c
-@@ -1051,4 +1051,61 @@ int nand_isbad_bbt (struct mtd_info *mtd
+--- u-boot.orig/drivers/nand/nand_bbt.c	2007-02-16 23:53:09.000000000 +0100
++++ u-boot/drivers/nand/nand_bbt.c	2007-02-16 23:53:36.000000000 +0100
+@@ -1049,4 +1049,61 @@
  	return 1;
  }
  
@@ -83,9 +83,9 @@
  #endif
 Index: u-boot/include/configs/neo1973.h
 ===================================================================
---- u-boot.orig/include/configs/neo1973.h
-+++ u-boot/include/configs/neo1973.h
-@@ -103,7 +103,7 @@
+--- u-boot.orig/include/configs/neo1973.h	2007-02-16 23:53:34.000000000 +0100
++++ u-boot/include/configs/neo1973.h	2007-02-16 23:53:36.000000000 +0100
+@@ -102,7 +102,7 @@
  			CFG_CMD_ELF	 | \
  			CFG_CMD_MISC	 | \
  			/* CFG_CMD_USB	 | */ \
@@ -94,7 +94,7 @@
  			CFG_CMD_DIAG	 | \
  			/* CFG_CMD_HWFLOW	 | */ \
  			CFG_CMD_SAVES	 | \
-@@ -211,13 +211,13 @@
+@@ -212,13 +212,13 @@
  #define CONFIG_FAT		1
  #define CONFIG_SUPPORT_VFAT	1
  
@@ -111,9 +111,9 @@
  #endif
  
  /* ATAG configuration */
-@@ -253,4 +253,7 @@
+@@ -254,4 +254,7 @@
  
- #define CONFIG_S3C2410_NAND_BBT		1
+ #define CONFIG_S3C2410_NAND_BBT                1
  
 +#define MTDIDS_DEFAULT	"nand0=neo1973-nand"
 +#define MTPARTS_DEFAULT	"neo1973-nand:192k(u-boot),8k(u-boot_env),2M(kernel),2M(splash),-(jffs2)"
@@ -121,9 +121,9 @@
  #endif	/* __CONFIG_H */
 Index: u-boot/common/cmd_jffs2.c
 ===================================================================
---- u-boot.orig/common/cmd_jffs2.c
-+++ u-boot/common/cmd_jffs2.c
-@@ -2123,6 +2123,18 @@ int do_jffs2_mtdparts(cmd_tbl_t *cmdtp, 
+--- u-boot.orig/common/cmd_jffs2.c	2007-02-16 23:53:09.000000000 +0100
++++ u-boot/common/cmd_jffs2.c	2007-02-16 23:53:36.000000000 +0100
+@@ -2123,6 +2123,18 @@
  	printf ("Usage:\n%s\n", cmdtp->usage);
  	return 1;
  }
@@ -142,7 +142,7 @@
  #endif /* #ifdef CONFIG_JFFS2_CMDLINE */
  
  /***************************************************/
-@@ -2188,6 +2200,13 @@ U_BOOT_CMD(
+@@ -2188,6 +2200,13 @@
  	"<name>     := '(' NAME ')'\n"
  	"<ro-flag>  := when set to 'ro' makes partition read-only (not used, passed to kernel)\n"
  );

Deleted: trunk/src/target/u-boot/patches/s3c2410-nand_badblock_skip.patch
===================================================================
--- trunk/src/target/u-boot/patches/s3c2410-nand_badblock_skip.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/s3c2410-nand_badblock_skip.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,56 +0,0 @@
-This patch introduces bad block skipping to the first stage bootloader
-(the one that relocates us from NAND into SDRAM) of the S3C2410.
-
-Signed-off-by: Harald Welte <laforge at openmoko.org>
-
-Index: u-boot.git/cpu/arm920t/s3c24x0/nand_read.c
-===================================================================
---- u-boot.git.orig/cpu/arm920t/s3c24x0/nand_read.c	2007-02-06 11:59:05.000000000 +0100
-+++ u-boot.git/cpu/arm920t/s3c24x0/nand_read.c	2007-02-06 12:10:21.000000000 +0100
-@@ -33,6 +33,7 @@
- 
- #define NAND_SECTOR_SIZE	512
- #define NAND_BLOCK_MASK		(NAND_SECTOR_SIZE - 1)
-+#define NAND_PAGE_SIZE		0x4000
- 
- /* low level nand read function */
- int
-@@ -49,6 +50,26 @@
-     for(i=0; i<10; i++);
- 
-     for(i=start_addr; i < (start_addr + size);) {
-+
-+#ifdef CONFIG_S3C2410_NAND_SKIP_BAD
-+        if (start_addr % NAND_PAGE_SIZE == 0) {
-+	    unsigned char data;
-+	    NFCMD = 0x50;
-+	    NFADDR = 517&0xf;
-+	    NFADDR = (i >> 9) & 0xff;
-+	    NFADDR = (i >> 17) & 0xff;
-+	    NFADDR = (i >> 25) & 0xff;
-+	    wait_idle();
-+	    data = (NFDATA & 0xff);
-+	    if (data != 0xff) {
-+	    	/* Bad block */
-+		i += NAND_PAGE_SIZE;
-+		size += NAND_PAGE_SIZE;
-+		continue;
-+	    }
-+	}
-+#endif
-+
-       /* READ0 */
-       NFCMD = 0;
- 
-Index: u-boot.git/include/configs/neo1973.h
-===================================================================
---- u-boot.git.orig/include/configs/neo1973.h	2007-02-06 12:09:36.000000000 +0100
-+++ u-boot.git/include/configs/neo1973.h	2007-02-06 12:10:21.000000000 +0100
-@@ -33,6 +33,7 @@
- #else
- /* we want to start u-boot directly from within NAND flash */
- #define CONFIG_S3C2410_NAND_BOOT	1
-+#define CONFIG_S3C2410_NAND_SKIP_BAD	1
- #endif
- 
- /*

Deleted: trunk/src/target/u-boot/patches/s3c2410-nand_bbt.patch
===================================================================
--- trunk/src/target/u-boot/patches/s3c2410-nand_bbt.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/s3c2410-nand_bbt.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,45 +0,0 @@
-This introduces NAND bad block table support on the S3C2410, which is required
-by the dynamic partition support
-
-Signed-off-by: Harald Welte <laforge at openmoko.org>
-
-Index: u-boot.git/cpu/arm920t/s3c24x0/nand.c
-===================================================================
---- u-boot.git.orig/cpu/arm920t/s3c24x0/nand.c	2007-02-06 11:59:05.000000000 +0100
-+++ u-boot.git/cpu/arm920t/s3c24x0/nand.c	2007-02-06 12:10:58.000000000 +0100
-@@ -188,7 +188,11 @@
- 	nand->dev_ready = s3c2410_dev_ready;
- 
- 	nand->eccmode = NAND_ECC_SOFT;
-+#ifdef CONFIG_S3C2410_NAND_BBT
-+	nand->options = NAND_USE_FLASH_BBT;
-+#else
- 	nand->options = 0;
-+#endif
- 	//nand->waitfunc = dfc_wait;
- 
- 	//nand->cmdfunc = s3c2410_cmdfunc;
-Index: u-boot.git/drivers/nand/nand_bbt.c
-===================================================================
---- u-boot.git.orig/drivers/nand/nand_bbt.c	2007-02-06 11:38:01.000000000 +0100
-+++ u-boot.git/drivers/nand/nand_bbt.c	2007-02-06 12:10:58.000000000 +0100
-@@ -296,6 +296,8 @@
- 		for (j = 0; j < len; j++) {
- 			if (check_pattern (&buf[j * scanlen], scanlen, mtd->oobblock, bd)) {
- 				this->bbt[i >> 3] |= 0x03 << (i & 0x6);
-+				printk (KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
-+					i >> 1, (unsigned int) from);
- 				break;
- 			}
- 		}
-Index: u-boot.git/include/configs/neo1973.h
-===================================================================
---- u-boot.git.orig/include/configs/neo1973.h	2007-02-06 12:10:21.000000000 +0100
-+++ u-boot.git/include/configs/neo1973.h	2007-02-06 12:10:58.000000000 +0100
-@@ -251,4 +251,6 @@
- #define LCD_VIDEO_ADDR		0x33d00000
- #endif
- 
-+#define CONFIG_S3C2410_NAND_BBT		1
-+
- #endif	/* __CONFIG_H */

Modified: trunk/src/target/u-boot/patches/series
===================================================================
--- trunk/src/target/u-boot/patches/series	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/series	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,31 +1,36 @@
+# just some local hacks
 uboot-machtypes.patch
 uboot-arm920t_cp15_cmd.patch
-uboot-s3c2410-nand_mmc.patch
+ext2load_hex.patch
+uboot-mokoversion.patch
+
+# those we want to get mainline
+uboot-s3c2410-warnings-fix.patch
+uboot-strtoul.patch
+uboot-cramfs_but_no_jffs2.patch
+mmc_parititon_fix.patch
+nand-read_write_oob.patch
+uboot-s3c2410-nand.patch
+uboot-cmd_s3c2410.patch
+uboot-s3c2410-mmc.patch
 uboot-s3c2410_fb.patch
 uboot-20061030-qt2410.patch 
 uboot-20061030-neo1973.patch 
-uboot-gta01v4.patch
-mmc_parititon_fix.patch
-ext2load_hex.patch
-uboot-gta01b_v2.patch
-s3c2410-nand_badblock_skip.patch
-s3c2410-nand_bbt.patch
-nand-read_write_oob.patch
 env_nand_oob.patch
+
+# this will be somewhat more difficult
 nand-dynamic_partitions.patch
-uboot-arm920_s3c2410_irq_demux.patch
 uboot-s3c2410-norelocate_irqvec_cpy.patch
 uboot-usbtty-acm.patch
+uboot-arm920_s3c2410_irq_demux.patch
 uboot-s3c2410_udc.patch
-uboot-gta01bv3.patch
-uboot-neo1973-poweroff.patch
-uboot-cmd_s3c2410.patch
+
+# those need to be cleaned up
 bbt-create-optional.patch
 nand-createbbt.patch
-uboot-mokoversion.patch
-uboot-strtoul.patch
 nand-badisbad.patch
-uboot-neo1973-jbt6k74.patch
-uboot-s3c2410-warnings-fix.patch
 dynpart-absorb-bad.patch
 uboot-bbt-quiet.patch
+
+# those have to be implemented fully
+uboot-dfu.patch

Modified: trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-20061030-neo1973.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,26 +1,31 @@
 This patch adds neo1973 'board' (FIC Neo1973 phone) support to u-boot.
-Specifically, it adds support for the GTA01v3 hardware revision.
+Specifically, it adds support for the GTA01v3, GTA01v4, GTA01Bv2 and
+GTA01Bv3 hardware revisions.
 
 Signed-off-by: Harald Welte <laforge at openmoko.org>
 
-Index: u-boot.git/Makefile
+Index: u-boot/Makefile
 ===================================================================
---- u-boot.git.orig/Makefile	2007-02-07 16:48:01.000000000 +0100
-+++ u-boot.git/Makefile	2007-02-07 16:48:38.000000000 +0100
-@@ -1907,6 +1907,9 @@
+--- u-boot.orig/Makefile	2007-02-16 23:34:01.000000000 +0100
++++ u-boot/Makefile	2007-02-16 23:37:04.000000000 +0100
+@@ -1928,6 +1928,13 @@
  sbc2410x_config: unconfig
  	@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
  
-+gta01_config	:	unconfig
-+	@./mkconfig $(@:_config=) arm arm920t neo1973 NULL s3c24x0
++gta01_config \
++gta01v3_config \
++gta01bv2_config \
++gta01bv3_config \
++gta01v4_config :	unconfig
++	@board/neo1973/split_by_variant.sh $@
 +
  qt2410_config	:	unconfig
  	@./mkconfig $(@:_config=) arm arm920t qt2410 NULL s3c24x0
  
-Index: u-boot.git/board/neo1973/Makefile
+Index: u-boot/board/neo1973/Makefile
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/neo1973/Makefile	2007-02-07 16:48:38.000000000 +0100
++++ u-boot/board/neo1973/Makefile	2007-02-16 23:40:48.000000000 +0100
 @@ -0,0 +1,47 @@
 +#
 +# (C) Copyright 2000, 2001, 2002
@@ -49,7 +54,7 @@
 +
 +LIB	= lib$(BOARD).a
 +
-+OBJS	:= neo1973.o
++OBJS	:= neo1973.o pcf50606.o cmd_neo1973.o jbt6k74.o
 +SOBJS	:= lowlevel_init.o
 +
 +$(LIB):	$(OBJS) $(SOBJS)
@@ -69,11 +74,11 @@
 +-include .depend
 +
 +#########################################################################
-Index: u-boot.git/board/neo1973/config.mk
+Index: u-boot/board/neo1973/config.mk
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/neo1973/config.mk	2007-02-07 16:48:38.000000000 +0100
-@@ -0,0 +1,25 @@
++++ u-boot/board/neo1973/config.mk	2007-02-16 23:37:00.000000000 +0100
+@@ -0,0 +1,34 @@
 +#
 +# (C) Copyright 2002
 +# Gary Jennejohn, DENX Software Engineering, <gj at denx.de>
@@ -84,26 +89,35 @@
 +# see http://www.samsung.com/ for more information on SAMSUNG
 +#
 +
++# GTA01v3 has 1 bank of 64 MB SDRAM
++# GTA01v4 has 1 bank of 64 MB SDRAM
 +#
-+# GTA01 has 1 bank of 64 MB DRAM
++# 	3000'0000 to 3400'0000
++# we load ourself to 33F8'0000
 +#
-+# 3000'0000 to 3400'0000
++# GTA01Bv2 or later has 1 bank of 128 MB SDRAM
 +#
++# 	3000'0000 to 3800'0000
++# we load ourself to 37F8'0000
++#
 +# Linux-Kernel is expected to be at 3000'8000, entry 3000'8000
 +# optionally with a ramdisk at 3080'0000
 +#
-+# we load ourself to 33F8'0000
-+#
-+# download area is 3300'0000
-+#
++# download area is 3200'0000 or 3300'0000
 +
++sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
 +
++ifeq ($(GTA01_BIG_RAM),y)
++# FIXME: TEXT_BASE = 0x37F80000
 +TEXT_BASE = 0x33F80000
-Index: u-boot.git/board/neo1973/neo1973.c
++else
++TEXT_BASE = 0x33F80000
++endif
+Index: u-boot/board/neo1973/neo1973.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/neo1973/neo1973.c	2007-02-07 16:48:38.000000000 +0100
-@@ -0,0 +1,148 @@
++++ u-boot/board/neo1973/neo1973.c	2007-02-16 23:40:48.000000000 +0100
+@@ -0,0 +1,317 @@
 +/*
 + * (C) 2006 by OpenMoko, Inc.
 + * Author: Harald Welte <laforge at openmoko.org>
@@ -140,31 +154,43 @@
 +#include <s3c2410.h>
 +#include <i2c.h>
 +
++#include "neo1973.h"
++#include "pcf50606.h"
++#include "jbt6k74.h"
++
 +DECLARE_GLOBAL_DATA_PTR;
 +
-+#if 1
++/* That many seconds the power key needs to be pressed to power up */
++#define POWER_KEY_SECONDS	2
++
++#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
 +//#define M_MDIV	0xA1		/* Fout = 202.8MHz */
 +//#define M_PDIV	0x3
 +//#define M_SDIV	0x1
 +#define M_MDIV	0x90		/* Fout = 202.8MHz */
 +#define M_PDIV	0x7
 +#define M_SDIV	0x0
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++#if 0
++#define M_MDIV	0x7d		/* Fout = 266MHz */
++#define M_PDIV	0x1
++#define M_SDIV	0x1
 +#else
-+#define M_MDIV	0x5c		/* Fout = 150.0MHz */
-+#define M_PDIV	0x4
++#define M_MDIV	0x90		/* Fout = 202.8MHz */
++#define M_PDIV	0x7
 +#define M_SDIV	0x0
 +#endif
++#else
++#error Please define GTA01 revision
++#endif
 +
-+#if 1
 +#define U_M_MDIV	0x78
 +#define U_M_PDIV	0x2
 +#define U_M_SDIV	0x3
-+#else
-+#define U_M_MDIV	0x48
-+#define U_M_PDIV	0x3
-+#define U_M_SDIV	0x2
-+#endif
 +
++unsigned int neo1973_wakeup_cause;
++extern int nobootdelay;
++
 +static inline void delay (unsigned long loops)
 +{
 +	__asm__ volatile ("1:\n"
@@ -197,9 +223,10 @@
 +	delay (8000);
 +
 +	/* set up the I/O ports */
++#if defined(CONFIG_ARCH_GTA01_v3)
 +	gpio->GPACON = 0x007FFFFF;
 +
-+	gpio->GPBCON = 0x00005056;
++	gpio->GPBCON = 0x00005055;
 +	gpio->GPBUP = 0x000007FF;
 +
 +	gpio->GPCCON = 0xAAAA12A8;
@@ -219,7 +246,59 @@
 +
 +	gpio->GPHCON = 0x0008FAAA;
 +	gpio->GPHUP = 0x000007FF;
++#elif defined(CONFIG_ARCH_GTA01_v4)
++	gpio->GPACON = 0x005E47FF;
 +
++	gpio->GPBCON = 0x00045015;
++	gpio->GPBUP = 0x000007FF;
++	gpio->GPBDAT |= 0x4;		/* Set GBP2 to high (Flash power-up) */
++
++	gpio->GPCCON = 0xAAAA12A9;
++	gpio->GPCUP = 0x0000FFFF;
++
++	gpio->GPDCON = 0xAAAAAAAA;
++	gpio->GPDUP = 0x0000FFFF;
++
++	gpio->GPECON = 0xA02AAAAA;
++	gpio->GPEUP = 0x0000FFFF;
++
++	gpio->GPFCON = 0x0000aa09;
++	gpio->GPFUP = 0x000000FF;
++
++	gpio->GPGCON = 0xFF40F0C1;
++	gpio->GPGUP = 0x0000AFEF;
++
++	gpio->GPHCON = 0x0000FAAA;
++	gpio->GPHUP = 0x000007FF;
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	gpio->GPACON = 0x005E47FF;
++
++	gpio->GPBCON = 0x00145415;
++	gpio->GPBUP = 0x000007FF;
++	gpio->GPBDAT |= 0x4;		/* Set GBP2 to high (Flash power-up) */
++
++	gpio->GPCCON = 0xAAAA12A9;
++	gpio->GPCUP = 0x0000FFFF;
++
++	gpio->GPDCON = 0xAAAAAAAA;
++	gpio->GPDUP = 0x0000FFFF;
++
++	gpio->GPECON = 0xA02AAAAA;
++	gpio->GPEUP = 0x0000FFFF;
++
++	gpio->GPFCON = 0x0000aa19;
++	gpio->GPFUP = 0x000000FF;
++	gpio->GPFDAT |= 0x4;		/* Set GBF2 to high (nGSM_EN) */
++
++	gpio->GPGCON = 0xFF40F0C1;
++	gpio->GPGUP = 0x0000AFEF;
++
++	gpio->GPHCON = 0x0000FAAA;
++	gpio->GPHUP = 0x000007FF;
++#else
++#error Please define GTA01 version
++#endif
++
 +	/* arch number of SMDK2410-Board */
 +	gd->bd->bi_arch_number = MACH_TYPE_NEO1973;
 +
@@ -234,9 +313,70 @@
 +
 +int board_late_init(void)
 +{
-+	const char mmc_power = 0x8f;
-+	/* enable D3REG 3.3V (SC/MMC power) */
-+	i2c_write(0x08, 0x25, 1, &mmc_power, 1);
++	unsigned char tmp;
++	char buf[32];
++
++	/* Initialize the Power Management Unit with a safe register set */
++	pcf50606_init();
++
++	/* obtain wake-up reason, save INT1 in environment */
++	tmp = pcf50606_reg_read(PCF50606_REG_INT1);
++	sprintf(buf, "0x%02x", tmp);
++	setenv("pcf50606_int1", buf);
++
++	if (tmp & PCF50606_INT1_ALARM) {
++		/* we've been woken up by RTC alarm or charger insert, boot */
++		neo1973_wakeup_cause = NEO1973_WAKEUP_ALARM;
++		goto continue_boot;
++	}
++	if (tmp & PCF50606_INT1_EXTONR) {
++		neo1973_wakeup_cause = NEO1973_WAKEUP_CHARGER;
++	}
++
++	if (tmp & PCF50606_INT1_ONKEYF) {
++		int seconds = 0;
++		neo1973_wakeup_cause = NEO1973_WAKEUP_POWER_KEY;
++		/* we've been woken up by a falling edge of the onkey */
++
++		/* we can't just setenv(bootdelay,-1) because that would
++		 * accidentially become permanent if the user does saveenv */
++		if (neo1973_911_key_pressed())
++			nobootdelay = 1;
++
++		while (1) {
++			u_int8_t int1, oocs;
++
++			oocs = pcf50606_reg_read(PCF50606_REG_OOCS);
++			if (oocs & PFC50606_OOCS_ONKEY)
++				break;
++
++			int1 = pcf50606_reg_read(PCF50606_REG_INT1);
++			if (int1 & PCF50606_INT1_SECOND)
++				seconds++;
++
++			if (seconds >= POWER_KEY_SECONDS)
++				goto continue_boot;
++		}
++		/* Power off if minimum number of seconds not reached */
++		neo1973_poweroff();
++	}
++
++	/* if there's no other reason, must be regular reset */
++	neo1973_wakeup_cause = NEO1973_WAKEUP_RESET;
++
++continue_boot:
++	/* issue a short pulse with the vibrator */
++	neo1973_vibrator(1);
++	udelay(50000);
++	neo1973_vibrator(0);
++
++	/* switch on the backlight */
++	neo1973_backlight(1);
++
++	jbt6k74_init();
++	jbt6k74_enter_state(JBT_STATE_NORMAL);
++	jbt6k74_display_onoff(1);
++
 +	return 0;
 +}
 +
@@ -250,13 +390,56 @@
 +
 +u_int32_t get_board_rev(void)
 +{
++#if defined(CONFIG_ARCH_GTA01_v3)
 +	return 0x00000130;
++#elif defined(CONFIG_ARCH_GTA01_v4)
++	return 0x00000140;
++#elif defined(CONFIG_ARCH_GTA01B_v2)
++	return 0x00000220;
++#elif defined(CONFIG_ARCH_GTA01B_v3)
++	return 0x00000230;
++#endif
 +}
-Index: u-boot.git/board/neo1973/lowlevel_init.S
++
++void neo1973_poweroff(void)
++{
++	serial_printf("poweroff\n");
++	udc_disconnect();
++	pcf50606_reg_write(PCF50606_REG_OOCC1, PCF50606_OOCC1_GOSTDBY);
++	/* don't return to caller */
++	while (1) ;
++}
++
++void neo1973_backlight(int on)
++{
++	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++	if (on)
++		gpio->GPBDAT |= 0x01;
++	else
++		gpio->GPBDAT &= ~0x01;
++}
++
++void neo1973_vibrator(int on)
++{
++	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++	if (on)
++		gpio->GPBDAT |= (1 << 10);
++	else
++		gpio->GPBDAT &= ~(1 << 10);
++}
++
++int neo1973_911_key_pressed(void)
++{
++	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++	if (gpio->GPFDAT & (1 << 6))
++		return 0;
++	return 1;
++}
+Index: u-boot/board/neo1973/lowlevel_init.S
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/neo1973/lowlevel_init.S	2007-02-07 16:48:38.000000000 +0100
-@@ -0,0 +1,171 @@
++++ u-boot/board/neo1973/lowlevel_init.S	2007-02-16 23:37:04.000000000 +0100
+@@ -0,0 +1,188 @@
 +/*
 + * Memory Setup stuff - taken from blob memsetup.S
 + *
@@ -367,12 +550,16 @@
 +#define B5_PMC		 	0x0	/* normal */
 +
 +#define B6_MT		 	0x3	/* SDRAM */
-+#define B6_Trcd	 	 	0x1
++#define B6_Trcd	 	 	0x1	/* 3clk */
++#if defined (CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
 +#define B6_SCAN		 	0x1	/* 9bit */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++#define B6_SCAN		 	0x2	/* 10bit */
++#endif
 +
 +#define B7_MT		 	0x3	/* SDRAM */
 +#define B7_Trcd		 	0x1	/* 3clk */
-+#define B7_SCAN		 	0x1	/* 9bit */
++#define B7_SCAN		 	0x2	/* 10bit */
 +
 +/* REFRESH parameter */
 +#define REFEN		 	0x1	/* Refresh enable */
@@ -408,6 +595,19 @@
 +	orr	r1, r1, #0xc0000000
 +	mcr	p15, 0, r1, c1, c0, 0
 +
++#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	/* switch on power for NAND */
++	ldr	r0, =0x56000010	/* GPBCON */
++	ldr	r1, [r0]
++	orr	r1, r1, #0x10
++	str	r1, [r0]
++
++	ldr	r0, =0x56000014	/* GPBDAT */
++	ldr	r1, [r0]
++	orr	r1, r1, #(1 <<2)
++	str	r1, [r0]
++#endif
++
 +	/* everything is fine now */
 +	mov	pc, lr
 +
@@ -428,10 +628,10 @@
 +    .word 0xb2
 +    .word 0x30
 +    .word 0x30
-Index: u-boot.git/board/neo1973/u-boot.lds
+Index: u-boot/board/neo1973/u-boot.lds
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/neo1973/u-boot.lds	2007-02-07 16:48:43.000000000 +0100
++++ u-boot/board/neo1973/u-boot.lds	2007-02-16 23:34:02.000000000 +0100
 @@ -0,0 +1,58 @@
 +/*
 + * (C) Copyright 2002
@@ -491,11 +691,11 @@
 +	.bss : { *(.bss) }
 +	_end = .;
 +}
-Index: u-boot.git/include/configs/neo1973.h
+Index: u-boot/include/configs/neo1973.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/include/configs/neo1973.h	2007-02-07 16:48:38.000000000 +0100
-@@ -0,0 +1,241 @@
++++ u-boot/include/configs/neo1973.h	2007-02-16 23:41:35.000000000 +0100
+@@ -0,0 +1,257 @@
 +/*
 + * (C) Copyright 2006 OpenMoko, Inc.
 + * Author: Harald Welte <laforge at openmoko.org>
@@ -531,6 +731,7 @@
 +#else
 +/* we want to start u-boot directly from within NAND flash */
 +#define CONFIG_S3C2410_NAND_BOOT	1
++#define CONFIG_S3C2410_NAND_SKIP_BAD	1
 +#endif
 +
 +/*
@@ -562,7 +763,6 @@
 + * select serial console configuration
 + */
 +#define CONFIG_SERIAL1          1	/* we use SERIAL 1 on GTA01 */
-+//#define CONFIG_HWFLOW		1
 +
 +/************************************************************
 + * RTC
@@ -629,7 +829,15 @@
 + * Miscellaneous configurable options
 + */
 +#define	CFG_LONGHELP				/* undef to save memory		*/
++#if defined(CONFIG_ARCH_GTA01_v3)
 +#define	CFG_PROMPT		"GTA01v3 # "	/* Monitor Command Prompt	*/
++#elif defined(CONFIG_ARCH_GTA01_v4)
++#define	CFG_PROMPT		"GTA01v4 # "	/* Monitor Command Prompt	*/
++#elif defined(CONFIG_ARCH_GTA01B_v2)
++#define	CFG_PROMPT		"GTA01Bv2 # "	/* Monitor Command Prompt	*/
++#elif defined(CONFIG_ARCH_GTA01B_v3)
++#define	CFG_PROMPT		"GTA01Bv3 # "	/* Monitor Command Prompt	*/
++#endif
 +#define	CFG_CBSIZE		256		/* Console I/O Buffer Size	*/
 +#define	CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
 +#define	CFG_MAXARGS		16		/* max number of command args	*/
@@ -669,7 +877,13 @@
 + */
 +#define CONFIG_NR_DRAM_BANKS	1	   /* we have 1 bank of DRAM */
 +#define PHYS_SDRAM_1		0x30000000 /* SDRAM Bank #1 */
++#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
 +#define PHYS_SDRAM_1_SIZE	0x04000000 /* 64 MB */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++#define PHYS_SDRAM_1_SIZE	0x08000000 /* 128 MB */
++#else
++#error Please define GTA01 variant
++#endif
 +#define PHYS_SDRAM_RES_SIZE	0x00200000 /* 2 MB for frame buffer */
 +
 +/*-----------------------------------------------------------------------
@@ -722,7 +936,7 @@
 +/* we have a board_late_init() function */
 +#define BOARD_LATE_INIT			1
 +
-+#if 0
++#if 1
 +#define CONFIG_VIDEO
 +#define CONFIG_VIDEO_S3C2410
 +#define CONFIG_CFB_CONSOLE
@@ -736,4 +950,1101 @@
 +#define LCD_VIDEO_ADDR		0x33d00000
 +#endif
 +
++#define CONFIG_S3C2410_NAND_BBT                1
++
 +#endif	/* __CONFIG_H */
+Index: u-boot/board/neo1973/split_by_variant.sh
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/board/neo1973/split_by_variant.sh	2007-02-16 23:37:04.000000000 +0100
+@@ -0,0 +1,49 @@
++#!/bin/sh
++# ---------------------------------------------------------
++#  Set the core module defines according to Core Module
++# ---------------------------------------------------------
++# ---------------------------------------------------------
++# Set up the GTA01 type define
++# ---------------------------------------------------------
++
++mkdir -p ${obj}include
++if [ "$1" == "" ]
++then
++	echo "$0:: No parameters - using GTA01Bv3 config"
++	echo "#define CONFIG_ARCH_GTA01B_v3" > ${obj}include/config.h
++	echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++else
++	case "$1" in
++	gta01v4_config)
++	echo "#define CONFIG_ARCH_GTA01_v4" > ${obj}include/config.h
++	echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
++	;;
++
++	gta01v3_config)
++	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
++	echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
++	;;
++
++	gta01bv2_config)
++	echo "#define CONFIG_ARCH_GTA01B_v2" > ${obj}include/config.h
++	echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++	;;
++
++	gta01bv3_config)
++	echo "#define CONFIG_ARCH_GTA01B_v3" > ${obj}include/config.h
++	echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
++	;;
++
++	*)
++	echo "$0:: Unrecognised config - using gta01v3_config"
++	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
++	echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
++	;;
++
++	esac
++
++fi
++# ---------------------------------------------------------
++# Complete the configuration
++# ---------------------------------------------------------
++$MKCONFIG -a neo1973 arm arm920t neo1973 NULL s3c24x0
+Index: u-boot/board/neo1973/cmd_neo1973.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/board/neo1973/cmd_neo1973.c	2007-02-16 23:38:13.000000000 +0100
+@@ -0,0 +1,120 @@
++/*
++ * (C) Copyright 2006 by OpenMoko, Inc.
++ * Author: Harald Welte <laforge at openmoko.org>
++ *
++ * See file CREDITS for list of people who contributed to this
++ * project.
++ *
++ * 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
++ */
++
++/*
++ * Boot support
++ */
++#include <common.h>
++#include <command.h>
++#include <net.h>		/* for print_IPaddr */
++#include <s3c2410.h>
++
++#include "neo1973.h"
++#include "pcf50606.h"
++
++DECLARE_GLOBAL_DATA_PTR;
++
++#if (CONFIG_COMMANDS & CFG_CMD_BDI)
++
++static const char *chgstate_names[] = {
++	[PCF50606_MBCC1_CHGMOD_QUAL]		= "qualification",
++	[PCF50606_MBCC1_CHGMOD_PRE]		= "pre",
++	[PCF50606_MBCC1_CHGMOD_TRICKLE]		= "trickle",
++	[PCF50606_MBCC1_CHGMOD_FAST_CCCV]	= "fast_cccv",
++	[PCF50606_MBCC1_CHGMOD_FAST_NOCC]	= "fast_nocc",
++	[PCF50606_MBCC1_CHGMOD_FAST_NOCV]	= "fast_nocv",
++	[PCF50606_MBCC1_CHGMOD_FAST_SW]		= "fast_switch",
++	[PCF50606_MBCC1_CHGMOD_IDLE]		= "idle",
++};
++
++int do_neo1973 ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
++{
++	int i;
++
++	if (!strcmp(argv[1], "info")) {
++		printf("FIC GTA01 Hardware Revision 0x%04x\n", get_board_rev());
++	} else if (!strcmp(argv[1], "power-off")) {
++		neo1973_poweroff();
++	} else if (!strcmp(argv[1], "charger") || !strcmp(argv[1], "charge")) {
++		if (argc < 3)
++			goto out_help;
++		if (!strcmp(argv[2], "status") || !strcmp(argv[2], "state")) {
++			u_int8_t mbcc1 = pcf50606_reg_read(PCF50606_REG_MBCC1);
++			u_int8_t chgmod = (mbcc1 & PCF50606_MBCC1_CHGMOD_MASK);
++			printf("%s\n", chgstate_names[chgmod]);
++		} else if (!strcmp(argv[2], "autofast")) {
++			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
++						  PCF50606_MBCC1_AUTOFST,
++						  PCF50606_MBCC1_AUTOFST);
++		} else if (!strcmp(argv[2], "!autofast")) {
++			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
++						  PCF50606_MBCC1_AUTOFST, 0);
++		} else if (!strcmp(argv[2], "off")) {
++			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
++						  PCF50606_MBCC1_CHGMOD_MASK,
++						  PCF50606_MBCC1_CHGMOD_IDLE);
++		} else if (!strcmp(argv[2], "fast")) {
++			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
++						  PCF50606_MBCC1_CHGMOD_MASK,
++						  PCF50606_MBCC1_CHGMOD_FAST_CCCV);
++		} else
++			goto out_help;
++	} else if (!strcmp(argv[1], "backlight")) {
++		if (argc < 3)
++			goto out_help;
++		if (!strcmp(argv[2], "on"))
++			neo1973_backlight(1);
++		else
++			neo1973_backlight(0);
++	} else if (!strcmp(argv[1], "vibrator")) {
++		if (argc < 3)
++			goto out_help;
++		if (!strcmp(argv[2], "on"))
++			neo1973_vibrator(1);
++		else
++			neo1973_vibrator(0);
++	} else {
++out_help:
++		printf("Usage:\n%s\n", cmdtp->usage);
++		return 1;
++	}
++
++	return 0;
++}
++
++/* -------------------------------------------------------------------- */
++
++U_BOOT_CMD(
++	neo1973,	4,	1,	do_neo1973,
++	"neo1973 - phone specific commands\n",
++	"neo1973 info - display phone informantion\n"
++	"neo1973 power-off - switch off the phone\n"
++	"neo1973 charger status - display charger status\n"
++	"neo1973 charger autofast - enable automatic fast (500mA) charging\n"
++	"neo1973 charger !autofast - disable automatic fast (500mA) charging\n"
++	"neo1973 charger fast - enable fast (500mA) charging\n"
++	"neo1973 charger off - disable charging\n"
++	"neo1973 backlight (on|off) - switch backlight on or off\n"
++	"neo1973 vibrator (on|off) - switch vibrator on or off\n"
++);
++#endif	/* CFG_CMD_BDI */
+Index: u-boot/board/neo1973/neo1973.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/board/neo1973/neo1973.h	2007-02-16 23:38:13.000000000 +0100
+@@ -0,0 +1,18 @@
++#ifndef _NEO1973_H
++#define _NEO1973_H
++
++enum wakeup_reason {
++	NEO1973_WAKEUP_NONE,
++	NEO1973_WAKEUP_RESET,
++	NEO1973_WAKEUP_POWER_KEY,
++	NEO1973_WAKEUP_CHARGER,
++	NEO1973_WAKEUP_ALARM,
++};
++
++extern unsigned int neo1973_wakeup_cause;
++
++void neo1973_poweroff(void);
++void neo1973_backlight(int on);
++void neo1973_vibrator(int on);
++
++#endif
+Index: u-boot/board/neo1973/pcf50606.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/board/neo1973/pcf50606.c	2007-02-16 23:38:13.000000000 +0100
+@@ -0,0 +1,168 @@
++
++#include <common.h>
++#include <i2c.h>
++#include "pcf50606.h"
++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
++
++#define PCF50606_I2C_ADDR		0x08
++
++void pcf50606_reg_write(u_int8_t reg, u_int8_t val)
++{
++	i2c_write(PCF50606_I2C_ADDR, reg, 1, &val, 1);
++}
++
++u_int8_t pcf50606_reg_read(u_int8_t reg)
++{
++	u_int8_t tmp;
++	i2c_read(PCF50606_I2C_ADDR, reg, 1, &tmp, 1);
++	return tmp;
++}
++
++u_int8_t pcf50606_reg_set_bit_mask(u_int8_t reg, u_int8_t mask, u_int8_t val)
++{
++	u_int8_t tmp = pcf50606_reg_read(reg);
++	pcf50606_reg_write(reg, (val & mask) | (tmp & ~mask));
++}
++
++static const u_int8_t regs_valid[] = {
++	PCF50606_REG_OOCS, PCF50606_REG_INT1M, PCF50606_REG_INT2M,
++	PCF50606_REG_INT3M, PCF50606_REG_OOCC1, PCF50606_REG_OOCC2,
++	PCF50606_REG_PSSC, PCF50606_REG_PWROKM, PCF50606_REG_DCDC1,
++	PCF50606_REG_DCDC2, PCF50606_REG_DCDC3, PCF50606_REG_DCDC4,
++	PCF50606_REG_DCDEC1, PCF50606_REG_DCDEC2, PCF50606_REG_DCUDC1,
++	PCF50606_REG_DCUDC2, PCF50606_REG_IOREGC, PCF50606_REG_D1REGC1,
++	PCF50606_REG_D2REGC1, PCF50606_REG_D3REGC1, PCF50606_REG_LPREGC1,
++	PCF50606_REG_LPREGC2, PCF50606_REG_MBCC1, PCF50606_REG_MBCC2,
++	PCF50606_REG_MBCC3, PCF50606_REG_BBCC, PCF50606_REG_ADCC1,
++	PCF50606_REG_ADCC2, PCF50606_REG_ACDC1, PCF50606_REG_BVMC,
++	PCF50606_REG_PWMC1, PCF50606_REG_LEDC1, PCF50606_REG_LEDC2,
++	PCF50606_REG_GPOC1, PCF50606_REG_GPOC2, PCF50606_REG_GPOC3,
++	PCF50606_REG_GPOC4, PCF50606_REG_GPOC5,
++};
++
++
++static const u_int8_t initial_register_set[__NUM_PCF50606_REGS] = {
++	[PCF50606_REG_OOCS] 	= 0x00,
++	/* gap */
++	[PCF50606_REG_INT1M]	= PCF50606_INT1_SECOND,
++	[PCF50606_REG_INT2M]	= 0x00,
++	[PCF50606_REG_INT3M]	= PCF50606_INT3_TSCPRES,
++	[PCF50606_REG_OOCC1] 	= PCF50606_OOCC1_RTCWAK |
++				  PCF50606_OOCC1_CHGWAK |
++				  PCF50606_OOCC1_EXTONWAK_HIGH,
++	[PCF50606_REG_OOCC2]	= PCF50606_OOCC2_ONKEYDB_14ms |
++				  PCF50606_OOCC2_EXTONDB_14ms,
++	/* gap */
++	[PCF50606_REG_PSSC]	= 0x00,
++	[PCF50606_REG_PWROKM]	= 0x00,
++	/* gap */
++#if defined(CONFIG_ARCH_GTA01B_v2)
++	[PCF50606_REG_DCDC1]	= 0x1e,	/* GL_3V3: off */
++#elif defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_DCDC1]	= 0x18,	/* GL_1V5: off */
++#endif
++	[PCF50606_REG_DCDC2]	= 0x00,
++	[PCF50606_REG_DCDC3]	= 0x00,
++	[PCF50606_REG_DCDC4]	= 0x30, /* 1.25A */
++
++	[PCF50606_REG_DCDEC1]	= 0xe8, /* IO_3V3: on */
++	[PCF50606_REG_DCDEC2]	= 0x00,
++
++#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
++	[PCF50606_REG_DCUDC1]	= 0xe3, /* CORE_1V8: 1.8V */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_DCUDC1]	= 0xe4, /* CORE_1V8: 2.1V */
++#endif
++	[PCF50606_REG_DCUDC2]	= 0x30, /* 1.25A current limit */
++
++#if defined(CONFIG_ARCH_GTA01_v3)
++	[PCF50606_REG_IOREGC]	= 0x13, /* VTCXO_2V8: off */
++#elif defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	//see internal bug 94 [PCF50606_REG_IOREGC]	= 0x18, /* CODEC_3V3: off */
++	[PCF50606_REG_IOREGC]	= 0xf8, /* CODEC_3V3: on */
++#endif
++
++#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
++	[PCF50606_REG_D1REGC1]	= 0x15, /* VRF_3V: off */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_D1REGC1]	= 0x16, /* BT_3V15: off */
++#endif
++
++#if defined(CONFIG_ARCH_GTA01_v3)
++	[PCF50606_REG_D2REGC1]	= 0xf8, /* SD_3V3: on */
++#elif defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_D2REGC1]	= 0x10, /* GL_2V5: off */
++#endif
++
++#if defined(CONFIG_ARCH_GTA01_v3)
++	[PCF50606_REG_D3REGC1]	= 0x18, /* CODEC_3V3: off */
++#elif defined(CONFIG_ARCH_GTA01_v4)
++	[PCF50606_REG_D3REGC1]	= 0x13, /* VTXCO_2V8: off */
++#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
++	[PCF50606_REG_D3REGC1]	= 0x00, /* USER1: off */
++#endif
++
++	[PCF50606_REG_LPREGC1]	= 0xf8, /* LCM_3V3: on */
++	[PCF50606_REG_LPREGC2]	= 0x00,
++
++	[PCF50606_REG_MBCC1]	= 0x01, /* CHGAPE */
++	[PCF50606_REG_MBCC2]	= 0x00,	/* unlimited charging */
++	[PCF50606_REG_MBCC3]	= 0x1a, /* 0.2*Ifast, 4.20V */
++	[PCF50606_REG_BBCC]	= 0x13, /* 50uA */
++	[PCF50606_REG_ADCC1]	= 0x00,
++	[PCF50606_REG_ADCC2]	= 0x00,
++	/* gap */
++	[PCF50606_REG_ACDC1]	= 0x00,
++	[PCF50606_REG_BVMC]	= PCF50606_BVMC_THRSHLD_2V8,
++	[PCF50606_REG_PWMC1]	= 0x00,
++	[PCF50606_REG_LEDC1]	= 0x00,
++	[PCF50606_REG_LEDC2]	= 0x00,
++	[PCF50606_REG_GPOC1]	= 0x00,
++	[PCF50606_REG_GPOC2]	= 0x00,
++	[PCF50606_REG_GPOC3]	= 0x00,
++	[PCF50606_REG_GPOC4]	= 0x00,
++	[PCF50606_REG_GPOC5]	= 0x00,
++};
++
++
++/* initialize PCF50606 register set */
++void pcf50606_init(void)
++{
++#if 0
++	/* We don't want to write to RTC, Alarm and other status registers
++	 * but rather concentrate on efficiently writing/stting those we
++	 * need */
++
++	pcf50606_reg_write(PCF50606_REG_OOCS,
++			   initial_register_set[PCF50606_REG_OOCS]);
++
++	/* GAP: 0x02-0x04 */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x05, 1,
++		  &initial_register_set[0x05], 5);
++
++	/* GAP: 0x0a..0a17 */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x18, 1,
++		  &initial_register_set[0x18], 2);
++
++	/* GAP: 0x1a */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x1b, 1,
++		  &initial_register_set[0x1b], 17);
++
++	/* GAP: 0x2c */
++
++	i2c_write(PCF50606_I2C_ADDR, 0x2d, 1,
++		  &initial_register_set[0x2d], 3);
++
++	/* GAP: 0x30-0x32 */
++	i2c_write(PCF50606_I2C_ADDR, 0x23, 1,
++		  &initial_register_set[0x33], 10);
++#else
++	int i;
++	for (i = 0; i < ARRAY_SIZE(regs_valid); i++)
++		pcf50606_reg_write(regs_valid[i],
++				   initial_register_set[regs_valid[i]]);
++#endif
++}
+Index: u-boot/board/neo1973/pcf50606.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/board/neo1973/pcf50606.h	2007-02-16 23:38:13.000000000 +0100
+@@ -0,0 +1,267 @@
++#ifndef _PCF50606_H
++#define _PCF50606_H
++
++/* Philips PCF50606 Power Managemnt Unit (PMU) driver
++ * (C) 2006-2007 by OpenMoko, Inc.
++ * Author: Harald Welte <laforge at openmoko.org>
++ *
++ */
++
++enum pfc50606_regs {
++	PCF50606_REG_ID		= 0x00,
++	PCF50606_REG_OOCS	= 0x01,
++	PCF50606_REG_INT1	= 0x02,	/* Interrupt Status */
++	PCF50606_REG_INT2	= 0x03,	/* Interrupt Status */
++	PCF50606_REG_INT3	= 0x04,	/* Interrupt Status */
++	PCF50606_REG_INT1M	= 0x05,	/* Interrupt Mask */
++	PCF50606_REG_INT2M	= 0x06,	/* Interrupt Mask */
++	PCF50606_REG_INT3M	= 0x07,	/* Interrupt Mask */
++	PCF50606_REG_OOCC1	= 0x08,
++	PCF50606_REG_OOCC2	= 0x09,
++	PCF50606_REG_RTCSC	= 0x0a,	/* Second */
++	PCF50606_REG_RTCMN	= 0x0b,	/* Minute */
++	PCF50606_REG_RTCHR	= 0x0c,	/* Hour */
++	PCF50606_REG_RTCWD	= 0x0d,	/* Weekday */
++	PCF50606_REG_RTCDT	= 0x0e,	/* Day */
++	PCF50606_REG_RTCMT	= 0x0f,	/* Month */
++	PCF50606_REG_RTCYR	= 0x10,	/* Year */
++	PCF50606_REG_RTCSCA	= 0x11, /* Alarm Second */
++	PCF50606_REG_RTCMNA	= 0x12, /* Alarm Minute */
++	PCF50606_REG_RTCHRA	= 0x13, /* Alarm Hour */
++	PCF50606_REG_RTCWDA	= 0x14, /* Alarm Weekday */
++	PCF50606_REG_RTCDTA	= 0x15, /* Alarm Day */
++	PCF50606_REG_RTCMTA	= 0x16, /* Alarm Month */
++	PCF50606_REG_RTCYRA	= 0x17, /* Alarm Year */
++	PCF50606_REG_PSSC	= 0x18,	/* Power sequencing */
++	PCF50606_REG_PWROKM	= 0x19,	/* PWROK mask */
++	PCF50606_REG_PWROKS	= 0x1a,	/* PWROK status */
++	PCF50606_REG_DCDC1	= 0x1b,
++	PCF50606_REG_DCDC2	= 0x1c,
++	PCF50606_REG_DCDC3	= 0x1d,
++	PCF50606_REG_DCDC4	= 0x1e,
++	PCF50606_REG_DCDEC1	= 0x1f,
++	PCF50606_REG_DCDEC2	= 0x20,
++	PCF50606_REG_DCUDC1	= 0x21,
++	PCF50606_REG_DCUDC2	= 0x22,
++	PCF50606_REG_IOREGC	= 0x23,
++	PCF50606_REG_D1REGC1	= 0x24,
++	PCF50606_REG_D2REGC1	= 0x25,
++	PCF50606_REG_D3REGC1	= 0x26,
++	PCF50606_REG_LPREGC1	= 0x27,
++	PCF50606_REG_LPREGC2	= 0x28,
++	PCF50606_REG_MBCC1	= 0x29,
++	PCF50606_REG_MBCC2	= 0x2a,
++	PCF50606_REG_MBCC3	= 0x2b,
++	PCF50606_REG_MBCS1	= 0x2c,
++	PCF50606_REG_BBCC	= 0x2d,
++	PCF50606_REG_ADCC1	= 0x2e,
++	PCF50606_REG_ADCC2	= 0x2f,
++	PCF50606_REG_ADCS1	= 0x30,
++	PCF50606_REG_ADCS2	= 0x31,
++	PCF50606_REG_ADCS3	= 0x32,
++	PCF50606_REG_ACDC1	= 0x33,
++	PCF50606_REG_BVMC	= 0x34,
++	PCF50606_REG_PWMC1	= 0x35,
++	PCF50606_REG_LEDC1	= 0x36,
++	PCF50606_REG_LEDC2	= 0x37,
++	PCF50606_REG_GPOC1	= 0x38,
++	PCF50606_REG_GPOC2	= 0x39,
++	PCF50606_REG_GPOC3	= 0x3a,
++	PCF50606_REG_GPOC4	= 0x3b,
++	PCF50606_REG_GPOC5	= 0x3c,
++	__NUM_PCF50606_REGS
++};
++
++enum pcf50606_reg_oocs {
++	PFC50606_OOCS_ONKEY	= 0x01,
++	PCF50606_OOCS_EXTON	= 0x02,
++	PCF50606_OOCS_PWROKRST	= 0x04,
++	PCF50606_OOCS_BATOK	= 0x08,
++	PCF50606_OOCS_BACKOK	= 0x10,
++	PCF50606_OOCS_CHGOK	= 0x20,
++	PCF50606_OOCS_TEMPOK	= 0x40,
++	PCF50606_OOCS_WDTEXP	= 0x80,
++};
++
++enum pcf50606_reg_oocc1 {
++	PCF50606_OOCC1_GOSTDBY	= 0x01,
++	PCF50606_OOCC1_TOTRST	= 0x02,
++	PCF50606_OOCC1_CLK32ON	= 0x04,
++	PCF50606_OOCC1_WDTRST	= 0x08,
++	PCF50606_OOCC1_RTCWAK	= 0x10,
++	PCF50606_OOCC1_CHGWAK	= 0x20,
++	PCF50606_OOCC1_EXTONWAK_HIGH	= 0x40,
++	PCF50606_OOCC1_EXTONWAK_LOW	= 0x80,
++};
++
++enum pcf50606_reg_oocc2 {
++	PCF50606_OOCC2_ONKEYDB_NONE	= 0x00,
++	PCF50606_OOCC2_ONKEYDB_14ms	= 0x01,
++	PCF50606_OOCC2_ONKEYDB_62ms	= 0x02,
++	PCF50606_OOCC2_ONKEYDB_500ms	= 0x03,
++	PCF50606_OOCC2_EXTONDB_NONE	= 0x00,
++	PCF50606_OOCC2_EXTONDB_14ms	= 0x04,
++	PCF50606_OOCC2_EXTONDB_62ms	= 0x08,
++	PCF50606_OOCC2_EXTONDB_500ms	= 0x0c,
++};
++
++enum pcf50606_reg_int1 {
++	PCF50606_INT1_ONKEYR	= 0x01,	/* ONKEY rising edge */
++	PCF50606_INT1_ONKEYF	= 0x02,	/* ONKEY falling edge */
++	PCF50606_INT1_ONKEY1S	= 0x04,	/* OMKEY at least 1sec low */
++	PCF50606_INT1_EXTONR	= 0x08,	/* EXTON rising edge */
++	PCF50606_INT1_EXTONF	= 0x10,	/* EXTON falling edge */
++	PCF50606_INT1_SECOND	= 0x40,	/* RTC periodic second interrupt */
++	PCF50606_INT1_ALARM	= 0x80, /* RTC alarm time is reached */
++};
++
++enum pcf50606_reg_int2 {
++	PCF50606_INT2_CHGINS	= 0x01, /* Charger inserted */
++	PCF50606_INT2_CHGRM	= 0x02, /* Charger removed */
++	PCF50606_INT2_CHGFOK	= 0x04,	/* Fast charging OK */
++	PCF50606_INT2_CHGERR	= 0x08,	/* Error in charging mode */
++	PCF50606_INT2_CHGFRDY	= 0x10,	/* Fast charge completed */
++	PCF50606_INT2_CHGPROT	= 0x20,	/* Charging protection interrupt */
++	PCF50606_INT2_CHGWD10S	= 0x40,	/* Charger watchdig expires in 10s */
++	PCF50606_INT2_CHGWDEXP	= 0x80,	/* Charger watchdog expires */
++};
++
++enum pcf50606_reg_int3 {
++	PCF50606_INT3_ADCRDY	= 0x01,	/* ADC conversion finished */
++	PCF50606_INT3_ACDINS	= 0x02,	/* Accessory inserted */
++	PCF50606_INT3_ACDREM	= 0x04, /* Accessory removed */
++	PCF50606_INT3_TSCPRES	= 0x08,	/* Touch screen pressed */
++	PCF50606_INT3_LOWBAT	= 0x40,	/* Low battery voltage */
++	PCF50606_INT3_HIGHTMP	= 0x80, /* High temperature */
++};
++
++/* used by PSSC, PWROKM, PWROKS, */
++enum pcf50606_regu {
++	PCF50606_REGU_DCD	= 0x01,	/* DCD in phase 2 */
++	PCF50606_REGU_DCDE	= 0x02,	/* DCDE in phase 2 */
++	PCF50606_REGU_DCUD	= 0x04,	/* DCDU in phase 2 */
++	PCF50606_REGU_IO	= 0x08,	/* IO in phase 2 */
++	PCF50606_REGU_D1	= 0x10, /* D1 in phase 2 */
++	PCF50606_REGU_D2	= 0x20,	/* D2 in phase 2 */
++	PCF50606_REGU_D3	= 0x40,	/* D3 in phase 2 */
++	PCF50606_REGU_LP	= 0x80,	/* LP in phase 2 */
++};
++
++enum pcf50606_reg_dcdc4 {
++	PCF50606_DCDC4_MODE_AUTO	= 0x00,
++	PCF50606_DCDC4_MODE_PWM		= 0x01,
++	PCF50606_DCDC4_MODE_PCF		= 0x02,
++	PCF50606_DCDC4_OFF_FLOAT	= 0x00,
++	PCF50606_DCDC4_OFF_BYPASS	= 0x04,
++	PCF50606_DCDC4_OFF_PULLDOWN	= 0x08,
++	PCF50606_DCDC4_CURLIM_500mA	= 0x00,
++	PCF50606_DCDC4_CURLIM_750mA	= 0x10,
++	PCF50606_DCDC4_CURLIM_1000mA	= 0x20,
++	PCF50606_DCDC4_CURLIM_1250mA	= 0x30,
++	PCF50606_DCDC4_TOGGLE		= 0x40,
++	PCF50606_DCDC4_REGSEL_DCDC2	= 0x80,
++};
++
++enum pcf50606_reg_dcdec2 {
++	PCF50606_DCDEC2_MODE_AUTO	= 0x00,
++	PCF50606_DCDEC2_MODE_PWM	= 0x01,
++	PCF50606_DCDEC2_MODE_PCF	= 0x02,
++	PCF50606_DCDEC2_OFF_FLOAT	= 0x00,
++	PCF50606_DCDEC2_OFF_BYPASS	= 0x04,
++};
++
++enum pcf50606_reg_dcudc2 {
++	PCF50606_DCUDC2_MODE_AUTO	= 0x00,
++	PCF50606_DCUDC2_MODE_PWM	= 0x01,
++	PCF50606_DCUDC2_MODE_PCF	= 0x02,
++	PCF50606_DCUDC2_OFF_FLOAT	= 0x00,
++	PCF50606_DCUDC2_OFF_BYPASS	= 0x04,
++};
++
++enum pcf50606_reg_adcc1 {
++	PCF50606_ADCC1_TSCMODACT	= 0x01,
++	PCF50606_ADCC1_TSCMODSTB	= 0x02,
++	PCF50606_ADCC1_TRATSET		= 0x04,
++	PCF50606_ADCC1_NTCSWAPE		= 0x08,
++	PCF50606_ADCC1_NTCSWAOFF	= 0x10,
++	PCF50606_ADCC1_EXTSYNCBREAK	= 0x20,
++	/* reserved */
++	PCF50606_ADCC1_TSCINT		= 0x80,
++};
++
++enum pcf50606_reg_adcc2 {
++	PCF50606_ADCC2_ADCSTART		= 0x01,
++	/* see enum pcf50606_adcc2_adcmux */
++	PCF50606_ADCC2_SYNC_NONE	= 0x00,
++	PCF50606_ADCC2_SYNC_TXON	= 0x20,
++	PCF50606_ADCC2_SYNC_PWREN1	= 0x40,
++	PCF50606_ADCC2_SYNC_PWREN2	= 0x60,
++	PCF50606_ADCC2_RES_10BIT	= 0x00,
++	PCF50606_ADCC2_RES_8BIT		= 0x80,
++};
++
++#define PCF50606_ADCC2_ADCMUX_MASK	(0xf << 1)
++
++#define ADCMUX_SHIFT	1
++enum pcf50606_adcc2_adcmux {
++	PCF50606_ADCMUX_BATVOLT_RES	= 0x0 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_BATVOLT_SUBTR	= 0x1 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_ADCIN1_RES	= 0x2 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_ADCIN1_SUBTR	= 0x3 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_BATTEMP		= 0x4 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_ADCIN2		= 0x5 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_ADCIN3		= 0x6 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_ADCIN3_RATIO	= 0x7 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_XPOS		= 0x8 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_YPOS		= 0x9 << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_P1		= 0xa << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_P2		= 0xb << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_BATVOLT_ADCIN1	= 0xc << ADCMUX_SHIFT,
++	PCF50606_ADCMUX_XY_SEQUENCE	= 0xe << ADCMUX_SHIFT,
++	PCF50606_P1_P2_RESISTANCE	= 0xf << ADCMUX_SHIFT,
++};
++
++enum pcf50606_adcs2 {
++	PCF50606_ADCS2_ADCRDY		= 0x80,
++};
++
++enum pcf50606_reg_mbcc1 {
++	PCF50606_MBCC1_CHGAPE		= 0x01,
++	PCF50606_MBCC1_AUTOFST		= 0x02,
++#define	PCF50606_MBCC1_CHGMOD_MASK	  0x1c
++#define	PCF50606_MBCC1_CHGMOD_SHIFT	  2
++	PCF50606_MBCC1_CHGMOD_QUAL	= 0x00,
++	PCF50606_MBCC1_CHGMOD_PRE	= 0x04,
++	PCF50606_MBCC1_CHGMOD_TRICKLE	= 0x08,
++	PCF50606_MBCC1_CHGMOD_FAST_CCCV	= 0x0c,
++	PCF50606_MBCC1_CHGMOD_FAST_NOCC	= 0x10,
++	PCF50606_MBCC1_CHGMOD_FAST_NOCV	= 0x14,
++	PCF50606_MBCC1_CHGMOD_FAST_SW	= 0x18,
++	PCF50606_MBCC1_CHGMOD_IDLE	= 0x1c,
++	PCF50606_MBCC1_DETMOD_LOWCHG	= 0x20,
++	PCF50606_MBCC1_DETMOD_WDRST	= 0x40,
++};
++
++enum pcf50606_reg_bvmc {
++	PCF50606_BVMC_LOWBAT		= 0x01,
++	PCF50606_BVMC_THRSHLD_NULL	= 0x00,
++	PCF50606_BVMC_THRSHLD_2V8	= 0x02,
++	PCF50606_BVMC_THRSHLD_2V9	= 0x04,
++	PCF50606_BVMC_THRSHLD_3V	= 0x08,
++	PCF50606_BVMC_THRSHLD_3V1	= 0x08,
++	PCF50606_BVMC_THRSHLD_3V2	= 0x0a,
++	PCF50606_BVMC_THRSHLD_3V3	= 0x0c,
++	PCF50606_BVMC_THRSHLD_3V4	= 0x0e,
++	PCF50606_BVMC_DISDB		= 0x10,
++};
++
++void pcf50606_reg_write(u_int8_t reg, u_int8_t val);
++
++u_int8_t pcf50606_reg_read(u_int8_t reg);
++
++u_int8_t pcf50606_reg_set_bit_mask(u_int8_t reg, u_int8_t mask, u_int8_t val);
++
++void pcf50606_init(void);
++
++#endif /* _PCF50606_H */
++
+Index: u-boot/common/main.c
+===================================================================
+--- u-boot.orig/common/main.c	2007-02-16 23:35:56.000000000 +0100
++++ u-boot/common/main.c	2007-02-16 23:38:13.000000000 +0100
+@@ -61,6 +61,7 @@
+ #undef DEBUG_PARSER
+ 
+ char        console_buffer[CFG_CBSIZE];		/* console I/O buffer	*/
++int nobootdelay;
+ 
+ #ifndef CONFIG_CMDLINE_EDITING
+ static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen);
+@@ -404,7 +405,7 @@
+ 
+ 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
+ 
+-	if (bootdelay >= 0 && s && !abortboot (bootdelay)) {
++	if (!nobootdelay && bootdelay >= 0 && s && !abortboot (bootdelay)) {
+ # ifdef CONFIG_AUTOBOOT_KEYED
+ 		int prev = disable_ctrlc(1);	/* disable Control C checking */
+ # endif
+Index: u-boot/board/neo1973/jbt6k74.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/board/neo1973/jbt6k74.c	2007-02-16 23:40:48.000000000 +0100
+@@ -0,0 +1,403 @@
++/* u-boot driver for the tpo JBT6K74-AS LCM ASIC
++ *
++ * Copyright (C) 2006-2007 by OpenMoko, Inc.
++ * Author: Harald Welte <laforge 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 <common.h>
++#include <spi.h>
++#include <asm/errno.h>
++#include <s3c2410.h>
++#include "jbt6k74.h"
++
++#if 0
++#define DEBUGP(x, args...) printf("%s: " x, __FUNCTION__, ## args);
++#define DEBUGPC(x, args...) printf(x, ## args);
++#else
++#define DEBUGP(x, args...) do { } while (0)
++#define DEBUGPC(x, args...) do { } while (0)
++#endif
++
++
++enum jbt_register {
++	JBT_REG_SLEEP_IN		= 0x10,
++	JBT_REG_SLEEP_OUT		= 0x11,
++
++	JBT_REG_DISPLAY_OFF		= 0x28,
++	JBT_REG_DISPLAY_ON		= 0x29,
++
++	JBT_REG_RGB_FORMAT		= 0x3a,
++	JBT_REG_QUAD_RATE		= 0x3b,
++
++	JBT_REG_POWER_ON_OFF		= 0xb0,
++	JBT_REG_BOOSTER_OP		= 0xb1,
++	JBT_REG_BOOSTER_MODE		= 0xb2,
++	JBT_REG_BOOSTER_FREQ		= 0xb3,
++	JBT_REG_OPAMP_SYSCLK		= 0xb4,
++	JBT_REG_VSC_VOLTAGE		= 0xb5,
++	JBT_REG_VCOM_VOLTAGE		= 0xb6,
++	JBT_REG_EXT_DISPL		= 0xb7,
++	JBT_REG_OUTPUT_CONTROL		= 0xb8,
++	JBT_REG_DCCLK_DCEV		= 0xb9,
++	JBT_REG_DISPLAY_MODE1		= 0xba,
++	JBT_REG_DISPLAY_MODE2		= 0xbb,
++	JBT_REG_DISPLAY_MODE		= 0xbc,
++	JBT_REG_ASW_SLEW		= 0xbd,
++	JBT_REG_DUMMY_DISPLAY		= 0xbe,
++	JBT_REG_DRIVE_SYSTEM		= 0xbf,
++
++	JBT_REG_SLEEP_OUT_FR_A		= 0xc0,
++	JBT_REG_SLEEP_OUT_FR_B		= 0xc1,
++	JBT_REG_SLEEP_OUT_FR_C		= 0xc2,
++	JBT_REG_SLEEP_IN_LCCNT_D	= 0xc3,
++	JBT_REG_SLEEP_IN_LCCNT_E	= 0xc4,
++	JBT_REG_SLEEP_IN_LCCNT_F	= 0xc5,
++	JBT_REG_SLEEP_IN_LCCNT_G	= 0xc6,
++
++	JBT_REG_GAMMA1_FINE_1		= 0xc7,
++	JBT_REG_GAMMA1_FINE_2		= 0xc8,
++	JBT_REG_GAMMA1_INCLINATION	= 0xc9,
++	JBT_REG_GAMMA1_BLUE_OFFSET	= 0xca,
++
++	JBT_REG_BLANK_CONTROL		= 0xcf,
++	JBT_REG_BLANK_TH_TV		= 0xd0,
++	JBT_REG_CKV_ON_OFF		= 0xd1,
++	JBT_REG_CKV_1_2			= 0xd2,
++	JBT_REG_OEV_TIMING		= 0xd3,
++	JBT_REG_ASW_TIMING_1		= 0xd4,
++	JBT_REG_ASW_TIMING_2		= 0xd5,
++
++	JBT_REG_HCLOCK_VGA		= 0xec,
++	JBT_REG_HCLOCK_QVGA		= 0xed,
++
++};
++
++static const char *jbt_state_names[] = {
++	[JBT_STATE_DEEP_STANDBY]	= "deep-standby",
++	[JBT_STATE_SLEEP]		= "sleep",
++	[JBT_STATE_NORMAL]		= "normal",
++};
++
++#define GTA01_SCLK	(1 << 7) 	/* GPG7 */
++#define GTA01_MOSI	(1 << 6)	/* GPG6 */
++#define GTA01_MISO	(1 << 5)	/* GPG5 */
++#define GTA01_CS	(1 << 3)	/* GPG3 */
++
++#define SPI_READ        ((immr->GPGDAT & GTA01_MISO) != 0)
++
++#define SPI_CS(bit) 	if (bit) gpio->GPGDAT |= GTA01_CS; \
++			else gpio->GPGDAT &= ~GTA01_CS
++
++#define SPI_SDA(bit)    if (bit) gpio->GPGDAT |=  GTA01_MOSI; \
++			else    gpio->GPGDAT &= ~GTA01_MOSI
++
++#define SPI_SCL(bit)    if (bit) gpio->GPGDAT |=  GTA01_SCLK; \
++			else    gpio->GPGDAT &= ~GTA01_SCLK
++
++/* 150uS minimum clock cycle, we have two of this plus our other
++ * instructions */
++#define SPI_DELAY	udelay(75)
++
++
++#define JBT_TX_BUF_SIZE
++struct jbt_info {
++	enum jbt_state state;
++	u_int16_t tx_buf[4];
++	struct spi_device *spi_dev;
++};
++
++static struct jbt_info _jbt, *jbt = &_jbt;
++
++static int jbt_spi_xfer(int wordnum, int bitlen, u_int16_t *dout)
++{
++	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++	u_int16_t tmpdout = 0;
++	int   i, j;
++
++	DEBUGP("spi_xfer: dout %08X wordnum %u bitlen %d\n",
++		*(uint *)dout, wordnum, bitlen);
++
++	SPI_CS(0);
++
++	for (i = 0; i < wordnum; i ++) {
++		tmpdout = dout[i];
++
++		for (j = 0; j < bitlen; j++) {
++			SPI_SCL(0);
++			if (tmpdout & (1 << bitlen-1)) {
++				SPI_SDA(1);
++				DEBUGPC("1");
++			} else {
++				SPI_SDA(0);
++				DEBUGPC("0");
++			}
++			SPI_DELAY;
++			SPI_SCL(1);
++			SPI_DELAY;
++			tmpdout <<= 1;
++		}
++		DEBUGPC(" ");
++	}
++	DEBUGPC("\n");
++
++	SPI_CS(1);
++
++	return 0;
++}
++
++#define JBT_COMMAND	0x000
++#define JBT_DATA	0x100
++
++static int jbt_reg_write_nodata(struct jbt_info *jbt, u_int8_t reg)
++{
++	int rc;
++
++	jbt->tx_buf[0] = JBT_COMMAND | reg;
++
++	rc = jbt_spi_xfer(1, 9, jbt->tx_buf);
++
++	return rc;
++}
++
++
++static int jbt_reg_write(struct jbt_info *jbt, u_int8_t reg, u_int8_t data)
++{
++	int rc;
++
++	jbt->tx_buf[0] = JBT_COMMAND | reg;
++	jbt->tx_buf[1] = JBT_DATA | data;
++
++	rc = jbt_spi_xfer(2, 9, jbt->tx_buf);
++
++	return rc;
++}
++
++static int jbt_reg_write16(struct jbt_info *jbt, u_int8_t reg, u_int16_t data)
++{
++	int rc;
++
++	jbt->tx_buf[0] = JBT_COMMAND | reg;
++	jbt->tx_buf[1] = JBT_DATA | (data >> 8);
++	jbt->tx_buf[2] = JBT_DATA | (data & 0xff);
++
++	rc = jbt_spi_xfer(3, 9, jbt->tx_buf);
++
++	return rc;
++}
++
++static int jbt_init_regs(struct jbt_info *jbt)
++{
++	int rc;
++
++	DEBUGP("entering\n");
++
++	rc = jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE1, 0x01);
++	rc |= jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE2, 0x00);
++	rc |= jbt_reg_write(jbt, JBT_REG_RGB_FORMAT, 0x60);
++	rc |= jbt_reg_write(jbt, JBT_REG_DRIVE_SYSTEM, 0x10);
++	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_OP, 0x56);
++	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_MODE, 0x33);
++	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_FREQ, 0x11);
++	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_FREQ, 0x11);
++	rc |= jbt_reg_write(jbt, JBT_REG_OPAMP_SYSCLK, 0x02);
++	rc |= jbt_reg_write(jbt, JBT_REG_VSC_VOLTAGE, 0x2b);
++	rc |= jbt_reg_write(jbt, JBT_REG_VCOM_VOLTAGE, 0x40);
++	rc |= jbt_reg_write(jbt, JBT_REG_EXT_DISPL, 0x03);
++	rc |= jbt_reg_write(jbt, JBT_REG_DCCLK_DCEV, 0x04);
++	rc |= jbt_reg_write(jbt, JBT_REG_ASW_SLEW, 0x02);
++	rc |= jbt_reg_write(jbt, JBT_REG_DUMMY_DISPLAY, 0x00);
++
++	rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_A, 0x11);
++	rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_B, 0x11);
++	rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_C, 0x11);
++	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_D, 0x2040);
++	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_E, 0x60c0);
++	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_F, 0x1020);
++	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_G, 0x60c0);
++
++	rc |= jbt_reg_write16(jbt, JBT_REG_GAMMA1_FINE_1, 0x5533);
++	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_FINE_2, 0x00);
++	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_INCLINATION, 0x00);
++	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_BLUE_OFFSET, 0x00);
++	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_BLUE_OFFSET, 0x00);
++
++	rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_VGA, 0x1f0);
++	rc |= jbt_reg_write(jbt, JBT_REG_BLANK_CONTROL, 0x02);
++	rc |= jbt_reg_write16(jbt, JBT_REG_BLANK_TH_TV, 0x0804);
++	rc |= jbt_reg_write16(jbt, JBT_REG_BLANK_TH_TV, 0x0804);
++
++	rc |= jbt_reg_write(jbt, JBT_REG_CKV_ON_OFF, 0x01);
++	rc |= jbt_reg_write16(jbt, JBT_REG_CKV_1_2, 0x0000);
++
++	rc |= jbt_reg_write16(jbt, JBT_REG_OEV_TIMING, 0x0d0e);
++	rc |= jbt_reg_write16(jbt, JBT_REG_ASW_TIMING_1, 0x11a4);
++	rc |= jbt_reg_write(jbt, JBT_REG_ASW_TIMING_2, 0x0e);
++
++#if 0
++	rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_QVGA, 0x00ff);
++	rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_QVGA, 0x00ff);
++#endif
++
++	return rc;
++}
++
++static int standby_to_sleep(struct jbt_info *jbt)
++{
++	int rc;
++
++	DEBUGP("entering\n");
++
++	/* three times command zero */
++	rc = jbt_reg_write_nodata(jbt, 0x00);
++	udelay(1000);
++	rc = jbt_reg_write_nodata(jbt, 0x00);
++	udelay(1000);
++	rc = jbt_reg_write_nodata(jbt, 0x00);
++	udelay(1000);
++
++	/* deep standby out */
++	rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17);
++
++	return rc;
++}
++
++static int sleep_to_normal(struct jbt_info *jbt)
++{
++	int rc;
++	DEBUGP("entering\n");
++
++	/* RGB I/F on, RAM wirte off, QVGA through, SIGCON enable */
++	rc = jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE, 0x80);
++
++	/* Quad mode off */
++	rc |= jbt_reg_write(jbt, JBT_REG_QUAD_RATE, 0x00);
++
++	/* AVDD on, XVDD on */
++	rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x16);
++
++	/* Output control */
++	rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0xfff9);
++
++	/* Sleep mode off */
++	rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_OUT);
++
++	/* initialize register set */
++	rc |= jbt_init_regs(jbt);
++	return rc;
++}
++
++static int normal_to_sleep(struct jbt_info *jbt)
++{
++	int rc;
++	DEBUGP("entering\n");
++
++	rc = jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
++	rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0x8002);
++	rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_IN);
++
++	return rc;
++}
++
++static int sleep_to_standby(struct jbt_info *jbt)
++{
++	DEBUGP("entering\n");
++	return jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x00);
++}
++
++/* frontend function */
++int jbt6k74_enter_state(enum jbt_state new_state)
++{
++	int rc = -EINVAL;
++
++	DEBUGP("entering(old_state=%u, new_state=%u)\n", jbt->state, new_state);
++
++	switch (jbt->state) {
++	case JBT_STATE_DEEP_STANDBY:
++		switch (new_state) {
++		case JBT_STATE_DEEP_STANDBY:
++			rc = 0;
++			break;
++		case JBT_STATE_SLEEP:
++			rc = standby_to_sleep(jbt);
++			break;
++		case JBT_STATE_NORMAL:
++			/* first transition into sleep */
++			rc = standby_to_sleep(jbt);
++			/* then transition into normal */
++			rc |= sleep_to_normal(jbt);
++			break;
++		}
++		break;
++	case JBT_STATE_SLEEP:
++		switch (new_state) {
++		case JBT_STATE_SLEEP:
++			rc = 0;
++			break;
++		case JBT_STATE_DEEP_STANDBY:
++			rc = sleep_to_standby(jbt);
++			break;
++		case JBT_STATE_NORMAL:
++			rc = sleep_to_normal(jbt);
++			break;
++		}
++		break;
++	case JBT_STATE_NORMAL:
++		switch (new_state) {
++		case JBT_STATE_NORMAL:
++			rc = 0;
++			break;
++		case JBT_STATE_DEEP_STANDBY:
++			/* first transition into sleep */
++			rc = normal_to_sleep(jbt);
++			/* then transition into deep standby */
++			rc |= sleep_to_standby(jbt);
++			break;
++		case JBT_STATE_SLEEP:
++			rc = normal_to_sleep(jbt);
++			break;
++		}
++		break;
++	}
++
++	return rc;
++}
++
++int jbt6k74_display_onoff(int on)
++{
++	DEBUGP("entering\n");
++	if (on)
++		return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON);
++	else
++		return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
++}
++
++int jbt6k74_init(void)
++{
++	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
++
++	/* initialize SPI for GPIO bitbang */
++	gpio->GPGCON &= 0xffff033f;
++	gpio->GPGCON |= 0x00005440;
++
++	/* get LCM out of reset */
++	gpio->GPCDAT |= (1 << 6);
++
++	/* wait 50ms (Tpos of LCM) */
++	udelay(50000);
++}
+Index: u-boot/board/neo1973/jbt6k74.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/board/neo1973/jbt6k74.h	2007-02-16 23:40:48.000000000 +0100
+@@ -0,0 +1,14 @@
++#ifndef _JBT6K74_H
++#define _JBT6K74_H
++
++enum jbt_state {
++	JBT_STATE_DEEP_STANDBY,
++	JBT_STATE_SLEEP,
++	JBT_STATE_NORMAL,
++};
++
++int jbt6k74_init(void);
++int jbt6k74_display_onoff(int on);
++int jbt6k74_enter_state(enum jbt_state new_state);
++
++#endif

Modified: trunk/src/target/u-boot/patches/uboot-20061030-qt2410.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-20061030-qt2410.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-20061030-qt2410.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -3,11 +3,11 @@
 
 Signed-off-by: Harald Welte <laforge at openmoko.org>
 
-Index: u-boot.git/Makefile
+Index: u-boot/Makefile
 ===================================================================
---- u-boot.git.orig/Makefile	2007-02-07 16:47:39.000000000 +0100
-+++ u-boot.git/Makefile	2007-02-07 16:48:01.000000000 +0100
-@@ -1907,6 +1907,9 @@
+--- u-boot.orig/Makefile	2007-02-16 23:01:22.000000000 +0100
++++ u-boot/Makefile	2007-02-16 23:02:54.000000000 +0100
+@@ -1928,6 +1928,9 @@
  sbc2410x_config: unconfig
  	@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
  
@@ -17,10 +17,10 @@
  scb9328_config	:	unconfig
  	@$(MKCONFIG) $(@:_config=) arm arm920t scb9328 NULL imx
  
-Index: u-boot.git/board/qt2410/Makefile
+Index: u-boot/board/qt2410/Makefile
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/qt2410/Makefile	2007-02-07 16:48:01.000000000 +0100
++++ u-boot/board/qt2410/Makefile	2007-02-16 23:02:55.000000000 +0100
 @@ -0,0 +1,47 @@
 +#
 +# (C) Copyright 2000, 2001, 2002
@@ -69,10 +69,10 @@
 +-include .depend
 +
 +#########################################################################
-Index: u-boot.git/board/qt2410/config.mk
+Index: u-boot/board/qt2410/config.mk
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/qt2410/config.mk	2007-02-07 16:48:01.000000000 +0100
++++ u-boot/board/qt2410/config.mk	2007-02-16 23:02:55.000000000 +0100
 @@ -0,0 +1,25 @@
 +#
 +# (C) Copyright 2002
@@ -99,10 +99,10 @@
 +
 +
 +TEXT_BASE = 0x33F80000
-Index: u-boot.git/board/qt2410/flash.c
+Index: u-boot/board/qt2410/flash.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/qt2410/flash.c	2007-02-07 16:48:01.000000000 +0100
++++ u-boot/board/qt2410/flash.c	2007-02-16 23:02:55.000000000 +0100
 @@ -0,0 +1,435 @@
 +/*
 + * (C) Copyright 2002
@@ -539,10 +539,10 @@
 +
 +	return write_hword (info, wp, data);
 +}
-Index: u-boot.git/board/qt2410/lowlevel_init.S
+Index: u-boot/board/qt2410/lowlevel_init.S
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/qt2410/lowlevel_init.S	2007-02-07 16:48:01.000000000 +0100
++++ u-boot/board/qt2410/lowlevel_init.S	2007-02-16 23:02:55.000000000 +0100
 @@ -0,0 +1,173 @@
 +/*
 + * Memory Setup stuff - taken from blob memsetup.S
@@ -717,10 +717,10 @@
 +    .word 0xb2
 +    .word 0x30
 +    .word 0x30
-Index: u-boot.git/board/qt2410/qt2410.c
+Index: u-boot/board/qt2410/qt2410.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/qt2410/qt2410.c	2007-02-07 16:48:01.000000000 +0100
++++ u-boot/board/qt2410/qt2410.c	2007-02-16 23:02:55.000000000 +0100
 @@ -0,0 +1,127 @@
 +/*
 + * (C) 2006 by OpenMoko, Inc.
@@ -849,10 +849,10 @@
 +	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
 +
 +	return 0;
-Index: u-boot.git/board/qt2410/u-boot.lds
+Index: u-boot/board/qt2410/u-boot.lds
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/qt2410/u-boot.lds	2007-02-07 16:48:21.000000000 +0100
++++ u-boot/board/qt2410/u-boot.lds	2007-02-16 23:02:55.000000000 +0100
 @@ -0,0 +1,58 @@
 +/*
 + * (C) Copyright 2002
@@ -912,71 +912,11 @@
 +	.bss : { *(.bss) }
 +	_end = .;
 +}
-Index: u-boot.git/drivers/cs8900.c
+Index: u-boot/include/configs/qt2410.h
 ===================================================================
---- u-boot.git.orig/drivers/cs8900.c	2007-02-07 16:47:39.000000000 +0100
-+++ u-boot.git/drivers/cs8900.c	2007-02-07 16:48:01.000000000 +0100
-@@ -120,6 +120,7 @@
- 	unsigned char env_enetaddr[6];
- 	char *tmp = getenv ("ethaddr");
- 	char *end;
-+	unsigned short chip_id;
- 
- 	for (i=0; i<6; i++) {
- 		env_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0;
-@@ -128,7 +129,9 @@
- 	}
- 
- 	/* verify chip id */
--	if (get_reg_init_bus (PP_ChipID) != 0x630e)
-+	chip_id = get_reg_init_bus (PP_ChipID);
-+	printf("\ncs8900a chipid 0x%04x\n", chip_id);
-+	if (chip_id != 0x630e)
- 		return;
- 	eth_reset ();
- 	if ((get_reg (PP_SelfST) & (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK)) ==
-Index: u-boot.git/fs/cramfs/cramfs.c
-===================================================================
---- u-boot.git.orig/fs/cramfs/cramfs.c	2007-02-07 16:47:39.000000000 +0100
-+++ u-boot.git/fs/cramfs/cramfs.c	2007-02-07 16:48:01.000000000 +0100
-@@ -27,7 +27,7 @@
- #include <common.h>
- #include <malloc.h>
- 
--#if (CONFIG_COMMANDS & CFG_CMD_JFFS2)
-+#if (CONFIG_COMMANDS & CFG_CMD_CRAMFS)
- 
- #include <asm/byteorder.h>
- #include <linux/stat.h>
-@@ -343,5 +343,22 @@
- 	}
- 	return 1;
- }
--
-+#else
-+int cramfs_load (char *loadoffset, struct part_info *info, char *filename)
-+{
-+	return -1;
-+}
-+int cramfs_ls (struct part_info *info, char *filename)
-+{
-+	return 0;
-+}
-+int cramfs_info (struct part_info *info)
-+{
-+	return 0;
-+}
-+int cramfs_check (struct part_info *info)
-+{
-+	return 0;
-+}
- #endif /* CFG_FS_CRAMFS */
-+
-Index: u-boot.git/include/configs/qt2410.h
-===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/include/configs/qt2410.h	2007-02-07 16:48:01.000000000 +0100
-@@ -0,0 +1,245 @@
++++ u-boot/include/configs/qt2410.h	2007-02-16 23:04:11.000000000 +0100
+@@ -0,0 +1,216 @@
 +/*
 + * (C) Copyright 2002
 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
@@ -984,7 +924,7 @@
 + * Gary Jennejohn <gj at denx.de>
 + * David Mueller <d.mueller at elsoft.ch>
 + *
-+ * Configuation settings for the SAMSUNG SMDK2410 board.
++ * Configuation settings for the Armzone QT2410 board.
 + *
 + * See file CREDITS for list of people who contributed to this
 + * project.
@@ -1142,16 +1082,6 @@
 +#define CONFIG_STACKSIZE_FIQ	(4*1024)	/* FIQ stack */
 +#endif
 +
-+/* IDE/ATA config */
-+
-+#if 0
-+#define CFG_IDE_MAXBUS		1
-+#define CFG_IDE_MAXDEVICE	2
-+#define CFG_IDE_PREINIT		0
-+
-+#define CFG_ATA_BASE_ADDR	
-+#endif
-+
 +#define CONFIG_USB_OHCI		1
 +
 +/*-----------------------------------------------------------------------
@@ -1201,24 +1131,5 @@
 +#define CONFIG_INITRD_TAG		1
 +#define CONFIG_SETUP_MEMORY_TAGS	1
 +#define CONFIG_CMDLINE_TAG		1
-+#if 0
-+#define CONFIG_SERIAL_TAG		1
-+#define CONFIG_REVISION_TAG		1
-+#endif
 +
-+
-+#if 0
-+#define CONFIG_VIDEO
-+#define CONFIG_VIDEO_S3C2410
-+#define CONFIG_CFB_CONSOLE
-+#define CONFIG_VIDEO_LOGO
-+#define CONFIG_VGA_AS_SINGLE_DEVICE
-+
-+#define VIDEO_KBD_INIT_FCT	0
-+#define VIDEO_TSTC_FCT		serial_tstc
-+#define VIDEO_GETC_FCT		serial_getc
-+
-+#define LCD_VIDEO_ADDR		0x33d00000
-+#endif
-+
 +#endif	/* __CONFIG_H */

Modified: trunk/src/target/u-boot/patches/uboot-bbt-quiet.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-bbt-quiet.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-bbt-quiet.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -4,8 +4,8 @@
 
 Index: u-boot/drivers/nand/nand_bbt.c
 ===================================================================
---- u-boot.orig/drivers/nand/nand_bbt.c	2007-02-15 02:28:42.000000000 +0100
-+++ u-boot/drivers/nand/nand_bbt.c	2007-02-15 02:29:45.000000000 +0100
+--- u-boot.orig/drivers/nand/nand_bbt.c	2007-02-16 23:54:02.000000000 +0100
++++ u-boot/drivers/nand/nand_bbt.c	2007-02-16 23:54:05.000000000 +0100
 @@ -157,10 +157,6 @@
  					this->bbt[offs + (act >> 3)] |= 0x2 << (act & 0x06);
  					continue;
@@ -32,7 +32,7 @@
  	}
  
  	return 1;
-@@ -376,8 +370,6 @@
+@@ -374,8 +368,6 @@
  	for (i = 0; i < chips; i++) {
  		if (td->pages[i] == -1)
  			printk (KERN_WARNING "Bad block table not found for chip %d\n", i);

Modified: trunk/src/target/u-boot/patches/uboot-cmd_s3c2410.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-cmd_s3c2410.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-cmd_s3c2410.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -5,21 +5,21 @@
 
 Index: u-boot/cpu/arm920t/s3c24x0/Makefile
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/Makefile	2007-02-15 02:26:31.000000000 +0100
-+++ u-boot/cpu/arm920t/s3c24x0/Makefile	2007-02-15 02:28:27.000000000 +0100
+--- u-boot.orig/cpu/arm920t/s3c24x0/Makefile	2007-02-16 23:24:10.000000000 +0100
++++ u-boot/cpu/arm920t/s3c24x0/Makefile	2007-02-16 23:27:58.000000000 +0100
 @@ -26,7 +26,7 @@
  LIB	= $(obj)lib$(SOC).a
  
  COBJS	= i2c.o interrupts.o serial.o speed.o \
--	  usb_ohci.o mmc.o nand_read.o nand.o
-+	  usb_ohci.o mmc.o nand_read.o nand.o cmd_s3c2410.o
+-	  usb_ohci.o nand_read.o nand.o
++	  usb_ohci.o nand_read.o nand.o cmd_s3c2410.o
  
  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
  OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
 Index: u-boot/cpu/arm920t/s3c24x0/cmd_s3c2410.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/cpu/arm920t/s3c24x0/cmd_s3c2410.c	2007-02-15 02:34:23.000000000 +0100
++++ u-boot/cpu/arm920t/s3c24x0/cmd_s3c2410.c	2007-02-16 23:27:31.000000000 +0100
 @@ -0,0 +1,151 @@
 +/*
 + * (C) Copyright 2006 by OpenMoko, Inc.

Added: trunk/src/target/u-boot/patches/uboot-cramfs_but_no_jffs2.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-cramfs_but_no_jffs2.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-cramfs_but_no_jffs2.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -0,0 +1,42 @@
+Fix building with CRAMFS but not JFFS2 support
+
+Signed-off-by: Harald Welte <laforge at openmoko.org>
+
+Index: u-boot.git/fs/cramfs/cramfs.c
+===================================================================
+--- u-boot.git.orig/fs/cramfs/cramfs.c	2007-02-07 16:47:39.000000000 +0100
++++ u-boot.git/fs/cramfs/cramfs.c	2007-02-07 16:48:01.000000000 +0100
+@@ -27,7 +27,7 @@
+ #include <common.h>
+ #include <malloc.h>
+ 
+-#if (CONFIG_COMMANDS & CFG_CMD_JFFS2)
++#if (CONFIG_COMMANDS & CFG_CMD_CRAMFS)
+ 
+ #include <asm/byteorder.h>
+ #include <linux/stat.h>
+@@ -343,5 +343,22 @@
+ 	}
+ 	return 1;
+ }
+-
++#else
++int cramfs_load (char *loadoffset, struct part_info *info, char *filename)
++{
++	return -1;
++}
++int cramfs_ls (struct part_info *info, char *filename)
++{
++	return 0;
++}
++int cramfs_info (struct part_info *info)
++{
++	return 0;
++}
++int cramfs_check (struct part_info *info)
++{
++	return 0;
++}
+ #endif /* CFG_FS_CRAMFS */
++
+

Added: trunk/src/target/u-boot/patches/uboot-dfu.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-dfu.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-dfu.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -0,0 +1,373 @@
+Index: u-boot/drivers/usbdcore_ep0.c
+===================================================================
+--- u-boot.orig/drivers/usbdcore_ep0.c	2007-02-15 18:07:52.000000000 +0100
++++ u-boot/drivers/usbdcore_ep0.c	2007-02-15 20:50:05.000000000 +0100
+@@ -388,6 +388,11 @@
+ 		 le16_to_cpu (request->wLength),
+ 		 USBD_DEVICE_REQUESTS (request->bRequest));
+ 
++#ifdef CONFIG_USB_DFU
++	if ((request->bmRequestType & 0x3f) == USB_TYPE_DFU)
++		return dfu_ep0_handler(urb);
++#endif /* CONFIG_USB_DFU */
++
+ 	/* handle USB Standard Request (c.f. USB Spec table 9-2) */
+ 	if ((request->bmRequestType & USB_REQ_TYPE_MASK) != 0) {
+ 		if (device->device_state <= STATE_CONFIGURED)
+Index: u-boot/drivers/usbdfu.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/drivers/usbdfu.c	2007-02-16 18:59:54.000000000 +0100
+@@ -0,0 +1,352 @@
++/*
++ * (C) 2007 by OpenMoko, Inc.
++ * Author: Harald Welte <laforge at openmoko.org>
++ *
++ * based on existing SAM7DFU code from OpenPCD:
++ *
++ * (C) Copyright 2006 by Harald Welte <hwelte at hmw-consulting.de>
++ *
++ * See file CREDITS for list of people who contributed to this
++ * project.
++ *
++ * 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 u_int32_t dfu_state = DFU_STATE_appIDLE;
++
++static int handle_dnload(u_int16_t val, u_int16_t len)
++{
++	volatile u_int32_t *p = (volatile u_int32_t *)ptr;
++	u_int8_t *pagebuf = (u_int8_t *) pagebuf32;
++	int i;
++
++	DEBUGE("download ");
++
++	if (len > AT91C_IFLASH_PAGE_SIZE) {
++		/* Too big. Not that we'd really care, but it's a
++		 * DFU protocol violation */
++		DEBUGP("length exceeds flash page size ");
++	    	dfu_state = DFU_STATE_dfuERROR;
++		dfu_status = DFU_STATUS_errADDRESS;
++		return RET_STALL;
++	}
++	if (len & 0x3) {
++		/* reject non-four-byte-aligned writes */
++		DEBUGP("not four-byte-aligned length ");
++		dfu_state = DFU_STATE_dfuERROR;
++		dfu_status = DFU_STATUS_errADDRESS;
++		return RET_STALL;
++	}
++	if (len == 0) {
++		DEBUGP("zero-size write -> MANIFEST_SYNC ");
++		flash_page(p);
++		dfu_state = DFU_STATE_dfuMANIFEST_SYNC;
++		return RET_ZLP;
++	}
++	if (ptr + len > (u_int8_t *) AT91C_IFLASH + AT91C_IFLASH_SIZE) {
++		DEBUGP("end of write exceeds flash end ");
++		dfu_state = DFU_STATE_dfuERROR;
++		dfu_status = DFU_STATUS_errADDRESS;
++		return RET_STALL;
++	}
++
++	DEBUGP("try_to_recv=%u ", len);
++	udp_ep0_recv_data(pagebuf, len);
++
++	DEBUGR(hexdump(pagebuf, len));
++
++	/* FXIME: actually write the data somewhere */
++
++	return RET_ZLP;
++}
++
++#define AT91C_IFLASH_END ((u_int8_t *)AT91C_IFLASH + AT91C_IFLASH_SIZE)
++static dfufunc int handle_upload(u_int16_t val, u_int16_t len)
++{
++	DEBUGE("upload ");
++	if (len > AT91C_IFLASH_PAGE_SIZE) {
++		/* Too big */
++		dfu_state = DFU_STATE_dfuERROR;
++		dfu_status = DFU_STATUS_errADDRESS;
++		udp_ep0_send_stall();
++		return -EINVAL;
++	}
++
++	if (ptr + len > AT91C_IFLASH_END)
++		len = AT91C_IFLASH_END - (u_int8_t *)ptr;
++
++	udp_ep0_send_data((char *)ptr, len);
++	ptr+= len;
++
++	return len;
++}
++
++static void handle_getstatus(void)
++{
++	struct dfu_status dstat;
++	u_int32_t fsr = AT91F_MC_EFC_GetStatus(AT91C_BASE_MC);
++
++	DEBUGE("getstatus(fsr=0x%08x) ", fsr);
++
++	switch (dfu_state) {
++	case DFU_STATE_dfuDNLOAD_SYNC:
++	case DFU_STATE_dfuDNBUSY:
++		if (fsr & AT91C_MC_PROGE) {
++			DEBUGE("errPROG ");
++			dfu_status = DFU_STATUS_errPROG;
++			dfu_state = DFU_STATE_dfuERROR;
++		} else if (fsr & AT91C_MC_LOCKE) {
++			DEBUGE("errWRITE ");
++			dfu_status = DFU_STATUS_errWRITE;
++			dfu_state = DFU_STATE_dfuERROR;
++		} else if (fsr & AT91C_MC_FRDY) {
++			DEBUGE("DNLOAD_IDLE ");
++			dfu_state = DFU_STATE_dfuDNLOAD_IDLE;
++		} else {
++			DEBUGE("DNBUSY ");
++			dfu_state = DFU_STATE_dfuDNBUSY;
++		}
++		break;
++	case DFU_STATE_dfuMANIFEST_SYNC:
++		dfu_state = DFU_STATE_dfuMANIFEST;
++		break;
++	}
++
++	/* send status response */
++	dstat.bStatus = dfu_status;
++	dstat.bState = dfu_state;
++	dstat.iString = 0;
++	/* FIXME: set dstat.bwPollTimeout */
++
++	udp_ep0_send_data((char *)&dstat, sizeof(dstat));
++}
++
++static void handle_getstate(void)
++{
++	u_int8_t u8 = dfu_state;
++	DEBUGE("getstate ");
++
++	udp_ep0_send_data((char *)&u8, sizeof(u8));
++}
++
++
++int dfu_ep0_handler(struct urb *urb)
++{
++	int rc, ret = RET_NOTHING;
++
++	DEBUGE("old_state = %u ", dfu_state);
++
++	switch (dfu_state) {
++	case DFU_STATE_appIDLE:
++		switch (req) {
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		case USB_REQ_DFU_DETACH:
++			dfu_state = DFU_STATE_appDETACH;
++			ret = RET_ZLP;
++			goto out;
++			break;
++		default:
++			ret = RET_STALL;
++		}
++		break;
++	case DFU_STATE_appDETACH:
++		switch (req) {
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		default:
++			dfu_state = DFU_STATE_appIDLE;
++			ret = RET_STALL;
++			goto out;
++			break;
++		}
++		/* FIXME: implement timer to return to appIDLE */
++		break;
++	case DFU_STATE_dfuIDLE:
++		switch (req) {
++		case USB_REQ_DFU_DNLOAD:
++			if (len == 0) {
++				dfu_state = DFU_STATE_dfuERROR;
++				ret = RET_STALL;
++				goto out;
++			}
++			dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
++			ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE;
++			ret = handle_dnload(val, len);
++			break;
++		case USB_REQ_DFU_UPLOAD:
++			ptr = (u_int8_t *) AT91C_IFLASH + SAM7DFU_SIZE;
++			dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
++			handle_upload(val, len);
++			break;
++		case USB_REQ_DFU_ABORT:
++			/* no zlp? */
++			ret = RET_ZLP;
++			break;
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		default:
++			dfu_state = DFU_STATE_dfuERROR;
++			ret = RET_STALL;
++			goto out;
++			break;
++		}
++		break;
++	case DFU_STATE_dfuDNLOAD_SYNC:
++		switch (req) {
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			/* FIXME: state transition depending on block completeness */
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		default:
++			dfu_state = DFU_STATE_dfuERROR;
++			ret = RET_STALL;
++			goto out;
++		}
++		break;
++	case DFU_STATE_dfuDNBUSY:
++		switch (req) {
++		case USB_REQ_DFU_GETSTATUS:
++			/* FIXME: only accept getstatus if bwPollTimeout
++			 * has elapsed */
++			handle_getstatus();
++			break;
++		default:
++			dfu_state = DFU_STATE_dfuERROR;
++			ret = RET_STALL;
++			goto out;
++		}
++		break;
++	case DFU_STATE_dfuDNLOAD_IDLE:
++		switch (req) {
++		case USB_REQ_DFU_DNLOAD:
++			dfu_state = DFU_STATE_dfuDNLOAD_SYNC;
++			ret = handle_dnload(val, len);
++			break;
++		case USB_REQ_DFU_ABORT:
++			dfu_state = DFU_STATE_dfuIDLE;
++			ret = RET_ZLP;
++			break;
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		default:
++			dfu_state = DFU_STATE_dfuERROR;
++			ret = RET_STALL;
++			break;
++		}
++		break;
++	case DFU_STATE_dfuMANIFEST_SYNC:
++		switch (req) {
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		default:
++			dfu_state = DFU_STATE_dfuERROR;
++			ret = RET_STALL;
++			break;
++		}
++		break;
++	case DFU_STATE_dfuMANIFEST:
++		dfu_state = DFU_STATE_dfuERROR;
++		ret = RET_STALL;
++		break;
++	case DFU_STATE_dfuMANIFEST_WAIT_RST:
++		/* we should never go here */
++		break;
++	case DFU_STATE_dfuUPLOAD_IDLE:
++		switch (req) {
++		case USB_REQ_DFU_UPLOAD:
++			/* state transition if less data then requested */
++			rc = handle_upload(val, len);
++			if (rc >= 0 && rc < len)
++				dfu_state = DFU_STATE_dfuIDLE;
++			break;
++		case USB_REQ_DFU_ABORT:
++			dfu_state = DFU_STATE_dfuIDLE;
++			/* no zlp? */
++			ret = RET_ZLP;
++			break;
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		default:
++			dfu_state = DFU_STATE_dfuERROR;
++			ret = RET_STALL;
++			break;
++		}
++		break;
++	case DFU_STATE_dfuERROR:
++		switch (req) {
++		case USB_REQ_DFU_GETSTATUS:
++			handle_getstatus();
++			break;
++		case USB_REQ_DFU_GETSTATE:
++			handle_getstate();
++			break;
++		case USB_REQ_DFU_CLRSTATUS:
++			dfu_state = DFU_STATE_dfuIDLE;
++			dfu_status = DFU_STATUS_OK;
++			/* no zlp? */
++			ret = RET_ZLP;
++			break;
++		default:
++			dfu_state = DFU_STATE_dfuERROR;
++			ret = RET_STALL;
++			break;
++		}
++		break;
++	}
++
++out:
++	DEBUGE("new_state = %u\r\n", dfu_state);
++
++	switch (ret) {
++	case RET_NOTHING:
++		break;
++	case RET_ZLP:
++		udp_ep0_send_zlp();
++		break;
++	case RET_STALL:
++		udp_ep0_send_stall();
++		break;
++	}
++	return 0;
++
++}

Deleted: trunk/src/target/u-boot/patches/uboot-gta01b_v2.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-gta01b_v2.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-gta01b_v2.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,265 +0,0 @@
-This patch adds support for the GTA01Bv2 variant of the FIC GTA01 (Neo1973) phone
-
-Signed-off-by: Harald Welte <laforge at openmook.org>
-
-Index: u-boot.git/Makefile
-===================================================================
---- u-boot.git.orig/Makefile	2007-02-06 12:07:48.000000000 +0100
-+++ u-boot.git/Makefile	2007-02-06 12:09:36.000000000 +0100
-@@ -1909,6 +1909,7 @@
- 
- gta01_config \
- gta01v3_config \
-+gta01bv2_config \
- gta01v4_config :	unconfig
- 	@board/neo1973/split_by_variant.sh $@
- 
-Index: u-boot.git/board/neo1973/neo1973.c
-===================================================================
---- u-boot.git.orig/board/neo1973/neo1973.c	2007-02-06 12:07:48.000000000 +0100
-+++ u-boot.git/board/neo1973/neo1973.c	2007-02-06 12:09:36.000000000 +0100
-@@ -36,28 +36,30 @@
- 
- DECLARE_GLOBAL_DATA_PTR;
- 
--#if 1
-+#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
- //#define M_MDIV	0xA1		/* Fout = 202.8MHz */
- //#define M_PDIV	0x3
- //#define M_SDIV	0x1
- #define M_MDIV	0x90		/* Fout = 202.8MHz */
- #define M_PDIV	0x7
- #define M_SDIV	0x0
-+#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#if 0
-+#define M_MDIV	0x7d		/* Fout = 266MHz */
-+#define M_PDIV	0x1
-+#define M_SDIV	0x1
- #else
--#define M_MDIV	0x5c		/* Fout = 150.0MHz */
--#define M_PDIV	0x4
-+#define M_MDIV	0x90		/* Fout = 202.8MHz */
-+#define M_PDIV	0x7
- #define M_SDIV	0x0
- #endif
-+#else
-+#error Please define GTA01 revision
-+#endif
- 
--#if 1
- #define U_M_MDIV	0x78
- #define U_M_PDIV	0x2
- #define U_M_SDIV	0x3
--#else
--#define U_M_MDIV	0x48
--#define U_M_PDIV	0x3
--#define U_M_SDIV	0x2
--#endif
- 
- static inline void delay (unsigned long loops)
- {
-@@ -138,7 +140,31 @@
- 
- 	gpio->GPHCON = 0x0000FAAA;
- 	gpio->GPHUP = 0x000007FF;
-+#elif defined(CONFIG_ARCH_GTA01B_v2)
-+	gpio->GPACON = 0x005E47FF;
- 
-+	gpio->GPBCON = 0x00145416;
-+	gpio->GPBUP = 0x000007FF;
-+	gpio->GPBDAT |= 0x4;		/* Set GBP2 to high (Flash power-up) */
-+
-+	gpio->GPCCON = 0xAAAA12A9;
-+	gpio->GPCUP = 0x0000FFFF;
-+
-+	gpio->GPDCON = 0xAAAAAAAA;
-+	gpio->GPDUP = 0x0000FFFF;
-+
-+	gpio->GPECON = 0xA02AAAAA;
-+	gpio->GPEUP = 0x0000FFFF;
-+
-+	gpio->GPFCON = 0x0000aa19;
-+	gpio->GPFUP = 0x000000FF;
-+	gpio->GPFDAT |= 0x4;		/* Set GBF2 to high (nGSM_EN) */
-+
-+	gpio->GPGCON = 0xFF40F0C1;
-+	gpio->GPGUP = 0x0000AFEF;
-+
-+	gpio->GPHCON = 0x0000FAAA;
-+	gpio->GPHUP = 0x000007FF;
- #else
- #error Please define GTA01 version
- #endif
-@@ -157,9 +183,27 @@
- 
- int board_late_init(void)
- {
-+	unsigned char tmp;
-+
-+	tmp = 0x17; /* charge backup battery with 100uA during ACTIVE+STANDBY*/
-+	i2c_write(0x08, 0x2d, 1, &tmp, 1);
-+
-+	tmp = 0x1a; /* 4.2V battery, precharge 0.1*Ifast */
-+	i2c_write(0x08, 0x2b, 1, &tmp, 1);
-+
-+	tmp = 0x0f; /* CHGAPE | AUTOFST | fast charge */
-+	i2c_write(0x08, 0x29, 1, &tmp, 1);
-+
-+#if defined(CONFIG_ARCH_GTA01B_v2)
-+	tmp = 0xe4;	/* CPU Voltage: 2.1V */
-+	i2c_write(0x08, 0x21, 1, &tmp, 1);
-+#endif
-+
-+#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
- 	const char mmc_power = 0x8f;
--	/* enable D3REG 3.3V (SC/MMC power) */
-+	/* enable D2REG 3.3V (SC/MMC power) */
- 	i2c_write(0x08, 0x25, 1, &mmc_power, 1);
-+#endif
- 	return 0;
- }
- 
-@@ -177,5 +221,7 @@
- 	return 0x00000130;
- #elif defined(CONFIG_ARCH_GTA01_v4)
- 	return 0x00000140;
-+#elif defined(CONFIG_ARCH_GTA01B_v2)
-+	return 0x00000220;
- #endif
- }
-Index: u-boot.git/board/neo1973/split_by_variant.sh
-===================================================================
---- u-boot.git.orig/board/neo1973/split_by_variant.sh	2007-02-06 12:07:48.000000000 +0100
-+++ u-boot.git/board/neo1973/split_by_variant.sh	2007-02-06 12:09:36.000000000 +0100
-@@ -15,16 +15,23 @@
- 	case "$1" in
- 	gta01v4_config)
- 	echo "#define CONFIG_ARCH_GTA01_v4" > ${obj}include/config.h
-+	echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
- 	;;
- 
- 	gta01v3_config)
- 	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-+	echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
- 	;;
- 
-+	gta01bv2_config)
-+	echo "#define CONFIG_ARCH_GTA01B_v2" > ${obj}include/config.h
-+	echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
-+	;;
- 
- 	*)
- 	echo "$0:: Unrecognised config - using gta01v3_config"
- 	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-+	echo "GTA01_BIG_RAM=n" > ${obj}board/neo1973/config.tmp
- 	;;
- 
- 	esac
-Index: u-boot.git/include/configs/neo1973.h
-===================================================================
---- u-boot.git.orig/include/configs/neo1973.h	2007-02-06 12:07:48.000000000 +0100
-+++ u-boot.git/include/configs/neo1973.h	2007-02-06 12:09:36.000000000 +0100
-@@ -135,6 +135,8 @@
- #define	CFG_PROMPT		"GTA01v3 # "	/* Monitor Command Prompt	*/
- #elif defined(CONFIG_ARCH_GTA01_v4)
- #define	CFG_PROMPT		"GTA01v4 # "	/* Monitor Command Prompt	*/
-+#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#define	CFG_PROMPT		"GTA01Bv2 # "	/* Monitor Command Prompt	*/
- #endif
- #define	CFG_CBSIZE		256		/* Console I/O Buffer Size	*/
- #define	CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
-@@ -175,7 +177,13 @@
-  */
- #define CONFIG_NR_DRAM_BANKS	1	   /* we have 1 bank of DRAM */
- #define PHYS_SDRAM_1		0x30000000 /* SDRAM Bank #1 */
-+#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
- #define PHYS_SDRAM_1_SIZE	0x04000000 /* 64 MB */
-+#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#define PHYS_SDRAM_1_SIZE	0x08000000 /* 128 MB */
-+#else
-+#error Please define GTA01 variant
-+#endif
- #define PHYS_SDRAM_RES_SIZE	0x00200000 /* 2 MB for frame buffer */
- 
- /*-----------------------------------------------------------------------
-Index: u-boot.git/board/neo1973/lowlevel_init.S
-===================================================================
---- u-boot.git.orig/board/neo1973/lowlevel_init.S	2007-02-06 12:04:53.000000000 +0100
-+++ u-boot.git/board/neo1973/lowlevel_init.S	2007-02-06 12:09:36.000000000 +0100
-@@ -108,12 +108,16 @@
- #define B5_PMC		 	0x0	/* normal */
- 
- #define B6_MT		 	0x3	/* SDRAM */
--#define B6_Trcd	 	 	0x1
-+#define B6_Trcd	 	 	0x1	/* 3clk */
-+#if defined (CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
- #define B6_SCAN		 	0x1	/* 9bit */
-+#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#define B6_SCAN		 	0x2	/* 10bit */
-+#endif
- 
- #define B7_MT		 	0x3	/* SDRAM */
- #define B7_Trcd		 	0x1	/* 3clk */
--#define B7_SCAN		 	0x1	/* 9bit */
-+#define B7_SCAN		 	0x2	/* 10bit */
- 
- /* REFRESH parameter */
- #define REFEN		 	0x1	/* Refresh enable */
-@@ -149,6 +153,19 @@
- 	orr	r1, r1, #0xc0000000
- 	mcr	p15, 0, r1, c1, c0, 0
- 
-+#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2)
-+	/* switch on power for NAND */
-+	ldr	r0, =0x56000010	/* GPBCON */
-+	ldr	r1, [r0]
-+	orr	r1, r1, #0x10
-+	str	r1, [r0]
-+
-+	ldr	r0, =0x56000014	/* GPBDAT */
-+	ldr	r1, [r0]
-+	orr	r1, r1, #(1 <<2)
-+	str	r1, [r0]
-+#endif
-+
- 	/* everything is fine now */
- 	mov	pc, lr
- 
-Index: u-boot.git/board/neo1973/config.mk
-===================================================================
---- u-boot.git.orig/board/neo1973/config.mk	2007-02-06 12:04:53.000000000 +0100
-+++ u-boot.git/board/neo1973/config.mk	2007-02-06 12:09:36.000000000 +0100
-@@ -8,18 +8,27 @@
- # see http://www.samsung.com/ for more information on SAMSUNG
- #
- 
-+# GTA01v3 has 1 bank of 64 MB SDRAM
-+# GTA01v4 has 1 bank of 64 MB SDRAM
- #
--# GTA01 has 1 bank of 64 MB DRAM
-+# 	3000'0000 to 3400'0000
-+# we load ourself to 33F8'0000
-+#
-+# GTA01Bv2 or later has 1 bank of 128 MB SDRAM
- #
--# 3000'0000 to 3400'0000
-+# 	3000'0000 to 3800'0000
-+# we load ourself to 37F8'0000
- #
- # Linux-Kernel is expected to be at 3000'8000, entry 3000'8000
- # optionally with a ramdisk at 3080'0000
- #
--# we load ourself to 33F8'0000
--#
--# download area is 3300'0000
--#
-+# download area is 3200'0000 or 3300'0000
- 
-+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
- 
-+ifeq ($(GTA01_BIG_RAM),y)
-+# FIXME: TEXT_BASE = 0x37F80000
-+TEXT_BASE = 0x33F80000
-+else
- TEXT_BASE = 0x33F80000
-+endif

Deleted: trunk/src/target/u-boot/patches/uboot-gta01bv3.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-gta01bv3.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-gta01bv3.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,151 +0,0 @@
-This patch adds support for the GTA01Bv3 revision of the FIC Neo1973 smartphone.
-
-GTA01Bv3 is the "Phase 0" revision (due to be shipped on Feb 11, 2007).
-
-Signed-off-by: Harald Welte <laforge at openmoko.org>
-
-Index: u-boot.git/Makefile
-===================================================================
---- u-boot.git.orig/Makefile	2007-02-06 14:11:13.000000000 +0100
-+++ u-boot.git/Makefile	2007-02-06 14:11:25.000000000 +0100
-@@ -1910,6 +1910,7 @@
- gta01_config \
- gta01v3_config \
- gta01bv2_config \
-+gta01bv3_config \
- gta01v4_config :	unconfig
- 	@board/neo1973/split_by_variant.sh $@
- 
-Index: u-boot.git/board/neo1973/lowlevel_init.S
-===================================================================
---- u-boot.git.orig/board/neo1973/lowlevel_init.S	2007-02-06 14:13:28.000000000 +0100
-+++ u-boot.git/board/neo1973/lowlevel_init.S	2007-02-06 14:13:51.000000000 +0100
-@@ -111,7 +111,7 @@
- #define B6_Trcd	 	 	0x1	/* 3clk */
- #if defined (CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
- #define B6_SCAN		 	0x1	/* 9bit */
--#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- #define B6_SCAN		 	0x2	/* 10bit */
- #endif
- 
-@@ -153,7 +153,7 @@
- 	orr	r1, r1, #0xc0000000
- 	mcr	p15, 0, r1, c1, c0, 0
- 
--#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2)
-+#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- 	/* switch on power for NAND */
- 	ldr	r0, =0x56000010	/* GPBCON */
- 	ldr	r1, [r0]
-Index: u-boot.git/board/neo1973/neo1973.c
-===================================================================
---- u-boot.git.orig/board/neo1973/neo1973.c	2007-02-06 14:09:44.000000000 +0100
-+++ u-boot.git/board/neo1973/neo1973.c	2007-02-06 14:11:04.000000000 +0100
-@@ -43,7 +43,7 @@
- #define M_MDIV	0x90		/* Fout = 202.8MHz */
- #define M_PDIV	0x7
- #define M_SDIV	0x0
--#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- #if 0
- #define M_MDIV	0x7d		/* Fout = 266MHz */
- #define M_PDIV	0x1
-@@ -140,7 +140,7 @@
- 
- 	gpio->GPHCON = 0x0000FAAA;
- 	gpio->GPHUP = 0x000007FF;
--#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- 	gpio->GPACON = 0x005E47FF;
- 
- 	gpio->GPBCON = 0x00145416;
-@@ -194,7 +194,7 @@
- 	tmp = 0x0f; /* CHGAPE | AUTOFST | fast charge */
- 	i2c_write(0x08, 0x29, 1, &tmp, 1);
- 
--#if defined(CONFIG_ARCH_GTA01B_v2)
-+#if defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- 	tmp = 0xe4;	/* CPU Voltage: 2.1V */
- 	i2c_write(0x08, 0x21, 1, &tmp, 1);
- #endif
-@@ -223,5 +223,7 @@
- 	return 0x00000140;
- #elif defined(CONFIG_ARCH_GTA01B_v2)
- 	return 0x00000220;
-+#elif defined(CONFIG_ARCH_GTA01B_v3)
-+	return 0x00000230;
- #endif
- }
-Index: u-boot.git/board/neo1973/split_by_variant.sh
-===================================================================
---- u-boot.git.orig/board/neo1973/split_by_variant.sh	2007-02-06 14:11:29.000000000 +0100
-+++ u-boot.git/board/neo1973/split_by_variant.sh	2007-02-06 14:12:07.000000000 +0100
-@@ -9,8 +9,9 @@
- mkdir -p ${obj}include
- if [ "$1" == "" ]
- then
--	echo "$0:: No parameters - using GTA01v3 config"
--	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-+	echo "$0:: No parameters - using GTA01Bv3 config"
-+	echo "#define CONFIG_ARCH_GTA01B_v3" > ${obj}include/config.h
-+	echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
- else
- 	case "$1" in
- 	gta01v4_config)
-@@ -28,6 +29,11 @@
- 	echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
- 	;;
- 
-+	gta01bv3_config)
-+	echo "#define CONFIG_ARCH_GTA01B_v3" > ${obj}include/config.h
-+	echo "GTA01_BIG_RAM=y" > ${obj}board/neo1973/config.tmp
-+	;;
-+
- 	*)
- 	echo "$0:: Unrecognised config - using gta01v3_config"
- 	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-Index: u-boot.git/drivers/usbdcore_s3c2410.c
-===================================================================
---- u-boot.git.orig/drivers/usbdcore_s3c2410.c	2007-02-06 14:14:44.000000000 +0100
-+++ u-boot.git/drivers/usbdcore_s3c2410.c	2007-02-06 14:15:15.000000000 +0100
-@@ -595,7 +595,7 @@
- void udc_connect (void)
- {
- 	UDCDBG ("connect, enable Pullup");
--#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2)
-+#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- 	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
- 
- 	/* create a short disconnect, since we might come out of reset */
-@@ -613,7 +613,7 @@
- {
- 	UDCDBG ("disconnect, disable Pullup");
- 	S3C24X0_INTERRUPT * irq = S3C24X0_GetBase_INTERRUPT();
--#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2)
-+#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- 	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
- 
- 	//s3c2410_gpio_setpin(GTA01_GPIO_USB_PULLUP, 0);
-Index: u-boot.git/include/configs/neo1973.h
-===================================================================
---- u-boot.git.orig/include/configs/neo1973.h	2007-02-06 14:14:01.000000000 +0100
-+++ u-boot.git/include/configs/neo1973.h	2007-02-06 14:14:25.000000000 +0100
-@@ -138,6 +138,8 @@
- #define	CFG_PROMPT		"GTA01v4 # "	/* Monitor Command Prompt	*/
- #elif defined(CONFIG_ARCH_GTA01B_v2)
- #define	CFG_PROMPT		"GTA01Bv2 # "	/* Monitor Command Prompt	*/
-+#elif defined(CONFIG_ARCH_GTA01B_v3)
-+#define	CFG_PROMPT		"GTA01Bv3 # "	/* Monitor Command Prompt	*/
- #endif
- #define	CFG_CBSIZE		256		/* Console I/O Buffer Size	*/
- #define	CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
-@@ -192,7 +194,7 @@
- #define PHYS_SDRAM_1		0x30000000 /* SDRAM Bank #1 */
- #if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
- #define PHYS_SDRAM_1_SIZE	0x04000000 /* 64 MB */
--#elif defined(CONFIG_ARCH_GTA01B_v2)
-+#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- #define PHYS_SDRAM_1_SIZE	0x08000000 /* 128 MB */
- #else
- #error Please define GTA01 variant

Deleted: trunk/src/target/u-boot/patches/uboot-gta01v4.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-gta01v4.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-gta01v4.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,135 +0,0 @@
-This adds support for the GTA01v4 hardware revision of Neo1973
-
-Signed-off-by: Harald Welte <laforge at openmoko.org>
-
-Index: u-boot.git/Makefile
-===================================================================
---- u-boot.git.orig/Makefile	2007-02-06 12:04:53.000000000 +0100
-+++ u-boot.git/Makefile	2007-02-06 12:07:48.000000000 +0100
-@@ -1907,8 +1907,10 @@
- sbc2410x_config: unconfig
- 	@$(MKCONFIG) $(@:_config=) arm arm920t sbc2410x NULL s3c24x0
- 
--gta01_config	:	unconfig
--	@./mkconfig $(@:_config=) arm arm920t neo1973 NULL s3c24x0
-+gta01_config \
-+gta01v3_config \
-+gta01v4_config :	unconfig
-+	@board/neo1973/split_by_variant.sh $@
- 
- qt2410_config	:	unconfig
- 	@./mkconfig $(@:_config=) arm arm920t qt2410 NULL s3c24x0
-Index: u-boot.git/board/neo1973/neo1973.c
-===================================================================
---- u-boot.git.orig/board/neo1973/neo1973.c	2007-02-06 12:04:53.000000000 +0100
-+++ u-boot.git/board/neo1973/neo1973.c	2007-02-06 12:07:48.000000000 +0100
-@@ -91,6 +91,7 @@
- 	delay (8000);
- 
- 	/* set up the I/O ports */
-+#if defined(CONFIG_ARCH_GTA01_v3)
- 	gpio->GPACON = 0x007FFFFF;
- 
- 	gpio->GPBCON = 0x00005056;
-@@ -113,6 +114,34 @@
- 
- 	gpio->GPHCON = 0x0008FAAA;
- 	gpio->GPHUP = 0x000007FF;
-+#elif defined(CONFIG_ARCH_GTA01_v4)
-+	gpio->GPACON = 0x005E47FF;
-+
-+	gpio->GPBCON = 0x00045016;
-+	gpio->GPBUP = 0x000007FF;
-+	gpio->GPBDAT |= 0x4;		/* Set GBP2 to high (Flash power-up) */
-+
-+	gpio->GPCCON = 0xAAAA12A9;
-+	gpio->GPCUP = 0x0000FFFF;
-+
-+	gpio->GPDCON = 0xAAAAAAAA;
-+	gpio->GPDUP = 0x0000FFFF;
-+
-+	gpio->GPECON = 0xA02AAAAA;
-+	gpio->GPEUP = 0x0000FFFF;
-+
-+	gpio->GPFCON = 0x0000aa09;
-+	gpio->GPFUP = 0x000000FF;
-+
-+	gpio->GPGCON = 0xFF40F0C1;
-+	gpio->GPGUP = 0x0000AFEF;
-+
-+	gpio->GPHCON = 0x0000FAAA;
-+	gpio->GPHUP = 0x000007FF;
-+
-+#else
-+#error Please define GTA01 version
-+#endif
- 
- 	/* arch number of SMDK2410-Board */
- 	gd->bd->bi_arch_number = MACH_TYPE_NEO1973;
-@@ -144,5 +173,9 @@
- 
- u_int32_t get_board_rev(void)
- {
-+#if defined(CONFIG_ARCH_GTA01_v3)
- 	return 0x00000130;
-+#elif defined(CONFIG_ARCH_GTA01_v4)
-+	return 0x00000140;
-+#endif
- }
-Index: u-boot.git/board/neo1973/split_by_variant.sh
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot.git/board/neo1973/split_by_variant.sh	2007-02-06 12:07:48.000000000 +0100
-@@ -0,0 +1,36 @@
-+#!/bin/sh
-+# ---------------------------------------------------------
-+#  Set the core module defines according to Core Module
-+# ---------------------------------------------------------
-+# ---------------------------------------------------------
-+# Set up the GTA01 type define
-+# ---------------------------------------------------------
-+
-+mkdir -p ${obj}include
-+if [ "$1" == "" ]
-+then
-+	echo "$0:: No parameters - using GTA01v3 config"
-+	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-+else
-+	case "$1" in
-+	gta01v4_config)
-+	echo "#define CONFIG_ARCH_GTA01_v4" > ${obj}include/config.h
-+	;;
-+
-+	gta01v3_config)
-+	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-+	;;
-+
-+
-+	*)
-+	echo "$0:: Unrecognised config - using gta01v3_config"
-+	echo "#define CONFIG_ARCH_GTA01_v3" > ${obj}include/config.h
-+	;;
-+
-+	esac
-+
-+fi
-+# ---------------------------------------------------------
-+# Complete the configuration
-+# ---------------------------------------------------------
-+$MKCONFIG -a neo1973 arm arm920t neo1973 NULL s3c24x0
-Index: u-boot.git/include/configs/neo1973.h
-===================================================================
---- u-boot.git.orig/include/configs/neo1973.h	2007-02-06 12:04:53.000000000 +0100
-+++ u-boot.git/include/configs/neo1973.h	2007-02-06 12:07:48.000000000 +0100
-@@ -131,7 +131,11 @@
-  * Miscellaneous configurable options
-  */
- #define	CFG_LONGHELP				/* undef to save memory		*/
-+#if defined(CONFIG_ARCH_GTA01_v3)
- #define	CFG_PROMPT		"GTA01v3 # "	/* Monitor Command Prompt	*/
-+#elif defined(CONFIG_ARCH_GTA01_v4)
-+#define	CFG_PROMPT		"GTA01v4 # "	/* Monitor Command Prompt	*/
-+#endif
- #define	CFG_CBSIZE		256		/* Console I/O Buffer Size	*/
- #define	CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
- #define	CFG_MAXARGS		16		/* max number of command args	*/

Deleted: trunk/src/target/u-boot/patches/uboot-neo1973-jbt6k74.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-neo1973-jbt6k74.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-neo1973-jbt6k74.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,476 +0,0 @@
-Index: u-boot/board/neo1973/Makefile
-===================================================================
---- u-boot.orig/board/neo1973/Makefile	2007-02-12 21:06:50.000000000 +0100
-+++ u-boot/board/neo1973/Makefile	2007-02-12 21:06:50.000000000 +0100
-@@ -25,7 +25,7 @@
- 
- LIB	= lib$(BOARD).a
- 
--OBJS	:= neo1973.o pcf50606.o cmd_neo1973.o
-+OBJS	:= neo1973.o pcf50606.o cmd_neo1973.o jbt6k74.o
- SOBJS	:= lowlevel_init.o
- 
- $(LIB):	$(OBJS) $(SOBJS)
-Index: u-boot/board/neo1973/jbt6k74.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/jbt6k74.c	2007-02-12 22:05:01.000000000 +0100
-@@ -0,0 +1,403 @@
-+/* u-boot driver for the tpo JBT6K74-AS LCM ASIC
-+ *
-+ * Copyright (C) 2006-2007 by OpenMoko, Inc.
-+ * Author: Harald Welte <laforge 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 <common.h>
-+#include <spi.h>
-+#include <asm/errno.h>
-+#include <s3c2410.h>
-+#include "jbt6k74.h"
-+
-+#if 0
-+#define DEBUGP(x, args...) printf("%s: " x, __FUNCTION__, ## args);
-+#define DEBUGPC(x, args...) printf(x, ## args);
-+#else
-+#define DEBUGP(x, args...) do { } while (0)
-+#define DEBUGPC(x, args...) do { } while (0)
-+#endif
-+
-+
-+enum jbt_register {
-+	JBT_REG_SLEEP_IN		= 0x10,
-+	JBT_REG_SLEEP_OUT		= 0x11,
-+
-+	JBT_REG_DISPLAY_OFF		= 0x28,
-+	JBT_REG_DISPLAY_ON		= 0x29,
-+
-+	JBT_REG_RGB_FORMAT		= 0x3a,
-+	JBT_REG_QUAD_RATE		= 0x3b,
-+
-+	JBT_REG_POWER_ON_OFF		= 0xb0,
-+	JBT_REG_BOOSTER_OP		= 0xb1,
-+	JBT_REG_BOOSTER_MODE		= 0xb2,
-+	JBT_REG_BOOSTER_FREQ		= 0xb3,
-+	JBT_REG_OPAMP_SYSCLK		= 0xb4,
-+	JBT_REG_VSC_VOLTAGE		= 0xb5,
-+	JBT_REG_VCOM_VOLTAGE		= 0xb6,
-+	JBT_REG_EXT_DISPL		= 0xb7,
-+	JBT_REG_OUTPUT_CONTROL		= 0xb8,
-+	JBT_REG_DCCLK_DCEV		= 0xb9,
-+	JBT_REG_DISPLAY_MODE1		= 0xba,
-+	JBT_REG_DISPLAY_MODE2		= 0xbb,
-+	JBT_REG_DISPLAY_MODE		= 0xbc,
-+	JBT_REG_ASW_SLEW		= 0xbd,
-+	JBT_REG_DUMMY_DISPLAY		= 0xbe,
-+	JBT_REG_DRIVE_SYSTEM		= 0xbf,
-+
-+	JBT_REG_SLEEP_OUT_FR_A		= 0xc0,
-+	JBT_REG_SLEEP_OUT_FR_B		= 0xc1,
-+	JBT_REG_SLEEP_OUT_FR_C		= 0xc2,
-+	JBT_REG_SLEEP_IN_LCCNT_D	= 0xc3,
-+	JBT_REG_SLEEP_IN_LCCNT_E	= 0xc4,
-+	JBT_REG_SLEEP_IN_LCCNT_F	= 0xc5,
-+	JBT_REG_SLEEP_IN_LCCNT_G	= 0xc6,
-+
-+	JBT_REG_GAMMA1_FINE_1		= 0xc7,
-+	JBT_REG_GAMMA1_FINE_2		= 0xc8,
-+	JBT_REG_GAMMA1_INCLINATION	= 0xc9,
-+	JBT_REG_GAMMA1_BLUE_OFFSET	= 0xca,
-+
-+	JBT_REG_BLANK_CONTROL		= 0xcf,
-+	JBT_REG_BLANK_TH_TV		= 0xd0,
-+	JBT_REG_CKV_ON_OFF		= 0xd1,
-+	JBT_REG_CKV_1_2			= 0xd2,
-+	JBT_REG_OEV_TIMING		= 0xd3,
-+	JBT_REG_ASW_TIMING_1		= 0xd4,
-+	JBT_REG_ASW_TIMING_2		= 0xd5,
-+
-+	JBT_REG_HCLOCK_VGA		= 0xec,
-+	JBT_REG_HCLOCK_QVGA		= 0xed,
-+
-+};
-+
-+static const char *jbt_state_names[] = {
-+	[JBT_STATE_DEEP_STANDBY]	= "deep-standby",
-+	[JBT_STATE_SLEEP]		= "sleep",
-+	[JBT_STATE_NORMAL]		= "normal",
-+};
-+
-+#define GTA01_SCLK	(1 << 7) 	/* GPG7 */
-+#define GTA01_MOSI	(1 << 6)	/* GPG6 */
-+#define GTA01_MISO	(1 << 5)	/* GPG5 */
-+#define GTA01_CS	(1 << 3)	/* GPG3 */
-+
-+#define SPI_READ        ((immr->GPGDAT & GTA01_MISO) != 0)
-+
-+#define SPI_CS(bit) 	if (bit) gpio->GPGDAT |= GTA01_CS; \
-+			else gpio->GPGDAT &= ~GTA01_CS
-+
-+#define SPI_SDA(bit)    if (bit) gpio->GPGDAT |=  GTA01_MOSI; \
-+			else    gpio->GPGDAT &= ~GTA01_MOSI
-+
-+#define SPI_SCL(bit)    if (bit) gpio->GPGDAT |=  GTA01_SCLK; \
-+			else    gpio->GPGDAT &= ~GTA01_SCLK
-+
-+/* 150uS minimum clock cycle, we have two of this plus our other
-+ * instructions */
-+#define SPI_DELAY	udelay(75)
-+
-+
-+#define JBT_TX_BUF_SIZE
-+struct jbt_info {
-+	enum jbt_state state;
-+	u_int16_t tx_buf[4];
-+	struct spi_device *spi_dev;
-+};
-+
-+static struct jbt_info _jbt, *jbt = &_jbt;
-+
-+static int jbt_spi_xfer(int wordnum, int bitlen, u_int16_t *dout)
-+{
-+	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-+	u_int16_t tmpdout = 0;
-+	int   i, j;
-+
-+	DEBUGP("spi_xfer: dout %08X wordnum %u bitlen %d\n",
-+		*(uint *)dout, wordnum, bitlen);
-+
-+	SPI_CS(0);
-+
-+	for (i = 0; i < wordnum; i ++) {
-+		tmpdout = dout[i];
-+
-+		for (j = 0; j < bitlen; j++) {
-+			SPI_SCL(0);
-+			if (tmpdout & (1 << bitlen-1)) {
-+				SPI_SDA(1);
-+				DEBUGPC("1");
-+			} else {
-+				SPI_SDA(0);
-+				DEBUGPC("0");
-+			}
-+			SPI_DELAY;
-+			SPI_SCL(1);
-+			SPI_DELAY;
-+			tmpdout <<= 1;
-+		}
-+		DEBUGPC(" ");
-+	}
-+	DEBUGPC("\n");
-+
-+	SPI_CS(1);
-+
-+	return 0;
-+}
-+
-+#define JBT_COMMAND	0x000
-+#define JBT_DATA	0x100
-+
-+static int jbt_reg_write_nodata(struct jbt_info *jbt, u_int8_t reg)
-+{
-+	int rc;
-+
-+	jbt->tx_buf[0] = JBT_COMMAND | reg;
-+
-+	rc = jbt_spi_xfer(1, 9, jbt->tx_buf);
-+
-+	return rc;
-+}
-+
-+
-+static int jbt_reg_write(struct jbt_info *jbt, u_int8_t reg, u_int8_t data)
-+{
-+	int rc;
-+
-+	jbt->tx_buf[0] = JBT_COMMAND | reg;
-+	jbt->tx_buf[1] = JBT_DATA | data;
-+
-+	rc = jbt_spi_xfer(2, 9, jbt->tx_buf);
-+
-+	return rc;
-+}
-+
-+static int jbt_reg_write16(struct jbt_info *jbt, u_int8_t reg, u_int16_t data)
-+{
-+	int rc;
-+
-+	jbt->tx_buf[0] = JBT_COMMAND | reg;
-+	jbt->tx_buf[1] = JBT_DATA | (data >> 8);
-+	jbt->tx_buf[2] = JBT_DATA | (data & 0xff);
-+
-+	rc = jbt_spi_xfer(3, 9, jbt->tx_buf);
-+
-+	return rc;
-+}
-+
-+static int jbt_init_regs(struct jbt_info *jbt)
-+{
-+	int rc;
-+
-+	DEBUGP("entering\n");
-+
-+	rc = jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE1, 0x01);
-+	rc |= jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE2, 0x00);
-+	rc |= jbt_reg_write(jbt, JBT_REG_RGB_FORMAT, 0x60);
-+	rc |= jbt_reg_write(jbt, JBT_REG_DRIVE_SYSTEM, 0x10);
-+	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_OP, 0x56);
-+	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_MODE, 0x33);
-+	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_FREQ, 0x11);
-+	rc |= jbt_reg_write(jbt, JBT_REG_BOOSTER_FREQ, 0x11);
-+	rc |= jbt_reg_write(jbt, JBT_REG_OPAMP_SYSCLK, 0x02);
-+	rc |= jbt_reg_write(jbt, JBT_REG_VSC_VOLTAGE, 0x2b);
-+	rc |= jbt_reg_write(jbt, JBT_REG_VCOM_VOLTAGE, 0x40);
-+	rc |= jbt_reg_write(jbt, JBT_REG_EXT_DISPL, 0x03);
-+	rc |= jbt_reg_write(jbt, JBT_REG_DCCLK_DCEV, 0x04);
-+	rc |= jbt_reg_write(jbt, JBT_REG_ASW_SLEW, 0x02);
-+	rc |= jbt_reg_write(jbt, JBT_REG_DUMMY_DISPLAY, 0x00);
-+
-+	rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_A, 0x11);
-+	rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_B, 0x11);
-+	rc |= jbt_reg_write(jbt, JBT_REG_SLEEP_OUT_FR_C, 0x11);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_D, 0x2040);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_E, 0x60c0);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_F, 0x1020);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_SLEEP_IN_LCCNT_G, 0x60c0);
-+
-+	rc |= jbt_reg_write16(jbt, JBT_REG_GAMMA1_FINE_1, 0x5533);
-+	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_FINE_2, 0x00);
-+	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_INCLINATION, 0x00);
-+	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_BLUE_OFFSET, 0x00);
-+	rc |= jbt_reg_write(jbt, JBT_REG_GAMMA1_BLUE_OFFSET, 0x00);
-+
-+	rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_VGA, 0x1f0);
-+	rc |= jbt_reg_write(jbt, JBT_REG_BLANK_CONTROL, 0x02);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_BLANK_TH_TV, 0x0804);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_BLANK_TH_TV, 0x0804);
-+
-+	rc |= jbt_reg_write(jbt, JBT_REG_CKV_ON_OFF, 0x01);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_CKV_1_2, 0x0000);
-+
-+	rc |= jbt_reg_write16(jbt, JBT_REG_OEV_TIMING, 0x0d0e);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_ASW_TIMING_1, 0x11a4);
-+	rc |= jbt_reg_write(jbt, JBT_REG_ASW_TIMING_2, 0x0e);
-+
-+#if 0
-+	rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_QVGA, 0x00ff);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_HCLOCK_QVGA, 0x00ff);
-+#endif
-+
-+	return rc;
-+}
-+
-+static int standby_to_sleep(struct jbt_info *jbt)
-+{
-+	int rc;
-+
-+	DEBUGP("entering\n");
-+
-+	/* three times command zero */
-+	rc = jbt_reg_write_nodata(jbt, 0x00);
-+	udelay(1000);
-+	rc = jbt_reg_write_nodata(jbt, 0x00);
-+	udelay(1000);
-+	rc = jbt_reg_write_nodata(jbt, 0x00);
-+	udelay(1000);
-+
-+	/* deep standby out */
-+	rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x17);
-+
-+	return rc;
-+}
-+
-+static int sleep_to_normal(struct jbt_info *jbt)
-+{
-+	int rc;
-+	DEBUGP("entering\n");
-+
-+	/* RGB I/F on, RAM wirte off, QVGA through, SIGCON enable */
-+	rc = jbt_reg_write(jbt, JBT_REG_DISPLAY_MODE, 0x80);
-+
-+	/* Quad mode off */
-+	rc |= jbt_reg_write(jbt, JBT_REG_QUAD_RATE, 0x00);
-+
-+	/* AVDD on, XVDD on */
-+	rc |= jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x16);
-+
-+	/* Output control */
-+	rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0xfff9);
-+
-+	/* Sleep mode off */
-+	rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_OUT);
-+
-+	/* initialize register set */
-+	rc |= jbt_init_regs(jbt);
-+	return rc;
-+}
-+
-+static int normal_to_sleep(struct jbt_info *jbt)
-+{
-+	int rc;
-+	DEBUGP("entering\n");
-+
-+	rc = jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
-+	rc |= jbt_reg_write16(jbt, JBT_REG_OUTPUT_CONTROL, 0x8002);
-+	rc |= jbt_reg_write_nodata(jbt, JBT_REG_SLEEP_IN);
-+
-+	return rc;
-+}
-+
-+static int sleep_to_standby(struct jbt_info *jbt)
-+{
-+	DEBUGP("entering\n");
-+	return jbt_reg_write(jbt, JBT_REG_POWER_ON_OFF, 0x00);
-+}
-+
-+/* frontend function */
-+int jbt6k74_enter_state(enum jbt_state new_state)
-+{
-+	int rc = -EINVAL;
-+
-+	DEBUGP("entering(old_state=%u, new_state=%u)\n", jbt->state, new_state);
-+
-+	switch (jbt->state) {
-+	case JBT_STATE_DEEP_STANDBY:
-+		switch (new_state) {
-+		case JBT_STATE_DEEP_STANDBY:
-+			rc = 0;
-+			break;
-+		case JBT_STATE_SLEEP:
-+			rc = standby_to_sleep(jbt);
-+			break;
-+		case JBT_STATE_NORMAL:
-+			/* first transition into sleep */
-+			rc = standby_to_sleep(jbt);
-+			/* then transition into normal */
-+			rc |= sleep_to_normal(jbt);
-+			break;
-+		}
-+		break;
-+	case JBT_STATE_SLEEP:
-+		switch (new_state) {
-+		case JBT_STATE_SLEEP:
-+			rc = 0;
-+			break;
-+		case JBT_STATE_DEEP_STANDBY:
-+			rc = sleep_to_standby(jbt);
-+			break;
-+		case JBT_STATE_NORMAL:
-+			rc = sleep_to_normal(jbt);
-+			break;
-+		}
-+		break;
-+	case JBT_STATE_NORMAL:
-+		switch (new_state) {
-+		case JBT_STATE_NORMAL:
-+			rc = 0;
-+			break;
-+		case JBT_STATE_DEEP_STANDBY:
-+			/* first transition into sleep */
-+			rc = normal_to_sleep(jbt);
-+			/* then transition into deep standby */
-+			rc |= sleep_to_standby(jbt);
-+			break;
-+		case JBT_STATE_SLEEP:
-+			rc = normal_to_sleep(jbt);
-+			break;
-+		}
-+		break;
-+	}
-+
-+	return rc;
-+}
-+
-+int jbt6k74_display_onoff(int on)
-+{
-+	DEBUGP("entering\n");
-+	if (on)
-+		return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_ON);
-+	else
-+		return jbt_reg_write_nodata(jbt, JBT_REG_DISPLAY_OFF);
-+}
-+
-+int jbt6k74_init(void)
-+{
-+	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-+
-+	/* initialize SPI for GPIO bitbang */
-+	gpio->GPGCON &= 0xffff033f;
-+	gpio->GPGCON |= 0x00005440;
-+
-+	/* get LCM out of reset */
-+	gpio->GPCDAT |= (1 << 6);
-+
-+	/* wait 50ms (Tpos of LCM) */
-+	udelay(50000);
-+}
-Index: u-boot/board/neo1973/jbt6k74.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/jbt6k74.h	2007-02-12 21:06:50.000000000 +0100
-@@ -0,0 +1,14 @@
-+#ifndef _JBT6K74_H
-+#define _JBT6K74_H
-+
-+enum jbt_state {
-+	JBT_STATE_DEEP_STANDBY,
-+	JBT_STATE_SLEEP,
-+	JBT_STATE_NORMAL,
-+};
-+
-+int jbt6k74_init(void);
-+int jbt6k74_display_onoff(int on);
-+int jbt6k74_enter_state(enum jbt_state new_state);
-+
-+#endif
-Index: u-boot/include/configs/neo1973.h
-===================================================================
---- u-boot.orig/include/configs/neo1973.h	2007-02-12 21:06:50.000000000 +0100
-+++ u-boot/include/configs/neo1973.h	2007-02-12 21:06:50.000000000 +0100
-@@ -251,7 +251,7 @@
- /* we have a board_late_init() function */
- #define BOARD_LATE_INIT			1
- 
--#if 0
-+#if 1
- #define CONFIG_VIDEO
- #define CONFIG_VIDEO_S3C2410
- #define CONFIG_CFB_CONSOLE
-Index: u-boot/board/neo1973/neo1973.c
-===================================================================
---- u-boot.orig/board/neo1973/neo1973.c	2007-02-12 21:06:50.000000000 +0100
-+++ u-boot/board/neo1973/neo1973.c	2007-02-12 21:06:50.000000000 +0100
-@@ -36,6 +36,7 @@
- 
- #include "neo1973.h"
- #include "pcf50606.h"
-+#include "jbt6k74.h"
- 
- DECLARE_GLOBAL_DATA_PTR;
- 
-@@ -252,6 +253,10 @@
- 	/* switch on the backlight */
- 	neo1973_backlight(1);
- 
-+	jbt6k74_init();
-+	jbt6k74_enter_state(JBT_STATE_NORMAL);
-+	jbt6k74_display_onoff(1);
-+
- 	return 0;
- }
- 

Deleted: trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-neo1973-poweroff.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,809 +0,0 @@
-This patch adds a new 'neo1973' command that can be used to control backlight,
-charger and power-off.
-
-Signed-off-by: Harald Welte <laforge at openmoko.org>
-
-Index: u-boot/board/neo1973/Makefile
-===================================================================
---- u-boot.orig/board/neo1973/Makefile	2007-02-15 00:43:51.000000000 +0100
-+++ u-boot/board/neo1973/Makefile	2007-02-15 01:36:20.000000000 +0100
-@@ -25,7 +25,7 @@
- 
- LIB	= lib$(BOARD).a
- 
--OBJS	:= neo1973.o
-+OBJS	:= neo1973.o pcf50606.o cmd_neo1973.o
- SOBJS	:= lowlevel_init.o
- 
- $(LIB):	$(OBJS) $(SOBJS)
-Index: u-boot/board/neo1973/cmd_neo1973.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/cmd_neo1973.c	2007-02-15 01:55:42.000000000 +0100
-@@ -0,0 +1,120 @@
-+/*
-+ * (C) Copyright 2006 by OpenMoko, Inc.
-+ * Author: Harald Welte <laforge at openmoko.org>
-+ *
-+ * See file CREDITS for list of people who contributed to this
-+ * project.
-+ *
-+ * 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
-+ */
-+
-+/*
-+ * Boot support
-+ */
-+#include <common.h>
-+#include <command.h>
-+#include <net.h>		/* for print_IPaddr */
-+#include <s3c2410.h>
-+
-+#include "neo1973.h"
-+#include "pcf50606.h"
-+
-+DECLARE_GLOBAL_DATA_PTR;
-+
-+#if (CONFIG_COMMANDS & CFG_CMD_BDI)
-+
-+static const char *chgstate_names[] = {
-+	[PCF50606_MBCC1_CHGMOD_QUAL]		= "qualification",
-+	[PCF50606_MBCC1_CHGMOD_PRE]		= "pre",
-+	[PCF50606_MBCC1_CHGMOD_TRICKLE]		= "trickle",
-+	[PCF50606_MBCC1_CHGMOD_FAST_CCCV]	= "fast_cccv",
-+	[PCF50606_MBCC1_CHGMOD_FAST_NOCC]	= "fast_nocc",
-+	[PCF50606_MBCC1_CHGMOD_FAST_NOCV]	= "fast_nocv",
-+	[PCF50606_MBCC1_CHGMOD_FAST_SW]		= "fast_switch",
-+	[PCF50606_MBCC1_CHGMOD_IDLE]		= "idle",
-+};
-+
-+int do_neo1973 ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
-+{
-+	int i;
-+
-+	if (!strcmp(argv[1], "info")) {
-+		printf("FIC GTA01 Hardware Revision 0x%04x\n", get_board_rev());
-+	} else if (!strcmp(argv[1], "power-off")) {
-+		neo1973_poweroff();
-+	} else if (!strcmp(argv[1], "charger") || !strcmp(argv[1], "charge")) {
-+		if (argc < 3)
-+			goto out_help;
-+		if (!strcmp(argv[2], "status") || !strcmp(argv[2], "state")) {
-+			u_int8_t mbcc1 = pcf50606_reg_read(PCF50606_REG_MBCC1);
-+			u_int8_t chgmod = (mbcc1 & PCF50606_MBCC1_CHGMOD_MASK);
-+			printf("%s\n", chgstate_names[chgmod]);
-+		} else if (!strcmp(argv[2], "autofast")) {
-+			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
-+						  PCF50606_MBCC1_AUTOFST,
-+						  PCF50606_MBCC1_AUTOFST);
-+		} else if (!strcmp(argv[2], "!autofast")) {
-+			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
-+						  PCF50606_MBCC1_AUTOFST, 0);
-+		} else if (!strcmp(argv[2], "off")) {
-+			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
-+						  PCF50606_MBCC1_CHGMOD_MASK,
-+						  PCF50606_MBCC1_CHGMOD_IDLE);
-+		} else if (!strcmp(argv[2], "fast")) {
-+			pcf50606_reg_set_bit_mask(PCF50606_REG_MBCC1,
-+						  PCF50606_MBCC1_CHGMOD_MASK,
-+						  PCF50606_MBCC1_CHGMOD_FAST_CCCV);
-+		} else
-+			goto out_help;
-+	} else if (!strcmp(argv[1], "backlight")) {
-+		if (argc < 3)
-+			goto out_help;
-+		if (!strcmp(argv[2], "on"))
-+			neo1973_backlight(1);
-+		else
-+			neo1973_backlight(0);
-+	} else if (!strcmp(argv[1], "vibrator")) {
-+		if (argc < 3)
-+			goto out_help;
-+		if (!strcmp(argv[2], "on"))
-+			neo1973_vibrator(1);
-+		else
-+			neo1973_vibrator(0);
-+	} else {
-+out_help:
-+		printf("Usage:\n%s\n", cmdtp->usage);
-+		return 1;
-+	}
-+
-+	return 0;
-+}
-+
-+/* -------------------------------------------------------------------- */
-+
-+U_BOOT_CMD(
-+	neo1973,	4,	1,	do_neo1973,
-+	"neo1973 - phone specific commands\n",
-+	"neo1973 info - display phone informantion\n"
-+	"neo1973 power-off - switch off the phone\n"
-+	"neo1973 charger status - display charger status\n"
-+	"neo1973 charger autofast - enable automatic fast (500mA) charging\n"
-+	"neo1973 charger !autofast - disable automatic fast (500mA) charging\n"
-+	"neo1973 charger fast - enable fast (500mA) charging\n"
-+	"neo1973 charger off - disable charging\n"
-+	"neo1973 backlight (on|off) - switch backlight on or off\n"
-+	"neo1973 vibrator (on|off) - switch vibrator on or off\n"
-+);
-+#endif	/* CFG_CMD_BDI */
-Index: u-boot/board/neo1973/neo1973.c
-===================================================================
---- u-boot.orig/board/neo1973/neo1973.c	2007-02-15 00:43:51.000000000 +0100
-+++ u-boot/board/neo1973/neo1973.c	2007-02-15 01:36:20.000000000 +0100
-@@ -34,8 +34,14 @@
- #include <s3c2410.h>
- #include <i2c.h>
- 
-+#include "neo1973.h"
-+#include "pcf50606.h"
-+
- DECLARE_GLOBAL_DATA_PTR;
- 
-+/* That many seconds the power key needs to be pressed to power up */
-+#define POWER_KEY_SECONDS	2
-+
- #if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
- //#define M_MDIV	0xA1		/* Fout = 202.8MHz */
- //#define M_PDIV	0x3
-@@ -61,6 +67,9 @@
- #define U_M_PDIV	0x2
- #define U_M_SDIV	0x3
- 
-+unsigned int neo1973_wakeup_cause;
-+extern int nobootdelay;
-+
- static inline void delay (unsigned long loops)
- {
- 	__asm__ volatile ("1:\n"
-@@ -96,7 +105,7 @@
- #if defined(CONFIG_ARCH_GTA01_v3)
- 	gpio->GPACON = 0x007FFFFF;
- 
--	gpio->GPBCON = 0x00005056;
-+	gpio->GPBCON = 0x00005055;
- 	gpio->GPBUP = 0x000007FF;
- 
- 	gpio->GPCCON = 0xAAAA12A8;
-@@ -119,7 +128,7 @@
- #elif defined(CONFIG_ARCH_GTA01_v4)
- 	gpio->GPACON = 0x005E47FF;
- 
--	gpio->GPBCON = 0x00045016;
-+	gpio->GPBCON = 0x00045015;
- 	gpio->GPBUP = 0x000007FF;
- 	gpio->GPBDAT |= 0x4;		/* Set GBP2 to high (Flash power-up) */
- 
-@@ -143,7 +152,7 @@
- #elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
- 	gpio->GPACON = 0x005E47FF;
- 
--	gpio->GPBCON = 0x00145416;
-+	gpio->GPBCON = 0x00145415;
- 	gpio->GPBUP = 0x000007FF;
- 	gpio->GPBDAT |= 0x4;		/* Set GBP2 to high (Flash power-up) */
- 
-@@ -184,26 +193,65 @@
- int board_late_init(void)
- {
- 	unsigned char tmp;
-+	char buf[32];
- 
--	tmp = 0x17; /* charge backup battery with 100uA during ACTIVE+STANDBY*/
--	i2c_write(0x08, 0x2d, 1, &tmp, 1);
-+	/* Initialize the Power Management Unit with a safe register set */
-+	pcf50606_init();
- 
--	tmp = 0x1a; /* 4.2V battery, precharge 0.1*Ifast */
--	i2c_write(0x08, 0x2b, 1, &tmp, 1);
-+	/* obtain wake-up reason, save INT1 in environment */
-+	tmp = pcf50606_reg_read(PCF50606_REG_INT1);
-+	sprintf(buf, "0x%02x", tmp);
-+	setenv("pcf50606_int1", buf);
-+
-+	if (tmp & PCF50606_INT1_ALARM) {
-+		/* we've been woken up by RTC alarm or charger insert, boot */
-+		neo1973_wakeup_cause = NEO1973_WAKEUP_ALARM;
-+		goto continue_boot;
-+	}
-+	if (tmp & PCF50606_INT1_EXTONR) {
-+		neo1973_wakeup_cause = NEO1973_WAKEUP_CHARGER;
-+	}
-+
-+	if (tmp & PCF50606_INT1_ONKEYF) {
-+		int seconds = 0;
-+		neo1973_wakeup_cause = NEO1973_WAKEUP_POWER_KEY;
-+		/* we've been woken up by a falling edge of the onkey */
-+
-+		/* we can't just setenv(bootdelay,-1) because that would
-+		 * accidentially become permanent if the user does saveenv */
-+		if (neo1973_911_key_pressed())
-+			nobootdelay = 1;
-+
-+		while (1) {
-+			u_int8_t int1, oocs;
-+
-+			oocs = pcf50606_reg_read(PCF50606_REG_OOCS);
-+			if (oocs & PFC50606_OOCS_ONKEY)
-+				break;
-+
-+			int1 = pcf50606_reg_read(PCF50606_REG_INT1);
-+			if (int1 & PCF50606_INT1_SECOND)
-+				seconds++;
-+
-+			if (seconds >= POWER_KEY_SECONDS)
-+				goto continue_boot;
-+		}
-+		/* Power off if minimum number of seconds not reached */
-+		neo1973_poweroff();
-+	}
-+
-+	/* if there's no other reason, must be regular reset */
-+	neo1973_wakeup_cause = NEO1973_WAKEUP_RESET;
-+
-+continue_boot:
-+	/* issue a short pulse with the vibrator */
-+	neo1973_vibrator(1);
-+	udelay(50000);
-+	neo1973_vibrator(0);
- 
--	tmp = 0x0f; /* CHGAPE | AUTOFST | fast charge */
--	i2c_write(0x08, 0x29, 1, &tmp, 1);
-+	/* switch on the backlight */
-+	neo1973_backlight(1);
- 
--#if defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
--	tmp = 0xe4;	/* CPU Voltage: 2.1V */
--	i2c_write(0x08, 0x21, 1, &tmp, 1);
--#endif
--
--#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
--	const char mmc_power = 0x8f;
--	/* enable D2REG 3.3V (SC/MMC power) */
--	i2c_write(0x08, 0x25, 1, &mmc_power, 1);
--#endif
- 	return 0;
- }
- 
-@@ -227,3 +275,38 @@
- 	return 0x00000230;
- #endif
- }
-+
-+void neo1973_poweroff(void)
-+{
-+	serial_printf("poweroff\n");
-+	udc_disconnect();
-+	pcf50606_reg_write(PCF50606_REG_OOCC1, PCF50606_OOCC1_GOSTDBY);
-+	/* don't return to caller */
-+	while (1) ;
-+}
-+
-+void neo1973_backlight(int on)
-+{
-+	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-+	if (on)
-+		gpio->GPBDAT |= 0x01;
-+	else
-+		gpio->GPBDAT &= ~0x01;
-+}
-+
-+void neo1973_vibrator(int on)
-+{
-+	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-+	if (on)
-+		gpio->GPBDAT |= (1 << 10);
-+	else
-+		gpio->GPBDAT &= ~(1 << 10);
-+}
-+
-+int neo1973_911_key_pressed(void)
-+{
-+	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
-+	if (gpio->GPFDAT & (1 << 6))
-+		return 0;
-+	return 1;
-+}
-Index: u-boot/board/neo1973/pcf50606.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/pcf50606.h	2007-02-15 00:43:54.000000000 +0100
-@@ -0,0 +1,267 @@
-+#ifndef _PCF50606_H
-+#define _PCF50606_H
-+
-+/* Philips PCF50606 Power Managemnt Unit (PMU) driver
-+ * (C) 2006-2007 by OpenMoko, Inc.
-+ * Author: Harald Welte <laforge at openmoko.org>
-+ *
-+ */
-+
-+enum pfc50606_regs {
-+	PCF50606_REG_ID		= 0x00,
-+	PCF50606_REG_OOCS	= 0x01,
-+	PCF50606_REG_INT1	= 0x02,	/* Interrupt Status */
-+	PCF50606_REG_INT2	= 0x03,	/* Interrupt Status */
-+	PCF50606_REG_INT3	= 0x04,	/* Interrupt Status */
-+	PCF50606_REG_INT1M	= 0x05,	/* Interrupt Mask */
-+	PCF50606_REG_INT2M	= 0x06,	/* Interrupt Mask */
-+	PCF50606_REG_INT3M	= 0x07,	/* Interrupt Mask */
-+	PCF50606_REG_OOCC1	= 0x08,
-+	PCF50606_REG_OOCC2	= 0x09,
-+	PCF50606_REG_RTCSC	= 0x0a,	/* Second */
-+	PCF50606_REG_RTCMN	= 0x0b,	/* Minute */
-+	PCF50606_REG_RTCHR	= 0x0c,	/* Hour */
-+	PCF50606_REG_RTCWD	= 0x0d,	/* Weekday */
-+	PCF50606_REG_RTCDT	= 0x0e,	/* Day */
-+	PCF50606_REG_RTCMT	= 0x0f,	/* Month */
-+	PCF50606_REG_RTCYR	= 0x10,	/* Year */
-+	PCF50606_REG_RTCSCA	= 0x11, /* Alarm Second */
-+	PCF50606_REG_RTCMNA	= 0x12, /* Alarm Minute */
-+	PCF50606_REG_RTCHRA	= 0x13, /* Alarm Hour */
-+	PCF50606_REG_RTCWDA	= 0x14, /* Alarm Weekday */
-+	PCF50606_REG_RTCDTA	= 0x15, /* Alarm Day */
-+	PCF50606_REG_RTCMTA	= 0x16, /* Alarm Month */
-+	PCF50606_REG_RTCYRA	= 0x17, /* Alarm Year */
-+	PCF50606_REG_PSSC	= 0x18,	/* Power sequencing */
-+	PCF50606_REG_PWROKM	= 0x19,	/* PWROK mask */
-+	PCF50606_REG_PWROKS	= 0x1a,	/* PWROK status */
-+	PCF50606_REG_DCDC1	= 0x1b,
-+	PCF50606_REG_DCDC2	= 0x1c,
-+	PCF50606_REG_DCDC3	= 0x1d,
-+	PCF50606_REG_DCDC4	= 0x1e,
-+	PCF50606_REG_DCDEC1	= 0x1f,
-+	PCF50606_REG_DCDEC2	= 0x20,
-+	PCF50606_REG_DCUDC1	= 0x21,
-+	PCF50606_REG_DCUDC2	= 0x22,
-+	PCF50606_REG_IOREGC	= 0x23,
-+	PCF50606_REG_D1REGC1	= 0x24,
-+	PCF50606_REG_D2REGC1	= 0x25,
-+	PCF50606_REG_D3REGC1	= 0x26,
-+	PCF50606_REG_LPREGC1	= 0x27,
-+	PCF50606_REG_LPREGC2	= 0x28,
-+	PCF50606_REG_MBCC1	= 0x29,
-+	PCF50606_REG_MBCC2	= 0x2a,
-+	PCF50606_REG_MBCC3	= 0x2b,
-+	PCF50606_REG_MBCS1	= 0x2c,
-+	PCF50606_REG_BBCC	= 0x2d,
-+	PCF50606_REG_ADCC1	= 0x2e,
-+	PCF50606_REG_ADCC2	= 0x2f,
-+	PCF50606_REG_ADCS1	= 0x30,
-+	PCF50606_REG_ADCS2	= 0x31,
-+	PCF50606_REG_ADCS3	= 0x32,
-+	PCF50606_REG_ACDC1	= 0x33,
-+	PCF50606_REG_BVMC	= 0x34,
-+	PCF50606_REG_PWMC1	= 0x35,
-+	PCF50606_REG_LEDC1	= 0x36,
-+	PCF50606_REG_LEDC2	= 0x37,
-+	PCF50606_REG_GPOC1	= 0x38,
-+	PCF50606_REG_GPOC2	= 0x39,
-+	PCF50606_REG_GPOC3	= 0x3a,
-+	PCF50606_REG_GPOC4	= 0x3b,
-+	PCF50606_REG_GPOC5	= 0x3c,
-+	__NUM_PCF50606_REGS
-+};
-+
-+enum pcf50606_reg_oocs {
-+	PFC50606_OOCS_ONKEY	= 0x01,
-+	PCF50606_OOCS_EXTON	= 0x02,
-+	PCF50606_OOCS_PWROKRST	= 0x04,
-+	PCF50606_OOCS_BATOK	= 0x08,
-+	PCF50606_OOCS_BACKOK	= 0x10,
-+	PCF50606_OOCS_CHGOK	= 0x20,
-+	PCF50606_OOCS_TEMPOK	= 0x40,
-+	PCF50606_OOCS_WDTEXP	= 0x80,
-+};
-+
-+enum pcf50606_reg_oocc1 {
-+	PCF50606_OOCC1_GOSTDBY	= 0x01,
-+	PCF50606_OOCC1_TOTRST	= 0x02,
-+	PCF50606_OOCC1_CLK32ON	= 0x04,
-+	PCF50606_OOCC1_WDTRST	= 0x08,
-+	PCF50606_OOCC1_RTCWAK	= 0x10,
-+	PCF50606_OOCC1_CHGWAK	= 0x20,
-+	PCF50606_OOCC1_EXTONWAK_HIGH	= 0x40,
-+	PCF50606_OOCC1_EXTONWAK_LOW	= 0x80,
-+};
-+
-+enum pcf50606_reg_oocc2 {
-+	PCF50606_OOCC2_ONKEYDB_NONE	= 0x00,
-+	PCF50606_OOCC2_ONKEYDB_14ms	= 0x01,
-+	PCF50606_OOCC2_ONKEYDB_62ms	= 0x02,
-+	PCF50606_OOCC2_ONKEYDB_500ms	= 0x03,
-+	PCF50606_OOCC2_EXTONDB_NONE	= 0x00,
-+	PCF50606_OOCC2_EXTONDB_14ms	= 0x04,
-+	PCF50606_OOCC2_EXTONDB_62ms	= 0x08,
-+	PCF50606_OOCC2_EXTONDB_500ms	= 0x0c,
-+};
-+
-+enum pcf50606_reg_int1 {
-+	PCF50606_INT1_ONKEYR	= 0x01,	/* ONKEY rising edge */
-+	PCF50606_INT1_ONKEYF	= 0x02,	/* ONKEY falling edge */
-+	PCF50606_INT1_ONKEY1S	= 0x04,	/* OMKEY at least 1sec low */
-+	PCF50606_INT1_EXTONR	= 0x08,	/* EXTON rising edge */
-+	PCF50606_INT1_EXTONF	= 0x10,	/* EXTON falling edge */
-+	PCF50606_INT1_SECOND	= 0x40,	/* RTC periodic second interrupt */
-+	PCF50606_INT1_ALARM	= 0x80, /* RTC alarm time is reached */
-+};
-+
-+enum pcf50606_reg_int2 {
-+	PCF50606_INT2_CHGINS	= 0x01, /* Charger inserted */
-+	PCF50606_INT2_CHGRM	= 0x02, /* Charger removed */
-+	PCF50606_INT2_CHGFOK	= 0x04,	/* Fast charging OK */
-+	PCF50606_INT2_CHGERR	= 0x08,	/* Error in charging mode */
-+	PCF50606_INT2_CHGFRDY	= 0x10,	/* Fast charge completed */
-+	PCF50606_INT2_CHGPROT	= 0x20,	/* Charging protection interrupt */
-+	PCF50606_INT2_CHGWD10S	= 0x40,	/* Charger watchdig expires in 10s */
-+	PCF50606_INT2_CHGWDEXP	= 0x80,	/* Charger watchdog expires */
-+};
-+
-+enum pcf50606_reg_int3 {
-+	PCF50606_INT3_ADCRDY	= 0x01,	/* ADC conversion finished */
-+	PCF50606_INT3_ACDINS	= 0x02,	/* Accessory inserted */
-+	PCF50606_INT3_ACDREM	= 0x04, /* Accessory removed */
-+	PCF50606_INT3_TSCPRES	= 0x08,	/* Touch screen pressed */
-+	PCF50606_INT3_LOWBAT	= 0x40,	/* Low battery voltage */
-+	PCF50606_INT3_HIGHTMP	= 0x80, /* High temperature */
-+};
-+
-+/* used by PSSC, PWROKM, PWROKS, */
-+enum pcf50606_regu {
-+	PCF50606_REGU_DCD	= 0x01,	/* DCD in phase 2 */
-+	PCF50606_REGU_DCDE	= 0x02,	/* DCDE in phase 2 */
-+	PCF50606_REGU_DCUD	= 0x04,	/* DCDU in phase 2 */
-+	PCF50606_REGU_IO	= 0x08,	/* IO in phase 2 */
-+	PCF50606_REGU_D1	= 0x10, /* D1 in phase 2 */
-+	PCF50606_REGU_D2	= 0x20,	/* D2 in phase 2 */
-+	PCF50606_REGU_D3	= 0x40,	/* D3 in phase 2 */
-+	PCF50606_REGU_LP	= 0x80,	/* LP in phase 2 */
-+};
-+
-+enum pcf50606_reg_dcdc4 {
-+	PCF50606_DCDC4_MODE_AUTO	= 0x00,
-+	PCF50606_DCDC4_MODE_PWM		= 0x01,
-+	PCF50606_DCDC4_MODE_PCF		= 0x02,
-+	PCF50606_DCDC4_OFF_FLOAT	= 0x00,
-+	PCF50606_DCDC4_OFF_BYPASS	= 0x04,
-+	PCF50606_DCDC4_OFF_PULLDOWN	= 0x08,
-+	PCF50606_DCDC4_CURLIM_500mA	= 0x00,
-+	PCF50606_DCDC4_CURLIM_750mA	= 0x10,
-+	PCF50606_DCDC4_CURLIM_1000mA	= 0x20,
-+	PCF50606_DCDC4_CURLIM_1250mA	= 0x30,
-+	PCF50606_DCDC4_TOGGLE		= 0x40,
-+	PCF50606_DCDC4_REGSEL_DCDC2	= 0x80,
-+};
-+
-+enum pcf50606_reg_dcdec2 {
-+	PCF50606_DCDEC2_MODE_AUTO	= 0x00,
-+	PCF50606_DCDEC2_MODE_PWM	= 0x01,
-+	PCF50606_DCDEC2_MODE_PCF	= 0x02,
-+	PCF50606_DCDEC2_OFF_FLOAT	= 0x00,
-+	PCF50606_DCDEC2_OFF_BYPASS	= 0x04,
-+};
-+
-+enum pcf50606_reg_dcudc2 {
-+	PCF50606_DCUDC2_MODE_AUTO	= 0x00,
-+	PCF50606_DCUDC2_MODE_PWM	= 0x01,
-+	PCF50606_DCUDC2_MODE_PCF	= 0x02,
-+	PCF50606_DCUDC2_OFF_FLOAT	= 0x00,
-+	PCF50606_DCUDC2_OFF_BYPASS	= 0x04,
-+};
-+
-+enum pcf50606_reg_adcc1 {
-+	PCF50606_ADCC1_TSCMODACT	= 0x01,
-+	PCF50606_ADCC1_TSCMODSTB	= 0x02,
-+	PCF50606_ADCC1_TRATSET		= 0x04,
-+	PCF50606_ADCC1_NTCSWAPE		= 0x08,
-+	PCF50606_ADCC1_NTCSWAOFF	= 0x10,
-+	PCF50606_ADCC1_EXTSYNCBREAK	= 0x20,
-+	/* reserved */
-+	PCF50606_ADCC1_TSCINT		= 0x80,
-+};
-+
-+enum pcf50606_reg_adcc2 {
-+	PCF50606_ADCC2_ADCSTART		= 0x01,
-+	/* see enum pcf50606_adcc2_adcmux */
-+	PCF50606_ADCC2_SYNC_NONE	= 0x00,
-+	PCF50606_ADCC2_SYNC_TXON	= 0x20,
-+	PCF50606_ADCC2_SYNC_PWREN1	= 0x40,
-+	PCF50606_ADCC2_SYNC_PWREN2	= 0x60,
-+	PCF50606_ADCC2_RES_10BIT	= 0x00,
-+	PCF50606_ADCC2_RES_8BIT		= 0x80,
-+};
-+
-+#define PCF50606_ADCC2_ADCMUX_MASK	(0xf << 1)
-+
-+#define ADCMUX_SHIFT	1
-+enum pcf50606_adcc2_adcmux {
-+	PCF50606_ADCMUX_BATVOLT_RES	= 0x0 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_BATVOLT_SUBTR	= 0x1 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_ADCIN1_RES	= 0x2 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_ADCIN1_SUBTR	= 0x3 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_BATTEMP		= 0x4 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_ADCIN2		= 0x5 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_ADCIN3		= 0x6 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_ADCIN3_RATIO	= 0x7 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_XPOS		= 0x8 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_YPOS		= 0x9 << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_P1		= 0xa << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_P2		= 0xb << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_BATVOLT_ADCIN1	= 0xc << ADCMUX_SHIFT,
-+	PCF50606_ADCMUX_XY_SEQUENCE	= 0xe << ADCMUX_SHIFT,
-+	PCF50606_P1_P2_RESISTANCE	= 0xf << ADCMUX_SHIFT,
-+};
-+
-+enum pcf50606_adcs2 {
-+	PCF50606_ADCS2_ADCRDY		= 0x80,
-+};
-+
-+enum pcf50606_reg_mbcc1 {
-+	PCF50606_MBCC1_CHGAPE		= 0x01,
-+	PCF50606_MBCC1_AUTOFST		= 0x02,
-+#define	PCF50606_MBCC1_CHGMOD_MASK	  0x1c
-+#define	PCF50606_MBCC1_CHGMOD_SHIFT	  2
-+	PCF50606_MBCC1_CHGMOD_QUAL	= 0x00,
-+	PCF50606_MBCC1_CHGMOD_PRE	= 0x04,
-+	PCF50606_MBCC1_CHGMOD_TRICKLE	= 0x08,
-+	PCF50606_MBCC1_CHGMOD_FAST_CCCV	= 0x0c,
-+	PCF50606_MBCC1_CHGMOD_FAST_NOCC	= 0x10,
-+	PCF50606_MBCC1_CHGMOD_FAST_NOCV	= 0x14,
-+	PCF50606_MBCC1_CHGMOD_FAST_SW	= 0x18,
-+	PCF50606_MBCC1_CHGMOD_IDLE	= 0x1c,
-+	PCF50606_MBCC1_DETMOD_LOWCHG	= 0x20,
-+	PCF50606_MBCC1_DETMOD_WDRST	= 0x40,
-+};
-+
-+enum pcf50606_reg_bvmc {
-+	PCF50606_BVMC_LOWBAT		= 0x01,
-+	PCF50606_BVMC_THRSHLD_NULL	= 0x00,
-+	PCF50606_BVMC_THRSHLD_2V8	= 0x02,
-+	PCF50606_BVMC_THRSHLD_2V9	= 0x04,
-+	PCF50606_BVMC_THRSHLD_3V	= 0x08,
-+	PCF50606_BVMC_THRSHLD_3V1	= 0x08,
-+	PCF50606_BVMC_THRSHLD_3V2	= 0x0a,
-+	PCF50606_BVMC_THRSHLD_3V3	= 0x0c,
-+	PCF50606_BVMC_THRSHLD_3V4	= 0x0e,
-+	PCF50606_BVMC_DISDB		= 0x10,
-+};
-+
-+void pcf50606_reg_write(u_int8_t reg, u_int8_t val);
-+
-+u_int8_t pcf50606_reg_read(u_int8_t reg);
-+
-+u_int8_t pcf50606_reg_set_bit_mask(u_int8_t reg, u_int8_t mask, u_int8_t val);
-+
-+void pcf50606_init(void);
-+
-+#endif /* _PCF50606_H */
-+
-Index: u-boot/board/neo1973/neo1973.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/neo1973.h	2007-02-15 00:43:54.000000000 +0100
-@@ -0,0 +1,18 @@
-+#ifndef _NEO1973_H
-+#define _NEO1973_H
-+
-+enum wakeup_reason {
-+	NEO1973_WAKEUP_NONE,
-+	NEO1973_WAKEUP_RESET,
-+	NEO1973_WAKEUP_POWER_KEY,
-+	NEO1973_WAKEUP_CHARGER,
-+	NEO1973_WAKEUP_ALARM,
-+};
-+
-+extern unsigned int neo1973_wakeup_cause;
-+
-+void neo1973_poweroff(void);
-+void neo1973_backlight(int on);
-+void neo1973_vibrator(int on);
-+
-+#endif
-Index: u-boot/board/neo1973/pcf50606.c
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/board/neo1973/pcf50606.c	2007-02-15 00:43:54.000000000 +0100
-@@ -0,0 +1,168 @@
-+
-+#include <common.h>
-+#include <i2c.h>
-+#include "pcf50606.h"
-+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-+
-+#define PCF50606_I2C_ADDR		0x08
-+
-+void pcf50606_reg_write(u_int8_t reg, u_int8_t val)
-+{
-+	i2c_write(PCF50606_I2C_ADDR, reg, 1, &val, 1);
-+}
-+
-+u_int8_t pcf50606_reg_read(u_int8_t reg)
-+{
-+	u_int8_t tmp;
-+	i2c_read(PCF50606_I2C_ADDR, reg, 1, &tmp, 1);
-+	return tmp;
-+}
-+
-+u_int8_t pcf50606_reg_set_bit_mask(u_int8_t reg, u_int8_t mask, u_int8_t val)
-+{
-+	u_int8_t tmp = pcf50606_reg_read(reg);
-+	pcf50606_reg_write(reg, (val & mask) | (tmp & ~mask));
-+}
-+
-+static const u_int8_t regs_valid[] = {
-+	PCF50606_REG_OOCS, PCF50606_REG_INT1M, PCF50606_REG_INT2M,
-+	PCF50606_REG_INT3M, PCF50606_REG_OOCC1, PCF50606_REG_OOCC2,
-+	PCF50606_REG_PSSC, PCF50606_REG_PWROKM, PCF50606_REG_DCDC1,
-+	PCF50606_REG_DCDC2, PCF50606_REG_DCDC3, PCF50606_REG_DCDC4,
-+	PCF50606_REG_DCDEC1, PCF50606_REG_DCDEC2, PCF50606_REG_DCUDC1,
-+	PCF50606_REG_DCUDC2, PCF50606_REG_IOREGC, PCF50606_REG_D1REGC1,
-+	PCF50606_REG_D2REGC1, PCF50606_REG_D3REGC1, PCF50606_REG_LPREGC1,
-+	PCF50606_REG_LPREGC2, PCF50606_REG_MBCC1, PCF50606_REG_MBCC2,
-+	PCF50606_REG_MBCC3, PCF50606_REG_BBCC, PCF50606_REG_ADCC1,
-+	PCF50606_REG_ADCC2, PCF50606_REG_ACDC1, PCF50606_REG_BVMC,
-+	PCF50606_REG_PWMC1, PCF50606_REG_LEDC1, PCF50606_REG_LEDC2,
-+	PCF50606_REG_GPOC1, PCF50606_REG_GPOC2, PCF50606_REG_GPOC3,
-+	PCF50606_REG_GPOC4, PCF50606_REG_GPOC5,
-+};
-+
-+
-+static const u_int8_t initial_register_set[__NUM_PCF50606_REGS] = {
-+	[PCF50606_REG_OOCS] 	= 0x00,
-+	/* gap */
-+	[PCF50606_REG_INT1M]	= PCF50606_INT1_SECOND,
-+	[PCF50606_REG_INT2M]	= 0x00,
-+	[PCF50606_REG_INT3M]	= PCF50606_INT3_TSCPRES,
-+	[PCF50606_REG_OOCC1] 	= PCF50606_OOCC1_RTCWAK |
-+				  PCF50606_OOCC1_CHGWAK |
-+				  PCF50606_OOCC1_EXTONWAK_HIGH,
-+	[PCF50606_REG_OOCC2]	= PCF50606_OOCC2_ONKEYDB_14ms |
-+				  PCF50606_OOCC2_EXTONDB_14ms,
-+	/* gap */
-+	[PCF50606_REG_PSSC]	= 0x00,
-+	[PCF50606_REG_PWROKM]	= 0x00,
-+	/* gap */
-+#if defined(CONFIG_ARCH_GTA01B_v2)
-+	[PCF50606_REG_DCDC1]	= 0x1e,	/* GL_3V3: off */
-+#elif defined(CONFIG_ARCH_GTA01B_v3)
-+	[PCF50606_REG_DCDC1]	= 0x18,	/* GL_1V5: off */
-+#endif
-+	[PCF50606_REG_DCDC2]	= 0x00,
-+	[PCF50606_REG_DCDC3]	= 0x00,
-+	[PCF50606_REG_DCDC4]	= 0x30, /* 1.25A */
-+
-+	[PCF50606_REG_DCDEC1]	= 0xe8, /* IO_3V3: on */
-+	[PCF50606_REG_DCDEC2]	= 0x00,
-+
-+#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
-+	[PCF50606_REG_DCUDC1]	= 0xe3, /* CORE_1V8: 1.8V */
-+#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
-+	[PCF50606_REG_DCUDC1]	= 0xe4, /* CORE_1V8: 2.1V */
-+#endif
-+	[PCF50606_REG_DCUDC2]	= 0x30, /* 1.25A current limit */
-+
-+#if defined(CONFIG_ARCH_GTA01_v3)
-+	[PCF50606_REG_IOREGC]	= 0x13, /* VTCXO_2V8: off */
-+#elif defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
-+	//see internal bug 94 [PCF50606_REG_IOREGC]	= 0x18, /* CODEC_3V3: off */
-+	[PCF50606_REG_IOREGC]	= 0xf8, /* CODEC_3V3: on */
-+#endif
-+
-+#if defined(CONFIG_ARCH_GTA01_v3) || defined(CONFIG_ARCH_GTA01_v4)
-+	[PCF50606_REG_D1REGC1]	= 0x15, /* VRF_3V: off */
-+#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
-+	[PCF50606_REG_D1REGC1]	= 0x16, /* BT_3V15: off */
-+#endif
-+
-+#if defined(CONFIG_ARCH_GTA01_v3)
-+	[PCF50606_REG_D2REGC1]	= 0xf8, /* SD_3V3: on */
-+#elif defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
-+	[PCF50606_REG_D2REGC1]	= 0x10, /* GL_2V5: off */
-+#endif
-+
-+#if defined(CONFIG_ARCH_GTA01_v3)
-+	[PCF50606_REG_D3REGC1]	= 0x18, /* CODEC_3V3: off */
-+#elif defined(CONFIG_ARCH_GTA01_v4)
-+	[PCF50606_REG_D3REGC1]	= 0x13, /* VTXCO_2V8: off */
-+#elif defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
-+	[PCF50606_REG_D3REGC1]	= 0x00, /* USER1: off */
-+#endif
-+
-+	[PCF50606_REG_LPREGC1]	= 0xf8, /* LCM_3V3: on */
-+	[PCF50606_REG_LPREGC2]	= 0x00,
-+
-+	[PCF50606_REG_MBCC1]	= 0x01, /* CHGAPE */
-+	[PCF50606_REG_MBCC2]	= 0x00,	/* unlimited charging */
-+	[PCF50606_REG_MBCC3]	= 0x1a, /* 0.2*Ifast, 4.20V */
-+	[PCF50606_REG_BBCC]	= 0x13, /* 50uA */
-+	[PCF50606_REG_ADCC1]	= 0x00,
-+	[PCF50606_REG_ADCC2]	= 0x00,
-+	/* gap */
-+	[PCF50606_REG_ACDC1]	= 0x00,
-+	[PCF50606_REG_BVMC]	= PCF50606_BVMC_THRSHLD_2V8,
-+	[PCF50606_REG_PWMC1]	= 0x00,
-+	[PCF50606_REG_LEDC1]	= 0x00,
-+	[PCF50606_REG_LEDC2]	= 0x00,
-+	[PCF50606_REG_GPOC1]	= 0x00,
-+	[PCF50606_REG_GPOC2]	= 0x00,
-+	[PCF50606_REG_GPOC3]	= 0x00,
-+	[PCF50606_REG_GPOC4]	= 0x00,
-+	[PCF50606_REG_GPOC5]	= 0x00,
-+};
-+
-+
-+/* initialize PCF50606 register set */
-+void pcf50606_init(void)
-+{
-+#if 0
-+	/* We don't want to write to RTC, Alarm and other status registers
-+	 * but rather concentrate on efficiently writing/stting those we
-+	 * need */
-+
-+	pcf50606_reg_write(PCF50606_REG_OOCS,
-+			   initial_register_set[PCF50606_REG_OOCS]);
-+
-+	/* GAP: 0x02-0x04 */
-+
-+	i2c_write(PCF50606_I2C_ADDR, 0x05, 1,
-+		  &initial_register_set[0x05], 5);
-+
-+	/* GAP: 0x0a..0a17 */
-+
-+	i2c_write(PCF50606_I2C_ADDR, 0x18, 1,
-+		  &initial_register_set[0x18], 2);
-+
-+	/* GAP: 0x1a */
-+
-+	i2c_write(PCF50606_I2C_ADDR, 0x1b, 1,
-+		  &initial_register_set[0x1b], 17);
-+
-+	/* GAP: 0x2c */
-+
-+	i2c_write(PCF50606_I2C_ADDR, 0x2d, 1,
-+		  &initial_register_set[0x2d], 3);
-+
-+	/* GAP: 0x30-0x32 */
-+	i2c_write(PCF50606_I2C_ADDR, 0x23, 1,
-+		  &initial_register_set[0x33], 10);
-+#else
-+	int i;
-+	for (i = 0; i < ARRAY_SIZE(regs_valid); i++)
-+		pcf50606_reg_write(regs_valid[i],
-+				   initial_register_set[regs_valid[i]]);
-+#endif
-+}
-Index: u-boot/common/main.c
-===================================================================
---- u-boot.orig/common/main.c	2007-02-15 00:43:51.000000000 +0100
-+++ u-boot/common/main.c	2007-02-15 00:43:54.000000000 +0100
-@@ -61,6 +61,7 @@
- #undef DEBUG_PARSER
- 
- char        console_buffer[CFG_CBSIZE];		/* console I/O buffer	*/
-+int nobootdelay;
- 
- #ifndef CONFIG_CMDLINE_EDITING
- static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen);
-@@ -404,7 +405,7 @@
- 
- 	debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
- 
--	if (bootdelay >= 0 && s && !abortboot (bootdelay)) {
-+	if (!nobootdelay && bootdelay >= 0 && s && !abortboot (bootdelay)) {
- # ifdef CONFIG_AUTOBOOT_KEYED
- 		int prev = disable_ctrlc(1);	/* disable Control C checking */
- # endif

Added: trunk/src/target/u-boot/patches/uboot-s3c2410-mmc.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-mmc.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-mmc.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -0,0 +1,791 @@
+This patch adds MMC/SD support to the S3C2410 SoC code in
+u-boot
+
+Signed-off-by: Harald Welte <laforge at openmoko.org>
+
+Index: u-boot/cpu/arm920t/s3c24x0/Makefile
+===================================================================
+--- u-boot.orig/cpu/arm920t/s3c24x0/Makefile	2007-02-16 23:42:19.000000000 +0100
++++ u-boot/cpu/arm920t/s3c24x0/Makefile	2007-02-16 23:42:19.000000000 +0100
+@@ -26,7 +26,7 @@
+ LIB	= $(obj)lib$(SOC).a
+ 
+ COBJS	= i2c.o interrupts.o serial.o speed.o \
+-	  usb_ohci.o nand_read.o nand.o cmd_s3c2410.o
++	  usb_ohci.o nand_read.o nand.o mmc.o cmd_s3c2410.o
+ 
+ SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+Index: u-boot/cpu/arm920t/s3c24x0/mmc.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/cpu/arm920t/s3c24x0/mmc.c	2007-02-16 23:43:28.000000000 +0100
+@@ -0,0 +1,504 @@
++/*
++ * u-boot S3C2410 MMC/SD card driver
++ * (C) Copyright 2006 by OpenMoko, Inc.
++ * Author: Harald Welte <laforge at openmoko.org>
++ *
++ * based on u-boot pxa MMC driver and linux/drivers/mmc/s3c2410mci.c
++ * (C) 2005-2005 Thomas Kleffel
++ *
++ * 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>
++#include <common.h>
++#include <mmc.h>
++#include <asm/errno.h>
++#include <asm/io.h>
++#include <s3c2410.h>
++#include <part.h>
++
++#ifdef CONFIG_MMC
++
++#define CONFIG_MMC_WIDE
++
++//#define MMC_DEBUG
++
++#ifdef MMC_DEBUG
++#define DEBUGP printf
++#else
++#define DEBUGP(x, args ...) do { } while(0)
++#endif
++
++static S3C2410_SDI *sdi;
++
++extern int
++fat_register_device(block_dev_desc_t *dev_desc, int part_no);
++
++static block_dev_desc_t mmc_dev;
++
++block_dev_desc_t * mmc_get_dev(int dev)
++{
++	return ((block_dev_desc_t *)&mmc_dev);
++}
++
++/*
++ * FIXME needs to read cid and csd info to determine block size
++ * and other parameters
++ */
++static uchar mmc_buf[MMC_BLOCK_SIZE];
++static mmc_csd_t mmc_csd;
++static int mmc_ready = 0;
++static int wide = 0;
++
++
++#define CMD_F_RESP	0x01
++#define CMD_F_RESP_LONG	0x02
++
++static u_int32_t *
++/****************************************************/
++mmc_cmd(ushort cmd, ulong arg, ushort flags)
++/****************************************************/
++{
++	static u_int32_t resp[5];
++	ulong status;
++	int i;
++
++	u_int32_t ccon, csta;
++	u_int32_t csta_rdy_bit = S3C2410_SDICMDSTAT_CMDSENT;
++
++	memset(resp, 0, sizeof(resp));
++
++	DEBUGP("mmc_cmd CMD%d arg=0x%08x flags=%x\n", cmd, arg, flags);
++
++	sdi->SDICSTA = 0xffffffff;
++	sdi->SDIDSTA = 0xffffffff;
++	sdi->SDIFSTA = 0xffffffff;
++
++	sdi->SDICARG = arg;
++
++	ccon = cmd & S3C2410_SDICMDCON_INDEX;
++	ccon |= S3C2410_SDICMDCON_SENDERHOST|S3C2410_SDICMDCON_CMDSTART;
++
++	if (flags & CMD_F_RESP) {
++		ccon |= S3C2410_SDICMDCON_WAITRSP;
++		csta_rdy_bit = S3C2410_SDICMDSTAT_RSPFIN; /* 1 << 9 */
++	}
++
++	if (flags & CMD_F_RESP_LONG)
++		ccon |= S3C2410_SDICMDCON_LONGRSP;
++
++	sdi->SDICCON = ccon;
++
++	while (1) {
++		csta = sdi->SDICSTA;
++		if (csta & csta_rdy_bit)
++			break;
++		if (csta & S3C2410_SDICMDSTAT_CMDTIMEOUT) {
++			printf("===============> MMC CMD Timeout\n");
++			sdi->SDICSTA |= S3C2410_SDICMDSTAT_CMDTIMEOUT;
++			break;
++		}
++	}
++
++	DEBUGP("final MMC CMD status 0x%x\n", csta);
++
++	sdi->SDICSTA |= csta_rdy_bit;
++
++	if (flags & CMD_F_RESP) {
++		resp[0] = sdi->SDIRSP0;
++		resp[1] = sdi->SDIRSP1;
++		resp[2] = sdi->SDIRSP2;
++		resp[3] = sdi->SDIRSP3;
++	}
++
++	return resp;
++}
++
++#define FIFO_FILL(host) ((host->SDIFSTA & S3C2410_SDIFSTA_COUNTMASK) >> 2)
++
++static int
++/****************************************************/
++mmc_block_read(uchar *dst, ulong src, ulong len)
++/****************************************************/
++{
++	u_int32_t dcon, fifo;
++	u_int32_t *dst_u32 = (u_int32_t *)dst;
++	u_int32_t *resp;
++
++	if (len == 0) {
++		return 0;
++	}
++
++	DEBUGP("mmc_block_rd dst %lx src %lx len %d\n", (ulong)dst, src, len);
++
++	/* set block len */
++	resp = mmc_cmd(MMC_CMD_SET_BLOCKLEN, len, CMD_F_RESP);
++	sdi->SDIBSIZE = len;
++
++	//sdi->SDIPRE = 0xff;
++
++	/* setup data */
++	dcon = (len >> 9) & S3C2410_SDIDCON_BLKNUM_MASK;
++	dcon |= S3C2410_SDIDCON_BLOCKMODE;
++	dcon |= S3C2410_SDIDCON_RXAFTERCMD|S3C2410_SDIDCON_XFER_RXSTART;
++	if (wide)
++		dcon |= S3C2410_SDIDCON_WIDEBUS;
++	sdi->SDIDCON = dcon;
++
++	/* send read command */
++	resp = mmc_cmd(MMC_CMD_READ_BLOCK, src, CMD_F_RESP);
++
++	while (len > 0) {
++		u_int32_t sdidsta = sdi->SDIDSTA;
++		fifo = FIFO_FILL(sdi);
++		if (sdidsta & (S3C2410_SDIDSTA_FIFOFAIL|
++				S3C2410_SDIDSTA_CRCFAIL|
++				S3C2410_SDIDSTA_RXCRCFAIL|
++				S3C2410_SDIDSTA_DATATIMEOUT)) {
++			printf("mmc_block_read: err SDIDSTA=0x%08x\n", sdidsta);
++			return -EIO;
++		}
++
++		while (fifo--) {
++			//DEBUGP("dst_u32 = 0x%08x\n", dst_u32);
++			*(dst_u32++) = sdi->SDIDAT;
++			if (len >= 4)
++				len -= 4;
++			else {
++				len = 0;
++				break;
++			}
++		}
++	}
++
++	DEBUGP("waiting for SDIDSTA  (currently 0x%08x\n", sdi->SDIDSTA);
++	while (!(sdi->SDIDSTA & (1 << 4))) {}
++	DEBUGP("done waiting for SDIDSTA (currently 0x%08x\n", sdi->SDIDSTA);
++
++	sdi->SDIDCON = 0;
++
++	if (!(sdi->SDIDSTA & S3C2410_SDIDSTA_XFERFINISH))
++		DEBUGP("mmc_block_read; transfer not finished!\n");
++
++	return 0;
++}
++
++static int
++/****************************************************/
++mmc_block_write(ulong dst, uchar *src, int len)
++/****************************************************/
++{
++	printf("MMC block write not yet supported on S3C2410!\n");
++	return -1;
++}
++
++
++int
++/****************************************************/
++mmc_read(ulong src, uchar *dst, int size)
++/****************************************************/
++{
++	ulong end, part_start, part_end, part_len, aligned_start, aligned_end;
++	ulong mmc_block_size, mmc_block_address;
++
++	if (size == 0) {
++		return 0;
++	}
++
++	if (!mmc_ready) {
++		printf("Please initialize the MMC first\n");
++		return -1;
++	}
++
++	mmc_block_size = MMC_BLOCK_SIZE;
++	mmc_block_address = ~(mmc_block_size - 1);
++
++	src -= CFG_MMC_BASE;
++	end = src + size;
++	part_start = ~mmc_block_address & src;
++	part_end = ~mmc_block_address & end;
++	aligned_start = mmc_block_address & src;
++	aligned_end = mmc_block_address & end;
++
++	/* all block aligned accesses */
++	DEBUGP("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++	src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++	if (part_start) {
++		part_len = mmc_block_size - part_start;
++		DEBUGP("ps src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++		src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++		if ((mmc_block_read(mmc_buf, aligned_start, mmc_block_size)) < 0) {
++			return -1;
++		}
++		memcpy(dst, mmc_buf+part_start, part_len);
++		dst += part_len;
++		src += part_len;
++	}
++	DEBUGP("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++	src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++	for (; src < aligned_end; src += mmc_block_size, dst += mmc_block_size) {
++		DEBUGP("al src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++		src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++		if ((mmc_block_read((uchar *)(dst), src, mmc_block_size)) < 0) {
++			return -1;
++		}
++	}
++	DEBUGP("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++	src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++	if (part_end && src < end) {
++		DEBUGP("pe src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++		src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++		if ((mmc_block_read(mmc_buf, aligned_end, mmc_block_size)) < 0) {
++			return -1;
++		}
++		memcpy(dst, mmc_buf, part_end);
++	}
++	return 0;
++}
++
++int
++/****************************************************/
++mmc_write(uchar *src, ulong dst, int size)
++/****************************************************/
++{
++	ulong end, part_start, part_end, part_len, aligned_start, aligned_end;
++	ulong mmc_block_size, mmc_block_address;
++
++	if (size == 0) {
++		return 0;
++	}
++
++	if (!mmc_ready) {
++		printf("Please initialize the MMC first\n");
++		return -1;
++	}
++
++	mmc_block_size = MMC_BLOCK_SIZE;
++	mmc_block_address = ~(mmc_block_size - 1);
++
++	dst -= CFG_MMC_BASE;
++	end = dst + size;
++	part_start = ~mmc_block_address & dst;
++	part_end = ~mmc_block_address & end;
++	aligned_start = mmc_block_address & dst;
++	aligned_end = mmc_block_address & end;
++
++	/* all block aligned accesses */
++	DEBUGP("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++	src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++	if (part_start) {
++		part_len = mmc_block_size - part_start;
++		DEBUGP("ps src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++		(ulong)src, dst, end, part_start, part_end, aligned_start, aligned_end);
++		if ((mmc_block_read(mmc_buf, aligned_start, mmc_block_size)) < 0) {
++			return -1;
++		}
++		memcpy(mmc_buf+part_start, src, part_len);
++		if ((mmc_block_write(aligned_start, mmc_buf, mmc_block_size)) < 0) {
++			return -1;
++		}
++		dst += part_len;
++		src += part_len;
++	}
++	DEBUGP("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++	src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++	for (; dst < aligned_end; src += mmc_block_size, dst += mmc_block_size) {
++		DEBUGP("al src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++		src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++		if ((mmc_block_write(dst, (uchar *)src, mmc_block_size)) < 0) {
++			return -1;
++		}
++	}
++	DEBUGP("src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++	src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++	if (part_end && dst < end) {
++		DEBUGP("pe src %lx dst %lx end %lx pstart %lx pend %lx astart %lx aend %lx\n",
++		src, (ulong)dst, end, part_start, part_end, aligned_start, aligned_end);
++		if ((mmc_block_read(mmc_buf, aligned_end, mmc_block_size)) < 0) {
++			return -1;
++		}
++		memcpy(mmc_buf, src, part_end);
++		if ((mmc_block_write(aligned_end, mmc_buf, mmc_block_size)) < 0) {
++			return -1;
++		}
++	}
++	return 0;
++}
++
++ulong
++/****************************************************/
++mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst)
++/****************************************************/
++{
++	int mmc_block_size = MMC_BLOCK_SIZE;
++	ulong src = blknr * mmc_block_size + CFG_MMC_BASE;
++
++	mmc_read(src, (uchar *)dst, blkcnt*mmc_block_size);
++	return blkcnt;
++}
++
++static u_int16_t rca = MMC_DEFAULT_RCA;
++
++static u_int32_t mmc_size(const struct mmc_csd *csd)
++{
++	u_int32_t block_len, mult, blocknr;
++
++	block_len = csd->read_bl_len << 12;
++	mult = csd->c_size_mult1 << 8;
++	blocknr = (csd->c_size+1) * mult;
++
++	return blocknr * block_len;
++}
++
++int
++/****************************************************/
++mmc_init(int verbose)
++/****************************************************/
++{
++ 	int retries, rc = -ENODEV;
++	int is_sd = 0;
++	u_int32_t *resp;
++	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
++
++	sdi = S3C2410_GetBase_SDI();
++
++	DEBUGP("mmc_init(PCLK=%u)\n", get_PCLK());
++
++	clk_power->CLKCON |= (1 << 9);
++
++	/* S3C2410 has some bug that prevents reliable operation at higher speed */
++	//sdi->SDIPRE = 0x3e;  /* SDCLK = PCLK/2 / (SDIPRE+1) = 396kHz */
++	sdi->SDIPRE = 0x02;  /* SDCLK = PCLK/2 / (SDIPRE+1) = 396kHz */
++	sdi->SDIBSIZE = 512;
++	sdi->SDIDTIMER = 0xffff;
++	sdi->SDIIMSK = 0x0;
++	sdi->SDICON = S3C2410_SDICON_FIFORESET|S3C2440_SDICON_MMCCLOCK;
++	udelay(125000); /* FIXME: 74 SDCLK cycles */
++
++	mmc_csd.c_size = 0;
++
++	/* reset */
++	retries = 10;
++	resp = mmc_cmd(MMC_CMD_RESET, 0, 0);
++
++	printf("trying to detect SD Card...\n");
++	while (retries--) {
++		int i;
++		udelay(100000);
++		resp = mmc_cmd(55, 0x00000000, CMD_F_RESP);
++		resp = mmc_cmd(41, 0x00300000, CMD_F_RESP);
++
++		if (resp[0] & (1 << 31)) {
++			is_sd = 1;
++			break;
++		}
++	}
++
++	if (retries == 0 && !is_sd) {
++		retries = 10;
++		printf("failed to detect SD Card, trying MMC\n");
++		resp = mmc_cmd(MMC_CMD_SEND_OP_COND, 0x00ffc000, CMD_F_RESP);
++		while (retries-- && resp && !(resp[4] & 0x80)) {
++			DEBUGP("resp %x %x\n", resp[0], resp[1]);
++			udelay(50);
++			resp = mmc_cmd(1, 0x00ffff00, CMD_F_RESP);
++		}
++	}
++
++	/* try to get card id */
++	resp = mmc_cmd(MMC_CMD_ALL_SEND_CID, 0, CMD_F_RESP|CMD_F_RESP_LONG);
++	if (resp) {
++		/* TODO configure mmc driver depending on card attributes */
++		mmc_cid_t *cid = (mmc_cid_t *)resp;
++		if (verbose) {
++			printf("MMC found. Card desciption is:\n");
++			printf("Manufacturer ID = %02x%02x%02x\n",
++							cid->id[0], cid->id[1], cid->id[2]);
++			printf("HW/FW Revision = %x %x\n",cid->hwrev, cid->fwrev);
++			cid->hwrev = cid->fwrev = 0;	/* null terminate string */
++			printf("Product Name = %s\n",cid->name);
++			printf("Serial Number = %02x%02x%02x\n",
++							cid->sn[0], cid->sn[1], cid->sn[2]);
++			printf("Month = %d\n",cid->month);
++			printf("Year = %d\n",1997 + cid->year);
++		}
++		/* fill in device description */
++		mmc_dev.if_type = IF_TYPE_MMC;
++		mmc_dev.part_type = PART_TYPE_DOS;
++		mmc_dev.dev = 0;
++		mmc_dev.lun = 0;
++		mmc_dev.type = 0;
++		/* FIXME fill in the correct size (is set to 32MByte) */
++		mmc_dev.blksz = 512;
++		mmc_dev.lba = 0x10000;
++		sprintf(mmc_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x",
++				cid->id[0], cid->id[1], cid->id[2],
++				cid->sn[0], cid->sn[1], cid->sn[2]);
++		sprintf(mmc_dev.product,"%s",cid->name);
++		sprintf(mmc_dev.revision,"%x %x",cid->hwrev, cid->fwrev);
++		mmc_dev.removable = 0;
++		mmc_dev.block_read = mmc_bread;
++
++		/* MMC exists, get CSD too */
++		resp = mmc_cmd(MMC_CMD_SET_RCA, MMC_DEFAULT_RCA, CMD_F_RESP);
++		if (is_sd)
++			rca = resp[0] >> 16;
++
++		resp = mmc_cmd(MMC_CMD_SEND_CSD, rca<<16, CMD_F_RESP|CMD_F_RESP_LONG);
++		if (resp) {
++			mmc_csd_t *csd = (mmc_csd_t *)resp;
++			memcpy(&mmc_csd, csd, sizeof(csd));
++			rc = 0;
++			mmc_ready = 1;
++			/* FIXME add verbose printout for csd */
++			printf("READ_BL_LEN=%u, C_SIZE_MULT=%u, C_SIZE=%u\n",
++				csd->read_bl_len, csd->c_size_mult1, csd->c_size);
++			printf("size = %u\n", mmc_size(csd));
++		}
++	}
++
++	resp = mmc_cmd(MMC_CMD_SELECT_CARD, rca<<16, CMD_F_RESP);
++
++#ifdef CONFIG_MMC_WIDE
++	if (is_sd) {
++		resp = mmc_cmd(55, rca<<16, CMD_F_RESP);
++		resp = mmc_cmd(6, 0x02, CMD_F_RESP);
++		wide = 1;
++	}
++#endif
++
++	fat_register_device(&mmc_dev,1); /* partitions start counting with 1 */
++
++	return rc;
++}
++
++int
++mmc_ident(block_dev_desc_t *dev)
++{
++	return 0;
++}
++
++int
++mmc2info(ulong addr)
++{
++	/* FIXME hard codes to 32 MB device */
++	if (addr >= CFG_MMC_BASE && addr < CFG_MMC_BASE + 0x02000000) {
++		return 1;
++	}
++	return 0;
++}
++
++#endif	/* CONFIG_MMC */
+Index: u-boot/include/asm-arm/arch-s3c24x0/mmc.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/include/asm-arm/arch-s3c24x0/mmc.h	2007-02-16 23:42:19.000000000 +0100
+@@ -0,0 +1,112 @@
++/*
++ *  linux/drivers/mmc/mmc_pxa.h
++ *
++ *  Author: Vladimir Shebordaev, Igor Oblakov
++ *  Copyright:  MontaVista Software Inc.
++ *
++ *  $Id: mmc_pxa.h,v 0.3.1.6 2002/09/25 19:25:48 ted Exp ted $
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License version 2 as
++ *  published by the Free Software Foundation.
++ */
++#ifndef __MMC_PXA_P_H__
++#define __MMC_PXA_P_H__
++
++#include <asm/arch/regs-sdi.h>
++
++#define MMC_DEFAULT_RCA			(1<<16)
++
++#define MMC_BLOCK_SIZE			512
++#define MMC_CMD_RESET			0
++#define MMC_CMD_SEND_OP_COND		1
++#define MMC_CMD_ALL_SEND_CID 		2
++#define MMC_CMD_SET_RCA			3
++#define MMC_CMD_SELECT_CARD		7
++#define MMC_CMD_SEND_CSD 		9
++#define MMC_CMD_SEND_CID 		10
++#define MMC_CMD_SEND_STATUS		13
++#define MMC_CMD_SET_BLOCKLEN		16
++#define MMC_CMD_READ_BLOCK		17
++#define MMC_CMD_RD_BLK_MULTI		18
++#define MMC_CMD_WRITE_BLOCK		24
++
++#define MMC_MAX_BLOCK_SIZE		512
++
++#define MMC_R1_IDLE_STATE		0x01
++#define MMC_R1_ERASE_STATE		0x02
++#define MMC_R1_ILLEGAL_CMD		0x04
++#define MMC_R1_COM_CRC_ERR		0x08
++#define MMC_R1_ERASE_SEQ_ERR		0x01
++#define MMC_R1_ADDR_ERR			0x02
++#define MMC_R1_PARAM_ERR		0x04
++
++#define MMC_R1B_WP_ERASE_SKIP		0x0002
++#define MMC_R1B_ERR			0x0004
++#define MMC_R1B_CC_ERR			0x0008
++#define MMC_R1B_CARD_ECC_ERR		0x0010
++#define MMC_R1B_WP_VIOLATION		0x0020
++#define MMC_R1B_ERASE_PARAM		0x0040
++#define MMC_R1B_OOR			0x0080
++#define MMC_R1B_IDLE_STATE		0x0100
++#define MMC_R1B_ERASE_RESET		0x0200
++#define MMC_R1B_ILLEGAL_CMD		0x0400
++#define MMC_R1B_COM_CRC_ERR		0x0800
++#define MMC_R1B_ERASE_SEQ_ERR		0x1000
++#define MMC_R1B_ADDR_ERR		0x2000
++#define MMC_R1B_PARAM_ERR		0x4000
++
++typedef struct mmc_cid
++{
++/* FIXME: BYTE_ORDER */
++   uchar year:4,
++   month:4;
++   uchar sn[3];
++   uchar fwrev:4,
++   hwrev:4;
++   uchar name[6];
++   uchar id[3];
++} mmc_cid_t;
++
++typedef struct mmc_csd
++{
++	uchar	ecc:2,
++		file_format:2,
++		tmp_write_protect:1,
++		perm_write_protect:1,
++		copy:1,
++		file_format_grp:1;
++	uint64_t content_prot_app:1,
++		rsvd3:4,
++		write_bl_partial:1,
++		write_bl_len:4,
++		r2w_factor:3,
++		default_ecc:2,
++		wp_grp_enable:1,
++		wp_grp_size:5,
++		erase_grp_mult:5,
++		erase_grp_size:5,
++		c_size_mult1:3,
++		vdd_w_curr_max:3,
++		vdd_w_curr_min:3,
++		vdd_r_curr_max:3,
++		vdd_r_curr_min:3,
++		c_size:12,
++		rsvd2:2,
++		dsr_imp:1,
++		read_blk_misalign:1,
++		write_blk_misalign:1,
++		read_bl_partial:1;
++
++	ushort	read_bl_len:4,
++		ccc:12;
++	uchar	tran_speed;
++	uchar	nsac;
++	uchar	taac;
++	uchar	rsvd1:2,
++  		spec_vers:4,
++		csd_structure:2;
++} mmc_csd_t;
++
++
++#endif /* __MMC_PXA_P_H__ */
+Index: u-boot/include/asm-arm/arch-s3c24x0/regs-sdi.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/include/asm-arm/arch-s3c24x0/regs-sdi.h	2007-02-16 23:42:19.000000000 +0100
+@@ -0,0 +1,110 @@
++/* linux/include/asm/arch-s3c2410/regs-sdi.h
++ *
++ * Copyright (c) 2004 Simtec Electronics <linux at simtec.co.uk>
++ *		      http://www.simtec.co.uk/products/SWLINUX/
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ * S3C2410 MMC/SDIO register definitions
++ *
++ *  Changelog:
++ *    18-Aug-2004 Ben Dooks      Created initial file
++ *    29-Nov-2004 Koen Martens   Added some missing defines, fixed duplicates
++ *    29-Nov-2004 Ben Dooks	 Updated Koen's patch
++*/
++
++#ifndef __ASM_ARM_REGS_SDI
++#define __ASM_ARM_REGS_SDI "regs-sdi.h"
++
++#define S3C2440_SDICON_SDRESET        (1<<8)
++#define S3C2440_SDICON_MMCCLOCK       (1<<5)
++#define S3C2410_SDICON_BYTEORDER      (1<<4)
++#define S3C2410_SDICON_SDIOIRQ        (1<<3)
++#define S3C2410_SDICON_RWAITEN        (1<<2)
++#define S3C2410_SDICON_FIFORESET      (1<<1)
++#define S3C2410_SDICON_CLOCKTYPE      (1<<0)
++
++#define S3C2410_SDICMDCON_ABORT       (1<<12)
++#define S3C2410_SDICMDCON_WITHDATA    (1<<11)
++#define S3C2410_SDICMDCON_LONGRSP     (1<<10)
++#define S3C2410_SDICMDCON_WAITRSP     (1<<9)
++#define S3C2410_SDICMDCON_CMDSTART    (1<<8)
++#define S3C2410_SDICMDCON_SENDERHOST  (1<<6)
++#define S3C2410_SDICMDCON_INDEX       (0x3f)
++
++#define S3C2410_SDICMDSTAT_CRCFAIL    (1<<12)
++#define S3C2410_SDICMDSTAT_CMDSENT    (1<<11)
++#define S3C2410_SDICMDSTAT_CMDTIMEOUT (1<<10)
++#define S3C2410_SDICMDSTAT_RSPFIN     (1<<9)
++#define S3C2410_SDICMDSTAT_XFERING    (1<<8)
++#define S3C2410_SDICMDSTAT_INDEX      (0xff)
++
++#define S3C2440_SDIDCON_DS_BYTE       (0<<22)
++#define S3C2440_SDIDCON_DS_HALFWORD   (1<<22)
++#define S3C2440_SDIDCON_DS_WORD       (2<<22)
++#define S3C2410_SDIDCON_IRQPERIOD     (1<<21)
++#define S3C2410_SDIDCON_TXAFTERRESP   (1<<20)
++#define S3C2410_SDIDCON_RXAFTERCMD    (1<<19)
++#define S3C2410_SDIDCON_BUSYAFTERCMD  (1<<18)
++#define S3C2410_SDIDCON_BLOCKMODE     (1<<17)
++#define S3C2410_SDIDCON_WIDEBUS       (1<<16)
++#define S3C2410_SDIDCON_DMAEN         (1<<15)
++#define S3C2410_SDIDCON_STOP          (1<<14)
++#define S3C2440_SDIDCON_DATSTART      (1<<14)
++#define S3C2410_SDIDCON_DATMODE	      (3<<12)
++#define S3C2410_SDIDCON_BLKNUM        (0x7ff)
++
++/* constants for S3C2410_SDIDCON_DATMODE */
++#define S3C2410_SDIDCON_XFER_READY    (0<<12)
++#define S3C2410_SDIDCON_XFER_CHKSTART (1<<12)
++#define S3C2410_SDIDCON_XFER_RXSTART  (2<<12)
++#define S3C2410_SDIDCON_XFER_TXSTART  (3<<12)
++
++#define S3C2410_SDIDCON_BLKNUM_MASK   (0xFFF)
++#define S3C2410_SDIDCNT_BLKNUM_SHIFT  (12)
++
++#define S3C2410_SDIDSTA_RDYWAITREQ    (1<<10)
++#define S3C2410_SDIDSTA_SDIOIRQDETECT (1<<9)
++#define S3C2410_SDIDSTA_FIFOFAIL      (1<<8)	/* reserved on 2440 */
++#define S3C2410_SDIDSTA_CRCFAIL       (1<<7)
++#define S3C2410_SDIDSTA_RXCRCFAIL     (1<<6)
++#define S3C2410_SDIDSTA_DATATIMEOUT   (1<<5)
++#define S3C2410_SDIDSTA_XFERFINISH    (1<<4)
++#define S3C2410_SDIDSTA_BUSYFINISH    (1<<3)
++#define S3C2410_SDIDSTA_SBITERR       (1<<2)	/* reserved on 2410a/2440 */
++#define S3C2410_SDIDSTA_TXDATAON      (1<<1)
++#define S3C2410_SDIDSTA_RXDATAON      (1<<0)
++
++#define S3C2440_SDIFSTA_FIFORESET      (1<<16)
++#define S3C2440_SDIFSTA_FIFOFAIL       (3<<14)  /* 3 is correct (2 bits) */
++#define S3C2410_SDIFSTA_TFDET          (1<<13)
++#define S3C2410_SDIFSTA_RFDET          (1<<12)
++#define S3C2410_SDIFSTA_TFHALF         (1<<11)
++#define S3C2410_SDIFSTA_TFEMPTY        (1<<10)
++#define S3C2410_SDIFSTA_RFLAST         (1<<9)
++#define S3C2410_SDIFSTA_RFFULL         (1<<8)
++#define S3C2410_SDIFSTA_RFHALF         (1<<7)
++#define S3C2410_SDIFSTA_COUNTMASK      (0x7f)
++
++#define S3C2410_SDIIMSK_RESPONSECRC    (1<<17)
++#define S3C2410_SDIIMSK_CMDSENT        (1<<16)
++#define S3C2410_SDIIMSK_CMDTIMEOUT     (1<<15)
++#define S3C2410_SDIIMSK_RESPONSEND     (1<<14)
++#define S3C2410_SDIIMSK_READWAIT       (1<<13)
++#define S3C2410_SDIIMSK_SDIOIRQ        (1<<12)
++#define S3C2410_SDIIMSK_FIFOFAIL       (1<<11)
++#define S3C2410_SDIIMSK_CRCSTATUS      (1<<10)
++#define S3C2410_SDIIMSK_DATACRC        (1<<9)
++#define S3C2410_SDIIMSK_DATATIMEOUT    (1<<8)
++#define S3C2410_SDIIMSK_DATAFINISH     (1<<7)
++#define S3C2410_SDIIMSK_BUSYFINISH     (1<<6)
++#define S3C2410_SDIIMSK_SBITERR        (1<<5)	/* reserved 2440/2410a */
++#define S3C2410_SDIIMSK_TXFIFOHALF     (1<<4)
++#define S3C2410_SDIIMSK_TXFIFOEMPTY    (1<<3)
++#define S3C2410_SDIIMSK_RXFIFOLAST     (1<<2)
++#define S3C2410_SDIIMSK_RXFIFOFULL     (1<<1)
++#define S3C2410_SDIIMSK_RXFIFOHALF     (1<<0)
++
++#endif /* __ASM_ARM_REGS_SDI */
+Index: u-boot/include/s3c24x0.h
+===================================================================
+--- u-boot.orig/include/s3c24x0.h	2007-02-16 23:42:02.000000000 +0100
++++ u-boot/include/s3c24x0.h	2007-02-16 23:42:19.000000000 +0100
+@@ -637,13 +637,7 @@
+ 	S3C24X0_REG32	SDIDCNT;
+ 	S3C24X0_REG32	SDIDSTA;
+ 	S3C24X0_REG32	SDIFSTA;
+-#ifdef __BIG_ENDIAN
+-	S3C24X0_REG8	res[3];
+-	S3C24X0_REG8	SDIDAT;
+-#else
+-	S3C24X0_REG8	SDIDAT;
+-	S3C24X0_REG8	res[3];
+-#endif
++	S3C24X0_REG32	SDIDAT;
+ 	S3C24X0_REG32	SDIIMSK;
+ } /*__attribute__((__packed__))*/ S3C2410_SDI;
+ 
+@@ -1123,11 +1117,7 @@
+ #define rSDIDatCnt		(*(volatile unsigned *)0x5A000030)
+ #define rSDIDatSta		(*(volatile unsigned *)0x5A000034)
+ #define rSDIFSTA		(*(volatile unsigned *)0x5A000038)
+-#ifdef __BIG_ENDIAN
+-#define rSDIDAT			(*(volatile unsigned char *)0x5A00003F)
+-#else
+-#define rSDIDAT			(*(volatile unsigned char *)0x5A00003C)
+-#endif
++#define rSDIDAT			(*(volatile unsigned *)0x5A00003C)
+ #define rSDIIntMsk		(*(volatile unsigned *)0x5A000040)
+ 
+ #endif

Added: trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-nand.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -0,0 +1,484 @@
+This patch adds NAND (including boot-from-NAND via steppingstone) support to
+the S3C2410 SoC code in u-boot
+
+Signed-off-by: Harald Welte <laforge at openmoko.org>
+
+Index: u-boot/cpu/arm920t/s3c24x0/Makefile
+===================================================================
+--- u-boot.orig/cpu/arm920t/s3c24x0/Makefile	2007-02-16 23:23:38.000000000 +0100
++++ u-boot/cpu/arm920t/s3c24x0/Makefile	2007-02-16 23:24:10.000000000 +0100
+@@ -26,7 +26,7 @@
+ LIB	= $(obj)lib$(SOC).a
+ 
+ COBJS	= i2c.o interrupts.o serial.o speed.o \
+-	  usb_ohci.o
++	  usb_ohci.o nand_read.o nand.o
+ 
+ SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+ OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+Index: u-boot/cpu/arm920t/s3c24x0/nand.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/cpu/arm920t/s3c24x0/nand.c	2007-02-16 23:25:05.000000000 +0100
+@@ -0,0 +1,185 @@
++/*
++ * (C) Copyright 2006 OpenMoko, Inc.
++ * Author: Harald Welte <laforge at openmoko.org>
++ *
++ * 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 <common.h>
++
++#if 0
++#define DEBUGN	printf
++#else
++#define DEBUGN(x, args ...) {}
++#endif
++
++#if (CONFIG_COMMANDS & CFG_CMD_NAND)
++#if !defined(CFG_NAND_LEGACY)
++
++#include <nand.h>
++#include <s3c2410.h>
++
++#define __REGb(x)	(*(volatile unsigned char *)(x))
++#define __REGi(x)	(*(volatile unsigned int *)(x))
++
++#define	NF_BASE		0x4e000000
++#define	NFCONF		__REGi(NF_BASE + 0x0)
++#define	NFCMD		__REGb(NF_BASE + 0x4)
++#define	NFADDR		__REGb(NF_BASE + 0x8)
++#define	NFDATA		__REGb(NF_BASE + 0xc)
++#define	NFSTAT		__REGb(NF_BASE + 0x10)
++
++#define S3C2410_NFCONF_EN          (1<<15)
++#define S3C2410_NFCONF_512BYTE     (1<<14)
++#define S3C2410_NFCONF_4STEP       (1<<13)
++#define S3C2410_NFCONF_INITECC     (1<<12)
++#define S3C2410_NFCONF_nFCE        (1<<11)
++#define S3C2410_NFCONF_TACLS(x)    ((x)<<8)
++#define S3C2410_NFCONF_TWRPH0(x)   ((x)<<4)
++#define S3C2410_NFCONF_TWRPH1(x)   ((x)<<0)
++
++static void s3c2410_hwcontrol(struct mtd_info *mtd, int cmd)
++{
++	struct nand_chip *chip = mtd->priv;
++
++	DEBUGN("hwcontrol(): 0x%02x: ", cmd);
++
++	switch (cmd) {
++	case NAND_CTL_SETNCE:
++		NFCONF &= ~S3C2410_NFCONF_nFCE;
++		DEBUGN("NFCONF=0x%08x\n", NFCONF);
++		break;
++	case NAND_CTL_CLRNCE:
++		NFCONF |= S3C2410_NFCONF_nFCE;
++		DEBUGN("NFCONF=0x%08x\n", NFCONF);
++		break;
++	case NAND_CTL_SETALE:
++		chip->IO_ADDR_W = NF_BASE + 0x8;
++		DEBUGN("SETALE\n");
++		break;
++	case NAND_CTL_SETCLE:
++		chip->IO_ADDR_W = NF_BASE + 0x4;
++		DEBUGN("SETCLE\n");
++		break;
++	default:
++		chip->IO_ADDR_W = NF_BASE + 0xc;
++		break;
++	}
++	return;
++}
++
++static int s3c2410_dev_ready(struct mtd_info *mtd)
++{
++	DEBUGN("dev_ready\n");
++	return (NFSTAT & 0x01);
++}
++
++static void s3c2410_cmdfunc(struct mtd_info *mtd, unsigned cmd,
++			    int column, int page_addr)
++{
++	DEBUGN("cmdfunc(): 0x%02x, col=%d, page=%d\n", cmd, column, page_addr);
++
++	switch (cmd) {
++	case NAND_CMD_READ0:
++	case NAND_CMD_READ1:
++	case NAND_CMD_READOOB:
++		NFCMD = cmd;
++		NFADDR = column & 0xff;
++		NFADDR = page_addr & 0xff;
++		NFADDR = (page_addr >> 8) & 0xff;
++		NFADDR = (page_addr >> 16) & 0xff;
++		break;
++	case NAND_CMD_READID:
++		NFCMD = cmd;
++		NFADDR = 0;
++		break;
++	case NAND_CMD_PAGEPROG:
++		NFCMD = cmd;
++		printf("PAGEPROG not implemented\n");
++		break;
++	case NAND_CMD_ERASE1:
++		NFCMD = cmd;
++		NFADDR = page_addr & 0xff;
++		NFADDR = (page_addr >> 8) & 0xff;
++		NFADDR = (page_addr >> 16) & 0xff;
++		break;
++	case NAND_CMD_ERASE2:
++		NFCMD = cmd;
++		break;
++	case NAND_CMD_SEQIN:
++		printf("SEQIN not implemented\n");
++		break;
++	case NAND_CMD_STATUS:
++		NFCMD = cmd;
++		break;
++	case NAND_CMD_RESET:
++		NFCMD = cmd;
++		break;
++	default:
++		break;
++	}
++
++	while (!s3c2410_dev_ready(mtd));
++}
++
++int board_nand_init(struct nand_chip *nand)
++{
++	u_int32_t cfg;
++	u_int8_t tacls, twrph0, twrph1;
++	S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
++
++	DEBUGN("board_nand_init()\n");
++
++	clk_power->CLKCON |= (1 << 4);
++
++	/* initialize hardware */
++	twrph0 = 3; twrph1 = 0; tacls = 0;
++
++	cfg = S3C2410_NFCONF_EN;
++	cfg |= S3C2410_NFCONF_TACLS(tacls - 1);
++	cfg |= S3C2410_NFCONF_TWRPH0(twrph0 - 1);
++	cfg |= S3C2410_NFCONF_TWRPH1(twrph1 - 1);
++
++	NFCONF = cfg;
++	//NFCONF = 0xf842;
++
++	/* initialize nand_chip data structure */
++	nand->IO_ADDR_R = nand->IO_ADDR_W = 0x4e00000c;
++
++	/* read_buf and write_buf are default */
++	/* read_byte and write_byte are default */
++
++	/* hwcontrol always must be implemented */
++	nand->hwcontrol = s3c2410_hwcontrol;
++
++	nand->dev_ready = s3c2410_dev_ready;
++
++	nand->eccmode = NAND_ECC_SOFT;
++#ifdef CONFIG_S3C2410_NAND_BBT
++	nand->options = NAND_USE_FLASH_BBT;
++#else
++	nand->options = 0;
++#endif
++
++	DEBUGN("end of nand_init\n");
++
++	return 0;
++}
++
++#else
++ #error "U-Boot legacy NAND support not available for S3C2410"
++#endif
++#endif
+Index: u-boot/cpu/arm920t/s3c24x0/nand_read.c
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ u-boot/cpu/arm920t/s3c24x0/nand_read.c	2007-02-16 23:24:10.000000000 +0100
+@@ -0,0 +1,97 @@
++/*
++ * nand_read.c: Simple NAND read functions for booting from NAND
++ *
++ * This is used by cpu/arm920/start.S assembler code,
++ * and the board-specific linker script must make sure this
++ * file is linked within the first 4kB of NAND flash.
++ *
++ * Taken from GPLv2 licensed vivi bootloader,
++ * Copyright (C) 2002 MIZI Research, Inc.
++ *
++ * Author: Hwang, Chideok <hwang at mizi.com>
++ * Date  : $Date: 2004/02/04 10:37:37 $
++ *
++ * u-boot integration and bad-block skipping (C) 2006 by OpenMoko, Inc.
++ * Author: Harald Welte <laforge at openmoko.org>
++ */
++
++#include <common.h>
++
++#ifdef CONFIG_S3C2410_NAND_BOOT
++
++#define __REGb(x)	(*(volatile unsigned char *)(x))
++#define __REGi(x)	(*(volatile unsigned int *)(x))
++#define NF_BASE		0x4e000000
++#define NFCONF		__REGi(NF_BASE + 0x0)
++#define NFCMD		__REGb(NF_BASE + 0x4)
++#define NFADDR		__REGb(NF_BASE + 0x8)
++#define NFDATA		__REGb(NF_BASE + 0xc)
++#define NFSTAT		__REGb(NF_BASE + 0x10)
++
++#define BUSY 1
++inline void wait_idle(void)
++{
++	int i;
++
++	while (!(NFSTAT & BUSY))
++		for (i=0; i<10; i++);
++}
++
++#define NAND_SECTOR_SIZE	512
++#define NAND_BLOCK_MASK		(NAND_SECTOR_SIZE - 1)
++
++/* low level nand read function */
++int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
++{
++	int i, j;
++
++	if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK))
++		return -1;	/* invalid alignment */
++
++	/* chip Enable */
++	NFCONF &= ~0x800;
++	for (i=0; i<10; i++);
++
++	for (i=start_addr; i < (start_addr + size);) {
++#ifdef CONFIG_S3C2410_NAND_SKIP_BAD
++		if (start_addr % NAND_PAGE_SIZE == 0) {
++			unsigned char data;
++			NFCMD = 0x50;
++			NFADDR = 517&0xf;
++			NFADDR = (i >> 9) & 0xff;
++			NFADDR = (i >> 17) & 0xff;
++			NFADDR = (i >> 25) & 0xff;
++			wait_idle();
++			data = (NFDATA & 0xff);
++			if (data != 0xff) {
++				/* Bad block */
++				i += NAND_PAGE_SIZE;
++				size += NAND_PAGE_SIZE;
++				continue;
++			}
++		}
++#endif
++		/* READ0 */
++		NFCMD = 0;
++
++		/* Write Address */
++		NFADDR = i & 0xff;
++		NFADDR = (i >> 9) & 0xff;
++		NFADDR = (i >> 17) & 0xff;
++		NFADDR = (i >> 25) & 0xff;
++
++		wait_idle();
++
++		for (j=0; j < NAND_SECTOR_SIZE; j++, i++) {
++			*buf = (NFDATA & 0xff);
++			buf++;
++		}
++	}
++
++	/* chip Disable */
++	NFCONF |= 0x800;	/* chip disable */
++
++	return 0;
++}
++
++#endif /* CONFIG_S3C2410_NAND_BOOT */
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S	2007-02-16 23:23:38.000000000 +0100
++++ u-boot/cpu/arm920t/start.S	2007-02-16 23:24:10.000000000 +0100
+@@ -5,6 +5,10 @@
+  *  Copyright (c) 2002	Alex Züpke <azu at sysgo.de>
+  *  Copyright (c) 2002	Gary Jennejohn <gj at denx.de>
+  *
++ * S3C2410 NAND portions
++ *  Copyright (c) 2001  MIZI Research, Inc.
++ *  Copyright (c) 2006  OpenMoko, Inc. (Harald Welte <laforge at openmmoko.org>
++ *
+  * See file CREDITS for list of people who contributed to this
+  * project.
+  *
+@@ -27,6 +31,7 @@
+ 
+ #include <config.h>
+ #include <version.h>
++#include <s3c2410.h>
+ 
+ 
+ /*
+@@ -161,6 +166,7 @@
+ #endif
+ 
+ #ifndef CONFIG_SKIP_RELOCATE_UBOOT
++#ifndef CONFIG_S3C2410_NAND_BOOT
+ relocate:				/* relocate U-Boot to RAM	    */
+ 	adr	r0, _start		/* r0 <- current position of code   */
+ 	ldr	r1, _TEXT_BASE		/* test if we run from flash or RAM */
+@@ -177,6 +183,93 @@
+ 	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */
+ 	cmp	r0, r2			/* until source end addreee [r2]    */
+ 	ble	copy_loop
++#else /* NAND_BOOT */
++relocate:
++copy_myself:
++	/* mov	r10, lr */
++
++	@ reset NAND
++	mov	r1, #S3C2410_NAND_BASE
++	ldr	r2, =0xf842		@ initial value enable tacls=3,rph0=6,rph1=0
++	str	r2, [r1, #oNFCONF]
++	ldr	r2, [r1, #oNFCONF]
++	bic	r2, r2, #0x800		@ enable chip
++	str	r2, [r1, #oNFCONF]
++	mov	r2, #0xff		@ RESET command
++	strb	r2, [r1, #oNFCMD]
++	mov	r3, #0			@ wait
++1:	add	r3, r3, #0x1
++	cmp	r3, #0xa
++	blt	1b
++2:	ldr	r2, [r1, #oNFSTAT]	@ wait ready
++	tst	r2, #0x1
++	beq	2b
++	ldr	r2, [r1, #oNFCONF]
++	orr	r2, r2, #0x800		@ disable chip
++	str	r2, [r1, #oNFCONF]
++
++#if 0
++	@ get ready to call C functions (for nand_read())
++	ldr	sp, DW_STACK_START	@ setup stack pointer
++	mov	fp, #0			@ no previous frame, so fp=0
++#else
++	ldr	r0, _TEXT_BASE		/* upper 128 KiB: relocated uboot   */
++	sub	r0, r0, #CFG_MALLOC_LEN	/* malloc area                      */
++	sub	r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo                        */
++#ifdef CONFIG_USE_IRQ
++	sub	r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
++#endif
++	sub	sp, r0, #12		/* leave 3 words for abort-stack    */
++#endif
++
++	@ copy u-boot to RAM
++	ldr	r0, _TEXT_BASE
++	mov     r1, #0x0
++	mov	r2, #0x30000
++	bl	nand_read_ll
++
++	tst	r0, #0x0
++	beq	ok_nand_read
++#ifdef CONFIG_DEBUG_LL
++bad_nand_read:
++	ldr	r0, STR_FAIL
++	ldr	r1, SerBase
++	bl	PrintWord
++1:	b	1b		@ infinite loop
++#endif
++
++ok_nand_read:
++#ifdef CONFIG_DEBUG_LL
++	ldr	r0, STR_OK
++	ldr	r1, SerBase
++	bl	PrintWord
++#endif
++
++	@ verify
++	mov	r0, #0
++	@ldr	r1, =0x33f00000
++	ldr	r1, _TEXT_BASE
++	mov	r2, #0x400	@ 4 bytes * 1024 = 4K-bytes
++go_next:
++	ldr	r3, [r0], #4
++	ldr	r4, [r1], #4
++	teq	r3, r4
++	bne	notmatch
++	subs	r2, r2, #4
++	beq	done_nand_read
++	bne	go_next
++notmatch:
++#ifdef CONFIG_DEBUG_LL
++	sub	r0, r0, #4
++	ldr	r1, SerBase
++	bl	PrintHexWord
++	ldr	r0, STR_FAIL
++	ldr	r1, SerBase
++	bl	PrintWord
++#endif
++1:	b	1b
++done_nand_read:
++#endif /* NAND_BOOT */
+ #endif	/* CONFIG_SKIP_RELOCATE_UBOOT */
+ 
+ 	/* Set up the stack						    */
+Index: u-boot/include/s3c2410.h
+===================================================================
+--- u-boot.orig/include/s3c2410.h	2007-02-16 23:24:07.000000000 +0100
++++ u-boot/include/s3c2410.h	2007-02-16 23:24:10.000000000 +0100
+@@ -38,12 +38,6 @@
+ #define S3C2410_ECCSIZE		512
+ #define S3C2410_ECCBYTES	3
+ 
+-typedef enum {
+-	S3C24X0_UART0,
+-	S3C24X0_UART1,
+-	S3C24X0_UART2
+-} S3C24X0_UARTS_NR;
+-
+ /* S3C2410 device base addresses */
+ #define S3C24X0_MEMCTL_BASE		0x48000000
+ #define S3C24X0_USB_HOST_BASE		0x49000000
+@@ -65,9 +59,23 @@
+ #define S3C2410_SDI_BASE		0x5A000000
+ 
+ 
++#define oNFCONF			0x00
++#define oNFCMD			0x04
++#define oNFADDR			0x08
++#define oNFDATA			0x0C
++#define oNFSTAT			0x10
++#define oNFECC			0x14
++
++#ifndef __ASSEMBLER__
++
+ /* include common stuff */
+ #include <s3c24x0.h>
+ 
++typedef enum {
++	S3C24X0_UART0,
++	S3C24X0_UART1,
++	S3C24X0_UART2
++} S3C24X0_UARTS_NR;
+ 
+ static inline S3C24X0_MEMCTL * S3C24X0_GetBase_MEMCTL(void)
+ {
+@@ -142,6 +150,7 @@
+ 	return (S3C2410_SDI * const)S3C2410_SDI_BASE;
+ }
+ 
++#endif
+ 
+ /* ISR */
+ #define pISR_RESET		(*(unsigned *)(_ISR_STARTADDRESS+0x0))

Modified: trunk/src/target/u-boot/patches/uboot-s3c2410-warnings-fix.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-warnings-fix.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-warnings-fix.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,11 +1,11 @@
 Index: u-boot/include/s3c2410.h
 ===================================================================
---- u-boot.orig/include/s3c2410.h	2007-02-12 22:37:35.000000000 +0100
-+++ u-boot/include/s3c2410.h	2007-02-12 22:37:35.000000000 +0100
-@@ -77,75 +77,75 @@
- 	S3C24X0_UART2
- } S3C24X0_UARTS_NR;
+--- u-boot.orig/include/s3c2410.h	2007-02-16 23:53:20.000000000 +0100
++++ u-boot/include/s3c2410.h	2007-02-16 23:53:21.000000000 +0100
+@@ -69,75 +69,75 @@
+ #include <s3c24x0.h>
  
+ 
 -static inline S3C24X0_MEMCTL * const S3C24X0_GetBase_MEMCTL(void)
 +static inline S3C24X0_MEMCTL * S3C24X0_GetBase_MEMCTL(void)
  {

Modified: trunk/src/target/u-boot/patches/uboot-s3c2410_udc.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410_udc.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410_udc.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -2,8 +2,8 @@
 
 Index: u-boot/drivers/Makefile
 ===================================================================
---- u-boot.orig/drivers/Makefile	2007-02-09 00:34:24.000000000 +0100
-+++ u-boot/drivers/Makefile	2007-02-09 00:34:34.000000000 +0100
+--- u-boot.orig/drivers/Makefile	2007-02-16 23:57:07.000000000 +0100
++++ u-boot/drivers/Makefile	2007-02-16 23:57:08.000000000 +0100
 @@ -46,7 +46,7 @@
  	  sl811_usb.o sm501.o smc91111.o smiLynxEM.o \
  	  status_led.o sym53c8xx.o ahci.o \
@@ -16,7 +16,7 @@
 Index: u-boot/drivers/usbdcore_s3c2410.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/drivers/usbdcore_s3c2410.c	2007-02-09 01:17:48.000000000 +0100
++++ u-boot/drivers/usbdcore_s3c2410.c	2007-02-16 23:57:23.000000000 +0100
 @@ -0,0 +1,708 @@
 +/* S3C2410 USB Device Controller Driver for u-boot
 + *
@@ -615,7 +615,7 @@
 +void udc_connect (void)
 +{
 +	UDCDBG ("connect, enable Pullup");
-+#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2)
++#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
 +	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
 +
 +	/* create a short disconnect, since we might come out of reset */
@@ -633,7 +633,7 @@
 +{
 +	UDCDBG ("disconnect, disable Pullup");
 +	S3C24X0_INTERRUPT * irq = S3C24X0_GetBase_INTERRUPT();
-+#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2)
++#if defined(CONFIG_ARCH_GTA01_v4) || defined(CONFIG_ARCH_GTA01B_v2) || defined(CONFIG_ARCH_GTA01B_v3)
 +	S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
 +
 +	//s3c2410_gpio_setpin(GTA01_GPIO_USB_PULLUP, 0);
@@ -729,7 +729,7 @@
 Index: u-boot/drivers/usbdcore_s3c2410.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ u-boot/drivers/usbdcore_s3c2410.h	2007-02-09 00:34:34.000000000 +0100
++++ u-boot/drivers/usbdcore_s3c2410.h	2007-02-16 23:57:08.000000000 +0100
 @@ -0,0 +1,273 @@
 +/* linux/include/asm/arch-s3c2410/regs-udc.h
 + *
@@ -1006,8 +1006,8 @@
 +#endif
 Index: u-boot/include/s3c2410.h
 ===================================================================
---- u-boot.orig/include/s3c2410.h	2007-02-09 00:34:24.000000000 +0100
-+++ u-boot/include/s3c2410.h	2007-02-09 00:34:34.000000000 +0100
+--- u-boot.orig/include/s3c2410.h	2007-02-16 23:57:06.000000000 +0100
++++ u-boot/include/s3c2410.h	2007-02-16 23:57:08.000000000 +0100
 @@ -233,4 +233,40 @@
  		 rINTPND;\
  		 }
@@ -1051,8 +1051,8 @@
  #endif /*__S3C2410_H__*/
 Index: u-boot/drivers/usbdcore_ep0.c
 ===================================================================
---- u-boot.orig/drivers/usbdcore_ep0.c	2007-02-09 00:34:33.000000000 +0100
-+++ u-boot/drivers/usbdcore_ep0.c	2007-02-09 01:18:01.000000000 +0100
+--- u-boot.orig/drivers/usbdcore_ep0.c	2007-02-16 23:57:08.000000000 +0100
++++ u-boot/drivers/usbdcore_ep0.c	2007-02-16 23:57:08.000000000 +0100
 @@ -43,7 +43,7 @@
  
  #include <common.h>
@@ -1148,22 +1148,20 @@
  		case USB_REQ_SET_DESCRIPTOR:	/* XXX should we support this? */
 Index: u-boot/include/configs/neo1973.h
 ===================================================================
---- u-boot.orig/include/configs/neo1973.h	2007-02-09 00:34:24.000000000 +0100
-+++ u-boot/include/configs/neo1973.h	2007-02-09 01:17:48.000000000 +0100
-@@ -173,6 +173,18 @@
+--- u-boot.orig/include/configs/neo1973.h	2007-02-16 23:57:08.000000000 +0100
++++ u-boot/include/configs/neo1973.h	2007-02-16 23:57:08.000000000 +0100
+@@ -174,6 +174,16 @@
  #define CONFIG_USB_OHCI		1
  #endif
  
 +#define CONFIG_USB_DEVICE	1
 +#define CONFIG_USB_TTY		1
 +#define CFG_CONSOLE_IS_IN_ENV	1
-+#if 0
-+#define CONFIG_USBD_MANUFACTURER      "OpenMoko, Inc."
-+#define CONFIG_USBD_PRODUCT_NAME        "Neo1973 Bootloader"
-+#define CONFIG_USBD_VENDORID    0x2342
-+#define CONFIG_USBD_PRODUCTID   0x0815
-+#endif
-+
++#define CONFIG_USBD_VENDORID 		0x1457     /* Linux/NetChip */
++#define CONFIG_USBD_PRODUCTID_GSERIAL	0x5120    /* gserial */
++#define CONFIG_USBD_PRODUCTID_CDCACM 	0x5119    /* CDC ACM */
++#define CONFIG_USBD_MANUFACTURER	"OpenMoko, Inc"
++#define CONFIG_USBD_PRODUCT_NAME	"Neo1973 Bootloader " U_BOOT_VERSION
 +#define CONFIG_EXTRA_ENV_SETTINGS 	"usbtty=cdc_acm\0"
 +
  /*-----------------------------------------------------------------------
@@ -1171,8 +1169,8 @@
   */
 Index: u-boot/cpu/arm920t/s3c24x0/interrupts.c
 ===================================================================
---- u-boot.orig/cpu/arm920t/s3c24x0/interrupts.c	2007-02-09 00:34:24.000000000 +0100
-+++ u-boot/cpu/arm920t/s3c24x0/interrupts.c	2007-02-09 00:34:34.000000000 +0100
+--- u-boot.orig/cpu/arm920t/s3c24x0/interrupts.c	2007-02-16 23:57:08.000000000 +0100
++++ u-boot/cpu/arm920t/s3c24x0/interrupts.c	2007-02-16 23:57:08.000000000 +0100
 @@ -222,6 +222,13 @@
  	S3C24X0_INTERRUPT * irq = S3C24X0_GetBase_INTERRUPT();
  	u_int32_t intpnd = irq->INTPND;
@@ -1189,8 +1187,8 @@
  
 Index: u-boot/drivers/usbtty.h
 ===================================================================
---- u-boot.orig/drivers/usbtty.h	2007-02-09 00:34:33.000000000 +0100
-+++ u-boot/drivers/usbtty.h	2007-02-09 00:34:34.000000000 +0100
+--- u-boot.orig/drivers/usbtty.h	2007-02-16 23:57:08.000000000 +0100
++++ u-boot/drivers/usbtty.h	2007-02-16 23:57:08.000000000 +0100
 @@ -29,6 +29,8 @@
  #include "usbdcore_mpc8xx.h"
  #elif defined(CONFIG_OMAP1510)

Modified: trunk/src/target/u-boot/patches/uboot-strtoul.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-strtoul.patch	2007-02-16 20:56:48 UTC (rev 1021)
+++ trunk/src/target/u-boot/patches/uboot-strtoul.patch	2007-02-16 22:59:07 UTC (rev 1022)
@@ -1,5 +1,7 @@
 Make simple_strtoul work with upper-case hex numbers.
 
+Signed-off-by: Harald Welte <laforge at openmoko.org>
+
 Index: u-boot/lib_generic/vsprintf.c
 ===================================================================
 --- u-boot.orig/lib_generic/vsprintf.c





More information about the commitlog mailing list