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