Upgrade rdc to 2.6.24
[openwrt/staging/wigyori.git] / target / linux / rdc / files / arch / x86 / mach-rdc / platform.c
1 /*
2 * $Id: platform.c 8331 2007-08-03 15:59:23Z florian $
3 *
4 * Generic RDC321x platform devices
5 *
6 * Copyright (C) 2007 OpenWrt.org
7 * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 *
24 */
25
26 #include <linux/init.h>
27 #include <linux/kernel.h>
28 #include <linux/list.h>
29 #include <linux/device.h>
30 #include <linux/platform_device.h>
31 #include <linux/version.h>
32 #include <linux/leds.h>
33 #include <linux/gpio_keys.h>
34 #include <linux/input.h>
35
36 #include <asm/gpio.h>
37
38 /* Flash */
39 static struct resource rdc_flash_resource[] = {
40 [0] = {
41 .start = (u32)-CONFIG_MTD_RDC3210_SIZE,
42 .end = (u32)-1,
43 .flags = IORESOURCE_MEM,
44 },
45 };
46
47 static struct platform_device rdc_flash_device = {
48 .name = "rdc321x-flash",
49 .id = -1,
50 .num_resources = ARRAY_SIZE(rdc_flash_resource),
51 .resource = rdc_flash_resource,
52 };
53
54 /* LEDS */
55 static struct gpio_led default_leds[] = {
56 { .name = "rdc321x:dmz", .gpio = 1, },
57 };
58
59 static struct gpio_led_platform_data rdc321x_led_data = {
60 .num_leds = ARRAY_SIZE(default_leds),
61 .leds = default_leds,
62 };
63
64 static struct platform_device rdc321x_leds = {
65 .name = "leds-gpio",
66 .id = -1,
67 .dev = {
68 .platform_data = &rdc321x_led_data,
69 }
70 };
71
72 /* Watchdog */
73 static struct platform_device rdc321x_wdt = {
74 .name = "rdc321x-wdt",
75 .id = -1,
76 .num_resources = 0,
77 };
78
79 /* Button */
80 static struct gpio_keys_button rdc321x_gpio_btn[] = {
81 {
82 .gpio = 0,
83 .code = BTN_0,
84 .desc = "Reset",
85 .active_low = 1,
86 }
87 };
88
89 static struct gpio_keys_platform_data rdc321x_gpio_btn_data = {
90 .buttons = rdc321x_gpio_btn,
91 .nbuttons = ARRAY_SIZE(rdc321x_gpio_btn),
92 };
93
94 static struct platform_device rdc321x_button = {
95 .name = "gpio-keys",
96 .id = -1,
97 .dev = {
98 .platform_data = &rdc321x_gpio_btn_data,
99 }
100 };
101
102 static struct platform_device *rdc321x_devs[] = {
103 &rdc_flash_device,
104 &rdc321x_leds,
105 &rdc321x_wdt,
106 &rdc321x_button
107 };
108
109 static int __init rdc_board_setup(void)
110 {
111 return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs));
112 }
113
114 arch_initcall(rdc_board_setup);