---
 arch/arm/mach-s3c2410/mach-h1940.c |   49 	49 +	0 -	0 !
 drivers/mtd/nand/s3c2410.c         |    2 	1 +	1 -	0 !
 2 files changed, 50 insertions(+), 1 deletion(-)

Index: linux-2.6/arch/arm/mach-s3c2410/mach-h1940.c
===================================================================
--- linux-2.6.orig/arch/arm/mach-s3c2410/mach-h1940.c	2006-11-23 23:30:49.000000000 +0100
+++ linux-2.6/arch/arm/mach-s3c2410/mach-h1940.c	2006-11-23 23:34:43.000000000 +0100
@@ -19,6 +19,9 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
@@ -44,6 +47,7 @@
 #include <asm/arch/ts.h>
 #include <asm/arch/lcd.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/nand.h>
 #include <asm/arch/buttons.h>
 
 #include <linux/serial_core.h>
@@ -147,6 +151,45 @@ static struct s3c24xx_mmc_platdata h1940
 	.gpio_detect    = S3C2410_GPF5,
 };
 
+static int chip0_map[] = { 0 };
+
+struct mtd_partition h1940_default_nand_part[] = {
+	{
+		.name   = "Whole flash",
+		.offset = 0,
+		.size   = MTDPART_SIZ_FULL,
+		.mask_flags = MTD_WRITEABLE,
+	},
+	{
+		.name   = "Kernel",
+		.offset = 0x50000,
+		.size   = 0x4d0000,
+	},
+	{
+ 		.name   = "Root",
+		.offset = 0x520000,
+		.size   = MTDPART_SIZ_FULL,
+	},
+};
+
+static struct s3c2410_nand_set h1940_nand_sets[] = {
+ 	{
+		.name           = "chip0",
+		.nr_chips       = 1,
+		.nr_map         = chip0_map,
+		.nr_partitions  = ARRAY_SIZE(h1940_default_nand_part),
+		.partitions     = h1940_default_nand_part
+	},
+};
+
+static struct s3c2410_platform_nand h1940_nand_info = {
+	.tacls          = 8,
+	.twrph0         = 38,
+	.twrph1         = 16,
+	.nr_sets        = ARRAY_SIZE(h1940_nand_sets),
+	.sets           = h1940_nand_sets,
+};
+
 /**
  * Set lcd on or off
  **/
@@ -346,6 +389,12 @@ static void __init h1940_init(void)
 	      | (0x02 << S3C2410_PLLCON_PDIVSHIFT)
 	      | (0x03 << S3C2410_PLLCON_SDIVSHIFT);
 	writel(tmp, S3C2410_UPLLCON);
+
+	/* Add nand partitioning */
+	s3c_device_nand.dev.platform_data = &h1940_nand_info;
+
+	/* Turn on the NAND write support */
+	/*s3c2410_gpio_setpin(S3C2410_GPA0, 1);*/
 }
 
 MACHINE_START(H1940, "IPAQ-H1940")
Index: linux-2.6/drivers/mtd/nand/s3c2410.c
===================================================================
--- linux-2.6.orig/drivers/mtd/nand/s3c2410.c	2006-11-23 21:51:47.000000000 +0100
+++ linux-2.6/drivers/mtd/nand/s3c2410.c	2006-11-23 23:32:41.000000000 +0100
@@ -81,7 +81,7 @@ static const int clock_stop = 0;
 
 static struct nand_ecclayout nand_hw_eccoob = {
 	.eccbytes = 3,
-	.eccpos = {0, 1, 2},
+	.eccpos = {8, 9, 10 },
 	.oobfree = {{8, 8}}
 };
 
