aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-2.6.32/at91/linux-2.6.32-001-configurable-nand-partitions.patch
blob: 3823bdd47b5f1a7a57dda7ca2939fce646d1a602 (plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
This patch modifies the NAND partitions of Atmel SAM9 Evaluation Kits.
The size of the System partition is configured using KConfig

The new partition sizes is will become

Bootstrap partition:	4MB
System partition:	Programmable Size (default 124 MB)
Data partition:		Rest of NAND flash

It modifies the following Atmel SAM9 development boards.

* cap9adk
* sam9260ek
* sam9261ek
* sam9263ek
* sam9g20ek-2slot-mmc
* sam9g20ek
* sam9m10g45ek
* sam9rlek

The KConfig configuration is implemented so that each board supporting
this function selects "MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE".
which enables the MTD_NAND_ATMEL_ROOTFS_SIZE configuration item.

Signed-off-by: Ulf Samuelsson <ulf.samuelsson@atmel.com>
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/at91_nand_partitions.h linux-2.6.32/arch/arm/mach-at91/at91_nand_partitions.h
--- linux-2.6.32-0rig/arch/arm/mach-at91/at91_nand_partitions.h	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/at91_nand_partitions.h	2009-12-13 11:32:51.000000000 +0100
@@ -0,0 +1,45 @@
+/*
+ * linux/arch/arm/mach-at91/at91_nand_partitions.h
+ *
+ *  Copyright (C) 2005 SAN People
+ *  Copyright (C) 2006 Atmel
+ *  Copyright (C) 2009 Ulf Samuelsson, Atmel
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+/*
+ * NAND flash
+ */
+static struct mtd_partition __initdata at91_nand_partition[] = {
+	{
+		.name   = "Bootstrap",
+		.offset = 0,
+		.size   = 4 * SZ_1M,
+	},
+	{
+		.name	= "System",
+		.offset	= MTDPART_OFS_NXTBLK,
+		.size	= CONFIG_MTD_NAND_ATMEL_ROOTFS_SIZE * SZ_1M,
+	},
+	{
+		.name	= "Data",
+		.offset	= MTDPART_OFS_NXTBLK,
+		.size	= MTDPART_SIZ_FULL,
+	},
+};
+
+
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-cap9adk.c linux-2.6.32/arch/arm/mach-at91/board-cap9adk.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-cap9adk.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-cap9adk.c	2009-12-13 11:35:57.000000000 +0100
@@ -47,7 +47,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
-
+#include "at91_nand_partitions.h"
 
 static void __init cap9adk_map_io(void)
 {
@@ -162,22 +162,10 @@
 	.is_rmii	= 1,
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata cap9adk_nand_partitions[] = {
-	{
-		.name	= "NAND partition",
-		.offset	= 0,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(cap9adk_nand_partitions);
-	return cap9adk_nand_partitions;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 static struct atmel_nand_data __initdata cap9adk_nand_data = {
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9260ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9260ek.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9260ek.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-sam9260ek.c	2009-12-13 11:35:21.000000000 +0100
@@ -47,6 +47,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
+#include "at91_nand_partitions.h"
 
 
 static void __init ek_map_io(void)
@@ -161,27 +162,10 @@
 	.is_rmii	= 1,
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-	{
-		.name	= "Partition 1",
-		.offset	= 0,
-		.size	= SZ_256K,
-	},
-	{
-		.name	= "Partition 2",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(ek_nand_partition);
-	return ek_nand_partition;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 static struct atmel_nand_data __initdata ek_nand_data = {
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9261ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9261ek.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9261ek.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-sam9261ek.c	2009-12-13 11:35:13.000000000 +0100
@@ -51,6 +51,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
+#include "at91_nand_partitions.h"
 
 
 static void __init ek_map_io(void)
@@ -177,27 +178,10 @@
 //	.vcc_pin	= ... not connected
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-	{
-		.name	= "Partition 1",
-		.offset	= 0,
-		.size	= SZ_256K,
-	},
-	{
-		.name	= "Partition 2",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(ek_nand_partition);
-	return ek_nand_partition;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 static struct atmel_nand_data __initdata ek_nand_data = {
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9263ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9263ek.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9263ek.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-sam9263ek.c	2009-12-13 11:34:43.000000000 +0100
@@ -50,6 +50,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
+#include "at91_nand_partitions.h"
 
 
 static void __init ek_map_io(void)
@@ -168,27 +169,10 @@
 	.is_rmii	= 1,
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-	{
-		.name	= "Partition 1",
-		.offset	= 0,
-		.size	= SZ_64M,
-	},
-	{
-		.name	= "Partition 2",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(ek_nand_partition);
-	return ek_nand_partition;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 static struct atmel_nand_data __initdata ek_nand_data = {
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c	2009-12-13 11:35:44.000000000 +0100
@@ -42,6 +42,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
+#include "at91_nand_partitions.h"
 
 
 static void __init ek_map_io(void)
@@ -117,32 +118,10 @@
 	.is_rmii	= 1,
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-	{
-		.name   = "Bootstrap",
-		.offset = 0,
-		.size   = 4 * SZ_1M,
-	},
-	{
-		.name	= "Partition 1",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= 60 * SZ_1M,
-	},
-	{
-		.name	= "Partition 2",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(ek_nand_partition);
-	return ek_nand_partition;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 /* det_pin is not connected */
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9g20ek.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-sam9g20ek.c	2009-12-13 11:35:50.000000000 +0100
@@ -43,6 +43,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
+#include "at91_nand_partitions.h"
 
 
 static void __init ek_map_io(void)
@@ -118,32 +119,10 @@
 	.is_rmii	= 1,
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-	{
-		.name   = "Bootstrap",
-		.offset = 0,
-		.size   = 4 * SZ_1M,
-	},
-	{
-		.name	= "Partition 1",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= 60 * SZ_1M,
-	},
-	{
-		.name	= "Partition 2",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(ek_nand_partition);
-	return ek_nand_partition;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 /* det_pin is not connected */
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9m10g45ek.c linux-2.6.32/arch/arm/mach-at91/board-sam9m10g45ek.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9m10g45ek.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-sam9m10g45ek.c	2009-12-13 11:35:37.000000000 +0100
@@ -44,6 +44,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
+#include "at91_nand_partitions.h"
 
 
 static void __init ek_map_io(void)
@@ -106,27 +107,10 @@
 	.is_rmii	= 1,
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-	{
-		.name	= "Partition 1",
-		.offset	= 0,
-		.size	= SZ_64M,
-	},
-	{
-		.name	= "Partition 2",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(ek_nand_partition);
-	return ek_nand_partition;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 /* det_pin is not connected */
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9rlek.c linux-2.6.32/arch/arm/mach-at91/board-sam9rlek.c
--- linux-2.6.32-0rig/arch/arm/mach-at91/board-sam9rlek.c	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/board-sam9rlek.c	2009-12-13 11:35:27.000000000 +0100
@@ -36,6 +36,7 @@
 
 #include "sam9_smc.h"
 #include "generic.h"
+#include "at91_nand_partitions.h"
 
 
 static void __init ek_map_io(void)
@@ -77,27 +78,10 @@
 //	.vcc_pin	= ... not connected
 };
 
-
-/*
- * NAND flash
- */
-static struct mtd_partition __initdata ek_nand_partition[] = {
-	{
-		.name	= "Partition 1",
-		.offset	= 0,
-		.size	= SZ_256K,
-	},
-	{
-		.name	= "Partition 2",
-		.offset	= MTDPART_OFS_NXTBLK,
-		.size	= MTDPART_SIZ_FULL,
-	},
-};
-
 static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
 {
-	*num_partitions = ARRAY_SIZE(ek_nand_partition);
-	return ek_nand_partition;
+	*num_partitions = ARRAY_SIZE(at91_nand_partition);
+	return at91_nand_partition;
 }
 
 static struct atmel_nand_data __initdata ek_nand_data = {
diff -urN linux-2.6.32-0rig/arch/arm/mach-at91/Kconfig linux-2.6.32/arch/arm/mach-at91/Kconfig
--- linux-2.6.32-0rig/arch/arm/mach-at91/Kconfig	2009-12-13 10:32:25.000000000 +0100
+++ linux-2.6.32/arch/arm/mach-at91/Kconfig	2009-12-13 11:01:29.000000000 +0100
@@ -183,6 +183,7 @@
 config MACH_AT91SAM9260EK
 	bool "Atmel AT91SAM9260-EK / AT91SAM9XE Evaluation Kit"
 	depends on ARCH_AT91SAM9260
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91SAM9260-EK or AT91SAM9XE Evaluation Kit
 	  <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3933>
@@ -242,6 +243,7 @@
 config MACH_AT91SAM9261EK
 	bool "Atmel AT91SAM9261-EK Evaluation Kit"
 	depends on ARCH_AT91SAM9261
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91SAM9261-EK Evaluation Kit.
 	  <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3820>
@@ -257,6 +259,7 @@
 config MACH_AT91SAM9G10EK
 	bool "Atmel AT91SAM9G10-EK Evaluation Kit"
 	depends on ARCH_AT91SAM9G10
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91SAM9G10-EK Evaluation Kit.
 	  <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4588>
@@ -272,6 +275,7 @@
 config MACH_AT91SAM9263EK
 	bool "Atmel AT91SAM9263-EK Evaluation Kit"
 	depends on ARCH_AT91SAM9263
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91SAM9263-EK Evaluation Kit.
 	  <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4057>
@@ -300,6 +304,7 @@
 config MACH_AT91SAM9RLEK
 	bool "Atmel AT91SAM9RL-EK Evaluation Kit"
 	depends on ARCH_AT91SAM9RL
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91SAM9RL-EK Evaluation Kit.
 
@@ -314,6 +319,7 @@
 config MACH_AT91SAM9G20EK
 	bool "Atmel AT91SAM9G20-EK Evaluation Kit"
 	depends on ARCH_AT91SAM9G20
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91SAM9G20-EK Evaluation Kit
 	  that embeds only one SD/MMC slot.
@@ -321,6 +327,7 @@
 config MACH_AT91SAM9G20EK_2MMC
 	bool "Atmel AT91SAM9G20-EK Evaluation Kit with 2 SD/MMC Slots"
 	depends on ARCH_AT91SAM9G20
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using an Atmel AT91SAM9G20-EK Evaluation Kit
 	  with 2 SD/MMC Slots. This is the case for AT91SAM9G20-EK rev. C and
@@ -344,6 +351,7 @@
 config MACH_AT91SAM9G45EKES
 	bool "Atmel AT91SAM9G45-EKES Evaluation Kit"
 	depends on ARCH_AT91SAM9G45
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91SAM9G45-EKES Evaluation Kit.
 	  "ES" at the end of the name means that this board is an
@@ -360,6 +368,7 @@
 config MACH_AT91CAP9ADK
 	bool "Atmel AT91CAP9A-DK Evaluation Kit"
 	depends on ARCH_AT91CAP9
+	select MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
 	help
 	  Select this if you are using Atmel's AT91CAP9A-DK Evaluation Kit.
 	  <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4138>
@@ -399,6 +408,24 @@
 	  On AT91SAM926x boards both types of NAND flash can be present
 	  (8 and 16 bit data bus width).
 
+config MTD_NAND_ATMEL_ROOTFS_SIZE
+	int "Size NAND rootfs in MB"
+	range 8 250
+	depends on MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+	default "124"
+	help
+	  Many Atmel development boards has a NAND Flash, 
+	  divided into three partitions.
+          1) Boot partition (4 MB)
+	  2) Root FS
+	  3) Data partition
+	  This allows you to configure the size of the root fs
+	  with the remainder ending up in the data partition.
+	  The legal values are between 8 and 250
+
+config MTD_NAND_ALLOW_CONFIGURABLE_ROOTFS_SIZE
+	bool
+
 # ----------------------------------------------------------
 
 comment "AT91 Feature Selections"