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