1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
This patch adds a nand flash configuration for the n30.
Index: linux-2.6.14/arch/arm/mach-s3c2410/mach-n30.c
===================================================================
--- linux-2.6.14.orig/arch/arm/mach-s3c2410/mach-n30.c
+++ linux-2.6.14/arch/arm/mach-s3c2410/mach-n30.c
@@ -33,6 +33,8 @@
#include <linux/kthread.h>
#include <linux/mmc/protocol.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -55,6 +57,7 @@
#include <asm/arch/ts.h>
#include <asm/arch/buttons.h>
#include <asm/arch/mmc.h>
+#include <asm/arch/nand.h>
#include <linux/serial_core.h>
@@ -276,6 +279,50 @@ static struct s3c24xx_mmc_platdata n30_m
.ocr_avail = MMC_VDD_32_33,
};
+static int chip0_map[] = { 0 };
+
+struct mtd_partition n30_default_nand_part[] = {
+ {
+ .name = "Whole flash",
+ .offset = 0,
+ .size = MTDPART_SIZ_FULL,
+ .mask_flags = MTD_WRITEABLE,
+ },
+ {
+ .name = "Partition Table",
+ .offset = 0x28000,
+ .size = 0x8000,
+ },
+ {
+ .name = "Kernel",
+ .offset = 0x30000,
+ .size = 0x4d0000,
+ },
+ {
+ .name = "Root",
+ .offset = 0x500000,
+ .size = MTDPART_SIZ_FULL,
+ },
+};
+
+static struct s3c2410_nand_set n30_nand_sets[] = {
+ {
+ .name = "chip0",
+ .nr_chips = 1,
+ .nr_map = chip0_map,
+ .nr_partitions = ARRAY_SIZE(n30_default_nand_part),
+ .partitions = n30_default_nand_part
+ },
+};
+
+static struct s3c2410_platform_nand n30_nand_info = {
+ .tacls = 80,
+ .twrph0 = 80,
+ .twrph1 = 80,
+ .nr_sets = ARRAY_SIZE(n30_nand_sets),
+ .sets = n30_nand_sets,
+};
+
static struct platform_device *n30_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
@@ -287,6 +334,7 @@ static struct platform_device *n30_devic
&s3c_device_iis,
&s3c_device_usbgadget,
&s3c_device_sdi,
+ &s3c_device_nand,
};
static struct s3c2410_platform_i2c n30_i2ccfg = {
@@ -329,6 +377,14 @@ static void __init n30_init(void)
s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
s3c_device_sdi.dev.platform_data = &n30_mmc_cfg;
+ s3c_device_nand.dev.platform_data = &n30_nand_info;
+
+ /* Clear any locks and write protects on the flash. */
+ s3c2410_gpio_setpin(S3C2410_GPC5, 1);
+ msleep(1);
+ s3c2410_gpio_setpin(S3C2410_GPC5, 0);
+ msleep(1);
+ s3c2410_gpio_setpin(S3C2410_GPC5, 1);
/* Turn off suspend on both USB ports, and switch the
* selectable USB port to USB device mode. */
|