aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c8
-rw-r--r--arch/arm/mach-s3c2410/mach-qt2410.c8
-rw-r--r--arch/arm/mach-s3c2412/mach-jive.c11
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c10
-rw-r--r--arch/arm/mach-s3c2440/mach-anubis.c12
-rw-r--r--arch/arm/mach-s3c2440/mach-at2440evb.c8
-rw-r--r--arch/arm/mach-s3c2440/mach-mini2440.c4
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c11
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c9
-rw-r--r--arch/arm/mach-s3c2442/mach-gta02.c6
-rw-r--r--arch/arm/mach-s3c6410/mach-hmt.c2
-rw-r--r--arch/arm/plat-s3c/dev-nand.c97
-rw-r--r--arch/arm/plat-s3c/include/plat/nand.h8
-rw-r--r--arch/arm/plat-s3c24xx/common-smdk.c2
14 files changed, 151 insertions, 45 deletions
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 647c9adb018f..c1219b10b18c 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -247,7 +247,7 @@ static int chip0_map[] = { 1 };
247static int chip1_map[] = { 2 }; 247static int chip1_map[] = { 2 };
248static int chip2_map[] = { 3 }; 248static int chip2_map[] = { 3 };
249 249
250static struct mtd_partition bast_default_nand_part[] = { 250static struct mtd_partition __initdata bast_default_nand_part[] = {
251 [0] = { 251 [0] = {
252 .name = "Boot Agent", 252 .name = "Boot Agent",
253 .size = SZ_16K, 253 .size = SZ_16K,
@@ -273,7 +273,7 @@ static struct mtd_partition bast_default_nand_part[] = {
273 * socket. 273 * socket.
274*/ 274*/
275 275
276static struct s3c2410_nand_set bast_nand_sets[] = { 276static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
277 [0] = { 277 [0] = {
278 .name = "SmartMedia", 278 .name = "SmartMedia",
279 .nr_chips = 1, 279 .nr_chips = 1,
@@ -323,7 +323,7 @@ static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
323 __raw_writeb(tmp, BAST_VA_CTRL2); 323 __raw_writeb(tmp, BAST_VA_CTRL2);
324} 324}
325 325
326static struct s3c2410_platform_nand bast_nand_info = { 326static struct s3c2410_platform_nand __initdata bast_nand_info = {
327 .tacls = 30, 327 .tacls = 30,
328 .twrph0 = 60, 328 .twrph0 = 60,
329 .twrph1 = 60, 329 .twrph1 = 60,
@@ -625,7 +625,6 @@ static void __init bast_map_io(void)
625 625
626 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks)); 626 s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
627 627
628 s3c_device_nand.dev.platform_data = &bast_nand_info;
629 s3c_device_hwmon.dev.platform_data = &bast_hwmon_info; 628 s3c_device_hwmon.dev.platform_data = &bast_hwmon_info;
630 629
631 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc)); 630 s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
@@ -639,6 +638,7 @@ static void __init bast_init(void)
639 sysdev_register(&bast_pm_sysdev); 638 sysdev_register(&bast_pm_sysdev);
640 639
641 s3c_i2c0_set_platdata(&bast_i2c_info); 640 s3c_i2c0_set_platdata(&bast_i2c_info);
641 s3c_nand_set_platdata(&bast_nand_info);
642 s3c24xx_fb_set_platdata(&bast_fb_info); 642 s3c24xx_fb_set_platdata(&bast_fb_info);
643 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); 643 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
644 644
diff --git a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
index 2cc9849eb448..ab092bcda393 100644
--- a/arch/arm/mach-s3c2410/mach-qt2410.c
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c
@@ -258,7 +258,7 @@ static struct platform_device *qt2410_devices[] __initdata = {
258 &qt2410_led, 258 &qt2410_led,
259}; 259};
260 260
261static struct mtd_partition qt2410_nand_part[] = { 261static struct mtd_partition __initdata qt2410_nand_part[] = {
262 [0] = { 262 [0] = {
263 .name = "U-Boot", 263 .name = "U-Boot",
264 .size = 0x30000, 264 .size = 0x30000,
@@ -286,7 +286,7 @@ static struct mtd_partition qt2410_nand_part[] = {
286 }, 286 },
287}; 287};
288 288
289static struct s3c2410_nand_set qt2410_nand_sets[] = { 289static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
290 [0] = { 290 [0] = {
291 .name = "NAND", 291 .name = "NAND",
292 .nr_chips = 1, 292 .nr_chips = 1,
@@ -299,7 +299,7 @@ static struct s3c2410_nand_set qt2410_nand_sets[] = {
299 * chips and beyond. 299 * chips and beyond.
300 */ 300 */
301 301
302static struct s3c2410_platform_nand qt2410_nand_info = { 302static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
303 .tacls = 20, 303 .tacls = 20,
304 .twrph0 = 60, 304 .twrph0 = 60,
305 .twrph1 = 20, 305 .twrph1 = 20,
@@ -331,7 +331,7 @@ static void __init qt2410_map_io(void)
331 331
332static void __init qt2410_machine_init(void) 332static void __init qt2410_machine_init(void)
333{ 333{
334 s3c_device_nand.dev.platform_data = &qt2410_nand_info; 334 s3c_nand_set_platdata(&qt2410_nand_info);
335 335
336 switch (tft_type) { 336 switch (tft_type) {
337 case 'p': /* production */ 337 case 'p': /* production */
diff --git a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
index 8df506eac903..c9fa3fca486c 100644
--- a/arch/arm/mach-s3c2412/mach-jive.c
+++ b/arch/arm/mach-s3c2412/mach-jive.c
@@ -96,7 +96,7 @@ static struct s3c2410_uartcfg jive_uartcfgs[] = {
96 * 0x017d0000-0x02bd0000 : cramfs B 96 * 0x017d0000-0x02bd0000 : cramfs B
97 * 0x02bd0000-0x03fd0000 : yaffs 97 * 0x02bd0000-0x03fd0000 : yaffs
98 */ 98 */
99static struct mtd_partition jive_imageA_nand_part[] = { 99static struct mtd_partition __initdata jive_imageA_nand_part[] = {
100 100
101#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER 101#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
102 /* Don't allow access to the bootloader from linux */ 102 /* Don't allow access to the bootloader from linux */
@@ -154,7 +154,7 @@ static struct mtd_partition jive_imageA_nand_part[] = {
154 }, 154 },
155}; 155};
156 156
157static struct mtd_partition jive_imageB_nand_part[] = { 157static struct mtd_partition __initdata jive_imageB_nand_part[] = {
158 158
159#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER 159#ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
160 /* Don't allow access to the bootloader from linux */ 160 /* Don't allow access to the bootloader from linux */
@@ -213,7 +213,7 @@ static struct mtd_partition jive_imageB_nand_part[] = {
213 }, 213 },
214}; 214};
215 215
216static struct s3c2410_nand_set jive_nand_sets[] = { 216static struct s3c2410_nand_set __initdata jive_nand_sets[] = {
217 [0] = { 217 [0] = {
218 .name = "flash", 218 .name = "flash",
219 .nr_chips = 1, 219 .nr_chips = 1,
@@ -222,7 +222,7 @@ static struct s3c2410_nand_set jive_nand_sets[] = {
222 }, 222 },
223}; 223};
224 224
225static struct s3c2410_platform_nand jive_nand_info = { 225static struct s3c2410_platform_nand __initdata jive_nand_info = {
226 /* set taken from osiris nand timings, possibly still conservative */ 226 /* set taken from osiris nand timings, possibly still conservative */
227 .tacls = 30, 227 .tacls = 30,
228 .twrph0 = 55, 228 .twrph0 = 55,
@@ -631,7 +631,8 @@ static void __init jive_machine_init(void)
631 631
632 s3c_pm_init(); 632 s3c_pm_init();
633 633
634 s3c_device_nand.dev.platform_data = &jive_nand_info; 634 /** TODO - check that this is after the cmdline option! */
635 s3c_nand_set_platdata(&jive_nand_info);
635 636
636 /* initialise the spi */ 637 /* initialise the spi */
637 638
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 11e8ad49fc7b..a6ba591b26bb 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -76,7 +76,7 @@ static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
76 } 76 }
77}; 77};
78 78
79static struct mtd_partition vstms_nand_part[] = { 79static struct mtd_partition __initdata vstms_nand_part[] = {
80 [0] = { 80 [0] = {
81 .name = "Boot Agent", 81 .name = "Boot Agent",
82 .size = 0x7C000, 82 .size = 0x7C000,
@@ -99,7 +99,7 @@ static struct mtd_partition vstms_nand_part[] = {
99 }, 99 },
100}; 100};
101 101
102static struct s3c2410_nand_set vstms_nand_sets[] = { 102static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
103 [0] = { 103 [0] = {
104 .name = "NAND", 104 .name = "NAND",
105 .nr_chips = 1, 105 .nr_chips = 1,
@@ -112,7 +112,7 @@ static struct s3c2410_nand_set vstms_nand_sets[] = {
112 * chips and beyond. 112 * chips and beyond.
113*/ 113*/
114 114
115static struct s3c2410_platform_nand vstms_nand_info = { 115static struct s3c2410_platform_nand __initdata vstms_nand_info = {
116 .tacls = 20, 116 .tacls = 20,
117 .twrph0 = 60, 117 .twrph0 = 60,
118 .twrph1 = 20, 118 .twrph1 = 20,
@@ -143,8 +143,6 @@ static void __init vstms_fixup(struct machine_desc *desc,
143 143
144static void __init vstms_map_io(void) 144static void __init vstms_map_io(void)
145{ 145{
146 s3c_device_nand.dev.platform_data = &vstms_nand_info;
147
148 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc)); 146 s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
149 s3c24xx_init_clocks(12000000); 147 s3c24xx_init_clocks(12000000);
150 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs)); 148 s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
@@ -153,6 +151,8 @@ static void __init vstms_map_io(void)
153static void __init vstms_init(void) 151static void __init vstms_init(void)
154{ 152{
155 s3c_i2c0_set_platdata(NULL); 153 s3c_i2c0_set_platdata(NULL);
154 s3c_nand_set_platdata(&vstms_nand_info);
155
156 platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices)); 156 platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
157} 157}
158 158
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c
index 68f3870991bf..5f5dccf306a8 100644
--- a/arch/arm/mach-s3c2440/mach-anubis.c
+++ b/arch/arm/mach-s3c2440/mach-anubis.c
@@ -138,7 +138,7 @@ static int external_map[] = { 2 };
138static int chip0_map[] = { 0 }; 138static int chip0_map[] = { 0 };
139static int chip1_map[] = { 1 }; 139static int chip1_map[] = { 1 };
140 140
141static struct mtd_partition anubis_default_nand_part[] = { 141static struct mtd_partition __initdata anubis_default_nand_part[] = {
142 [0] = { 142 [0] = {
143 .name = "Boot Agent", 143 .name = "Boot Agent",
144 .size = SZ_16K, 144 .size = SZ_16K,
@@ -161,7 +161,7 @@ static struct mtd_partition anubis_default_nand_part[] = {
161 } 161 }
162}; 162};
163 163
164static struct mtd_partition anubis_default_nand_part_large[] = { 164static struct mtd_partition __initdata anubis_default_nand_part_large[] = {
165 [0] = { 165 [0] = {
166 .name = "Boot Agent", 166 .name = "Boot Agent",
167 .size = SZ_128K, 167 .size = SZ_128K,
@@ -191,7 +191,7 @@ static struct mtd_partition anubis_default_nand_part_large[] = {
191 * socket. 191 * socket.
192*/ 192*/
193 193
194static struct s3c2410_nand_set anubis_nand_sets[] = { 194static struct s3c2410_nand_set __initdata anubis_nand_sets[] = {
195 [1] = { 195 [1] = {
196 .name = "External", 196 .name = "External",
197 .nr_chips = 1, 197 .nr_chips = 1,
@@ -233,7 +233,7 @@ static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
233 __raw_writeb(tmp, ANUBIS_VA_CTRL1); 233 __raw_writeb(tmp, ANUBIS_VA_CTRL1);
234} 234}
235 235
236static struct s3c2410_platform_nand anubis_nand_info = { 236static struct s3c2410_platform_nand __initdata anubis_nand_info = {
237 .tacls = 25, 237 .tacls = 25,
238 .twrph0 = 55, 238 .twrph0 = 55,
239 .twrph1 = 40, 239 .twrph1 = 40,
@@ -454,8 +454,6 @@ static void __init anubis_map_io(void)
454 454
455 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks)); 455 s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
456 456
457 s3c_device_nand.dev.platform_data = &anubis_nand_info;
458
459 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc)); 457 s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
460 s3c24xx_init_clocks(0); 458 s3c24xx_init_clocks(0);
461 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs)); 459 s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
@@ -476,6 +474,8 @@ static void __init anubis_map_io(void)
476static void __init anubis_init(void) 474static void __init anubis_init(void)
477{ 475{
478 s3c_i2c0_set_platdata(NULL); 476 s3c_i2c0_set_platdata(NULL);
477 s3c_nand_set_platdata(&anubis_nand_info);
478
479 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); 479 platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
480 480
481 i2c_register_board_info(0, anubis_i2c_devs, 481 i2c_register_board_info(0, anubis_i2c_devs,
diff --git a/arch/arm/mach-s3c2440/mach-at2440evb.c b/arch/arm/mach-s3c2440/mach-at2440evb.c
index dfc7010935da..d73ef9ac202b 100644
--- a/arch/arm/mach-s3c2440/mach-at2440evb.c
+++ b/arch/arm/mach-s3c2440/mach-at2440evb.c
@@ -96,7 +96,7 @@ static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
96 96
97/* NAND Flash on AT2440EVB board */ 97/* NAND Flash on AT2440EVB board */
98 98
99static struct mtd_partition at2440evb_default_nand_part[] = { 99static struct mtd_partition __initdata at2440evb_default_nand_part[] = {
100 [0] = { 100 [0] = {
101 .name = "Boot Agent", 101 .name = "Boot Agent",
102 .size = SZ_256K, 102 .size = SZ_256K,
@@ -114,7 +114,7 @@ static struct mtd_partition at2440evb_default_nand_part[] = {
114 }, 114 },
115}; 115};
116 116
117static struct s3c2410_nand_set at2440evb_nand_sets[] = { 117static struct s3c2410_nand_set __initdata at2440evb_nand_sets[] = {
118 [0] = { 118 [0] = {
119 .name = "nand", 119 .name = "nand",
120 .nr_chips = 1, 120 .nr_chips = 1,
@@ -123,7 +123,7 @@ static struct s3c2410_nand_set at2440evb_nand_sets[] = {
123 }, 123 },
124}; 124};
125 125
126static struct s3c2410_platform_nand at2440evb_nand_info = { 126static struct s3c2410_platform_nand __initdata at2440evb_nand_info = {
127 .tacls = 25, 127 .tacls = 25,
128 .twrph0 = 55, 128 .twrph0 = 55,
129 .twrph1 = 40, 129 .twrph1 = 40,
@@ -216,7 +216,6 @@ static struct platform_device *at2440evb_devices[] __initdata = {
216 216
217static void __init at2440evb_map_io(void) 217static void __init at2440evb_map_io(void)
218{ 218{
219 s3c_device_nand.dev.platform_data = &at2440evb_nand_info;
220 s3c_device_sdi.name = "s3c2440-sdi"; 219 s3c_device_sdi.name = "s3c2440-sdi";
221 s3c_device_sdi.dev.platform_data = &at2440evb_mci_pdata; 220 s3c_device_sdi.dev.platform_data = &at2440evb_mci_pdata;
222 221
@@ -228,6 +227,7 @@ static void __init at2440evb_map_io(void)
228static void __init at2440evb_init(void) 227static void __init at2440evb_init(void)
229{ 228{
230 s3c24xx_fb_set_platdata(&at2440evb_fb_info); 229 s3c24xx_fb_set_platdata(&at2440evb_fb_info);
230 s3c_nand_set_platdata(&at2440evb_nand_info);
231 s3c_i2c0_set_platdata(NULL); 231 s3c_i2c0_set_platdata(NULL);
232 232
233 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices)); 233 platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
diff --git a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
index 1c3382fefdd2..547d4fc99131 100644
--- a/arch/arm/mach-s3c2440/mach-mini2440.c
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c
@@ -532,7 +532,6 @@ static void __init mini2440_map_io(void)
532 s3c24xx_init_clocks(12000000); 532 s3c24xx_init_clocks(12000000);
533 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs)); 533 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
534 534
535 s3c_device_nand.dev.platform_data = &mini2440_nand_info;
536 s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg; 535 s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
537} 536}
538 537
@@ -677,8 +676,11 @@ static void __init mini2440_init(void)
677 printk("\n"); 676 printk("\n");
678 s3c24xx_fb_set_platdata(&mini2440_fb_info); 677 s3c24xx_fb_set_platdata(&mini2440_fb_info);
679 } 678 }
679
680 s3c24xx_udc_set_platdata(&mini2440_udc_cfg); 680 s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
681 s3c_nand_set_platdata(&mini2440_nand_info);
681 s3c_i2c0_set_platdata(NULL); 682 s3c_i2c0_set_platdata(NULL);
683
682 i2c_register_board_info(0, mini2440_i2c_devs, 684 i2c_register_board_info(0, mini2440_i2c_devs,
683 ARRAY_SIZE(mini2440_i2c_devs)); 685 ARRAY_SIZE(mini2440_i2c_devs));
684 686
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index 2105a41281a4..468a0ea3708b 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -148,7 +148,7 @@ static int external_map[] = { 2 };
148static int chip0_map[] = { 0 }; 148static int chip0_map[] = { 0 };
149static int chip1_map[] = { 1 }; 149static int chip1_map[] = { 1 };
150 150
151static struct mtd_partition osiris_default_nand_part[] = { 151static struct mtd_partition __initdata osiris_default_nand_part[] = {
152 [0] = { 152 [0] = {
153 .name = "Boot Agent", 153 .name = "Boot Agent",
154 .size = SZ_16K, 154 .size = SZ_16K,
@@ -171,7 +171,7 @@ static struct mtd_partition osiris_default_nand_part[] = {
171 } 171 }
172}; 172};
173 173
174static struct mtd_partition osiris_default_nand_part_large[] = { 174static struct mtd_partition __initdata osiris_default_nand_part_large[] = {
175 [0] = { 175 [0] = {
176 .name = "Boot Agent", 176 .name = "Boot Agent",
177 .size = SZ_128K, 177 .size = SZ_128K,
@@ -201,7 +201,7 @@ static struct mtd_partition osiris_default_nand_part_large[] = {
201 * socket. 201 * socket.
202*/ 202*/
203 203
204static struct s3c2410_nand_set osiris_nand_sets[] = { 204static struct s3c2410_nand_set __initdata osiris_nand_sets[] = {
205 [1] = { 205 [1] = {
206 .name = "External", 206 .name = "External",
207 .nr_chips = 1, 207 .nr_chips = 1,
@@ -243,7 +243,7 @@ static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
243 __raw_writeb(tmp, OSIRIS_VA_CTRL0); 243 __raw_writeb(tmp, OSIRIS_VA_CTRL0);
244} 244}
245 245
246static struct s3c2410_platform_nand osiris_nand_info = { 246static struct s3c2410_platform_nand __initdata osiris_nand_info = {
247 .tacls = 25, 247 .tacls = 25,
248 .twrph0 = 60, 248 .twrph0 = 60,
249 .twrph1 = 60, 249 .twrph1 = 60,
@@ -377,8 +377,6 @@ static void __init osiris_map_io(void)
377 377
378 s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks)); 378 s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks));
379 379
380 s3c_device_nand.dev.platform_data = &osiris_nand_info;
381
382 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc)); 380 s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
383 s3c24xx_init_clocks(0); 381 s3c24xx_init_clocks(0);
384 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs)); 382 s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
@@ -408,6 +406,7 @@ static void __init osiris_init(void)
408 sysdev_register(&osiris_pm_sysdev); 406 sysdev_register(&osiris_pm_sysdev);
409 407
410 s3c_i2c0_set_platdata(NULL); 408 s3c_i2c0_set_platdata(NULL);
409 s3c_nand_set_platdata(&osiris_nand_info);
411 410
412 s3c_cpufreq_setboard(&osiris_cpufreq); 411 s3c_cpufreq_setboard(&osiris_cpufreq);
413 412
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index bc8d8d1ebd1a..d77b8837b12f 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -149,7 +149,7 @@ static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
149 .gpdup_mask = 0xffffffff, 149 .gpdup_mask = 0xffffffff,
150}; 150};
151 151
152static struct mtd_partition rx3715_nand_part[] = { 152static struct mtd_partition __initdata rx3715_nand_part[] = {
153 [0] = { 153 [0] = {
154 .name = "Whole Flash", 154 .name = "Whole Flash",
155 .offset = 0, 155 .offset = 0,
@@ -158,7 +158,7 @@ static struct mtd_partition rx3715_nand_part[] = {
158 } 158 }
159}; 159};
160 160
161static struct s3c2410_nand_set rx3715_nand_sets[] = { 161static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = {
162 [0] = { 162 [0] = {
163 .name = "Internal", 163 .name = "Internal",
164 .nr_chips = 1, 164 .nr_chips = 1,
@@ -167,7 +167,7 @@ static struct s3c2410_nand_set rx3715_nand_sets[] = {
167 }, 167 },
168}; 168};
169 169
170static struct s3c2410_platform_nand rx3715_nand_info = { 170static struct s3c2410_platform_nand __initdata rx3715_nand_info = {
171 .tacls = 25, 171 .tacls = 25,
172 .twrph0 = 50, 172 .twrph0 = 50,
173 .twrph1 = 15, 173 .twrph1 = 15,
@@ -186,8 +186,6 @@ static struct platform_device *rx3715_devices[] __initdata = {
186 186
187static void __init rx3715_map_io(void) 187static void __init rx3715_map_io(void)
188{ 188{
189 s3c_device_nand.dev.platform_data = &rx3715_nand_info;
190
191 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc)); 189 s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
192 s3c24xx_init_clocks(16934000); 190 s3c24xx_init_clocks(16934000);
193 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 191 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
@@ -205,6 +203,7 @@ static void __init rx3715_init_machine(void)
205#endif 203#endif
206 s3c_pm_init(); 204 s3c_pm_init();
207 205
206 s3c_nand_set_platdata(&rx3715_nand_info);
208 s3c24xx_fb_set_platdata(&rx3715_fb_info); 207 s3c24xx_fb_set_platdata(&rx3715_fb_info);
209 platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices)); 208 platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
210} 209}
diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c
index 0fb385bd9cd9..f76d6ff4aeb9 100644
--- a/arch/arm/mach-s3c2442/mach-gta02.c
+++ b/arch/arm/mach-s3c2442/mach-gta02.c
@@ -423,7 +423,7 @@ static struct i2c_board_info gta02_i2c_devs[] __initdata = {
423 }, 423 },
424}; 424};
425 425
426static struct s3c2410_nand_set gta02_nand_sets[] = { 426static struct s3c2410_nand_set __initdata gta02_nand_sets[] = {
427 [0] = { 427 [0] = {
428 /* 428 /*
429 * This name is also hard-coded in the boot loaders, so 429 * This name is also hard-coded in the boot loaders, so
@@ -442,7 +442,7 @@ static struct s3c2410_nand_set gta02_nand_sets[] = {
442 * data sheet (K5D2G13ACM-D075 MCP Memory). 442 * data sheet (K5D2G13ACM-D075 MCP Memory).
443 */ 443 */
444 444
445static struct s3c2410_platform_nand gta02_nand_info = { 445static struct s3c2410_platform_nand __initdata gta02_nand_info = {
446 .tacls = 0, 446 .tacls = 0,
447 .twrph0 = 25, 447 .twrph0 = 25,
448 .twrph1 = 15, 448 .twrph1 = 15,
@@ -621,9 +621,9 @@ static void __init gta02_machine_init(void)
621#endif 621#endif
622 622
623 s3c_device_usb.dev.platform_data = &gta02_usb_info; 623 s3c_device_usb.dev.platform_data = &gta02_usb_info;
624 s3c_device_nand.dev.platform_data = &gta02_nand_info;
625 624
626 s3c24xx_udc_set_platdata(&gta02_udc_cfg); 625 s3c24xx_udc_set_platdata(&gta02_udc_cfg);
626 s3c_nand_set_platdata(&gta02_nand_info);
627 s3c_i2c0_set_platdata(NULL); 627 s3c_i2c0_set_platdata(NULL);
628 628
629 i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs)); 629 i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
diff --git a/arch/arm/mach-s3c6410/mach-hmt.c b/arch/arm/mach-s3c6410/mach-hmt.c
index c5741056193f..cdd4b5378552 100644
--- a/arch/arm/mach-s3c6410/mach-hmt.c
+++ b/arch/arm/mach-s3c6410/mach-hmt.c
@@ -250,7 +250,7 @@ static void __init hmt_machine_init(void)
250{ 250{
251 s3c_i2c0_set_platdata(NULL); 251 s3c_i2c0_set_platdata(NULL);
252 s3c_fb_set_platdata(&hmt_lcd_pdata); 252 s3c_fb_set_platdata(&hmt_lcd_pdata);
253 s3c_device_nand.dev.platform_data = &hmt_nand_info; 253 s3c_nand_set_platdata(&hmt_nand_info);
254 254
255 gpio_request(S3C64XX_GPC(7), "usb power"); 255 gpio_request(S3C64XX_GPC(7), "usb power");
256 gpio_direction_output(S3C64XX_GPC(7), 0); 256 gpio_direction_output(S3C64XX_GPC(7), 0);
diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
index 4e5323732434..e771e77dcd54 100644
--- a/arch/arm/plat-s3c/dev-nand.c
+++ b/arch/arm/plat-s3c/dev-nand.c
@@ -9,8 +9,12 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11 11
12#include <linux/mtd/mtd.h>
13#include <linux/mtd/partitions.h>
14
12#include <mach/map.h> 15#include <mach/map.h>
13#include <plat/devs.h> 16#include <plat/devs.h>
17#include <plat/nand.h>
14 18
15static struct resource s3c_nand_resource[] = { 19static struct resource s3c_nand_resource[] = {
16 [0] = { 20 [0] = {
@@ -28,3 +32,96 @@ struct platform_device s3c_device_nand = {
28}; 32};
29 33
30EXPORT_SYMBOL(s3c_device_nand); 34EXPORT_SYMBOL(s3c_device_nand);
35
36/**
37 * s3c_nand_copy_set() - copy nand set data
38 * @set: The new structure, directly copied from the old.
39 *
40 * Copy all the fields from the NAND set field from what is probably __initdata
41 * to new kernel memory. The code returns 0 if the copy happened correctly or
42 * an error code for the calling function to display.
43 *
44 * Note, we currently do not try and look to see if we've already copied the
45 * data in a previous set.
46 */
47static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
48{
49 void *ptr;
50 int size;
51
52 size = sizeof(struct mtd_partition) * set->nr_partitions;
53 if (size) {
54 ptr = kmemdup(set->partitions, size, GFP_KERNEL);
55 set->partitions = ptr;
56
57 if (!ptr)
58 return -ENOMEM;
59 }
60
61 size = sizeof(int) * set->nr_chips;
62 if (size) {
63 ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
64 set->nr_map = ptr;
65
66 if (!ptr)
67 return -ENOMEM;
68 }
69
70 if (set->ecc_layout) {
71 ptr = kmemdup(set->ecc_layout,
72 sizeof(struct nand_ecclayout), GFP_KERNEL);
73 set->ecc_layout = ptr;
74
75 if (!ptr)
76 return -ENOMEM;
77 }
78
79 return 0;
80}
81
82void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
83{
84 struct s3c2410_platform_nand *npd;
85 int size;
86 int ret;
87
88 /* note, if we get a failure in allocation, we simply drop out of the
89 * function. If there is so little memory available at initialisation
90 * time then there is little chance the system is going to run.
91 */
92
93 npd = kmemdup(nand, sizeof(struct s3c2410_platform_nand), GFP_KERNEL);
94 if (!npd) {
95 printk(KERN_ERR "%s: failed copying platform data\n", __func__);
96 return;
97 }
98
99 /* now see if we need to copy any of the nand set data */
100
101 size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
102 if (size) {
103 struct s3c2410_nand_set *from = npd->sets;
104 struct s3c2410_nand_set *to;
105 int i;
106
107 to = kmemdup(from, size, GFP_KERNEL);
108 npd->sets = to; /* set, even if we failed */
109
110 if (!to) {
111 printk(KERN_ERR "%s: no memory for sets\n", __func__);
112 return;
113 }
114
115 for (i = 0; i < npd->nr_sets; i++) {
116 ret = s3c_nand_copy_set(to);
117 if (!ret) {
118 printk(KERN_ERR "%s: failed to copy set %d\n",
119 __func__, i);
120 return;
121 }
122 to++;
123 }
124 }
125}
126
127EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);
diff --git a/arch/arm/plat-s3c/include/plat/nand.h b/arch/arm/plat-s3c/include/plat/nand.h
index 18f958801e64..065985978413 100644
--- a/arch/arm/plat-s3c/include/plat/nand.h
+++ b/arch/arm/plat-s3c/include/plat/nand.h
@@ -55,3 +55,11 @@ struct s3c2410_platform_nand {
55 int chip); 55 int chip);
56}; 56};
57 57
58/**
59 * s3c_nand_set_platdata() - register NAND platform data.
60 * @nand: The NAND platform data to register with s3c_device_nand.
61 *
62 * This function copies the given NAND platform data, @nand and registers
63 * it with the s3c_device_nand. This allows @nand to be __initdata.
64*/
65extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand);
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c
index aa119863c5ce..9e0e20ad2e46 100644
--- a/arch/arm/plat-s3c24xx/common-smdk.c
+++ b/arch/arm/plat-s3c24xx/common-smdk.c
@@ -198,7 +198,7 @@ void __init smdk_machine_init(void)
198 if (machine_is_smdk2443()) 198 if (machine_is_smdk2443())
199 smdk_nand_info.twrph0 = 50; 199 smdk_nand_info.twrph0 = 50;
200 200
201 s3c_device_nand.dev.platform_data = &smdk_nand_info; 201 s3c_nand_set_platdata(&smdk_nand_info);
202 202
203 platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs)); 203 platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));
204 204