Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
simtec-nor.c
Go to the documentation of this file.
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 <[email protected]>
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 <mach/map.h>
30 #include <mach/bast-map.h>
31 #include <mach/bast-cpld.h>
32 
33 #include "simtec.h"
34 
35 static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
36 {
37  unsigned int val;
38 
40 
41  printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
42 
43  if (vpp)
45  else
46  val &= ~BAST_CPLD_CTRL3_ROMWEN;
47 
49 }
50 
51 static struct physmap_flash_data simtec_nor_pdata = {
52  .width = 2,
53  .set_vpp = simtec_nor_vpp,
54  .nr_parts = 0,
55 };
56 
57 static struct resource simtec_nor_resource[] = {
58  [0] = DEFINE_RES_MEM(S3C2410_CS1 + 0x4000000, SZ_8M),
59 };
60 
61 static struct platform_device simtec_device_nor = {
62  .name = "physmap-flash",
63  .id = -1,
64  .num_resources = ARRAY_SIZE(simtec_nor_resource),
65  .resource = simtec_nor_resource,
66  .dev = {
67  .platform_data = &simtec_nor_pdata,
68  },
69 };
70 
72 {
73  int ret;
74 
75  ret = platform_device_register(&simtec_device_nor);
76  if (ret < 0)
77  printk(KERN_ERR "failed to register physmap-flash device\n");
78  else
79  simtec_nor_vpp(NULL, 1);
80 }