aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/debug-devices.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2006-12-06 20:14:03 -0500
committerTony Lindgren <tony@atomide.com>2007-09-20 12:59:20 -0400
commitf604931238dff7b44ef52ac2ad1f557e45b25b38 (patch)
treeefcacb3d5a3449cb0557d1194b202de7823f2184 /arch/arm/plat-omap/debug-devices.c
parent1c22cc13256046162bb8e7b44763f6c39790af74 (diff)
ARM: OMAP: abstract debug card setup (smc, leds)
Additional cleanup for debug boards on H2/P2/H3/H4: move the init code that's not board-specific into a new file where it can be easily shared between all the different boards (avoiding code duplication, and making it easier to support more devices). Make H4 use that. This should be easy to drop in to the OMAP1 boards using these debug cards; the only difference seems to be that the p2 does an extra reset of the smc using the fpga (probably all boards could do that, if it's necessary) and doesn't use the gpio mux or request APIs. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/debug-devices.c')
-rw-r--r--arch/arm/plat-omap/debug-devices.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
new file mode 100644
index 000000000000..83a5f8b91857
--- /dev/null
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -0,0 +1,86 @@
1/*
2 * linux/arch/arm/plat-omap/debug-devices.c
3 *
4 * Copyright (C) 2005 Nokia Corporation
5 * Modified from mach-omap2/board-h4.c
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
15
16#include <asm/hardware.h>
17#include <asm/io.h>
18
19#include <asm/arch/board.h>
20#include <asm/arch/gpio.h>
21
22
23/* Many OMAP development platforms reuse the same "debug board"; these
24 * platforms include H2, H3, H4, and Perseus2.
25 */
26
27static struct resource smc91x_resources[] = {
28 [0] = {
29 .flags = IORESOURCE_MEM,
30 },
31 [1] = {
32 .flags = IORESOURCE_IRQ,
33 },
34};
35
36static struct platform_device smc91x_device = {
37 .name = "smc91x",
38 .id = -1,
39 .num_resources = ARRAY_SIZE(smc91x_resources),
40 .resource = smc91x_resources,
41};
42
43static struct resource led_resources[] = {
44 [0] = {
45 .flags = IORESOURCE_MEM,
46 },
47};
48
49static struct platform_device led_device = {
50 .name = "omap_dbg_led",
51 .id = -1,
52 .num_resources = ARRAY_SIZE(led_resources),
53 .resource = led_resources,
54};
55
56static struct platform_device *debug_devices[] __initdata = {
57 &smc91x_device,
58 &led_device,
59 /* ps2 kbd + mouse ports */
60 /* 4 extra uarts */
61 /* 6 input dip switches */
62 /* 8 output pins */
63};
64
65int __init debug_card_init(u32 addr, unsigned gpio)
66{
67 int status;
68
69 smc91x_resources[0].start = addr + 0x300;
70 smc91x_resources[0].end = addr + 0x30f;
71
72 smc91x_resources[1].start = OMAP_GPIO_IRQ(gpio);
73 smc91x_resources[1].end = OMAP_GPIO_IRQ(gpio);
74
75 status = omap_request_gpio(gpio);
76 if (status < 0) {
77 printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
78 return status;
79 }
80 omap_set_gpio_direction(gpio, 1);
81
82 led_resources[0].start = addr;
83 led_resources[0].end = addr + SZ_4K - 1;
84
85 return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices));
86}