setup.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/export.h>
  10. #include <linux/io.h>
  11. #include <linux/ioport.h>
  12. #include <asm/bootinfo.h>
  13. #include <lantiq_soc.h>
  14. #include "machtypes.h"
  15. #include "devices.h"
  16. #include "prom.h"
  17. void __init plat_mem_setup(void)
  18. {
  19. /* assume 16M as default incase uboot fails to pass proper ramsize */
  20. unsigned long memsize = 16;
  21. char **envp = (char **) KSEG1ADDR(fw_arg2);
  22. ioport_resource.start = IOPORT_RESOURCE_START;
  23. ioport_resource.end = IOPORT_RESOURCE_END;
  24. iomem_resource.start = IOMEM_RESOURCE_START;
  25. iomem_resource.end = IOMEM_RESOURCE_END;
  26. set_io_port_base((unsigned long) KSEG1);
  27. while (*envp) {
  28. char *e = (char *)KSEG1ADDR(*envp);
  29. if (!strncmp(e, "memsize=", 8)) {
  30. e += 8;
  31. if (strict_strtoul(e, 0, &memsize))
  32. pr_warn("bad memsize specified\n");
  33. }
  34. envp++;
  35. }
  36. memsize *= 1024 * 1024;
  37. add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
  38. }
  39. static int __init
  40. lantiq_setup(void)
  41. {
  42. ltq_soc_setup();
  43. mips_machine_setup();
  44. return 0;
  45. }
  46. arch_initcall(lantiq_setup);
  47. static void __init
  48. lantiq_generic_init(void)
  49. {
  50. /* Nothing to do */
  51. }
  52. MIPS_MACHINE(LTQ_MACH_GENERIC,
  53. "Generic",
  54. "Generic Lantiq based board",
  55. lantiq_generic_init);