6809dcdd3f194d20b99742c2d2c9a5fea13cfb94
[openwrt/svn-archive/archive.git] / target / linux / rdc / files / arch / i386 / 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
32 #include <asm/gpio.h>
33
34 #define PFX "rdc321x: "
35
36 /* FIXME : Flash */
37 static struct resource rdc_flash_resource[] = {
38 [0] = {
39 .start = (u32)-CONFIG_MTD_RDC3210_SIZE,
40 .end = (u32)-1,
41 .flags = IORESOURCE_MEM,
42 },
43 };
44
45 static struct platform_device rdc_flash_device = {
46 .name = "rdc321x-flash",
47 .id = -1,
48 .num_resources = ARRAY_SIZE(rdc_flash_resource),
49 .resource = rdc_flash_resource,
50 };
51
52 /* LEDS */
53 static struct platform_device rdc321x_leds = {
54 .name = "rdc321x-leds",
55 .id = -1,
56 .num_resources = 0,
57 };
58
59 static struct platform_device rdc321x_wdt = {
60 .name = "rdc321x-wdt",
61 .id = -1,
62 .num_resources = 0,
63 };
64
65 static int __init rdc_board_setup(void)
66 {
67 int err;
68
69 err = platform_device_register(&rdc_flash_device);
70 if (err)
71 printk(KERN_ALERT PFX "failed to register flash\n");
72
73 err = platform_device_register(&rdc321x_leds);
74 if (err)
75 printk(KERN_ALERT PFX "failed to register LEDS\n");
76
77 err = platform_device_register(&rdc321x_wdt);
78 printk(KERN_ALERT PFX "failed to register watchdog\n");
79
80 return err;
81 }
82
83 arch_initcall(rdc_board_setup);