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.
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>
18 static struct smc_timing flash_timing __initdata
= {
24 .ncs_read_pulse
= 115,
26 .ncs_write_pulse
= 60,
33 static struct smc_config flash_config __initdata
= {
40 /* system flash definition */
42 static struct mtd_partition flash_parts_system
[] = {
46 .size
= 0x00020000, /* 128 KiB */
47 .mask_flags
= MTD_WRITEABLE
,
57 .size
= 0x00010000, /* 64KiB */
63 .mask_flags
= MTD_WRITEABLE
,
67 static struct physmap_flash_data flash_system
= {
69 .nr_parts
= ARRAY_SIZE(flash_parts_system
),
70 .parts
= flash_parts_system
,
73 static struct resource flash_resource_system
= {
76 .flags
= IORESOURCE_MEM
,
79 static struct platform_device flash_device_system
= {
80 .name
= "physmap-flash",
82 .resource
= &flash_resource_system
,
85 .platform_data
= &flash_system
,
89 /* data flash definition */
91 static struct mtd_partition flash_parts_data
[] = {
99 static struct physmap_flash_data flash_data
= {
101 .nr_parts
= ARRAY_SIZE(flash_parts_data
),
102 .parts
= flash_parts_data
,
105 static struct resource flash_resource_data
= {
108 .flags
= IORESOURCE_MEM
,
111 static struct platform_device flash_device_data
= {
112 .name
= "physmap-flash",
114 .resource
= &flash_resource_data
,
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)
126 smc_set_timing(&flash_config
, &flash_timing
);
127 ret
= smc_set_configuration(0, &flash_config
);
129 printk(KERN_ERR
"mimc200: failed to set 'System' NOR flash timing\n");
132 ret
= smc_set_configuration(1, &flash_config
);
134 printk(KERN_ERR
"mimc200: failed to set 'Data' NOR flash timing\n");
138 platform_device_register(&flash_device_system
);
139 platform_device_register(&flash_device_data
);
143 device_initcall(mimc200_flash_init
);