fdt.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright 2008 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 "mp.h"
  12. DECLARE_GLOBAL_DATA_PTR;
  13. DECLARE_GLOBAL_DATA_PTR;
  14. void ft_cpu_setup(void *blob, bd_t *bd)
  15. {
  16. #if (CONFIG_NUM_CPUS > 1)
  17. int off;
  18. u32 bootpg;
  19. #endif
  20. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  21. "timebase-frequency", bd->bi_busfreq / 4, 1);
  22. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  23. "bus-frequency", bd->bi_busfreq, 1);
  24. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
  25. "clock-frequency", bd->bi_intfreq, 1);
  26. do_fixup_by_prop_u32(blob, "device_type", "soc", 4,
  27. "bus-frequency", bd->bi_busfreq, 1);
  28. #if defined(CONFIG_MPC8641)
  29. do_fixup_by_compat_u32(blob, "fsl,mpc8641-localbus",
  30. "bus-frequency", gd->lbc_clk, 1);
  31. #endif
  32. do_fixup_by_compat_u32(blob, "fsl,elbc",
  33. "bus-frequency", gd->lbc_clk, 1);
  34. fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
  35. #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
  36. || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
  37. fdt_fixup_ethernet(blob);
  38. #endif
  39. #ifdef CONFIG_SYS_NS16550
  40. do_fixup_by_compat_u32(blob, "ns16550",
  41. "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
  42. #endif
  43. #if (CONFIG_NUM_CPUS > 1)
  44. /* if we have 4G or more of memory, put the boot page at 4Gb-1M */
  45. if (gd->ram_size > 0xfffff000)
  46. bootpg = 0xfff00000;
  47. else
  48. bootpg = gd->ram_size - (1024 * 1024);
  49. /* Reserve the boot page so OSes dont use it */
  50. off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
  51. if (off < 0)
  52. printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
  53. #endif
  54. }