162-wg302v1_mem_fixup.patch 973 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --- a/arch/arm/mach-ixp4xx/wg302v1-setup.c
  2. +++ b/arch/arm/mach-ixp4xx/wg302v1-setup.c
  3. @@ -117,6 +117,35 @@ static struct platform_device *wg302v1_d
  4. &wg302v1_eth[0],
  5. };
  6. +static char wg302v1_mem_fixup[] __initdata = " mem=32M";
  7. +
  8. +static void __init wg302v1_fixup(struct tag *tags, char **cmdline,
  9. + struct meminfo *mi)
  10. +{
  11. + struct tag *t = tags;
  12. + char *p = *cmdline;
  13. + size_t fixlen, cmdlen;
  14. +
  15. + /* Find the end of the tags table, taking note of any cmdline tag. */
  16. + for (; t->hdr.size; t = tag_next(t)) {
  17. + if (t->hdr.tag == ATAG_CMDLINE) {
  18. + p = t->u.cmdline.cmdline;
  19. + }
  20. + }
  21. +
  22. + fixlen = strlen(wg302v1_mem_fixup);
  23. + cmdlen = strlen(p);
  24. + if (fixlen + cmdlen >= COMMAND_LINE_SIZE)
  25. + return;
  26. +
  27. + /* append the fixup to the cmdline */
  28. + memmove(p + cmdlen, wg302v1_mem_fixup, fixlen + 1);
  29. +
  30. + /* Adjust the size of the atag if there was one */
  31. + if (t->hdr.size)
  32. + t->hdr.size += fixlen;
  33. +}
  34. +
  35. static void __init wg302v1_init(void)
  36. {
  37. ixp4xx_sys_init();