Add generic gpio support to rdc, convert the led driver to be a platform driver,...
[openwrt.git] / target / linux / rdc-2.6 / 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 #include <asm/mach-rdc/rdc321x_defs.h>
34
35 /* FIXME : Flash */
36 static struct resource rdc_flash_resource[] = {
37         [0] = {
38                 .start = RDC_FLASH_BASE,
39                 .end = RDC_FLASH_BASE+CONFIG_MTD_RDC3210_SIZE-1,
40                 .flags = IORESOURCE_MEM,
41         },
42 };
43
44 static struct platform_device rdc_flash_device = {
45         .name = "rdc321x-flash",
46         .id = -1,
47         .num_resources = ARRAY_SIZE(rdc_flash_resource),
48         .resource = rdc_flash_resource,
49 };
50
51 /* LEDS */
52 static struct platform_device rdc321x_leds = {
53         .name = "rdc321x-leds",
54         .id = -1,
55         .num_resources = 0,
56 };
57
58 static int __init rdc_board_setup(void)
59 {
60         int err;
61
62         err = platform_device_register(&rdc_flash_device);
63         if (err)
64                 printk(KERN_ALERT "rdc321x: failed to register flash\n");
65
66         err = platform_device_register(&rdc321x_leds);
67         if (err)
68                 printk(KERN_ALERT "rdc321x: failed to register LEDS\n");
69
70         return err; 
71 }
72
73 arch_initcall(rdc_board_setup);