Merge git://1984.lsi.us.es/nf-next
[cascardo/linux.git] / arch / arm / mach-kirkwood / board-iconnect.c
1 /*
2  * arch/arm/mach-kirkwood/board-iconnect.c
3  *
4  * Iomega i-connect Board Setup
5  *
6  * This file is licensed under the terms of the GNU General Public
7  * License version 2.  This program is licensed "as is" without any
8  * warranty of any kind, whether express or implied.
9  */
10
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/of.h>
15 #include <linux/of_address.h>
16 #include <linux/of_fdt.h>
17 #include <linux/of_irq.h>
18 #include <linux/of_platform.h>
19 #include <linux/mtd/partitions.h>
20 #include <linux/mv643xx_eth.h>
21 #include <linux/gpio.h>
22 #include <linux/input.h>
23 #include <linux/gpio_keys.h>
24 #include <asm/mach/arch.h>
25 #include <mach/kirkwood.h>
26 #include "common.h"
27 #include "mpp.h"
28
29 static struct mv643xx_eth_platform_data iconnect_ge00_data = {
30         .phy_addr       = MV643XX_ETH_PHY_ADDR(11),
31 };
32
33 static unsigned int iconnect_mpp_config[] __initdata = {
34         MPP12_GPIO,
35         MPP35_GPIO,
36         MPP41_GPIO,
37         MPP42_GPIO,
38         MPP43_GPIO,
39         MPP44_GPIO,
40         MPP45_GPIO,
41         MPP46_GPIO,
42         MPP47_GPIO,
43         MPP48_GPIO,
44         0
45 };
46
47 static struct mtd_partition iconnect_nand_parts[] = {
48         {
49                 .name = "flash",
50                 .offset = 0,
51                 .size = MTDPART_SIZ_FULL,
52         },
53 };
54
55 /* yikes... theses are the original input buttons */
56 /* but I'm not convinced by the sw event choices  */
57 static struct gpio_keys_button iconnect_buttons[] = {
58         {
59                 .type           = EV_SW,
60                 .code           = SW_LID,
61                 .gpio           = 12,
62                 .desc           = "Reset Button",
63                 .active_low     = 1,
64                 .debounce_interval = 100,
65         }, {
66                 .type           = EV_SW,
67                 .code           = SW_TABLET_MODE,
68                 .gpio           = 35,
69                 .desc           = "OTB Button",
70                 .active_low     = 1,
71                 .debounce_interval = 100,
72         },
73 };
74
75 static struct gpio_keys_platform_data iconnect_button_data = {
76         .buttons        = iconnect_buttons,
77         .nbuttons       = ARRAY_SIZE(iconnect_buttons),
78 };
79
80 static struct platform_device iconnect_button_device = {
81         .name           = "gpio-keys",
82         .id             = -1,
83         .num_resources  = 0,
84         .dev        = {
85                 .platform_data  = &iconnect_button_data,
86         },
87 };
88
89 void __init iconnect_init(void)
90 {
91         kirkwood_mpp_conf(iconnect_mpp_config);
92         kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
93
94         kirkwood_ehci_init();
95         kirkwood_ge00_init(&iconnect_ge00_data);
96
97         platform_device_register(&iconnect_button_device);
98 }
99
100 static int __init iconnect_pci_init(void)
101 {
102         if (of_machine_is_compatible("iom,iconnect"))
103                 kirkwood_pcie_init(KW_PCIE0);
104         return 0;
105 }
106 subsys_initcall(iconnect_pci_init);