2 * linux/arch/arm/plat-omap/debug-devices.c
4 * Copyright (C) 2005 Nokia Corporation
5 * Modified from mach-omap2/board-h4.c
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.
11 #include <linux/gpio.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
16 #include <linux/smc91x.h>
18 #include <mach/hardware.h>
19 #include "../mach-omap2/debug-devices.h"
21 /* Many OMAP development platforms reuse the same "debug board"; these
22 * platforms include H2, H3, H4, and Perseus2.
25 static struct smc91x_platdata smc91x_info = {
26 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
27 .leda = RPC_LED_100_10,
28 .ledb = RPC_LED_TX_RX,
31 static struct resource smc91x_resources[] = {
33 .flags = IORESOURCE_MEM,
36 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
40 static struct platform_device smc91x_device = {
44 .platform_data = &smc91x_info,
46 .num_resources = ARRAY_SIZE(smc91x_resources),
47 .resource = smc91x_resources,
50 static struct resource led_resources[] = {
52 .flags = IORESOURCE_MEM,
56 static struct platform_device led_device = {
57 .name = "omap_dbg_led",
59 .num_resources = ARRAY_SIZE(led_resources),
60 .resource = led_resources,
63 static struct platform_device *debug_devices[] __initdata = {
66 /* ps2 kbd + mouse ports */
68 /* 6 input dip switches */
72 int __init debug_card_init(u32 addr, unsigned gpio)
76 smc91x_resources[0].start = addr + 0x300;
77 smc91x_resources[0].end = addr + 0x30f;
79 smc91x_resources[1].start = gpio_to_irq(gpio);
80 smc91x_resources[1].end = gpio_to_irq(gpio);
82 status = gpio_request(gpio, "SMC91x irq");
84 printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
87 gpio_direction_input(gpio);
89 led_resources[0].start = addr;
90 led_resources[0].end = addr + SZ_4K - 1;
92 return platform_add_devices(debug_devices, ARRAY_SIZE(debug_devices));