2 * ATSTK1000 board-specific flash initialization
4 * Copyright (C) 2005-2006 Atmel Corporation
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>
16 #include <asm/arch/smc.h>
18 static struct smc_config flash_config __initdata
= {
26 .ncs_write_pulse
= 65,
38 static struct mtd_partition flash_parts
[] = {
42 .size
= 0x00020000, /* 128 KiB */
43 .mask_flags
= MTD_WRITEABLE
,
54 .mask_flags
= MTD_WRITEABLE
,
58 static struct physmap_flash_data flash_data
= {
60 .nr_parts
= ARRAY_SIZE(flash_parts
),
64 static struct resource flash_resource
= {
67 .flags
= IORESOURCE_MEM
,
70 static struct platform_device flash_device
= {
71 .name
= "physmap-flash",
73 .resource
= &flash_resource
,
76 .platform_data
= &flash_data
,
80 /* This needs to be called after the SMC has been initialized */
81 static int __init
atstk1000_flash_init(void)
85 ret
= smc_set_configuration(0, &flash_config
);
87 printk(KERN_ERR
"atstk1000: failed to set NOR flash timing\n");
91 platform_device_register(&flash_device
);
95 device_initcall(atstk1000_flash_init
);