generic: rtl8366: cleanup MIB counter printing
[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,81 @@
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 + if (master->size == 0x100000)
425 + kernel_len = master->size - 0x10000;
426 + else {
427 + res = master->read(master, 0x4000 + 1036, 2, &len, (char *) &tmp);
428 + if (res)
429 + return res;
430 + kernel_len = tmp * master->erasesize;
431 + }
432 +
433 + rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 4, GFP_KERNEL);
434 +
435 + *pparts = rdc_flash_parts;
436 +
437 + rdc_flash_parts[0].name = "biffboot";
438 + rdc_flash_parts[0].offset = master->size - 0x10000;
439 + rdc_flash_parts[0].size = 0x10000;
440 + rdc_flash_parts[0].mask_flags = MTD_WRITEABLE;
441 + rdc_flash_parts[1].name = "firmware";
442 + rdc_flash_parts[1].offset = 0;
443 + rdc_flash_parts[1].size = rdc_flash_parts[0].offset;
444 + rdc_flash_parts[2].name = "kernel";
445 + rdc_flash_parts[2].offset = 0x00000000;
446 + rdc_flash_parts[2].size = kernel_len;
447 +
448 + if (master->size == 0x100000)
449 + return 2;
450 +
451 + rdc_flash_parts[3].name = "rootfs";
452 + rdc_flash_parts[3].offset = MTDPART_OFS_APPEND;
453 + rdc_flash_parts[3].size = rdc_flash_parts[1].size - rdc_flash_parts[2].size;
454 +
455 + return 4;
456 +}
457 +
458 +struct mtd_part_parser __initdata bifferboard_parser = {
459 + .owner = THIS_MODULE,
460 + .parse_fn = parse_bifferboard_partitions,
461 + .name = "Bifferboard",
462 +};
463 +
464 +static int __init bifferboard_setup(void)
465 +{
466 + return register_mtd_parser(&bifferboard_parser);
467 +}
468 +arch_initcall(bifferboard_setup);
469 --- /dev/null
470 +++ b/arch/x86/mach-rdc321x/boards/r8610.c
471 @@ -0,0 +1,65 @@
472 +/*
473 + * R8610 RDC321x platform devices
474 + *
475 + * Copyright (C) 2009, Florian Fainelli <florian@openwrt.org>
476 + *
477 + * This program is free software; you can redistribute it and/or
478 + * modify it under the terms of the GNU General Public License
479 + * as published by the Free Software Foundation; either version 2
480 + * of the License, or (at your option) any later version.
481 + *
482 + * This program is distributed in the hope that it will be useful,
483 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
484 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
485 + * GNU General Public License for more details.
486 + *
487 + * You should have received a copy of the GNU General Public License
488 + * along with this program; if not, write to the
489 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
490 + * Boston, MA 02110-1301, USA.
491 + *
492 + */
493 +
494 +#include <linux/init.h>
495 +#include <linux/mtd/physmap.h>
496 +#include <linux/input.h>
497 +
498 +#include <asm/rdc_boards.h>
499 +
500 +static int __init parse_r8610_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
501 +{
502 + struct mtd_partition *rdc_flash_parts;
503 +
504 + rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 4, GFP_KERNEL);
505 +
506 + *pparts = rdc_flash_parts;
507 +
508 + rdc_flash_parts[0].name = "kernel";
509 + rdc_flash_parts[0].size = 0x001f0000;
510 + rdc_flash_parts[0].offset = 0;
511 + rdc_flash_parts[1].name = "config";
512 + rdc_flash_parts[1].size = 0x10000;
513 + rdc_flash_parts[1].offset = MTDPART_OFS_APPEND;
514 + rdc_flash_parts[2].name = "rootfs";
515 + rdc_flash_parts[2].size = 0x1E0000;
516 + rdc_flash_parts[2].offset = MTDPART_OFS_APPEND;
517 + rdc_flash_parts[3].name = "redboot";
518 + rdc_flash_parts[3].size = 0x20000;
519 + rdc_flash_parts[3].offset = MTDPART_OFS_APPEND;
520 + rdc_flash_parts[3].mask_flags = MTD_WRITEABLE;
521 +
522 + return 4;
523 +}
524 +
525 +struct mtd_part_parser __initdata r8610_parser = {
526 + .owner = THIS_MODULE,
527 + .parse_fn = parse_r8610_partitions,
528 + .name = "R8610",
529 +};
530 +
531 +static int __init r8610_setup(void)
532 +{
533 + return register_mtd_parser(&r8610_parser);
534 +}
535 +
536 +arch_initcall(r8610_setup);
537 --- /dev/null
538 +++ b/arch/x86/mach-rdc321x/boards/sitecom.c
539 @@ -0,0 +1,111 @@
540 +/*
541 + * Sitecom RDC321x platform devices
542 + *
543 + * Copyright (C) 2007-2009 OpenWrt.org
544 + * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
545 + * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
546 + *
547 + * This program is free software; you can redistribute it and/or
548 + * modify it under the terms of the GNU General Public License
549 + * as published by the Free Software Foundation; either version 2
550 + * of the License, or (at your option) any later version.
551 + *
552 + * This program is distributed in the hope that it will be useful,
553 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
554 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
555 + * GNU General Public License for more details.
556 + *
557 + * You should have received a copy of the GNU General Public License
558 + * along with this program; if not, write to the
559 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
560 + * Boston, MA 02110-1301, USA.
561 + *
562 + */
563 +
564 +#include <linux/init.h>
565 +#include <linux/mtd/physmap.h>
566 +#include <linux/input.h>
567 +
568 +#include <asm/rdc_boards.h>
569 +
570 +struct image_header {
571 + char magic[4];
572 + u32 kernel_length;
573 + u32 ramdisk_length;
574 + char magic2[4];
575 + u32 kernel_length2;
576 +};
577 +
578 +static struct gpio_led sitecom_leds[] = {
579 + { .name = "rdc321x:power", .gpio = 15, .active_low = 1},
580 + { .name = "rdc321x:usb0", .gpio = 0, .active_low = 1},
581 + { .name = "rdc321x:usb1", .gpio = 1, .active_low = 1},
582 +};
583 +
584 +static struct gpio_button sitecom_btns[] = {
585 + {
586 + .gpio = 6,
587 + .code = BTN_0,
588 + .desc = "Reset",
589 + .active_low = 1,
590 + }
591 +};
592 +
593 +static int __init parse_sitecom_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long plat_data)
594 +{
595 + struct image_header header;
596 + int res;
597 + size_t len;
598 + struct mtd_partition *rdc_flash_parts;
599 + struct rdc_platform_data *pdata = (struct rdc_platform_data *) plat_data;
600 +
601 + if (master->size != 0x400000) /* 4MB */
602 + return -ENOSYS;
603 +
604 + res = master->read(master, 0x8000, sizeof(header), &len, (char *)&header);
605 + if (res)
606 + return res;
607 +
608 + if (strncmp(header.magic, "CSYS", 4) || strncmp(header.magic2, "WRRM", 4))
609 + return -ENOSYS;
610 +
611 + rdc_flash_parts = kzalloc(sizeof(struct mtd_partition) * 5, GFP_KERNEL);
612 +
613 + rdc_flash_parts[0].name = "firmware";
614 + rdc_flash_parts[0].offset = 0x8000;
615 + rdc_flash_parts[0].size = 0x3F0000 - 0x8000;
616 + rdc_flash_parts[1].name = "config";
617 + rdc_flash_parts[1].offset = 0;
618 + rdc_flash_parts[1].size = 0x8000;
619 + rdc_flash_parts[2].name = "kernel";
620 + rdc_flash_parts[2].offset = 0x8014;
621 + rdc_flash_parts[2].size = header.kernel_length;
622 + rdc_flash_parts[3].name = "rootfs";
623 + rdc_flash_parts[3].offset = 0x8014 + header.kernel_length;
624 + rdc_flash_parts[3].size = 0x3F0000 - rdc_flash_parts[3].offset;
625 + rdc_flash_parts[4].name = "bootloader";
626 + rdc_flash_parts[4].offset = 0x3F0000;
627 + rdc_flash_parts[4].size = 0x10000;
628 +
629 + *pparts = rdc_flash_parts;
630 +
631 + pdata->led_data.num_leds = ARRAY_SIZE(sitecom_leds);
632 + pdata->led_data.leds = sitecom_leds;
633 + pdata->button_data.nbuttons = ARRAY_SIZE(sitecom_btns);
634 + pdata->button_data.buttons = sitecom_btns;
635 +
636 + return 5;
637 +}
638 +
639 +struct mtd_part_parser __initdata sitecom_parser = {
640 + .owner = THIS_MODULE,
641 + .parse_fn = parse_sitecom_partitions,
642 + .name = "Sitecom",
643 +};
644 +
645 +static int __init sitecom_setup(void)
646 +{
647 + return register_mtd_parser(&sitecom_parser);
648 +}
649 +
650 +arch_initcall(sitecom_setup);
651 --- /dev/null
652 +++ b/arch/x86/mach-rdc321x/reboot.c
653 @@ -0,0 +1,44 @@
654 +/*
655 + * This program is free software; you can redistribute it and/or
656 + * modify it under the terms of the GNU General Public License
657 + * as published by the Free Software Foundation; either version 2
658 + * of the License, or (at your option) any later version.
659 + *
660 + * This program is distributed in the hope that it will be useful,
661 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
662 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
663 + * GNU General Public License for more details.
664 + *
665 + * You should have received a copy of the GNU General Public License
666 + * along with this program; if not, write to the
667 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
668 + * Boston, MA 02110-1301, USA.
669 + *
670 + */
671 +
672 +#include <asm/reboot.h>
673 +#include <asm/io.h>
674 +
675 +static void rdc321x_reset(void)
676 +{
677 + unsigned i;
678 +
679 + /* write to southbridge config register 0x41
680 + enable pci reset on cpu reset, make internal port 0x92 writeable
681 + and switch port 0x92 to internal */
682 + outl(0x80003840, 0xCF8);
683 + i = inl(0xCFC);
684 + i |= 0x1600;
685 + outl(i, 0xCFC);
686 +
687 + /* soft reset */
688 + outb(1, 0x92);
689 +}
690 +
691 +static int __init rdc_setup_reset(void)
692 +{
693 + machine_ops.emergency_restart = rdc321x_reset;
694 + return 0;
695 +}
696 +
697 +arch_initcall(rdc_setup_reset);
698 --- /dev/null
699 +++ b/arch/x86/include/asm/rdc_boards.h
700 @@ -0,0 +1,36 @@
701 +/*
702 + * RDC321x boards
703 + *
704 + * Copyright (C) 2007-2009 OpenWrt.org
705 + * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
706 + * Copyright (C) 2008-2009 Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
707 + *
708 + * This program is free software; you can redistribute it and/or
709 + * modify it under the terms of the GNU General Public License
710 + * as published by the Free Software Foundation; either version 2
711 + * of the License, or (at your option) any later version.
712 + *
713 + * This program is distributed in the hope that it will be useful,
714 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
715 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
716 + * GNU General Public License for more details.
717 + *
718 + * You should have received a copy of the GNU General Public License
719 + * along with this program; if not, write to the
720 + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
721 + * Boston, MA 02110-1301, USA.
722 + *
723 + */
724 +
725 +#ifndef _RDC_BOARDS_H__
726 +#define _RDC_BOARDS_H__
727 +
728 +#include <linux/leds.h>
729 +#include <linux/gpio_buttons.h>
730 +
731 +struct rdc_platform_data {
732 + struct gpio_led_platform_data led_data;
733 + struct gpio_buttons_platform_data button_data;
734 +};
735 +
736 +#endif
This page took 0.080529 seconds and 5 git commands to generate.