fdt.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 2008, 2011 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. #include <common.h>
  7. #include <libfdt.h>
  8. #include <fdt_support.h>
  9. #include <asm/mp.h>
  10. DECLARE_GLOBAL_DATA_PTR;
  11. extern void ft_fixup_num_cores(void *blob);
  12. extern void ft_srio_setup(void *blob);
  13. void ft_cpu_setup(void *blob, bd_t *bd)
  14. {
  15. #ifdef CONFIG_MP
  16. int off;
  17. u32 bootpg = determine_mp_bootpg(NULL);
  18. #endif
  19. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  20. "timebase-frequency", bd->bi_busfreq / 4, 1);
  21. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  22. "bus-frequency", bd->bi_busfreq, 1);
  23. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  24. "clock-frequency", bd->bi_intfreq, 1);
  25. do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
  26. "bus-frequency", bd->bi_busfreq, 1);
  27. fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
  28. #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
  29. || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
  30. fdt_fixup_ethernet(blob);
  31. #endif
  32. #ifdef CONFIG_SYS_NS16550
  33. do_fixup_by_compat_u32(blob, "ns16550",
  34. "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
  35. #endif
  36. #ifdef CONFIG_MP
  37. /* Reserve the boot page so OSes dont use it */
  38. off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
  39. if (off < 0)
  40. printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
  41. ft_fixup_num_cores(blob);
  42. #endif
  43. #ifdef CONFIG_SYS_SRIO
  44. ft_srio_setup(blob);
  45. #endif
  46. }