aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/boards/favr-32/flash.c
diff options
context:
space:
mode:
authorHans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>2008-07-29 05:25:37 -0400
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-10-13 10:01:18 -0400
commit45c349b58c58f3922bfdec917aa30ff8425caa3f (patch)
tree1a120cdf16ebd97e0084e12a53a0ec6519d5c0a1 /arch/avr32/boards/favr-32/flash.c
parenta3bee42f058c2f9fe281df942eff397924630a12 (diff)
avr32: add support for EarthLCD Favr-32 board
This patch adds support for the Favr-32 board made by EarthLCD. This kit, which is also called ezLCD-101, has a 10.4" touch screen LCD panel, 16 MB 32-bit SDRAM, 8 MB parallel flash, Ethernet, audio out, USB device, SD-card slot, USART and various other connectors for cennecting stuff to SPI, I2C, GPIO, etc. Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/boards/favr-32/flash.c')
-rw-r--r--arch/avr32/boards/favr-32/flash.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/arch/avr32/boards/favr-32/flash.c b/arch/avr32/boards/favr-32/flash.c
new file mode 100644
index 000000000000..5f139b7cb5f7
--- /dev/null
+++ b/arch/avr32/boards/favr-32/flash.c
@@ -0,0 +1,98 @@
1/*
2 * Favr-32 board-specific flash initialization
3 *
4 * Copyright (C) 2008 Atmel Corporation
5 *
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
16#include <asm/arch/smc.h>
17
18static struct smc_timing flash_timing __initdata = {
19 .ncs_read_setup = 0,
20 .nrd_setup = 40,
21 .ncs_write_setup = 0,
22 .nwe_setup = 10,
23
24 .ncs_read_pulse = 80,
25 .nrd_pulse = 40,
26 .ncs_write_pulse = 65,
27 .nwe_pulse = 55,
28
29 .read_cycle = 120,
30 .write_cycle = 120,
31};
32
33static struct smc_config flash_config __initdata = {
34 .bus_width = 2,
35 .nrd_controlled = 1,
36 .nwe_controlled = 1,
37 .byte_write = 1,
38};
39
40static struct mtd_partition flash_parts[] = {
41 {
42 .name = "u-boot",
43 .offset = 0x00000000,
44 .size = 0x00020000, /* 128 KiB */
45 .mask_flags = MTD_WRITEABLE,
46 },
47 {
48 .name = "root",
49 .offset = 0x00020000,
50 .size = 0x007d0000,
51 },
52 {
53 .name = "env",
54 .offset = 0x007f0000,
55 .size = 0x00010000,
56 .mask_flags = MTD_WRITEABLE,
57 },
58};
59
60static struct physmap_flash_data flash_data = {
61 .width = 2,
62 .nr_parts = ARRAY_SIZE(flash_parts),
63 .parts = flash_parts,
64};
65
66static struct resource flash_resource = {
67 .start = 0x00000000,
68 .end = 0x007fffff,
69 .flags = IORESOURCE_MEM,
70};
71
72static struct platform_device flash_device = {
73 .name = "physmap-flash",
74 .id = 0,
75 .resource = &flash_resource,
76 .num_resources = 1,
77 .dev = {
78 .platform_data = &flash_data,
79 },
80};
81
82/* This needs to be called after the SMC has been initialized */
83static int __init favr32_flash_init(void)
84{
85 int ret;
86
87 smc_set_timing(&flash_config, &flash_timing);
88 ret = smc_set_configuration(0, &flash_config);
89 if (ret < 0) {
90 printk(KERN_ERR "Favr-32: failed to set NOR flash timing\n");
91 return ret;
92 }
93
94 platform_device_register(&flash_device);
95
96 return 0;
97}
98device_initcall(favr32_flash_init);