[kirkwood]: upgrade to 2.6.37
[openwrt.git] / target / linux / kirkwood / patches / 200-iconnect.patch
1 --- a/arch/arm/mach-kirkwood/Makefile
2 +++ b/arch/arm/mach-kirkwood/Makefile
3 @@ -8,6 +8,7 @@ obj-$(CONFIG_MACH_SHEEVAPLUG)           += sheeva
4  obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG)    += sheevaplug-setup.o
5  obj-$(CONFIG_MACH_GURUPLUG)            += guruplug-setup.o
6  obj-$(CONFIG_MACH_DOCKSTAR)            += dockstar-setup.o
7 +obj-$(CONFIG_MACH_ICONNECT)            += iconnect-setup.o
8  obj-$(CONFIG_MACH_TS219)               += ts219-setup.o tsx1x-common.o
9  obj-$(CONFIG_MACH_TS41X)               += ts41x-setup.o tsx1x-common.o
10  obj-$(CONFIG_MACH_OPENRD)              += openrd-setup.o
11 --- a/arch/arm/mach-kirkwood/Kconfig
12 +++ b/arch/arm/mach-kirkwood/Kconfig
13 @@ -130,6 +130,12 @@ config MACH_T5325
14           Say 'Y' here if you want your kernel to support the
15           HP t5325 Thin Client.
16  
17 +config MACH_ICONNECT
18 +       bool "Iomega iConnect Wireless"
19 +       help
20 +         Say 'Y' here if you want your kernel to support the
21 +         Iomega iConnect Wireless.
22 +
23  endmenu
24  
25  endif
26 --- a/arch/arm/mach-kirkwood/mpp.h
27 +++ b/arch/arm/mach-kirkwood/mpp.h
28 @@ -108,6 +108,7 @@
29  #define MPP11_SATA0_ACTn       MPP( 11, 0x5, 0, 1, 0,   1,   1,   1,   1 )
30  
31  #define MPP12_GPO              MPP( 12, 0x0, 0, 1, 1,   1,   1,   1,   1 )
32 +#define MPP12_GPIO             MPP( 12, 0x0, 1, 1, 1,   1,   1,   1,   1 )
33  #define MPP12_SD_CLK           MPP( 12, 0x1, 0, 1, 1,   1,   1,   1,   1 )
34  #define MPP12_AU_SPDIF0                MPP( 12, 0xa, 0, 1, 0,   0,   0,   0,   1 )
35  #define MPP12_SPI_MOSI         MPP( 12, 0xb, 0, 1, 0,   0,   0,   0,   1 )
36 --- /dev/null
37 +++ b/arch/arm/mach-kirkwood/iconnect-setup.c
38 @@ -0,0 +1,188 @@
39 +/*
40 + * arch/arm/mach-kirkwood/iconnect-setup.c
41 + *
42 + * Iomega iConnect Wireless
43 + *
44 + * This file is licensed under the terms of the GNU General Public
45 + * License version 2.  This program is licensed "as is" without any
46 + * warranty of any kind, whether express or implied.
47 + */
48 +
49 +#include <linux/kernel.h>
50 +#include <linux/init.h>
51 +#include <linux/platform_device.h>
52 +#include <linux/irq.h>
53 +#include <linux/mtd/partitions.h>
54 +#include <linux/mv643xx_eth.h>
55 +#include <linux/ethtool.h>
56 +#include <linux/gpio.h>
57 +#include <linux/gpio_keys.h>
58 +#include <linux/input.h>
59 +#include <linux/leds.h>
60 +#include <asm/mach-types.h>
61 +#include <asm/mach/arch.h>
62 +#include <mach/kirkwood.h>
63 +#include "common.h"
64 +#include "mpp.h"
65 +
66 +static struct mtd_partition iconnect_nand_parts[] = {
67 +       {
68 +               .name = "u-boot",
69 +               .offset = 0,
70 +               .size = SZ_1M
71 +       }, {
72 +               .name = "uImage",
73 +               .offset = MTDPART_OFS_NXTBLK,
74 +               .size = SZ_1M + SZ_2M
75 +       }, {
76 +               .name = "rootfs",
77 +               .offset = MTDPART_OFS_NXTBLK,
78 +               .size = SZ_32M,
79 +       }, {
80 +               .name = "data",
81 +               .offset = MTDPART_OFS_NXTBLK,
82 +               .size = MTDPART_SIZ_FULL
83 +       },
84 +};
85 +
86 +static struct mv643xx_eth_platform_data iconnect_ge00_data = {
87 +       .phy_addr       = MV643XX_ETH_PHY_ADDR(11),
88 +};
89 +
90 +static struct gpio_led iconnect_led_pins[] = {
91 +       {
92 +               .name                   = "iconnect:blue:power",
93 +               .default_trigger        = "default-on",
94 +               .gpio                   = 42,
95 +       },
96 +       {
97 +               .name                   = "iconnect:red:power",
98 +               .gpio                   = 43,
99 +       },
100 +       {
101 +               .name                   = "iconnect:blue:usb1",
102 +               .gpio                   = 44,
103 +       },
104 +       {
105 +               .name                   = "iconnect:blue:usb2",
106 +               .gpio                   = 45,
107 +       },
108 +       {
109 +               .name                   = "iconnect:blue:usb3",
110 +               .gpio                   = 46,
111 +       },
112 +       {
113 +               .name                   = "iconnect:blue:usb4",
114 +               .gpio                   = 47,
115 +       },
116 +       {
117 +               .name                   = "iconnect:blue:otb",
118 +               .gpio                   = 48,
119 +       },
120 +};
121 +
122 +static struct gpio_led_platform_data iconnect_led_data = {
123 +       .leds           = iconnect_led_pins,
124 +       .num_leds       = ARRAY_SIZE(iconnect_led_pins),
125 +};
126 +
127 +static struct platform_device iconnect_leds = {
128 +       .name   = "leds-gpio",
129 +       .id     = -1,
130 +       .dev    = {
131 +               .platform_data  = &iconnect_led_data,
132 +       }
133 +};
134 +
135 +#define ICONNECT_GPIO_KEY_RESET                12
136 +#define ICONNECT_GPIO_KEY_OTB          35
137 +
138 +#define ICONNECT_SW_RESET              0x00
139 +#define ICONNECT_SW_OTB                        0x01
140 +
141 +static struct gpio_keys_button iconnect_buttons[] = {
142 +               {
143 +               .type           = EV_SW,
144 +               .code           = ICONNECT_SW_RESET,
145 +               .gpio           = ICONNECT_GPIO_KEY_RESET,
146 +               .desc           = "Reset Button",
147 +               .active_low     = 1,
148 +               .debounce_interval = 100,
149 +               }, 
150 +               {
151 +               .type           = EV_SW,
152 +               .code           = ICONNECT_SW_OTB,
153 +               .gpio           = ICONNECT_GPIO_KEY_OTB,
154 +               .desc           = "OTB Button",
155 +               .active_low     = 1,
156 +               .debounce_interval = 100,
157 +               },
158 +};
159 +
160 +static struct gpio_keys_platform_data iconnect_button_data = {
161 +       .buttons        = iconnect_buttons,
162 +       .nbuttons       = ARRAY_SIZE(iconnect_buttons),
163 +};
164 +
165 +static struct platform_device iconnect_button_device = {
166 +       .name      = "gpio-keys",
167 +       .id          = -1,
168 +       .num_resources  = 0,
169 +       .dev        =   {
170 +                                       .platform_data  = &iconnect_button_data,
171 +                                       },
172 +};
173 +
174 +static unsigned int iconnect_mpp_config[] __initdata = {
175 +       MPP12_GPIO, /*Input for reset button*/
176 +       MPP35_GPIO, /*Input for OTB button*/
177 +       MPP42_GPIO,
178 +       MPP43_GPIO,
179 +       MPP44_GPIO,
180 +       MPP45_GPIO,
181 +       MPP46_GPIO,
182 +       MPP47_GPIO,
183 +       MPP48_GPIO,
184 +       0
185 +};
186 +
187 +static void __init iconnect_init(void)
188 +{
189 +       u32 dev, rev;
190 +
191 +       /*
192 +        * Basic setup. Needs to be called early.
193 +        */
194 +       kirkwood_init();
195 +       kirkwood_mpp_conf(iconnect_mpp_config);
196 +
197 +       kirkwood_nand_init(ARRAY_AND_SIZE(iconnect_nand_parts), 25);
198 +       kirkwood_ehci_init();
199 +
200 +       kirkwood_ge00_init(&iconnect_ge00_data);
201 +       kirkwood_pcie_id(&dev, &rev);
202 +
203 +       kirkwood_uart0_init();
204 +       kirkwood_i2c_init();
205 +
206 +       platform_device_register(&iconnect_leds);
207 +       platform_device_register(&iconnect_button_device);
208 +}
209 +
210 +static int __init iconnect_pci_init(void)
211 +{
212 +       if (machine_is_iconnect())
213 +               kirkwood_pcie_init(KW_PCIE0);
214 +
215 +       return 0;
216 +}
217 +subsys_initcall(iconnect_pci_init);
218 +
219 +
220 +MACHINE_START(ICONNECT, "Iomega iConnect Wireless")
221 +       .boot_params    = 0x00000100,
222 +       .init_machine   = iconnect_init,
223 +       .map_io         = kirkwood_map_io,
224 +       .init_irq       = kirkwood_init_irq,
225 +       .timer          = &kirkwood_timer,
226 +MACHINE_END