nfsd4: typo logical vs bitwise negate for want_mask
[linux-btrfs-devel.git] / arch / avr32 / boards / merisc / flash.c
blob8e856fd6f0131d06c440f4c75b27cc8330873e43
1 /*
2 * Merisc board-specific flash initialization
4 * Copyright (C) 2008 Martinsson Elektronik AB
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>
15 #include <mach/smc.h>
17 /* Will be translated to units of 14.3 ns, rounded up */
18 static struct smc_timing flash_timing __initdata = {
19 .ncs_read_setup = 1 * 14,
20 .nrd_setup = 5 * 14,
21 .ncs_write_setup = 1 * 14,
22 .nwe_setup = 2 * 14,
24 .ncs_read_pulse = 12 * 14,
25 .nrd_pulse = 7 * 14,
26 .ncs_write_pulse = 8 * 14,
27 .nwe_pulse = 4 * 14,
29 .read_cycle = 14 * 14,
30 .write_cycle = 10 * 14,
33 static struct smc_config flash_config __initdata = {
34 .bus_width = 2,
35 .nrd_controlled = 1,
36 .nwe_controlled = 1,
37 .byte_write = 1,
38 .tdf_cycles = 3,
41 static struct mtd_partition flash_0_parts[] = {
43 .name = "boot",
44 .offset = 0x00000000,
45 .size = 0x00060000,
46 .mask_flags = 0,
49 .name = "kernel",
50 .offset = 0x00060000,
51 .size = 0x00200000,
52 .mask_flags = 0,
55 .name = "root",
56 .offset = 0x00260000,
57 .size = MTDPART_SIZ_FULL,
58 .mask_flags = 0,
62 static struct mtd_partition flash_1_parts[] = {
64 .name = "2ndflash",
65 .offset = 0x00000000,
66 .size = MTDPART_SIZ_FULL,
67 .mask_flags = 0,
71 static struct physmap_flash_data flash_data[] = {
73 .width = 2,
74 .nr_parts = ARRAY_SIZE(flash_0_parts),
75 .parts = flash_0_parts,
78 .width = 2,
79 .nr_parts = ARRAY_SIZE(flash_1_parts),
80 .parts = flash_1_parts,
84 static struct resource flash_resource[] = {
86 .start = 0x00000000,
87 .end = 0x03ffffff,
88 .flags = IORESOURCE_MEM,
91 .start = 0x04000000,
92 .end = 0x07ffffff,
93 .flags = IORESOURCE_MEM,
97 static struct platform_device flash_device[] = {
99 .name = "physmap-flash",
100 .id = 0,
101 .resource = &flash_resource[0],
102 .num_resources = 1,
103 .dev = {
104 .platform_data = &flash_data[0],
108 .name = "physmap-flash",
109 .id = 1,
110 .resource = &flash_resource[1],
111 .num_resources = 1,
112 .dev = {
113 .platform_data = &flash_data[1],
118 static int __init merisc_flash_init(void)
120 int ret;
121 smc_set_timing(&flash_config, &flash_timing);
123 ret = smc_set_configuration(0, &flash_config);
124 if (ret < 0) {
125 printk(KERN_ERR "Merisc: failed to set NOR flash timing #0\n");
126 return ret;
129 ret = smc_set_configuration(4, &flash_config);
130 if (ret < 0) {
131 printk(KERN_ERR "Merisc: failed to set NOR flash timing #1\n");
132 return ret;
135 platform_device_register(&flash_device[0]);
136 platform_device_register(&flash_device[1]);
137 return 0;
139 device_initcall(merisc_flash_init);