]> Pileus Git - ~andy/linux/blob - arch/arm/mach-kirkwood/board-iconnect.c
Merge branch 'x86-reboot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[~andy/linux] / 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/leds.h>
23 #include <linux/i2c.h>
24 #include <linux/input.h>
25 #include <linux/gpio_keys.h>
26 #include <asm/mach/arch.h>
27 #include <mach/kirkwood.h>
28 #include "common.h"
29 #include "mpp.h"
30
31 static struct mv643xx_eth_platform_data iconnect_ge00_data = {
32         .phy_addr       = MV643XX_ETH_PHY_ADDR(11),
33 };
34
35 static struct gpio_led iconnect_led_pins[] = {
36         {
37                 .name           = "led_level",
38                 .gpio           = 41,
39                 .default_trigger = "default-on",
40         }, {
41                 .name           = "power:blue",
42                 .gpio           = 42,
43                 .default_trigger = "timer",
44         }, {
45                 .name           = "power:red",
46                 .gpio           = 43,
47         }, {
48                 .name           = "usb1:blue",
49                 .gpio           = 44,
50         }, {
51                 .name           = "usb2:blue",
52                 .gpio           = 45,
53         }, {
54                 .name           = "usb3:blue",
55                 .gpio           = 46,
56         }, {
57                 .name           = "usb4:blue",
58                 .gpio           = 47,
59         }, {
60                 .name           = "otb:blue",
61                 .gpio           = 48,
62         },
63 };
64
65 static struct gpio_led_platform_data iconnect_led_data = {
66         .leds           = iconnect_led_pins,
67         .num_leds       = ARRAY_SIZE(iconnect_led_pins),
68         .gpio_blink_set = orion_gpio_led_blink_set,
69 };
70
71 static struct platform_device iconnect_leds = {
72         .name   = "leds-gpio",
73         .id     = -1,
74         .dev    = {
75                 .platform_data  = &iconnect_led_data,
76         }
77 };
78
79 static unsigned int iconnect_mpp_config[] __initdata = {
80         MPP12_GPIO,
81         MPP35_GPIO,
82         MPP41_GPIO,
83         MPP42_GPIO,
84         MPP43_GPIO,
85         MPP44_GPIO,
86         MPP45_GPIO,
87         MPP46_GPIO,
88         MPP47_GPIO,
89         MPP48_GPIO,
90         0
91 };
92
93 static struct i2c_board_info __initdata iconnect_board_info[] = {
94         {
95                 I2C_BOARD_INFO("lm63", 0x4c),
96         },
97 };
98
99 static struct mtd_partition iconnect_nand_parts[] = {
100         {
101                 .name = "flash",
102                 .offset = 0,
103                 .size = MTDPART_SIZ_FULL,
104         },
105 };
106
107 /* yikes... theses are the original input buttons */
108 /* but I'm not convinced by the sw event choices  */
109 static struct gpio_keys_button iconnect_buttons[] = {
110         {
111                 .type           = EV_SW,
112                 .code           = SW_LID,
113                 .gpio           = 12,
114                 .desc           = "Reset Button",
115                 .active_low     = 1,
116                 .debounce_interval = 100,
117         }, {
118                 .type           = EV_SW,
119                 .code           = SW_TABLET_MODE,
120                 .gpio           = 35,
121                 .desc           = "OTB Button",
122                 .active_low     = 1,
123                 .debounce_interval = 100,
124         },
125 };
126
127 static struct gpio_keys_platform_data iconnect_button_data = {
128         .buttons        = iconnect_buttons,
129         .nbuttons       = ARRAY_SIZE(iconnect_buttons),
130 };
131
132 static struct platform_device iconnect_button_device = {
133         .name           = "gpio-keys",
134         .id             = -1,
135         .num_resources  = 0,
136         .dev        = {
137                 .platform_data  = &iconnect_button_data,
138         },
139 };
140
141 void __init iconnect_init(void)
142 {
143         kirkwood_mpp_conf(iconnect_mpp_config);
144         kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
145         kirkwood_i2c_init();
146         i2c_register_board_info(0, iconnect_board_info,
147                 ARRAY_SIZE(iconnect_board_info));
148
149         kirkwood_ehci_init();
150         kirkwood_ge00_init(&iconnect_ge00_data);
151
152         platform_device_register(&iconnect_button_device);
153         platform_device_register(&iconnect_leds);
154 }
155
156 static int __init iconnect_pci_init(void)
157 {
158         if (of_machine_is_compatible("iom,iconnect"))
159                 kirkwood_pcie_init(KW_PCIE0);
160         return 0;
161 }
162 subsys_initcall(iconnect_pci_init);