2 * Generic RDC321x platform devices
4 * Copyright (C) 2007-2009 OpenWrt.org
5 * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
6 * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
25 #include <linux/init.h>
26 //#include <linux/kernel.h>
27 //#include <linux/list.h>
28 //#include <linux/device.h>
29 #include <linux/platform_device.h>
30 //#include <linux/version.h>
31 //#include <linux/input.h>
32 #include <linux/mtd/map.h>
33 #include <linux/mtd/mtd.h>
34 #include <linux/mtd/physmap.h>
35 #include <linux/root_dev.h>
37 #include <asm/rdc_boards.h>
39 static struct rdc_platform_data rdcplat_data
;
42 static struct platform_device rdc321x_leds
= {
46 .platform_data
= &rdcplat_data
.led_data
,
51 static struct platform_device rdc321x_buttons
= {
52 .name
= "gpio-buttons",
55 .platform_data
= &rdcplat_data
.button_data
,
59 static __initdata
struct platform_device
*rdc321x_devs
[] = {
64 const char *__initdata boards
[] = {
72 static struct map_info rdc_map_info
= {
74 .size
= 0x800000, //8MB
75 .phys
= 0xFF800000, //(u32) -rdc_map_info.size;
79 static int __init
rdc_board_setup(void)
81 struct mtd_partition
*partitions
;
83 struct mtd_info
*mtdinfo
;
85 simple_map_init(&rdc_map_info
);
88 rdc_map_info
.virt
= ioremap(rdc_map_info
.phys
, rdc_map_info
.size
);
89 if (rdc_map_info
.virt
== NULL
)
92 mtdinfo
= do_map_probe("cfi_probe", &rdc_map_info
);
94 mtdinfo
= do_map_probe("jedec_probe", &rdc_map_info
);
98 iounmap(rdc_map_info
.virt
);
99 if ((rdc_map_info
.size
>>= 1) < 0x100000) //1MB
100 panic("RDC321x: Could not find start of flash!");
101 rdc_map_info
.phys
= (u32
) -rdc_map_info
.size
;
104 count
= parse_mtd_partitions(mtdinfo
, boards
, &partitions
, (unsigned long) &rdcplat_data
);
107 panic("RDC321x: can't identify board type");
112 res
= add_mtd_partitions(mtdinfo
, partitions
, count
);
116 return platform_add_devices(rdc321x_devs
, ARRAY_SIZE(rdc321x_devs
));
120 late_initcall(rdc_board_setup
);