parport/share.c: proper externs
[linux-2.6/openmoko-kernel.git] / arch / arm / mach-s3c2410 / nor-simtec.c
blobf44e21b9c3bab25f76577253c663a37536bf8ab5
1 /* linux/arch/arm/mach-s3c2410/nor-simtec.c
3 * Copyright (c) 2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
7 * Simtec NOR mapping
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.
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>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/map.h>
22 #include <linux/mtd/physmap.h>
23 #include <linux/mtd/partitions.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/irq.h>
29 #include <asm/arch/map.h>
30 #include <asm/arch/bast-map.h>
31 #include <asm/arch/bast-cpld.h>
34 static void simtec_nor_vpp(struct map_info *map, int vpp)
36 unsigned int val;
37 unsigned long flags;
39 local_irq_save(flags);
40 val = __raw_readb(BAST_VA_CTRL3);
42 printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
44 if (vpp)
45 val |= BAST_CPLD_CTRL3_ROMWEN;
46 else
47 val &= ~BAST_CPLD_CTRL3_ROMWEN;
49 __raw_writeb(val, BAST_VA_CTRL3);
50 local_irq_restore(flags);
53 struct physmap_flash_data simtec_nor_pdata = {
54 .width = 2,
55 .set_vpp = simtec_nor_vpp,
56 .nr_parts = 0,
59 static struct resource simtec_nor_resource[] = {
60 [0] = {
61 .start = S3C2410_CS1 + 0x4000000,
62 .end = S3C2410_CS1 + 0x4000000 + SZ_8M - 1,
63 .flags = IORESOURCE_MEM,
67 static 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,
77 void __init nor_simtec_init(void)
79 int ret;
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);