cuboot-83xx.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Old U-boot compatibility for 83xx
  4. *
  5. * Author: Scott Wood <scottwood@freescale.com>
  6. *
  7. * Copyright (c) 2007 Freescale Semiconductor, Inc.
  8. */
  9. #include "ops.h"
  10. #include "stdio.h"
  11. #include "cuboot.h"
  12. #define TARGET_83xx
  13. #include "ppcboot.h"
  14. static bd_t bd;
  15. static void platform_fixups(void)
  16. {
  17. void *soc;
  18. dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
  19. dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
  20. dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
  21. dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
  22. /* Unfortunately, the specific model number is encoded in the
  23. * soc node name in existing dts files -- once that is fixed,
  24. * this can do a simple path lookup.
  25. */
  26. soc = find_node_by_devtype(NULL, "soc");
  27. if (soc) {
  28. void *serial = NULL;
  29. setprop(soc, "bus-frequency", &bd.bi_busfreq,
  30. sizeof(bd.bi_busfreq));
  31. while ((serial = find_node_by_devtype(serial, "serial"))) {
  32. if (get_parent(serial) != soc)
  33. continue;
  34. setprop(serial, "clock-frequency", &bd.bi_busfreq,
  35. sizeof(bd.bi_busfreq));
  36. }
  37. }
  38. }
  39. void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  40. unsigned long r6, unsigned long r7)
  41. {
  42. CUBOOT_INIT();
  43. fdt_init(_dtb_start);
  44. serial_console_init();
  45. platform_ops.fixups = platform_fixups;
  46. }