setup.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License version 2 as published
  4. * by the Free Software Foundation.
  5. *
  6. * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/module.h>
  10. #include <linux/io.h>
  11. #include <linux/ioport.h>
  12. #include <asm/bootinfo.h>
  13. #include <lantiq_soc.h>
  14. void __init plat_mem_setup(void)
  15. {
  16. /* assume 16M as default incase uboot fails to pass proper ramsize */
  17. unsigned long memsize = 16;
  18. char **envp = (char **) KSEG1ADDR(fw_arg2);
  19. ioport_resource.start = IOPORT_RESOURCE_START;
  20. ioport_resource.end = IOPORT_RESOURCE_END;
  21. iomem_resource.start = IOMEM_RESOURCE_START;
  22. iomem_resource.end = IOMEM_RESOURCE_END;
  23. set_io_port_base((unsigned long) KSEG1);
  24. while (*envp) {
  25. char *e = (char *)KSEG1ADDR(*envp);
  26. if (!strncmp(e, "memsize=", 8)) {
  27. e += 8;
  28. if (strict_strtoul(e, 0, &memsize))
  29. pr_warn("bad memsize specified\n");
  30. }
  31. envp++;
  32. }
  33. memsize *= 1024 * 1024;
  34. add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
  35. }