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