[au1000] switch to using 2.6.37.1
[openwrt.git] / target / linux / rdc / patches-2.6.32 / 100-rdc_boards.patch
1 --- a/arch/x86/Makefile
2 +++ b/arch/x86/Makefile
3 @@ -125,6 +125,9 @@ libs-y += arch/x86/lib/
4 # See arch/x86/Kbuild for content of core part of the kernel
5 core-y += arch/x86/
6
7 +# RDC R-321X support
8 +core-$(CONFIG_X86_RDC321X) += arch/x86/mach-rdc321x/
9 +
10 # drivers-y are linked after core-y
11 drivers-$(CONFIG_MATH_EMULATION) += arch/x86/math-emu/
12 drivers-$(CONFIG_PCI) += arch/x86/pci/
13 --- /dev/null
14 +++ b/arch/x86/mach-rdc321x/Makefile
15 @@ -0,0 +1,5 @@
16 +#
17 +# Makefile for the RDC321x specific parts of the kernel
18 +#
19 +obj-$(CONFIG_X86_RDC321X) := platform.o reboot.o boards/sitecom.o boards/ar525w.o boards/bifferboard.o boards/r8610.o
20 +
21 --- /dev/null
22 +++ b/arch/x86/mach-rdc321x/platform.c
23 @@ -0,0 +1,115 @@
24 +/*
25 + * Generic RDC321x platform devices
26 + *
27 + * Copyright (C) 2007-2009 OpenWrt.org
28 + * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
29 + * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
30 + *
31 + * This program is free software; you can redistribute it and/or
32 + * modify it under the terms of the GNU General Public License
33 + * as published by the Free Software Foundation; either version 2
34 + * of the License, or (at your option) any later version.
35 + *
36 + * This program is distributed in the hope that it will be useful,
37 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
38 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 + * GNU General Public License for more details.
40 + *
41 + * You should have received a copy of the GNU General Public License
42 + * along with this program; if not, write to the
43 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
44 + * Boston, MA 02110-1301, USA.
45 + *
46 + */
47 +
48 +#include <linux/init.h>
49 +#include <linux/platform_device.h>
50 +#include <linux/mtd/map.h>
51 +#include <linux/mtd/mtd.h>
52 +#include <linux/mtd/physmap.h>
53 +#include <linux/root_dev.h>
54 +
55 +#include <asm/rdc_boards.h>
56 +
57 +static struct rdc_platform_data rdcplat_data;
58 +
59 +/* LEDS */
60 +static struct platform_device rdc321x_leds = {
61 + .name = "leds-gpio",
62 + .id = -1,
63 + .dev = {
64 + .platform_data = &rdcplat_data.led_data,
65 + }
66 +};
67 +
68 +/* Button */
69 +static struct platform_device rdc321x_buttons = {
70 + .name = "gpio-buttons",
71 + .id = -1,
72 + .dev = {
73 + .platform_data = &rdcplat_data.button_data,
74 + }
75 +};
76 +
77 +static __initdata struct platform_device *rdc321x_devs[] = {
78 + &rdc321x_leds,
79 + &rdc321x_buttons,
80 +};
81 +
82 +const char *__initdata boards[] = {
83 + "Sitecom",
84 + "AR525W",
85 + "Bifferboard",
86 + "R8610",
87 + 0
88 +};
89 +
90 +static struct map_info rdc_map_info = {
91 + .name = "rdc_flash",
92 + .size = 0x800000, /* 8MB */
93 + .phys = 0xFF800000, /* (u32) -rdc_map_info.size */
94 + .bankwidth = 2,
95 +};
96 +
97 +static int __init rdc_board_setup(void)
98 +{
99 + struct mtd_partition *partitions;
100 + int count, res;
101 + struct mtd_info *mtdinfo;
102 +
103 + simple_map_init(&rdc_map_info);
104 +
105 + while (1) {
106 + rdc_map_info.virt = ioremap(rdc_map_info.phys,
107 + rdc_map_info.size);
108 + if (rdc_map_info.virt == NULL)
109 + continue;
110 +
111 + mtdinfo = do_map_probe("cfi_probe", &rdc_map_info);
112 + if (mtdinfo == NULL)
113 + mtdinfo = do_map_probe("jedec_probe", &rdc_map_info);
114 + if (mtdinfo != NULL)
115 + break;
116 +
117 + iounmap(rdc_map_info.virt);
118 + if ((rdc_map_info.size >>= 1) < 0x100000) /* 1MB */
119 + panic("RDC321x: Could not find start of flash!");
120 + rdc_map_info.phys = (u32) -rdc_map_info.size;
121 + }
122 +
123 + count = parse_mtd_partitions(mtdinfo, boards, &partitions,
124 + (unsigned long) &rdcplat_data);
125 +
126 + if (count <= 0) {
127 + panic("RDC321x: can't identify board type");
128 + return -ENOSYS;
129 + }
130 +
131 + ROOT_DEV = 0;
132 + res = add_mtd_partitions(mtdinfo, partitions, count);
133 + if (res)
134 + return res;
135 +
136 + return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs));
137 +}
138 +late_initcall(rdc_board_setup);
139 --- /dev/null
140 +++ b/arch/x86/mach-rdc321x/boards/ar525w.c
141 @@ -0,0 +1,243 @@
142 +/*
143 + * ar525w RDC321x platform devices
144 + *
145 + * Copyright (C) 2007-2009 OpenWrt.org
146 + * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
147 + * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
148 + *
149 + * This program is free software; you can redistribute it and/or
150 + * modify it under the terms of the GNU General Public License
151 + * as published by the Free Software Foundation; either version 2
152 + * of the License, or (at your option) any later version.
153 + *
154 + * This program is distributed in the hope that it will be useful,
155 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
156 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
157 + * GNU General Public License for more details.
158 + *
159 + * You should have received a copy of the GNU General Public License
160 + * along with this program; if not, write to the
161 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
162 + * Boston, MA 02110-1301, USA.
163 + *
164 + */
165 +
166 +#include <linux/init.h>
167 +#include <linux/mtd/physmap.h>
168 +#include <linux/input.h>
169 +#include <linux/vmalloc.h>
170 +#include <linux/mtd/mtd.h>
171 +
172 +#include <asm/rdc_boards.h>
173 +
174 +struct image_header {
175 + char magic[4]; /* ASICII: GMTK */
176 + u32 checksum; /* CRC32 */
177 + u32 version; /* x.x.x.x */
178 + u32 kernelsz; /* The size of the kernel image */
179 + u32 imagesz; /* The length of this image file ( kernel + romfs + this header) */
180 + u32 pid; /* Product ID */
181 + u32 fastcksum; /* Partial CRC32 on (First(256), medium(256), last(512)) */
182 + u32 reserved;
183 +};
184 +
185 +static struct gpio_led ar525w_leds[] = {
186 + { .name = "rdc321x:dmz", .gpio = 1, .active_low = 1},
187 +};
188 +static struct gpio_button ar525w_btns[] = {
189 + {
190 + .gpio = 6,
191 + .code = BTN_0,
192 + .desc = "Reset",
193 + .active_low = 1,
194 + }
195 +};
196 +
197 +static u32 __initdata crctab[257] = {
198 + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba,
199 + 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
200 + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
201 + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
202 + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
203 + 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
204 + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
205 + 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
206 + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
207 + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
208 + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940,
209 + 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
210 + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116,
211 + 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
212 + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
213 + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
214 + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a,
215 + 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
216 + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818,
217 + 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
218 + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
219 + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
220 + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c,
221 + 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
222 + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
223 + 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
224 + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
225 + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
226 + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086,
227 + 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
228 + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4,
229 + 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
230 + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
231 + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
232 + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
233 + 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
234 + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe,
235 + 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
236 + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
237 + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
238 + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252,
239 + 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
240 + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60,
241 + 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
242 + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
243 + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
244 + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04,
245 + 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
246 + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
247 + 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
248 + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
249 + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
250 + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e,
251 + 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
252 + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
253 + 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
254 + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
255 + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
256 + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0,
257 + 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
258 + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6,
259 + 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
260 + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
261 + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
262 + 0
263 +};
264 +
265 +static u32 __init crc32(u8 * buf, u32 len)
266 +{
267 + register int i;
268 + u32 sum;
269 + register u32 s0;
270 + s0 = ~0;
271 + for (i = 0; i < len; i++) {
272 + s0 = (s0 >> 8) ^ crctab[(u8) (s0 & 0xFF) ^ buf[i]];
273 + }
274 + sum = ~s0;
275 + return sum;
276 +}
277 +
278 +static int __init fixup_ar525w_header(struct mtd_info *master, struct image_header *header)
279 +{
280 + char *buffer;
281 + int res;
282 + u32 bufferlength = header->kernelsz + sizeof(struct image_header);
283 + u32 len;
284 + char crcbuf[0x400];
285 +
286 + printk(KERN_INFO "Fixing up AR525W header, old image size: %u, new image size: %u\n",
287 + header->imagesz, bufferlength);
288 +
289 + buffer = vmalloc(bufferlength);
290 + if (!buffer) {
291 + printk(KERN_ERR "Can't allocate %u bytes\n", bufferlength);
292 + return -ENOMEM;
293 + }
294 +
295 + res = master->read(master, 0x0, bufferlength, &len, buffer);
296 + if (res || len != bufferlength)
297 + goto out;
298 +
299 + header = (struct image_header *) buffer;
300 + header->imagesz = bufferlength;
301 + header->checksum = 0;
302 + header->fastcksum = 0;
303 +
304 + memcpy(crcbuf, buffer, 0x100);
305 + memcpy(crcbuf + 0x100, buffer + (bufferlength >> 1) - ((bufferlength & 0x6) >> 1), 0x100);
306 + memcpy(crcbuf + 0x200, buffer + bufferlength - 0x200, 0x200);
307 +
308 + header->fastcksum = crc32(crcbuf, sizeof(crcbuf));
309 + header->checksum = crc32(buffer, bufferlength);
310 +
311 + if (master->unlock)
312 + master->unlock(master, 0, master->erasesize);
313 + res = erase_write (master, 0, master->erasesize, buffer);
314 + if (res)
315 + printk(KERN_ERR "Can't rewrite image header\n");
316 +
317 +out:
318 + vfree(buffer);
319 + return res;
320 +}
321 +
322 +static int __init parse_ar525w_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
323 +{
324 + struct image_header header;
325 + int res;
326 + size_t len;
327 + struct mtd_partition *rdc_flash_parts;
328 + struct rdc_platform_data *pdata = (struct rdc_platform_data *) plat_data;
329 +
330 + if (master->size != 0x400000) //4MB
331 + return -ENOSYS;
332 +
333 + res = master->read(master, 0x0, sizeof(header), &len, (char *)&header);
334 + if (res)
335 + return res;
336 +
337 + if (strncmp(header.magic, "GMTK", 4))
338 + return -ENOSYS;
339 +
340 + if (header.kernelsz > 0x400000 || header.kernelsz < master->erasesize) {
341 + printk(KERN_ERR "AR525W image header found, but seems corrupt, kernel size %u\n", header.kernelsz);
342 + return -EINVAL;
343 + }
344 +
345 + if (header.kernelsz + sizeof(header) != header.imagesz) {
346 + res = fixup_ar525w_header(master, &header);
347 + if (res)
348 + return res;
349 + }
350 +
351 + rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 3, GFP_KERNEL);
352 +
353 + rdc_flash_parts[0].name = "firmware";
354 + rdc_flash_parts[0].offset = 0x0;
355 + rdc_flash_parts[0].size = 0x3E0000;
356 + rdc_flash_parts[1].name = "rootfs";
357 + rdc_flash_parts[1].offset = header.kernelsz + sizeof(header);
358 + rdc_flash_parts[1].size = rdc_flash_parts[0].size - rdc_flash_parts[1].offset;
359 + rdc_flash_parts[2].name = "bootloader";
360 + rdc_flash_parts[2].offset = 0x3E0000;
361 + rdc_flash_parts[2].size = 0x20000;
362 +
363 + *pparts = rdc_flash_parts;
364 +
365 + pdata->led_data.num_leds = ARRAY_SIZE(ar525w_leds);
366 + pdata->led_data.leds = ar525w_leds;
367 + pdata->button_data.nbuttons = ARRAY_SIZE(ar525w_btns);
368 + pdata->button_data.buttons = ar525w_btns;
369 +
370 + return 3;
371 +}
372 +
373 +static struct mtd_part_parser __initdata ar525w_parser = {
374 + .owner = THIS_MODULE,
375 + .parse_fn = parse_ar525w_partitions,
376 + .name = "AR525W",
377 +};
378 +
379 +static int __init ar525w_setup(void)
380 +{
381 + return register_mtd_parser(&ar525w_parser);
382 +}
383 +
384 +arch_initcall(ar525w_setup);
385 --- /dev/null
386 +++ b/arch/x86/mach-rdc321x/boards/bifferboard.c
387 @@ -0,0 +1,69 @@
388 +/*
389 + * Bifferboard RDC321x platform devices
390 + *
391 + * Copyright (C) 2010 bifferos@yahoo.co.uk
392 + *
393 + * This program is free software; you can redistribute it and/or
394 + * modify it under the terms of the GNU General Public License
395 + * as published by the Free Software Foundation; either version 2
396 + * of the License, or (at your option) any later version.
397 + *
398 + * This program is distributed in the hope that it will be useful,
399 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
400 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
401 + * GNU General Public License for more details.
402 + *
403 + * You should have received a copy of the GNU General Public License
404 + * along with this program; if not, write to the
405 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
406 + * Boston, MA 02110-1301, USA.
407 + *
408 + */
409 +
410 +#include <linux/init.h>
411 +#include <linux/mtd/physmap.h>
412 +#include <linux/input.h>
413 +
414 +#include <asm/rdc_boards.h>
415 +
416 +static int __init parse_bifferboard_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
417 +{
418 + int res;
419 + size_t len;
420 + struct mtd_partition *rdc_flash_parts;
421 + u32 kernel_len;
422 + u16 tmp;
423 +
424 + res = master->read(master, 0x4000 + 1036, 2, &len, (char *) &tmp);
425 + if (res)
426 + return res;
427 + kernel_len = tmp * master->erasesize;
428 +
429 + rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 3, GFP_KERNEL);
430 +
431 + *pparts = rdc_flash_parts;
432 +
433 + rdc_flash_parts[0].name = "kernel";
434 + rdc_flash_parts[0].offset = 0;
435 + rdc_flash_parts[0].size = kernel_len;
436 + rdc_flash_parts[1].name = "rootfs";
437 + rdc_flash_parts[1].offset = kernel_len;
438 + rdc_flash_parts[1].size = master->size - kernel_len - 0x10000;
439 + rdc_flash_parts[2].name = "biffboot";
440 + rdc_flash_parts[2].offset = master->size - 0x10000;
441 + rdc_flash_parts[2].size = 0x10000;
442 +
443 + return 3;
444 +}
445 +
446 +struct mtd_part_parser __initdata bifferboard_parser = {
447 + .owner = THIS_MODULE,
448 + .parse_fn = parse_bifferboard_partitions,
449 + .name = "Bifferboard",
450 +};
451 +
452 +static int __init bifferboard_setup(void)
453 +{
454 + return register_mtd_parser(&bifferboard_parser);
455 +}
456 +arch_initcall(bifferboard_setup);
457 --- /dev/null
458 +++ b/arch/x86/mach-rdc321x/boards/r8610.c
459 @@ -0,0 +1,65 @@
460 +/*
461 + * R8610 RDC321x platform devices
462 + *
463 + * Copyright (C) 2009, Florian Fainelli <florian@openwrt.org>
464 + *
465 + * This program is free software; you can redistribute it and/or
466 + * modify it under the terms of the GNU General Public License
467 + * as published by the Free Software Foundation; either version 2
468 + * of the License, or (at your option) any later version.
469 + *
470 + * This program is distributed in the hope that it will be useful,
471 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
472 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
473 + * GNU General Public License for more details.
474 + *
475 + * You should have received a copy of the GNU General Public License
476 + * along with this program; if not, write to the
477 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
478 + * Boston, MA 02110-1301, USA.
479 + *
480 + */
481 +
482 +#include <linux/init.h>
483 +#include <linux/mtd/physmap.h>
484 +#include <linux/input.h>
485 +
486 +#include <asm/rdc_boards.h>
487 +
488 +static int __init parse_r8610_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
489 +{
490 + struct mtd_partition *rdc_flash_parts;
491 +
492 + rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 4, GFP_KERNEL);
493 +
494 + *pparts = rdc_flash_parts;
495 +
496 + rdc_flash_parts[0].name = "kernel";
497 + rdc_flash_parts[0].size = 0x001f0000;
498 + rdc_flash_parts[0].offset = 0;
499 + rdc_flash_parts[1].name = "config";
500 + rdc_flash_parts[1].size = 0x10000;
501 + rdc_flash_parts[1].offset = MTDPART_OFS_APPEND;
502 + rdc_flash_parts[2].name = "rootfs";
503 + rdc_flash_parts[2].size = 0x1E0000;
504 + rdc_flash_parts[2].offset = MTDPART_OFS_APPEND;
505 + rdc_flash_parts[3].name = "redboot";
506 + rdc_flash_parts[3].size = 0x20000;
507 + rdc_flash_parts[3].offset = MTDPART_OFS_APPEND;
508 + rdc_flash_parts[3].mask_flags = MTD_WRITEABLE;
509 +
510 + return 4;
511 +}
512 +
513 +struct mtd_part_parser __initdata r8610_parser = {
514 + .owner = THIS_MODULE,
515 + .parse_fn = parse_r8610_partitions,
516 + .name = "R8610",
517 +};
518 +
519 +static int __init r8610_setup(void)
520 +{
521 + return register_mtd_parser(&r8610_parser);
522 +}
523 +
524 +arch_initcall(r8610_setup);
525 --- /dev/null
526 +++ b/arch/x86/mach-rdc321x/boards/sitecom.c
527 @@ -0,0 +1,111 @@
528 +/*
529 + * Sitecom RDC321x platform devices
530 + *
531 + * Copyright (C) 2007-2009 OpenWrt.org
532 + * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
533 + * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
534 + *
535 + * This program is free software; you can redistribute it and/or
536 + * modify it under the terms of the GNU General Public License
537 + * as published by the Free Software Foundation; either version 2
538 + * of the License, or (at your option) any later version.
539 + *
540 + * This program is distributed in the hope that it will be useful,
541 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
542 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
543 + * GNU General Public License for more details.
544 + *
545 + * You should have received a copy of the GNU General Public License
546 + * along with this program; if not, write to the
547 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
548 + * Boston, MA 02110-1301, USA.
549 + *
550 + */
551 +
552 +#include <linux/init.h>
553 +#include <linux/mtd/physmap.h>
554 +#include <linux/input.h>
555 +
556 +#include <asm/rdc_boards.h>
557 +
558 +struct image_header {
559 + char magic[4];
560 + u32 kernel_length;
561 + u32 ramdisk_length;
562 + char magic2[4];
563 + u32 kernel_length2;
564 +};
565 +
566 +static struct gpio_led sitecom_leds[] = {
567 + { .name = "rdc321x:power", .gpio = 15, .active_low = 1},
568 + { .name = "rdc321x:usb0", .gpio = 0, .active_low = 1},
569 + { .name = "rdc321x:usb1", .gpio = 1, .active_low = 1},
570 +};
571 +
572 +static struct gpio_button sitecom_btns[] = {
573 + {
574 + .gpio = 6,
575 + .code = BTN_0,
576 + .desc = "Reset",
577 + .active_low = 1,
578 + }
579 +};
580 +
581 +static int __init parse_sitecom_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
582 +{
583 + struct image_header header;
584 + int res;
585 + size_t len;
586 + struct mtd_partition *rdc_flash_parts;
587 + struct rdc_platform_data *pdata = (struct rdc_platform_data *) plat_data;
588 +
589 + if (master->size != 0x400000) /* 4MB */
590 + return -ENOSYS;
591 +
592 + res = master->read(master, 0x8000, sizeof(header), &len, (char *)&header);
593 + if (res)
594 + return res;
595 +
596 + if (strncmp(header.magic, "CSYS", 4) || strncmp(header.magic2, "WRRM", 4))
597 + return -ENOSYS;
598 +
599 + rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 5, GFP_KERNEL);
600 +
601 + rdc_flash_parts[0].name = "firmware";
602 + rdc_flash_parts[0].offset = 0x8000;
603 + rdc_flash_parts[0].size = 0x3F0000 - 0x8000;
604 + rdc_flash_parts[1].name = "config";
605 + rdc_flash_parts[1].offset = 0;
606 + rdc_flash_parts[1].size = 0x8000;
607 + rdc_flash_parts[2].name = "kernel";
608 + rdc_flash_parts[2].offset = 0x8014;
609 + rdc_flash_parts[2].size = header.kernel_length;
610 + rdc_flash_parts[3].name = "rootfs";
611 + rdc_flash_parts[3].offset = 0x8014 + header.kernel_length;
612 + rdc_flash_parts[3].size = 0x3F0000 - rdc_flash_parts[3].offset;
613 + rdc_flash_parts[4].name = "bootloader";
614 + rdc_flash_parts[4].offset = 0x3F0000;
615 + rdc_flash_parts[4].size = 0x10000;
616 +
617 + *pparts = rdc_flash_parts;
618 +
619 + pdata->led_data.num_leds = ARRAY_SIZE(sitecom_leds);
620 + pdata->led_data.leds = sitecom_leds;
621 + pdata->button_data.nbuttons = ARRAY_SIZE(sitecom_btns);
622 + pdata->button_data.buttons = sitecom_btns;
623 +
624 + return 5;
625 +}
626 +
627 +struct mtd_part_parser __initdata sitecom_parser = {
628 + .owner = THIS_MODULE,
629 + .parse_fn = parse_sitecom_partitions,
630 + .name = "Sitecom",
631 +};
632 +
633 +static int __init sitecom_setup(void)
634 +{
635 + return register_mtd_parser(&sitecom_parser);
636 +}
637 +
638 +arch_initcall(sitecom_setup);
639 --- /dev/null
640 +++ b/arch/x86/mach-rdc321x/reboot.c
641 @@ -0,0 +1,44 @@
642 +/*
643 + * This program is free software; you can redistribute it and/or
644 + * modify it under the terms of the GNU General Public License
645 + * as published by the Free Software Foundation; either version 2
646 + * of the License, or (at your option) any later version.
647 + *
648 + * This program is distributed in the hope that it will be useful,
649 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
650 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
651 + * GNU General Public License for more details.
652 + *
653 + * You should have received a copy of the GNU General Public License
654 + * along with this program; if not, write to the
655 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
656 + * Boston, MA 02110-1301, USA.
657 + *
658 + */
659 +
660 +#include <asm/reboot.h>
661 +#include <asm/io.h>
662 +
663 +static void rdc321x_reset(void)
664 +{
665 + unsigned i;
666 +
667 + /* write to southbridge config register 0x41
668 + enable pci reset on cpu reset, make internal port 0x92 writeable
669 + and switch port 0x92 to internal */
670 + outl(0x80003840, 0xCF8);
671 + i = inl(0xCFC);
672 + i |= 0x1600;
673 + outl(i, 0xCFC);
674 +
675 + /* soft reset */
676 + outb(1, 0x92);
677 +}
678 +
679 +static int __init rdc_setup_reset(void)
680 +{
681 + machine_ops.emergency_restart = rdc321x_reset;
682 + return 0;
683 +}
684 +
685 +arch_initcall(rdc_setup_reset);
686 --- /dev/null
687 +++ b/arch/x86/include/asm/rdc_boards.h
688 @@ -0,0 +1,36 @@
689 +/*
690 + * RDC321x boards
691 + *
692 + * Copyright (C) 2007-2009 OpenWrt.org
693 + * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
694 + * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
695 + *
696 + * This program is free software; you can redistribute it and/or
697 + * modify it under the terms of the GNU General Public License
698 + * as published by the Free Software Foundation; either version 2
699 + * of the License, or (at your option) any later version.
700 + *
701 + * This program is distributed in the hope that it will be useful,
702 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
703 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
704 + * GNU General Public License for more details.
705 + *
706 + * You should have received a copy of the GNU General Public License
707 + * along with this program; if not, write to the
708 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
709 + * Boston, MA 02110-1301, USA.
710 + *
711 + */
712 +
713 +#ifndef _RDC_BOARDS_H__
714 +#define _RDC_BOARDS_H__
715 +
716 +#include <linux/leds.h>
717 +#include <linux/gpio_buttons.h>
718 +
719 +struct rdc_platform_data {
720 + struct gpio_led_platform_data led_data;
721 + struct gpio_buttons_platform_data button_data;
722 +};
723 +
724 +#endif
This page took 0.066374 seconds and 5 git commands to generate.