From c8955e56555dae6e308b3fa3ea91c8d823402bd5 Mon Sep 17 00:00:00 2001 From: Jiri Pinkava Date: Sat, 22 May 2010 05:01:39 +0200 Subject: [PATCH 08/14] n35: Support for NAND Flash on Acer n35 Signed-off-by: Jiri Pinkava --- arch/arm/mach-s3c2410/mach-n30.c | 73 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 73 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c index 3158165..c492f5d 100644 --- a/arch/arm/mach-s3c2410/mach-n30.c +++ b/arch/arm/mach-s3c2410/mach-n30.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -49,10 +50,69 @@ #include #include #include +#include #include #include #include +#ifdef CONFIG_MTD_PARTITIONS +#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, +}; +#endif + static struct map_desc n30_iodesc[] __initdata = { /* nothing here yet */ }; @@ -492,6 +552,9 @@ static struct platform_device *n35_devices[] __initdata = { &s3c_device_rtc, &s3c_device_usbgadget, &s3c_device_sdi, +#ifdef CONFIG_MTD_PARTITIONS + &s3c_device_nand, +#endif &s3c_device_adc, &s3c_device_ts, &s3c_device_timer[0], @@ -681,6 +744,16 @@ static void __init n30_init(void) } 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. -- 1.7.3.1