cuboot-85xx-cpm2.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Old U-boot compatibility for 85xx
  3. *
  4. * Author: Scott Wood <scottwood@freescale.com>
  5. *
  6. * Copyright (c) 2007 Freescale Semiconductor, Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published
  10. * by the Free Software Foundation.
  11. */
  12. #include "ops.h"
  13. #include "stdio.h"
  14. #include "cuboot.h"
  15. #define TARGET_85xx
  16. #define TARGET_CPM2
  17. #include "ppcboot.h"
  18. static bd_t bd;
  19. static void platform_fixups(void)
  20. {
  21. void *devp;
  22. dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
  23. dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
  24. dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
  25. dt_fixup_mac_address_by_alias("ethernet2", bd.bi_enet2addr);
  26. dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 8, bd.bi_busfreq);
  27. /* Unfortunately, the specific model number is encoded in the
  28. * soc node name in existing dts files -- once that is fixed,
  29. * this can do a simple path lookup.
  30. */
  31. devp = find_node_by_devtype(NULL, "soc");
  32. if (devp) {
  33. void *serial = NULL;
  34. setprop(devp, "bus-frequency", &bd.bi_busfreq,
  35. sizeof(bd.bi_busfreq));
  36. while ((serial = find_node_by_devtype(serial, "serial"))) {
  37. if (get_parent(serial) != devp)
  38. continue;
  39. setprop(serial, "clock-frequency", &bd.bi_busfreq,
  40. sizeof(bd.bi_busfreq));
  41. }
  42. }
  43. devp = find_node_by_compatible(NULL, "fsl,cpm2-brg");
  44. if (devp)
  45. setprop(devp, "clock-frequency", &bd.bi_brgfreq,
  46. sizeof(bd.bi_brgfreq));
  47. }
  48. void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  49. unsigned long r6, unsigned long r7)
  50. {
  51. CUBOOT_INIT();
  52. fdt_init(_dtb_start);
  53. serial_console_init();
  54. platform_ops.fixups = platform_fixups;
  55. }