fdt.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * (C) Copyright 2007
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <watchdog.h>
  25. #include <command.h>
  26. #include <asm/cache.h>
  27. #include <ppc4xx.h>
  28. #if defined(CONFIG_OF_LIBFDT)
  29. #include <libfdt.h>
  30. #include <libfdt_env.h>
  31. #include <fdt_support.h>
  32. DECLARE_GLOBAL_DATA_PTR;
  33. void ft_cpu_setup(void *blob, bd_t *bd)
  34. {
  35. sys_info_t sys_info;
  36. get_sys_info(&sys_info);
  37. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, "timebase-frequency",
  38. bd->bi_intfreq, 1);
  39. do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, "clock-frequency",
  40. bd->bi_intfreq, 1);
  41. do_fixup_by_path_u32(blob, "/plb", "clock-frequency", sys_info.freqPLB, 1);
  42. do_fixup_by_path_u32(blob, "/plb/opb", "clock-frequency", sys_info.freqOPB, 1);
  43. do_fixup_by_path_u32(blob, "/plb/opb/ebc", "clock-frequency",
  44. sys_info.freqEBC, 1);
  45. fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
  46. /*
  47. * Setup all baudrates for the UARTs
  48. */
  49. do_fixup_by_compat_u32(blob, "ns16550", "clock-frequency", gd->uart_clk, 1);
  50. /*
  51. * Fixup all ethernet nodes
  52. * Note: aliases in the dts are required for this
  53. */
  54. fdt_fixup_ethernet(blob, bd);
  55. }
  56. #endif /* CONFIG_OF_LIBFDT */