aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/board-sffsdr.c
diff options
context:
space:
mode:
authorHugo Villeneuve <hugo.villeneuve@lyrtech.com>2009-04-29 19:46:57 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-05-26 10:18:15 -0400
commitf5ce6a67a78357da5e88782b1cf1cc10b36f102c (patch)
treeab65c2f686e053bb6f094dbe6156384e7bfc83bd /arch/arm/mach-davinci/board-sffsdr.c
parentfb6313879caa46831d71a316b97b51d37d100269 (diff)
davinci: DM644x: add support for SFFSDR board
Signed-off-by: Hugo Villeneuve <hugo.villeneuve@lyrtech.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/board-sffsdr.c')
-rw-r--r--arch/arm/mach-davinci/board-sffsdr.c180
1 files changed, 180 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
new file mode 100644
index 000000000000..c6525e43ea33
--- /dev/null
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -0,0 +1,180 @@
1/*
2 * Lyrtech SFFSDR board support.
3 *
4 * Copyright (C) 2008 Philip Balister, OpenSDR <philip@opensdr.com>
5 * Copyright (C) 2008 Lyrtech <www.lyrtech.com>
6 *
7 * Based on DV-EVM platform, original copyright follows:
8 *
9 * Copyright (C) 2007 MontaVista Software, Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <linux/kernel.h>
27#include <linux/module.h>
28#include <linux/init.h>
29#include <linux/dma-mapping.h>
30#include <linux/platform_device.h>
31#include <linux/gpio.h>
32
33#include <linux/i2c.h>
34#include <linux/i2c/at24.h>
35#include <linux/etherdevice.h>
36#include <linux/mtd/mtd.h>
37#include <linux/mtd/nand.h>
38#include <linux/mtd/partitions.h>
39#include <linux/mtd/physmap.h>
40#include <linux/io.h>
41
42#include <asm/setup.h>
43#include <asm/mach-types.h>
44
45#include <asm/mach/arch.h>
46#include <asm/mach/map.h>
47#include <asm/mach/flash.h>
48
49#include <mach/dm644x.h>
50#include <mach/common.h>
51#include <mach/i2c.h>
52#include <mach/serial.h>
53#include <mach/psc.h>
54#include <mach/mux.h>
55
56#define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x01e00000
57#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
58
59struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
60 /* U-Boot Environment: Block 0
61 * UBL: Block 1
62 * U-Boot: Blocks 6-7 (256 kb)
63 * Integrity Kernel: Blocks 8-31 (3 Mb)
64 * Integrity Data: Blocks 100-END
65 */
66 {
67 .name = "Linux Kernel",
68 .offset = 32 * SZ_128K,
69 .size = 16 * SZ_128K, /* 2 Mb */
70 .mask_flags = MTD_WRITEABLE, /* Force read-only */
71 },
72 {
73 .name = "Linux ROOT",
74 .offset = MTDPART_OFS_APPEND,
75 .size = 256 * SZ_128K, /* 32 Mb */
76 .mask_flags = 0, /* R/W */
77 },
78};
79
80static struct flash_platform_data davinci_sffsdr_nandflash_data = {
81 .parts = davinci_sffsdr_nandflash_partition,
82 .nr_parts = ARRAY_SIZE(davinci_sffsdr_nandflash_partition),
83};
84
85static struct resource davinci_sffsdr_nandflash_resource[] = {
86 {
87 .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE,
88 .end = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
89 .flags = IORESOURCE_MEM,
90 }, {
91 .start = DAVINCI_ASYNC_EMIF_CONTROL_BASE,
92 .end = DAVINCI_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1,
93 .flags = IORESOURCE_MEM,
94 },
95};
96
97static struct platform_device davinci_sffsdr_nandflash_device = {
98 .name = "davinci_nand", /* Name of driver */
99 .id = 0,
100 .dev = {
101 .platform_data = &davinci_sffsdr_nandflash_data,
102 },
103 .num_resources = ARRAY_SIZE(davinci_sffsdr_nandflash_resource),
104 .resource = davinci_sffsdr_nandflash_resource,
105};
106
107/* Get Ethernet address from kernel boot params */
108static u8 mac_addr[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
109
110static struct at24_platform_data eeprom_info = {
111 .byte_len = (64*1024) / 8,
112 .page_size = 32,
113 .flags = AT24_FLAG_ADDR16,
114};
115
116static struct i2c_board_info __initdata i2c_info[] = {
117 {
118 I2C_BOARD_INFO("24lc64", 0x50),
119 .platform_data = &eeprom_info,
120 },
121 /* Other I2C devices:
122 * MSP430, addr 0x23 (not used)
123 * PCA9543, addr 0x70 (setup done by U-Boot)
124 * ADS7828, addr 0x48 (ADC for voltage monitoring.)
125 */
126};
127
128static struct davinci_i2c_platform_data i2c_pdata = {
129 .bus_freq = 20 /* kHz */,
130 .bus_delay = 100 /* usec */,
131};
132
133static void __init sffsdr_init_i2c(void)
134{
135 davinci_init_i2c(&i2c_pdata);
136 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
137}
138
139static struct platform_device *davinci_sffsdr_devices[] __initdata = {
140 &davinci_sffsdr_nandflash_device,
141};
142
143static struct davinci_uart_config uart_config __initdata = {
144 .enabled_uarts = (1 << 0),
145};
146
147static void __init davinci_sffsdr_map_io(void)
148{
149 davinci_map_common_io();
150 dm644x_init();
151}
152
153static __init void davinci_sffsdr_init(void)
154{
155 platform_add_devices(davinci_sffsdr_devices,
156 ARRAY_SIZE(davinci_sffsdr_devices));
157 sffsdr_init_i2c();
158 davinci_serial_init(&uart_config);
159 setup_usb(0, 0); /* We support only peripheral mode. */
160
161 /* mux VLYNQ pins */
162 davinci_cfg_reg(DM644X_VLYNQEN);
163 davinci_cfg_reg(DM644X_VLYNQWD);
164}
165
166static __init void davinci_sffsdr_irq_init(void)
167{
168 davinci_irq_init();
169}
170
171MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
172 /* Maintainer: Hugo Villeneuve hugo.villeneuve@lyrtech.com */
173 .phys_io = IO_PHYS,
174 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
175 .boot_params = (DAVINCI_DDR_BASE + 0x100),
176 .map_io = davinci_sffsdr_map_io,
177 .init_irq = davinci_sffsdr_irq_init,
178 .timer = &davinci_timer,
179 .init_machine = davinci_sffsdr_init,
180MACHINE_END