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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
From c8955e56555dae6e308b3fa3ea91c8d823402bd5 Mon Sep 17 00:00:00 2001
From: Jiri Pinkava <jiri.pinkava@vscht.cz>
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 <jiri.pinkava@vscht.cz>
---
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 <linux/kernel.h>
#include <linux/types.h>
+#include <linux/delay.h>
#include <linux/gpio_keys.h>
#include <linux/init.h>
#include <linux/gpio.h>
@@ -49,10 +50,69 @@
#include <plat/cpu.h>
#include <plat/devs.h>
#include <plat/mci.h>
+#include <plat/nand.h>
#include <plat/s3c2410.h>
#include <plat/ts.h>
#include <plat/udc.h>
+#ifdef CONFIG_MTD_PARTITIONS
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/nand_ecc.h>
+#include <linux/mtd/partitions.h>
+
+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
|