devicetree.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Architecture specific OF callbacks.
  3. *
  4. * Copyright (C) 2011 Texas Instruments Incorporated
  5. * Author: Mark Salter <msalter@redhat.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #include <linux/init.h>
  13. #include <linux/of.h>
  14. #include <linux/of_fdt.h>
  15. #include <linux/initrd.h>
  16. #include <linux/memblock.h>
  17. void __init early_init_devtree(void *params)
  18. {
  19. /* Setup flat device-tree pointer */
  20. initial_boot_params = params;
  21. /* Retrieve various informations from the /chosen node of the
  22. * device-tree, including the platform type, initrd location and
  23. * size and more ...
  24. */
  25. of_scan_flat_dt(early_init_dt_scan_chosen, c6x_command_line);
  26. /* Scan memory nodes and rebuild MEMBLOCKs */
  27. of_scan_flat_dt(early_init_dt_scan_root, NULL);
  28. of_scan_flat_dt(early_init_dt_scan_memory, NULL);
  29. }
  30. #ifdef CONFIG_BLK_DEV_INITRD
  31. void __init early_init_dt_setup_initrd_arch(unsigned long start,
  32. unsigned long end)
  33. {
  34. initrd_start = (unsigned long)__va(start);
  35. initrd_end = (unsigned long)__va(end);
  36. initrd_below_start_ok = 1;
  37. }
  38. #endif
  39. void __init early_init_dt_add_memory_arch(u64 base, u64 size)
  40. {
  41. c6x_add_memory(base, size);
  42. }
  43. void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
  44. {
  45. return __va(memblock_alloc(size, align));
  46. }