We use different toolchain directories for different ARM archs, so we should set...
[openwrt/staging/wigyori.git] / target / linux / gemini / patches / 200-wbd222_support.patch
1 --- a/arch/arm/mach-gemini/Kconfig
2 +++ b/arch/arm/mach-gemini/Kconfig
3 @@ -23,6 +23,13 @@ config MACH_WBD111
4 Say Y here if you intend to run this kernel on a
5 Wiliboard WBD-111.
6
7 +config MACH_WBD222
8 + bool "Wiliboard WBD-222"
9 + select GEMINI_MEM_SWAP
10 + help
11 + Say Y here if you intend to run this kernel on a
12 + Wiliboard WBD-222.
13 +
14 endmenu
15
16 config GEMINI_MEM_SWAP
17 --- a/arch/arm/mach-gemini/Makefile
18 +++ b/arch/arm/mach-gemini/Makefile
19 @@ -12,3 +12,4 @@ obj-$(CONFIG_PCI) += pci.o
20 obj-$(CONFIG_MACH_NAS4220B) += board-nas4220b.o
21 obj-$(CONFIG_MACH_RUT100) += board-rut1xx.o
22 obj-$(CONFIG_MACH_WBD111) += board-wbd111.o
23 +obj-$(CONFIG_MACH_WBD222) += board-wbd222.o
24 --- /dev/null
25 +++ b/arch/arm/mach-gemini/board-wbd222.c
26 @@ -0,0 +1,170 @@
27 +/*
28 + * Support for Wiliboard WBD-222
29 + *
30 + * Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org>
31 + *
32 + * This program is free software; you can redistribute it and/or modify
33 + * it under the terms of the GNU General Public License as published by
34 + * the Free Software Foundation; either version 2 of the License, or
35 + * (at your option) any later version.
36 + */
37 +#include <linux/kernel.h>
38 +#include <linux/init.h>
39 +#include <linux/platform_device.h>
40 +#include <linux/leds.h>
41 +#include <linux/input.h>
42 +#include <linux/skbuff.h>
43 +#include <linux/gpio_keys.h>
44 +#include <linux/mdio-gpio.h>
45 +#include <linux/mtd/mtd.h>
46 +#include <linux/mtd/partitions.h>
47 +#include <asm/mach-types.h>
48 +#include <asm/mach/arch.h>
49 +#include <asm/mach/time.h>
50 +
51 +#include <mach/gmac.h>
52 +
53 +#include "common.h"
54 +
55 +static struct mdio_gpio_platform_data wbd222_mdio = {
56 + .mdc = 22,
57 + .mdio = 21,
58 + .phy_mask = ~((1 << 1) | (1 << 3)),
59 +};
60 +
61 +static struct platform_device wbd222_phy_device = {
62 + .name = "mdio-gpio",
63 + .id = 0,
64 + .dev = {
65 + .platform_data = &wbd222_mdio,
66 + },
67 +};
68 +
69 +static struct gemini_gmac_platform_data gmac_data = {
70 + .bus_id[0] = "0:01",
71 + .interface[0] = PHY_INTERFACE_MODE_MII,
72 + .bus_id[1] = "0:03",
73 + .interface[1] = PHY_INTERFACE_MODE_MII,
74 +};
75 +
76 +static struct gpio_keys_button wbd222_keys[] = {
77 + {
78 + .code = KEY_SETUP,
79 + .gpio = 5,
80 + .active_low = 1,
81 + .desc = "reset",
82 + .type = EV_KEY,
83 + },
84 +};
85 +
86 +static struct gpio_keys_platform_data wbd222_keys_data = {
87 + .buttons = wbd222_keys,
88 + .nbuttons = ARRAY_SIZE(wbd222_keys),
89 +};
90 +
91 +static struct platform_device wbd222_keys_device = {
92 + .name = "gpio-keys",
93 + .id = -1,
94 + .dev = {
95 + .platform_data = &wbd222_keys_data,
96 + },
97 +};
98 +
99 +static struct gpio_led wbd222_leds[] = {
100 + {
101 + .name = "L3red",
102 + .gpio = 1,
103 + },
104 + {
105 + .name = "L4green",
106 + .gpio = 2,
107 + },
108 + {
109 + .name = "L4red",
110 + .gpio = 3,
111 + },
112 + {
113 + .name = "L3green",
114 + .gpio = 5,
115 + },
116 +};
117 +
118 +static struct gpio_led_platform_data wbd222_leds_data = {
119 + .num_leds = ARRAY_SIZE(wbd222_leds),
120 + .leds = wbd222_leds,
121 +};
122 +
123 +static struct platform_device wbd222_leds_device = {
124 + .name = "leds-gpio",
125 + .id = -1,
126 + .dev = {
127 + .platform_data = &wbd222_leds_data,
128 + },
129 +};
130 +
131 +static struct sys_timer wbd222_timer = {
132 + .init = gemini_timer_init,
133 +};
134 +
135 +#ifdef CONFIG_MTD_PARTITIONS
136 +static struct mtd_partition wbd222_partitions[] = {
137 + {
138 + .name = "RedBoot",
139 + .offset = 0,
140 + .size = 0x020000,
141 + .mask_flags = MTD_WRITEABLE,
142 + } , {
143 + .name = "kernel",
144 + .offset = 0x020000,
145 + .size = 0x100000,
146 + } , {
147 + .name = "rootfs",
148 + .offset = 0x120000,
149 + .size = 0x6a0000,
150 + } , {
151 + .name = "VCTL",
152 + .offset = 0x7c0000,
153 + .size = 0x010000,
154 + .mask_flags = MTD_WRITEABLE,
155 + } , {
156 + .name = "cfg",
157 + .offset = 0x7d0000,
158 + .size = 0x010000,
159 + .mask_flags = MTD_WRITEABLE,
160 + } , {
161 + .name = "FIS",
162 + .offset = 0x7e0000,
163 + .size = 0x010000,
164 + .mask_flags = MTD_WRITEABLE,
165 + }
166 +};
167 +#define wbd222_num_partitions ARRAY_SIZE(wbd222_partitions)
168 +#else
169 +#define wbd222_partitions NULL
170 +#define wbd222_num_partitions 0
171 +#endif /* CONFIG_MTD_PARTITIONS */
172 +
173 +static void __init wbd222_init(void)
174 +{
175 + gemini_gpio_init();
176 + platform_register_uart();
177 + platform_register_watchdog();
178 + platform_register_pflash(SZ_8M, wbd222_partitions,
179 + wbd222_num_partitions);
180 + platform_device_register(&wbd222_leds_device);
181 + platform_device_register(&wbd222_keys_device);
182 + platform_device_register(&wbd222_phy_device);
183 + platform_register_ethernet(&gmac_data);
184 + platform_register_usb(0);
185 + platform_register_usb(1);
186 +}
187 +
188 +MACHINE_START(WBD222, "Wiliboard WBD-222")
189 + .phys_io = 0x7fffc000,
190 + .io_pg_offst = ((0xffffc000) >> 18) & 0xfffc,
191 + .boot_params = 0x100,
192 + .map_io = gemini_map_io,
193 + .init_irq = gemini_init_irq,
194 + .timer = &wbd222_timer,
195 + .init_machine = wbd222_init,
196 +MACHINE_END