fdt.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 2008, 2011 Freescale Semiconductor, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * Version 2 as published by the Free Software Foundation.
  7. */
  8. #include <common.h>
  9. #include <libfdt.h>
  10. #include <fdt_support.h>
  11. #include <asm/mp.h>
  12. DECLARE_GLOBAL_DATA_PTR;
  13. extern void ft_fixup_num_cores(void *blob);
  14. extern void ft_srio_setup(void *blob);
  15. void ft_cpu_setup(void *blob, bd_t *bd)
  16. {
  17. #ifdef CONFIG_MP
  18. int off;
  19. u32 bootpg = determine_mp_bootpg();
  20. #endif
  21. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  22. "timebase-frequency", bd->bi_busfreq / 4, 1);
  23. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  24. "bus-frequency", bd->bi_busfreq, 1);
  25. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  26. "clock-frequency", bd->bi_intfreq, 1);
  27. do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
  28. "bus-frequency", bd->bi_busfreq, 1);
  29. #if defined(CONFIG_MPC8641)
  30. do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus",
  31. "bus-frequency", gd->lbc_clk, 1);
  32. #endif
  33. do_fixup_by_compat_u32(blob, "fsl,elbc",
  34. "bus-frequency", gd->lbc_clk, 1);
  35. fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
  36. #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
  37. || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
  38. fdt_fixup_ethernet(blob);
  39. #endif
  40. #ifdef CONFIG_SYS_NS16550
  41. do_fixup_by_compat_u32(blob, "ns16550",
  42. "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
  43. #endif
  44. #ifdef CONFIG_MP
  45. /* Reserve the boot page so OSes dont use it */
  46. off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
  47. if (off < 0)
  48. printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
  49. ft_fixup_num_cores(blob);
  50. #endif
  51. #ifdef CONFIG_SYS_SRIO
  52. ft_srio_setup(blob);
  53. #endif
  54. }