aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/board-evm.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@deeprootsystems.com>2009-04-14 11:57:40 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-04-27 12:49:46 -0400
commit73d3c68f09e608be983013dc8b3e49aebe89298c (patch)
tree9ae14423b1e53fd1f99be1ab5b575490be3e2121 /arch/arm/mach-davinci/board-evm.c
parent5526b3f7e3317bdd0dcc0483214935ae64236efb (diff)
davinci: DM644x: rename board file
Rename DM6446 EVM board file, no functional changes. Code is updated and reworked in following patch. Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/board-evm.c')
-rw-r--r--arch/arm/mach-davinci/board-evm.c440
1 files changed, 0 insertions, 440 deletions
diff --git a/arch/arm/mach-davinci/board-evm.c b/arch/arm/mach-davinci/board-evm.c
deleted file mode 100644
index c2701d740a1d..000000000000
--- a/arch/arm/mach-davinci/board-evm.c
+++ /dev/null
@@ -1,440 +0,0 @@
1/*
2 * TI DaVinci EVM board support
3 *
4 * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#include <linux/kernel.h>
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/dma-mapping.h>
15#include <linux/platform_device.h>
16#include <linux/gpio.h>
17#include <linux/leds.h>
18
19#include <linux/i2c.h>
20#include <linux/i2c/pcf857x.h>
21#include <linux/i2c/at24.h>
22
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h>
25#include <linux/mtd/physmap.h>
26#include <linux/io.h>
27
28#include <asm/setup.h>
29#include <asm/mach-types.h>
30
31#include <asm/mach/arch.h>
32#include <asm/mach/map.h>
33#include <asm/mach/flash.h>
34
35#include <mach/hardware.h>
36#include <mach/common.h>
37#include <mach/i2c.h>
38
39#define DAVINCI_CFC_ATA_BASE 0x01C66000
40#define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x02000000
41
42/* other misc. init functions */
43void __init davinci_psc_init(void);
44void __init davinci_irq_init(void);
45void __init davinci_map_common_io(void);
46void __init davinci_init_common_hw(void);
47
48#if defined(CONFIG_MTD_PHYSMAP) || \
49 defined(CONFIG_MTD_PHYSMAP_MODULE)
50
51static struct mtd_partition davinci_evm_norflash_partitions[] = {
52 /* bootloader (U-Boot, etc) in first 4 sectors */
53 {
54 .name = "bootloader",
55 .offset = 0,
56 .size = 4 * SZ_64K,
57 .mask_flags = MTD_WRITEABLE, /* force read-only */
58 },
59 /* bootloader params in the next 1 sectors */
60 {
61 .name = "params",
62 .offset = MTDPART_OFS_APPEND,
63 .size = SZ_64K,
64 .mask_flags = 0,
65 },
66 /* kernel */
67 {
68 .name = "kernel",
69 .offset = MTDPART_OFS_APPEND,
70 .size = SZ_2M,
71 .mask_flags = 0
72 },
73 /* file system */
74 {
75 .name = "filesystem",
76 .offset = MTDPART_OFS_APPEND,
77 .size = MTDPART_SIZ_FULL,
78 .mask_flags = 0
79 }
80};
81
82static struct physmap_flash_data davinci_evm_norflash_data = {
83 .width = 2,
84 .parts = davinci_evm_norflash_partitions,
85 .nr_parts = ARRAY_SIZE(davinci_evm_norflash_partitions),
86};
87
88/* NOTE: CFI probe will correctly detect flash part as 32M, but EMIF
89 * limits addresses to 16M, so using addresses past 16M will wrap */
90static struct resource davinci_evm_norflash_resource = {
91 .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE,
92 .end = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE + SZ_16M - 1,
93 .flags = IORESOURCE_MEM,
94};
95
96static struct platform_device davinci_evm_norflash_device = {
97 .name = "physmap-flash",
98 .id = 0,
99 .dev = {
100 .platform_data = &davinci_evm_norflash_data,
101 },
102 .num_resources = 1,
103 .resource = &davinci_evm_norflash_resource,
104};
105
106#endif
107
108#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
109 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
110
111static struct resource ide_resources[] = {
112 {
113 .start = DAVINCI_CFC_ATA_BASE,
114 .end = DAVINCI_CFC_ATA_BASE + 0x7ff,
115 .flags = IORESOURCE_MEM,
116 },
117 {
118 .start = IRQ_IDE,
119 .end = IRQ_IDE,
120 .flags = IORESOURCE_IRQ,
121 },
122};
123
124static u64 ide_dma_mask = DMA_BIT_MASK(32);
125
126static struct platform_device ide_dev = {
127 .name = "palm_bk3710",
128 .id = -1,
129 .resource = ide_resources,
130 .num_resources = ARRAY_SIZE(ide_resources),
131 .dev = {
132 .dma_mask = &ide_dma_mask,
133 .coherent_dma_mask = DMA_BIT_MASK(32),
134 },
135};
136
137#endif
138
139/*----------------------------------------------------------------------*/
140
141/*
142 * I2C GPIO expanders
143 */
144
145#define PCF_Uxx_BASE(x) (DAVINCI_N_GPIO + ((x) * 8))
146
147
148/* U2 -- LEDs */
149
150static struct gpio_led evm_leds[] = {
151 { .name = "DS8", .active_low = 1,
152 .default_trigger = "heartbeat", },
153 { .name = "DS7", .active_low = 1, },
154 { .name = "DS6", .active_low = 1, },
155 { .name = "DS5", .active_low = 1, },
156 { .name = "DS4", .active_low = 1, },
157 { .name = "DS3", .active_low = 1, },
158 { .name = "DS2", .active_low = 1,
159 .default_trigger = "mmc0", },
160 { .name = "DS1", .active_low = 1,
161 .default_trigger = "ide-disk", },
162};
163
164static const struct gpio_led_platform_data evm_led_data = {
165 .num_leds = ARRAY_SIZE(evm_leds),
166 .leds = evm_leds,
167};
168
169static struct platform_device *evm_led_dev;
170
171static int
172evm_led_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
173{
174 struct gpio_led *leds = evm_leds;
175 int status;
176
177 while (ngpio--) {
178 leds->gpio = gpio++;
179 leds++;
180 }
181
182 /* what an extremely annoying way to be forced to handle
183 * device unregistration ...
184 */
185 evm_led_dev = platform_device_alloc("leds-gpio", 0);
186 platform_device_add_data(evm_led_dev,
187 &evm_led_data, sizeof evm_led_data);
188
189 evm_led_dev->dev.parent = &client->dev;
190 status = platform_device_add(evm_led_dev);
191 if (status < 0) {
192 platform_device_put(evm_led_dev);
193 evm_led_dev = NULL;
194 }
195 return status;
196}
197
198static int
199evm_led_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
200{
201 if (evm_led_dev) {
202 platform_device_unregister(evm_led_dev);
203 evm_led_dev = NULL;
204 }
205 return 0;
206}
207
208static struct pcf857x_platform_data pcf_data_u2 = {
209 .gpio_base = PCF_Uxx_BASE(0),
210 .setup = evm_led_setup,
211 .teardown = evm_led_teardown,
212};
213
214
215/* U18 - A/V clock generator and user switch */
216
217static int sw_gpio;
218
219static ssize_t
220sw_show(struct device *d, struct device_attribute *a, char *buf)
221{
222 char *s = gpio_get_value_cansleep(sw_gpio) ? "on\n" : "off\n";
223
224 strcpy(buf, s);
225 return strlen(s);
226}
227
228static DEVICE_ATTR(user_sw, S_IRUGO, sw_show, NULL);
229
230static int
231evm_u18_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
232{
233 int status;
234
235 /* export dip switch option */
236 sw_gpio = gpio + 7;
237 status = gpio_request(sw_gpio, "user_sw");
238 if (status == 0)
239 status = gpio_direction_input(sw_gpio);
240 if (status == 0)
241 status = device_create_file(&client->dev, &dev_attr_user_sw);
242 else
243 gpio_free(sw_gpio);
244 if (status != 0)
245 sw_gpio = -EINVAL;
246
247 /* audio PLL: 48 kHz (vs 44.1 or 32), single rate (vs double) */
248 gpio_request(gpio + 3, "pll_fs2");
249 gpio_direction_output(gpio + 3, 0);
250
251 gpio_request(gpio + 2, "pll_fs1");
252 gpio_direction_output(gpio + 2, 0);
253
254 gpio_request(gpio + 1, "pll_sr");
255 gpio_direction_output(gpio + 1, 0);
256
257 return 0;
258}
259
260static int
261evm_u18_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
262{
263 gpio_free(gpio + 1);
264 gpio_free(gpio + 2);
265 gpio_free(gpio + 3);
266
267 if (sw_gpio > 0) {
268 device_remove_file(&client->dev, &dev_attr_user_sw);
269 gpio_free(sw_gpio);
270 }
271 return 0;
272}
273
274static struct pcf857x_platform_data pcf_data_u18 = {
275 .gpio_base = PCF_Uxx_BASE(1),
276 .n_latch = (1 << 3) | (1 << 2) | (1 << 1),
277 .setup = evm_u18_setup,
278 .teardown = evm_u18_teardown,
279};
280
281
282/* U35 - various I/O signals used to manage USB, CF, ATA, etc */
283
284static int
285evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
286{
287 /* p0 = nDRV_VBUS (initial: don't supply it) */
288 gpio_request(gpio + 0, "nDRV_VBUS");
289 gpio_direction_output(gpio + 0, 1);
290
291 /* p1 = VDDIMX_EN */
292 gpio_request(gpio + 1, "VDDIMX_EN");
293 gpio_direction_output(gpio + 1, 1);
294
295 /* p2 = VLYNQ_EN */
296 gpio_request(gpio + 2, "VLYNQ_EN");
297 gpio_direction_output(gpio + 2, 1);
298
299 /* p3 = n3V3_CF_RESET (initial: stay in reset) */
300 gpio_request(gpio + 3, "nCF_RESET");
301 gpio_direction_output(gpio + 3, 0);
302
303 /* (p4 unused) */
304
305 /* p5 = 1V8_WLAN_RESET (initial: stay in reset) */
306 gpio_request(gpio + 5, "WLAN_RESET");
307 gpio_direction_output(gpio + 5, 1);
308
309 /* p6 = nATA_SEL (initial: select) */
310 gpio_request(gpio + 6, "nATA_SEL");
311 gpio_direction_output(gpio + 6, 0);
312
313 /* p7 = nCF_SEL (initial: deselect) */
314 gpio_request(gpio + 7, "nCF_SEL");
315 gpio_direction_output(gpio + 7, 1);
316
317 /* irlml6401 sustains over 3A, switches 5V in under 8 msec */
318 setup_usb(500, 8);
319
320 return 0;
321}
322
323static int
324evm_u35_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
325{
326 gpio_free(gpio + 7);
327 gpio_free(gpio + 6);
328 gpio_free(gpio + 5);
329 gpio_free(gpio + 3);
330 gpio_free(gpio + 2);
331 gpio_free(gpio + 1);
332 gpio_free(gpio + 0);
333 return 0;
334}
335
336static struct pcf857x_platform_data pcf_data_u35 = {
337 .gpio_base = PCF_Uxx_BASE(2),
338 .setup = evm_u35_setup,
339 .teardown = evm_u35_teardown,
340};
341
342/*----------------------------------------------------------------------*/
343
344/* Most of this EEPROM is unused, but U-Boot uses some data:
345 * - 0x7f00, 6 bytes Ethernet Address
346 * - 0x0039, 1 byte NTSC vs PAL (bit 0x80 == PAL)
347 * - ... newer boards may have more
348 */
349static struct at24_platform_data eeprom_info = {
350 .byte_len = (256*1024) / 8,
351 .page_size = 64,
352 .flags = AT24_FLAG_ADDR16,
353};
354
355static struct i2c_board_info __initdata i2c_info[] = {
356 {
357 I2C_BOARD_INFO("pcf8574", 0x38),
358 .platform_data = &pcf_data_u2,
359 },
360 {
361 I2C_BOARD_INFO("pcf8574", 0x39),
362 .platform_data = &pcf_data_u18,
363 },
364 {
365 I2C_BOARD_INFO("pcf8574", 0x3a),
366 .platform_data = &pcf_data_u35,
367 },
368 {
369 I2C_BOARD_INFO("24c256", 0x50),
370 .platform_data = &eeprom_info,
371 },
372 /* ALSO:
373 * - tvl320aic33 audio codec (0x1b)
374 * - msp430 microcontroller (0x23)
375 * - tvp5146 video decoder (0x5d)
376 */
377};
378
379/* The msp430 uses a slow bitbanged I2C implementation (ergo 20 KHz),
380 * which requires 100 usec of idle bus after i2c writes sent to it.
381 */
382static struct davinci_i2c_platform_data i2c_pdata = {
383 .bus_freq = 20 /* kHz */,
384 .bus_delay = 100 /* usec */,
385};
386
387static void __init evm_init_i2c(void)
388{
389 davinci_init_i2c(&i2c_pdata);
390 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
391}
392
393static struct platform_device *davinci_evm_devices[] __initdata = {
394#if defined(CONFIG_MTD_PHYSMAP) || \
395 defined(CONFIG_MTD_PHYSMAP_MODULE)
396 &davinci_evm_norflash_device,
397#endif
398#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
399 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
400 &ide_dev,
401#endif
402};
403
404static void __init
405davinci_evm_map_io(void)
406{
407 davinci_map_common_io();
408}
409
410static __init void davinci_evm_init(void)
411{
412#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
413 defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
414#if defined(CONFIG_MTD_PHYSMAP) || \
415 defined(CONFIG_MTD_PHYSMAP_MODULE)
416 printk(KERN_WARNING "WARNING: both IDE and NOR flash are enabled, "
417 "but share pins.\n\t Disable IDE for NOR support.\n");
418#endif
419#endif
420
421 platform_add_devices(davinci_evm_devices,
422 ARRAY_SIZE(davinci_evm_devices));
423 evm_init_i2c();
424}
425
426static __init void davinci_evm_irq_init(void)
427{
428 davinci_irq_init();
429}
430
431MACHINE_START(DAVINCI_EVM, "DaVinci EVM")
432 /* Maintainer: MontaVista Software <source@mvista.com> */
433 .phys_io = IO_PHYS,
434 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
435 .boot_params = (DAVINCI_DDR_BASE + 0x100),
436 .map_io = davinci_evm_map_io,
437 .init_irq = davinci_evm_irq_init,
438 .timer = &davinci_timer,
439 .init_machine = davinci_evm_init,
440MACHINE_END