Merge branch 'next/drivers' into HEAD
[deliverable/linux.git] / arch / arm / plat-omap / debug-devices.c
CommitLineData
f6049312
DB
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 */
2f8163ba 11#include <linux/gpio.h>
f6049312
DB
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
fced80c7 15#include <linux/io.h>
3bc48014 16#include <linux/smc91x.h>
f6049312 17
a09e64fb 18#include <mach/hardware.h>
f6049312 19
f6049312
DB
20/* Many OMAP development platforms reuse the same "debug board"; these
21 * platforms include H2, H3, H4, and Perseus2.
22 */
23
3bc48014
LM
24static struct smc91x_platdata smc91x_info = {
25 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
26 .leda = RPC_LED_100_10,
27 .ledb = RPC_LED_TX_RX,
28};
29
f6049312
DB
30static struct resource smc91x_resources[] = {
31 [0] = {
32 .flags = IORESOURCE_MEM,
33 },
34 [1] = {
e7b3dc7e 35 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
f6049312
DB
36 },
37};
38
39static struct platform_device smc91x_device = {
40 .name = "smc91x",
41 .id = -1,
3bc48014
LM
42 .dev = {
43 .platform_data = &smc91x_info,
44 },
f6049312
DB
45 .num_resources = ARRAY_SIZE(smc91x_resources),
46 .resource = smc91x_resources,
47};
48
49static struct resource led_resources[] = {
50 [0] = {
51 .flags = IORESOURCE_MEM,
52 },
53};
54
55static struct platform_device led_device = {
56 .name = "omap_dbg_led",
57 .id = -1,
58 .num_resources = ARRAY_SIZE(led_resources),
59 .resource = led_resources,
60};
61
62static struct platform_device *debug_devices[] __initdata = {
63 &smc91x_device,
64 &led_device,
65 /* ps2 kbd + mouse ports */
66 /* 4 extra uarts */
67 /* 6 input dip switches */
68 /* 8 output pins */
69};
70
71int __init debug_card_init(u32 addr, unsigned gpio)
72{
73 int status;
74
75 smc91x_resources[0].start = addr + 0x300;
76 smc91x_resources[0].end = addr + 0x30f;
77
15f74b03
DB
78 smc91x_resources[1].start = gpio_to_irq(gpio);
79 smc91x_resources[1].end = gpio_to_irq(gpio);
f6049312 80
f2d18fea 81 status = gpio_request(gpio, "SMC91x irq");
f6049312
DB
82 if (status < 0) {
83 printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
84 return status;
85 }
40e3925b 86 gpio_direction_input(gpio);
f6049312
DB
87
88 led_resources[0].start = addr;
89 led_resources[0].end = addr + SZ_4K - 1;
90
91 return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices));
92}
This page took 0.351853 seconds and 5 git commands to generate.