999-memory-detect.patch 844 B

1234567891011121314151617181920212223242526272829303132
  1. --- a/arch/mips/ralink/of.c
  2. +++ b/arch/mips/ralink/of.c
  3. @@ -80,6 +80,16 @@ void __init device_tree_init(void)
  4. }
  5. extern struct boot_param_header __image_dtb;
  6. +static int memory_dtb;
  7. +
  8. +static int __init early_init_dt_find_memory(unsigned long node, const char *uname,
  9. + int depth, void *data)
  10. +{
  11. + if (depth == 1 && !strcmp(uname, "memory@0"))
  12. + memory_dtb = 1;
  13. +
  14. + return 0;
  15. +}
  16. void __init plat_mem_setup(void)
  17. {
  18. @@ -90,8 +100,10 @@ void __init plat_mem_setup(void)
  19. * parsed resulting in our memory appearing
  20. */
  21. __dt_setup_arch(&__image_dtb);
  22. -
  23. - if (soc_info.mem_size)
  24. + of_scan_flat_dt(early_init_dt_find_memory, NULL);
  25. + if (memory_dtb)
  26. + of_scan_flat_dt(early_init_dt_scan_memory, NULL);
  27. + else if (soc_info.mem_size)
  28. add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
  29. BOOT_MEM_RAM);
  30. else