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_timing flash_timing __initdata
= {
26 .ncs_write_pulse
= 65,
33 static struct smc_config flash_config __initdata
= {
40 static struct mtd_partition flash_parts
[] = {
44 .size
= 0x00020000, /* 128 KiB */
45 .mask_flags
= MTD_WRITEABLE
,
56 .mask_flags
= MTD_WRITEABLE
,
60 static struct physmap_flash_data flash_data
= {
62 .nr_parts
= ARRAY_SIZE(flash_parts
),
66 static struct resource flash_resource
= {
69 .flags
= IORESOURCE_MEM
,
72 static struct platform_device flash_device
= {
73 .name
= "physmap-flash",
75 .resource
= &flash_resource
,
78 .platform_data
= &flash_data
,
82 /* This needs to be called after the SMC has been initialized */
83 static int __init
atstk1000_flash_init(void)
87 smc_set_timing(&flash_config
, &flash_timing
);
88 ret
= smc_set_configuration(0, &flash_config
);
90 printk(KERN_ERR
"atstk1000: failed to set NOR flash timing\n");
94 platform_device_register(&flash_device
);
98 device_initcall(atstk1000_flash_init
);