2 * MTX-1 platform devices registration
4 * Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/init.h>
22 #include <linux/platform_device.h>
23 #include <linux/leds.h>
24 #include <linux/gpio.h>
25 #include <linux/gpio_keys.h>
26 #include <linux/input.h>
27 #include <linux/mtd/partitions.h>
28 #include <linux/mtd/physmap.h>
29 #include <mtd/mtd-abi.h>
31 #include <asm/mach-au1x00/au1xxx_eth.h>
33 static struct gpio_keys_button mtx1_gpio_button[] = {
37 .desc = "System button",
41 static struct gpio_keys_platform_data mtx1_buttons_data = {
42 .buttons = mtx1_gpio_button,
43 .nbuttons = ARRAY_SIZE(mtx1_gpio_button),
46 static struct platform_device mtx1_button = {
50 .platform_data = &mtx1_buttons_data,
54 static struct resource mtx1_wdt_res[] = {
58 .name = "mtx1-wdt-gpio",
59 .flags = IORESOURCE_IRQ,
63 static struct platform_device mtx1_wdt = {
66 .num_resources = ARRAY_SIZE(mtx1_wdt_res),
67 .resource = mtx1_wdt_res,
70 static struct gpio_led default_leds[] = {
80 static struct gpio_led_platform_data mtx1_led_data = {
81 .num_leds = ARRAY_SIZE(default_leds),
85 static struct platform_device mtx1_gpio_leds = {
89 .platform_data = &mtx1_led_data,
93 static struct mtd_partition mtx1_mtd_partitions[] = {
102 .offset = MTDPART_OFS_APPEND,
103 .mask_flags = MTD_WRITEABLE,
108 .offset = MTDPART_OFS_APPEND,
113 .offset = MTDPART_OFS_APPEND,
117 static struct physmap_flash_data mtx1_flash_data = {
120 .parts = mtx1_mtd_partitions,
123 static struct resource mtx1_mtd_resource = {
126 .flags = IORESOURCE_MEM,
129 static struct platform_device mtx1_mtd = {
130 .name = "physmap-flash",
132 .platform_data = &mtx1_flash_data,
135 .resource = &mtx1_mtd_resource,
138 static struct __initdata platform_device * mtx1_devs[] = {
145 static struct au1000_eth_platform_data mtx1_au1000_eth0_pdata = {
146 .phy_search_highest_addr = 1,
147 .phy1_search_mac0 = 1,
150 static int __init mtx1_register_devices(void)
154 au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata);
156 rc = gpio_request(mtx1_gpio_button[0].gpio,
157 mtx1_gpio_button[0].desc);
159 printk(KERN_INFO "mtx1: failed to request %d\n",
160 mtx1_gpio_button[0].gpio);
163 gpio_direction_input(mtx1_gpio_button[0].gpio);
165 return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
168 arch_initcall(mtx1_register_devices);