--- linux-3.1.6/arch/arm/mach-s3c2410/mach-n30.c.orig 2011-12-31 16:29:50.173870254 +0100 +++ linux-3.1.6/arch/arm/mach-s3c2410/mach-n30.c 2011-12-31 16:35:23.089570614 +0100 @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -49,10 +50,67 @@ #include #include #include +#include #include #include #include +#include +#include +#include +#include + +struct mtd_partition n35_default_nand_part[] = { + /* Original partitioning by manufacturer + * + * 0x0 - 0x3fff NBoot + * 0x4000 - 0x4fff TOC + * 0x8000 - 0x27fff Eboot + * 0x28000 - 0x2bfff partition table + * 0x2c000 - data ... + * FIXME: incomplete + * */ + { + .name = "bootloader", + .offset = 0, + .size = 0x28000, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "partition", + .offset = MTDPART_OFS_APPEND, + .size = 0x4000, + }, + { + .name = "kernel", + .offset = MTDPART_OFS_APPEND, + .size = 0x180000, + }, + { + .name = "rootfs", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + }, +}; + +static struct s3c2410_nand_set n35_nand_sets[] = { + { + .name = "chip0", + .nr_chips = 1, + .nr_partitions = ARRAY_SIZE(n35_default_nand_part), + .partitions = n35_default_nand_part, + }, +}; + +static struct s3c2410_platform_nand n35_nand_info = { + .tacls = 20, + .twrph0 = 35, + .twrph1 = 20, + .nr_sets = ARRAY_SIZE(n35_nand_sets), + .sets = n35_nand_sets, + .ignore_unset_ecc = 1, +}; + static struct map_desc n30_iodesc[] __initdata = { /* nothing here yet */ }; @@ -476,6 +534,7 @@ &s3c_device_rtc, &s3c_device_usbgadget, &s3c_device_sdi, + &s3c_device_nand, &s3c_device_adc, &s3c_device_ts, &s3c_device_timer[0], @@ -665,6 +724,16 @@ } if (machine_is_n35()) { + s3c_nand_set_platdata(&n35_nand_info); + + /* Clear any locks and write protects on the flash. */ + WARN_ON(gpio_request(S3C2410_GPC(5), "NAND write protection")); + gpio_set_value(S3C2410_GPC(5), 1); + udelay(1); + gpio_set_value(S3C2410_GPC(5), 0); + udelay(1); + gpio_set_value(S3C2410_GPC(5), 1); + /* Turn off suspend and switch the selectable USB port * to USB device mode. Turn on suspend for the host * port since it is not connected on the N35.