^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Old U-boot compatibility for 824x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2007 Freescale Semiconductor, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "ops.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "stdio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "cuboot.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define TARGET_824x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "ppcboot.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) static bd_t bd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static void platform_fixups(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) void *soc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) dt_fixup_mac_addresses(bd.bi_enetaddr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) soc = find_node_by_devtype(NULL, "soc");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) if (soc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) void *serial = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) setprop(soc, "bus-frequency", &bd.bi_busfreq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) sizeof(bd.bi_busfreq));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) while ((serial = find_node_by_devtype(serial, "serial"))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) if (get_parent(serial) != soc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) setprop(serial, "clock-frequency", &bd.bi_busfreq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) sizeof(bd.bi_busfreq));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) unsigned long r6, unsigned long r7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) CUBOOT_INIT();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) fdt_init(_dtb_start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) serial_console_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) platform_ops.fixups = platform_fixups;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) }