aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2410
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-07-03 06:24:39 -0400
committerBen Dooks <ben-linux@fluff.org>2008-07-03 11:51:28 -0400
commit9d529c6e7b73088551057445763b2be755a3b82f (patch)
treeeb2784455bdeb0e286c1518a1a1bdc238d7a6767 /arch/arm/mach-s3c2410
parentb9db83af69e4c61107803c85872d01a45949e052 (diff)
[ARM] S3C24XX: Add physmap device for all Simtec NOR equiped boards.
Move to using the physmap platform device code to attached NOR flash on Simtec boards so that the old bast-flash driver can be safely removed. Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s3c2410')
-rw-r--r--arch/arm/mach-s3c2410/Kconfig7
-rw-r--r--arch/arm/mach-s3c2410/Makefile4
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c22
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c22
-rw-r--r--arch/arm/mach-s3c2410/nor-simtec.c86
-rw-r--r--arch/arm/mach-s3c2410/nor-simtec.h14
6 files changed, 119 insertions, 36 deletions
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
index 69689701acfc..1a7d01b47440 100644
--- a/arch/arm/mach-s3c2410/Kconfig
+++ b/arch/arm/mach-s3c2410/Kconfig
@@ -37,6 +37,11 @@ config S3C2410_CLOCK
37 help 37 help
38 Clock code for the S3C2410, and similar processors 38 Clock code for the S3C2410, and similar processors
39 39
40config SIMTEC_NOR
41 bool
42 help
43 Internal node to specify machine has simtec NOR mapping
44
40config MACH_BAST_IDE 45config MACH_BAST_IDE
41 bool 46 bool
42 select HAVE_PATA_PLATFORM 47 select HAVE_PATA_PLATFORM
@@ -76,6 +81,7 @@ config ARCH_BAST
76 bool "Simtec Electronics BAST (EB2410ITX)" 81 bool "Simtec Electronics BAST (EB2410ITX)"
77 select CPU_S3C2410 82 select CPU_S3C2410
78 select PM_SIMTEC if PM 83 select PM_SIMTEC if PM
84 select SIMTEC_NOR
79 select MACH_BAST_IDE 85 select MACH_BAST_IDE
80 select ISA 86 select ISA
81 help 87 help
@@ -114,6 +120,7 @@ config MACH_TCT_HAMMER
114config MACH_VR1000 120config MACH_VR1000
115 bool "Thorcom VR1000" 121 bool "Thorcom VR1000"
116 select PM_SIMTEC if PM 122 select PM_SIMTEC if PM
123 select SIMTEC_NOR
117 select MACH_BAST_IDE 124 select MACH_BAST_IDE
118 select CPU_S3C2410 125 select CPU_S3C2410
119 help 126 help
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index 8a4055dc858b..00f31f8c4e78 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -31,6 +31,10 @@ obj-$(CONFIG_MACH_TCT_HAMMER) += mach-tct_hammer.o
31obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o 31obj-$(CONFIG_MACH_VR1000) += mach-vr1000.o usb-simtec.o
32obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o 32obj-$(CONFIG_MACH_QT2410) += mach-qt2410.o
33 33
34# Common bits of machine support
35
36obj-$(CONFIG_SIMTEC_NOR) += nor-simtec.o
37
34# machine additions 38# machine additions
35 39
36obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o 40obj-$(CONFIG_MACH_BAST_IDE) += bast-ide.o
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 093be00c8eb5..2a512e863141 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -57,7 +57,9 @@
57#include <asm/plat-s3c24xx/clock.h> 57#include <asm/plat-s3c24xx/clock.h>
58#include <asm/plat-s3c24xx/devs.h> 58#include <asm/plat-s3c24xx/devs.h>
59#include <asm/plat-s3c24xx/cpu.h> 59#include <asm/plat-s3c24xx/cpu.h>
60
60#include "usb-simtec.h" 61#include "usb-simtec.h"
62#include "nor-simtec.h"
61 63
62#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics" 64#define COPYRIGHT ", (c) 2004-2005 Simtec Electronics"
63 65
@@ -203,23 +205,6 @@ static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
203 } 205 }
204}; 206};
205 207
206/* NOR Flash on BAST board */
207
208static struct resource bast_nor_resource[] = {
209 [0] = {
210 .start = S3C2410_CS1 + 0x4000000,
211 .end = S3C2410_CS1 + 0x4000000 + (32*1024*1024) - 1,
212 .flags = IORESOURCE_MEM,
213 }
214};
215
216static struct platform_device bast_device_nor = {
217 .name = "bast-nor",
218 .id = -1,
219 .num_resources = ARRAY_SIZE(bast_nor_resource),
220 .resource = bast_nor_resource,
221};
222
223/* NAND Flash on BAST board */ 208/* NAND Flash on BAST board */
224 209
225#ifdef CONFIG_PM 210#ifdef CONFIG_PM
@@ -559,7 +544,6 @@ static struct platform_device *bast_devices[] __initdata = {
559 &s3c_device_i2c, 544 &s3c_device_i2c,
560 &s3c_device_rtc, 545 &s3c_device_rtc,
561 &s3c_device_nand, 546 &s3c_device_nand,
562 &bast_device_nor,
563 &bast_device_dm9k, 547 &bast_device_dm9k,
564 &bast_device_asix, 548 &bast_device_asix,
565 &bast_device_axpp, 549 &bast_device_axpp,
@@ -608,6 +592,8 @@ static void __init bast_init(void)
608 592
609 s3c24xx_fb_set_platdata(&bast_fb_info); 593 s3c24xx_fb_set_platdata(&bast_fb_info);
610 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices)); 594 platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
595
596 nor_simtec_init();
611} 597}
612 598
613MACHINE_START(BAST, "Simtec-BAST") 599MACHINE_START(BAST, "Simtec-BAST")
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 1d0a0284f336..f133ccfc359e 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -46,7 +46,9 @@
46#include <asm/plat-s3c24xx/clock.h> 46#include <asm/plat-s3c24xx/clock.h>
47#include <asm/plat-s3c24xx/devs.h> 47#include <asm/plat-s3c24xx/devs.h>
48#include <asm/plat-s3c24xx/cpu.h> 48#include <asm/plat-s3c24xx/cpu.h>
49
49#include "usb-simtec.h" 50#include "usb-simtec.h"
51#include "nor-simtec.h"
50 52
51/* macros for virtual address mods for the io space entries */ 53/* macros for virtual address mods for the io space entries */
52#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5) 54#define VA_C5(item) ((unsigned long)(item) + BAST_VAM_CS5)
@@ -202,23 +204,6 @@ static struct platform_device serial_device = {
202 }, 204 },
203}; 205};
204 206
205/* MTD NOR Flash */
206
207static struct resource vr1000_nor_resource[] = {
208 [0] = {
209 .start = S3C2410_CS1 + 0x4000000,
210 .end = S3C2410_CS1 + 0x4000000 + SZ_16M - 1,
211 .flags = IORESOURCE_MEM,
212 }
213};
214
215static struct platform_device vr1000_nor = {
216 .name = "bast-nor",
217 .id = -1,
218 .num_resources = ARRAY_SIZE(vr1000_nor_resource),
219 .resource = vr1000_nor_resource,
220};
221
222/* DM9000 ethernet devices */ 207/* DM9000 ethernet devices */
223 208
224static struct resource vr1000_dm9k0_resource[] = { 209static struct resource vr1000_dm9k0_resource[] = {
@@ -339,7 +324,6 @@ static struct platform_device *vr1000_devices[] __initdata = {
339 &s3c_device_i2c, 324 &s3c_device_i2c,
340 &s3c_device_adc, 325 &s3c_device_adc,
341 &serial_device, 326 &serial_device,
342 &vr1000_nor,
343 &vr1000_dm9k0, 327 &vr1000_dm9k0,
344 &vr1000_dm9k1, 328 &vr1000_dm9k1,
345 &vr1000_led1, 329 &vr1000_led1,
@@ -388,6 +372,8 @@ static void __init vr1000_map_io(void)
388static void __init vr1000_init(void) 372static void __init vr1000_init(void)
389{ 373{
390 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices)); 374 platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
375
376 nor_simtec_init();
391} 377}
392 378
393MACHINE_START(VR1000, "Thorcom-VR1000") 379MACHINE_START(VR1000, "Thorcom-VR1000")
diff --git a/arch/arm/mach-s3c2410/nor-simtec.c b/arch/arm/mach-s3c2410/nor-simtec.c
new file mode 100644
index 000000000000..f44e21b9c3ba
--- /dev/null
+++ b/arch/arm/mach-s3c2410/nor-simtec.c
@@ -0,0 +1,86 @@
1/* linux/arch/arm/mach-s3c2410/nor-simtec.c
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Simtec NOR mapping
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/module.h>
15#include <linux/types.h>
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/platform_device.h>
19
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/physmap.h>
23#include <linux/mtd/partitions.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
29#include <asm/arch/map.h>
30#include <asm/arch/bast-map.h>
31#include <asm/arch/bast-cpld.h>
32
33
34static void simtec_nor_vpp(struct map_info *map, int vpp)
35{
36 unsigned int val;
37 unsigned long flags;
38
39 local_irq_save(flags);
40 val = __raw_readb(BAST_VA_CTRL3);
41
42 printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
43
44 if (vpp)
45 val |= BAST_CPLD_CTRL3_ROMWEN;
46 else
47 val &= ~BAST_CPLD_CTRL3_ROMWEN;
48
49 __raw_writeb(val, BAST_VA_CTRL3);
50 local_irq_restore(flags);
51}
52
53struct physmap_flash_data simtec_nor_pdata = {
54 .width = 2,
55 .set_vpp = simtec_nor_vpp,
56 .nr_parts = 0,
57};
58
59static struct resource simtec_nor_resource[] = {
60 [0] = {
61 .start = S3C2410_CS1 + 0x4000000,
62 .end = S3C2410_CS1 + 0x4000000 + SZ_8M - 1,
63 .flags = IORESOURCE_MEM,
64 }
65};
66
67static struct platform_device simtec_device_nor = {
68 .name = "physmap-flash",
69 .id = -1,
70 .num_resources = ARRAY_SIZE(simtec_nor_resource),
71 .resource = simtec_nor_resource,
72 .dev = {
73 .platform_data = &simtec_nor_pdata,
74 },
75};
76
77void __init nor_simtec_init(void)
78{
79 int ret;
80
81 ret = platform_device_register(&simtec_device_nor);
82 if (ret < 0)
83 printk(KERN_ERR "failed to register physmap-flash device\n");
84 else
85 simtec_nor_vpp(NULL, 1);
86}
diff --git a/arch/arm/mach-s3c2410/nor-simtec.h b/arch/arm/mach-s3c2410/nor-simtec.h
new file mode 100644
index 000000000000..f619c1e0d0c8
--- /dev/null
+++ b/arch/arm/mach-s3c2410/nor-simtec.h
@@ -0,0 +1,14 @@
1/* linux/arch/arm/mach-s3c2410/nor-simtec.h
2 *
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Simtec NOR mapping
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14extern void nor_simtec_init(void);