add support for the Netgear WG302v1/WAG302v1
[openwrt/openwrt.git] / target / linux / ixp4xx / patches-2.6.23 / 162-wg302v1_mem_fixup.patch
1 diff -Nur linux-2.6.23.12/arch/arm/mach-ixp4xx/wg302v1-setup.c linux-2.6.23.12-owrt/arch/arm/mach-ixp4xx/wg302v1-setup.c
2 --- linux-2.6.23.12/arch/arm/mach-ixp4xx/wg302v1-setup.c 2008-01-14 23:12:03.000000000 +0100
3 +++ linux-2.6.23.12-owrt/arch/arm/mach-ixp4xx/wg302v1-setup.c 2008-01-14 23:11:34.000000000 +0100
4 @@ -100,6 +100,36 @@
5 &wg302_eth[0],
6 };
7
8 +static char wg302v1_mem_fixup[] __initdata = "mem=32M ";
9 +
10 +static void __init wg302v1_fixup(struct machine_desc *desc,
11 + struct tag *tags, char **cmdline, struct meminfo *mi)
12 +
13 +{
14 + struct tag *t = tags;
15 + char *p = *cmdline;
16 +
17 + /* Find the end of the tags table, taking note of any cmdline tag. */
18 + for (; t->hdr.size; t = tag_next(t)) {
19 + if (t->hdr.tag == ATAG_CMDLINE) {
20 + p = t->u.cmdline.cmdline;
21 + }
22 + }
23 +
24 + /* Overwrite the end of the table with a new cmdline tag. */
25 + t->hdr.tag = ATAG_CMDLINE;
26 + t->hdr.size = (sizeof (struct tag_header) +
27 + strlen(wg302v1_mem_fixup) + strlen(p) + 1 + 4) >> 2;
28 + strlcpy(t->u.cmdline.cmdline, wg302v1_mem_fixup, COMMAND_LINE_SIZE);
29 + strlcpy(t->u.cmdline.cmdline + strlen(wg302v1_mem_fixup), p,
30 + COMMAND_LINE_SIZE - strlen(wg302v1_mem_fixup));
31 +
32 + /* Terminate the table. */
33 + t = tag_next(t);
34 + t->hdr.tag = ATAG_NONE;
35 + t->hdr.size = 0;
36 +}
37 +
38 static void __init wg302v1_init(void)
39 {
40 ixp4xx_sys_init();
41 @@ -118,6 +148,7 @@
42 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
43 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
44 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
45 + .fixup = wg302v1_fixup,
46 .map_io = ixp4xx_map_io,
47 .init_irq = ixp4xx_init_irq,
48 .timer = &ixp4xx_timer,