diff -urN -X ../dontdiff linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/Kconfig linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/Kconfig --- linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/Kconfig 2004-09-17 15:19:38.000000000 +0100 +++ linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/Kconfig 2004-09-25 20:51:50.000000000 +0100 @@ -71,5 +71,19 @@ amount of time, as well as using an significant percantage of the CPU time doing so. +if ARCH_BAST + +comment "BAST Setup" + +config BAST_NAND + bool "BAST Extended NAND support" + depends on ARCH_BAST + help + Extended support for NAND flash on the Simtec EB2410ITX (BAST) + including supporting on-board chips and the SmartMedia socket. + + Note, this does not current support hot-plugging of the NAND + interface. +endif endif diff -urN -X ../dontdiff linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/Makefile linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/Makefile --- linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/Makefile 2004-09-17 15:19:38.000000000 +0100 +++ linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/Makefile 2004-09-25 20:51:13.000000000 +0100 @@ -26,3 +26,6 @@ obj-$(CONFIG_ARCH_SMDK2410) += mach-smdk2410.o obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o +# bast extra support + +obj-$(CONFIG_BAST_NAND) += bast-nand.o \ No newline at end of file diff -urN -X ../dontdiff linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/bast-nand.c linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/bast-nand.c --- linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/bast-nand.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/bast-nand.c 2004-09-26 00:38:06.000000000 +0100 @@ -0,0 +1,125 @@ +/* linux/arch/arm/mach-s3c2410/bast-nand.c + * + * Copyright (c) 2004 Simtec Electronics + * Ben Dooks + * + * http://www.simtec.co.uk/products/EB2410ITX/ + * + * 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. + * + * Modifications: + * 23-Sep-2004 BJD Initial support for NAND devices on BAST + * 25-Sep-2004 BJD Fixes for new mtd code +*/ + +//#define DEBUG + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +/* NAND Flash */ + +static int smartmedia_map[] = { 0 }; +static int chip0_map[] = { 1 }; +static int chip1_map[] = { 2 }; +static int chip2_map[] = { 3 }; + +struct mtd_partition bast_default_nand_part[] = { + [0] = { + .name = "Boot Agent", + .size = 16*1024, + .offset = 0 + }, + [1] = { + .name = "/boot", + .size = (4*1024*1024)-(16*1024), + .offset = 16*1024, + }, + [2] = { + .name = "user", + .offset = 4*1024*1024, + .size = MTDPART_SIZ_FULL, + } +}; + +static struct s3c2410_nand_set bast_nand_sets[] = { + [0] = { + .name = "SmartMedia", + .nr_chips = 1, + .nr_map = smartmedia_map, + .nr_partitions = ARRAY_SIZE(bast_default_nand_part), + .partitions = bast_default_nand_part + }, + [1] = { + .name = "chip0", + .nr_chips = 1, + .nr_map = chip0_map, + .nr_partitions = ARRAY_SIZE(bast_default_nand_part), + .partitions = bast_default_nand_part + }, + [2] = { + .name = "chip1", + .nr_chips = 1, + .nr_map = chip1_map, + .nr_partitions = ARRAY_SIZE(bast_default_nand_part), + .partitions = bast_default_nand_part + }, + [3] = { + .name = "chip2", + .nr_chips = 1, + .nr_map = chip2_map, + .nr_partitions = ARRAY_SIZE(bast_default_nand_part), + .partitions = bast_default_nand_part + } +}; + +static void bast_nand_select(struct s3c2410_nand_set *set, int slot) +{ + unsigned int tmp; + + slot = set->nr_map[slot] & 3; + + pr_debug("bast_nand: selecting slot %d (set %p,%p)\n", + slot, set, set->nr_map); + + tmp = __raw_readb(BAST_VA_CTRL2); + tmp &= BAST_CPLD_CTLR2_IDERST; + tmp |= slot; + tmp |= BAST_CPLD_CTRL2_WNAND; + + pr_debug("bast_nand: ctrl2 now %02x\n", tmp); + + __raw_writeb(tmp, BAST_VA_CTRL2); +} + +static struct s3c2410_platform_nand bast_nand_info = { + .tacls = 80, + .twrph0 = 80, + .twrph1 = 80, + .nr_sets = ARRAY_SIZE(bast_nand_sets), + .sets = bast_nand_sets, + .select_chip = bast_nand_select, +}; + +void __init bast_init_nand(struct device *dev) +{ + printk(KERN_INFO "BAST extended NAND flash support\n"); + dev->platform_data = &bast_nand_info; +} + diff -urN -X ../dontdiff linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/bast-nand.h linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/bast-nand.h --- linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/bast-nand.h 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/bast-nand.h 2004-09-25 19:28:58.000000000 +0100 @@ -0,0 +1,11 @@ +/* arch/arm/mach-s3c2410/bast-nand.h + */ + +#ifdef CONFIG_BAST_NAND +extern void bast_init_nand(struct device *dev); +#else +static void bast_init_nand(struct device *dev) +{ +} +#endif + diff -urN -X ../dontdiff linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/mach-bast.c linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/mach-bast.c --- linux-2.6.9-rc2-bk10-mtd-snap2/arch/arm/mach-s3c2410/mach-bast.c 2004-09-17 15:19:38.000000000 +0100 +++ linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/arch/arm/mach-s3c2410/mach-bast.c 2004-09-26 01:20:30.000000000 +0100 @@ -44,6 +44,7 @@ #include "s3c2410.h" #include "devs.h" #include "cpu.h" +#include "bast-nand.h" /* macros for virtual address mods for the io space entries */ #define VA_C5(item) ((item) + BAST_VAM_CS5) @@ -202,6 +203,7 @@ &s3c_device_i2c, &s3c_device_iis, &s3c_device_rtc, + &s3c_device_nand, &bast_device_nor }; @@ -214,6 +216,7 @@ { s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); s3c2410_init_uarts(bast_uartcfgs, ARRAY_SIZE(bast_uartcfgs)); + bast_init_nand(&s3c_device_nand.dev); s3c2410_set_board(&bast_board); } diff -urN -X ../dontdiff linux-2.6.9-rc2-bk10-mtd-snap2/include/asm-arm/arch-s3c2410/nand.h linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/include/asm-arm/arch-s3c2410/nand.h --- linux-2.6.9-rc2-bk10-mtd-snap2/include/asm-arm/arch-s3c2410/nand.h 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.9-rc2-bk10-mtd-snap2-work-clean1/include/asm-arm/arch-s3c2410/nand.h 2004-09-26 00:36:49.000000000 +0100 @@ -0,0 +1,48 @@ +/* linux/include/asm-arm/arch-s3c2410/nand.h + * + * (c) 2004 Simtec Electronics + * Ben Dooks + * + * S3C2410 - NAND device controller platfrom_device info + * + * 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. + * + * Changelog: + * 23-Sep-2004 BJD Created file +*/ + +/* struct s3c2410_nand_set + * + * define an set of one or more nand chips registered with an unique mtd + * + * nr_chips = number of chips in this set + * nr_partitions = number of partitions pointed to be partitoons (or zero) + * name = name of set (optional) + * nr_map = map for low-layer logical to physical chip numbers (option) + * partitions = mtd partition list +*/ + +struct s3c2410_nand_set { + int nr_chips; + int nr_partitions; + char *name; + int *nr_map; + struct mtd_partition *partitions; +}; + +struct s3c2410_platform_nand { + /* timing information for controller, all times in nanoseconds */ + + int tacls; /* time for active CLE/ALE to nWE/nOE */ + int twrph0; /* active time for nWE/nOE */ + int twrph1; /* time for release CLE/ALE from nWE/nOE inactive */ + + int nr_sets; + struct s3c2410_nand_set *sets; + + void (*select_chip)(struct s3c2410_nand_set *, + int chip); +}; +