ARM: OMAP3: Clean up spurious interrupt check logic
[linux-ginger.git] / arch / avr32 / boards / mimc200 / flash.c
blobd83d650fc13f1bda25f4c878e6194e323fef5022
1 /*
2 * MIMC200 board-specific flash initialization
4 * Copyright (C) 2008 Mercury IMC Ltd
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10 #include <linux/init.h>
11 #include <linux/platform_device.h>
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
14 #include <linux/mtd/physmap.h>
16 #include <mach/smc.h>
18 static struct smc_timing flash_timing __initdata = {
19 .ncs_read_setup = 0,
20 .nrd_setup = 15,
21 .ncs_write_setup = 0,
22 .nwe_setup = 0,
24 .ncs_read_pulse = 115,
25 .nrd_pulse = 110,
26 .ncs_write_pulse = 60,
27 .nwe_pulse = 60,
29 .read_cycle = 115,
30 .write_cycle = 100,
33 static struct smc_config flash_config __initdata = {
34 .bus_width = 2,
35 .nrd_controlled = 1,
36 .nwe_controlled = 1,
37 .byte_write = 1,
40 /* system flash definition */
42 static struct mtd_partition flash_parts_system[] = {
44 .name = "u-boot",
45 .offset = 0x00000000,
46 .size = 0x00020000, /* 128 KiB */
47 .mask_flags = MTD_WRITEABLE,
50 .name = "root",
51 .offset = 0x00020000,
52 .size = 0x007c0000,
55 .name = "splash",
56 .offset = 0x007e0000,
57 .size = 0x00010000, /* 64KiB */
60 .name = "env",
61 .offset = 0x007f0000,
62 .size = 0x00010000,
63 .mask_flags = MTD_WRITEABLE,
67 static struct physmap_flash_data flash_system = {
68 .width = 2,
69 .nr_parts = ARRAY_SIZE(flash_parts_system),
70 .parts = flash_parts_system,
73 static struct resource flash_resource_system = {
74 .start = 0x00000000,
75 .end = 0x007fffff,
76 .flags = IORESOURCE_MEM,
79 static struct platform_device flash_device_system = {
80 .name = "physmap-flash",
81 .id = 0,
82 .resource = &flash_resource_system,
83 .num_resources = 1,
84 .dev = {
85 .platform_data = &flash_system,
89 /* data flash definition */
91 static struct mtd_partition flash_parts_data[] = {
93 .name = "data",
94 .offset = 0x00000000,
95 .size = 0x00800000,
99 static struct physmap_flash_data flash_data = {
100 .width = 2,
101 .nr_parts = ARRAY_SIZE(flash_parts_data),
102 .parts = flash_parts_data,
105 static struct resource flash_resource_data = {
106 .start = 0x08000000,
107 .end = 0x087fffff,
108 .flags = IORESOURCE_MEM,
111 static struct platform_device flash_device_data = {
112 .name = "physmap-flash",
113 .id = 1,
114 .resource = &flash_resource_data,
115 .num_resources = 1,
116 .dev = {
117 .platform_data = &flash_data,
121 /* This needs to be called after the SMC has been initialized */
122 static int __init mimc200_flash_init(void)
124 int ret;
126 smc_set_timing(&flash_config, &flash_timing);
127 ret = smc_set_configuration(0, &flash_config);
128 if (ret < 0) {
129 printk(KERN_ERR "mimc200: failed to set 'System' NOR flash timing\n");
130 return ret;
132 ret = smc_set_configuration(1, &flash_config);
133 if (ret < 0) {
134 printk(KERN_ERR "mimc200: failed to set 'Data' NOR flash timing\n");
135 return ret;
138 platform_device_register(&flash_device_system);
139 platform_device_register(&flash_device_data);
141 return 0;
143 device_initcall(mimc200_flash_init);