1*d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
285498ae8SGrant Likely /*
385498ae8SGrant Likely * Old U-boot compatibility for MPC5200
485498ae8SGrant Likely *
585498ae8SGrant Likely * Author: Grant Likely <grant.likely@secretlab.ca>
685498ae8SGrant Likely *
785498ae8SGrant Likely * Copyright (c) 2007 Secret Lab Technologies Ltd.
885498ae8SGrant Likely * Copyright (c) 2007 Freescale Semiconductor, Inc.
985498ae8SGrant Likely */
1085498ae8SGrant Likely
1185498ae8SGrant Likely #include "ops.h"
1285498ae8SGrant Likely #include "stdio.h"
1385498ae8SGrant Likely #include "io.h"
1485498ae8SGrant Likely #include "cuboot.h"
1585498ae8SGrant Likely
1685498ae8SGrant Likely #define TARGET_PPC_MPC52xx
1785498ae8SGrant Likely #include "ppcboot.h"
1885498ae8SGrant Likely
1985498ae8SGrant Likely static bd_t bd;
2085498ae8SGrant Likely
platform_fixups(void)2185498ae8SGrant Likely static void platform_fixups(void)
2285498ae8SGrant Likely {
2385498ae8SGrant Likely void *soc, *reg;
2485498ae8SGrant Likely int div;
2585498ae8SGrant Likely u32 sysfreq;
2685498ae8SGrant Likely
2785498ae8SGrant Likely
2885498ae8SGrant Likely dt_fixup_memory(bd.bi_memstart, bd.bi_memsize);
2985498ae8SGrant Likely dt_fixup_mac_addresses(bd.bi_enetaddr);
3085498ae8SGrant Likely dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq);
3185498ae8SGrant Likely
3285498ae8SGrant Likely /* Unfortunately, the specific model number is encoded in the
3385498ae8SGrant Likely * soc node name in existing dts files -- once that is fixed,
3485498ae8SGrant Likely * this can do a simple path lookup.
3585498ae8SGrant Likely */
3685498ae8SGrant Likely soc = find_node_by_devtype(NULL, "soc");
3740847993SGrant Likely if (!soc)
3840847993SGrant Likely soc = find_node_by_compatible(NULL, "fsl,mpc5200-immr");
3940847993SGrant Likely if (!soc)
4040847993SGrant Likely soc = find_node_by_compatible(NULL, "fsl,mpc5200b-immr");
4185498ae8SGrant Likely if (soc) {
4285498ae8SGrant Likely setprop(soc, "bus-frequency", &bd.bi_ipbfreq,
4385498ae8SGrant Likely sizeof(bd.bi_ipbfreq));
4485498ae8SGrant Likely
4585498ae8SGrant Likely if (!dt_xlate_reg(soc, 0, (void*)®, NULL))
4685498ae8SGrant Likely return;
4785498ae8SGrant Likely div = in_8(reg + 0x204) & 0x0020 ? 8 : 4;
4885498ae8SGrant Likely sysfreq = bd.bi_busfreq * div;
4985498ae8SGrant Likely setprop(soc, "system-frequency", &sysfreq, sizeof(sysfreq));
5085498ae8SGrant Likely }
5185498ae8SGrant Likely }
5285498ae8SGrant Likely
platform_init(unsigned long r3,unsigned long r4,unsigned long r5,unsigned long r6,unsigned long r7)5385498ae8SGrant Likely void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
5485498ae8SGrant Likely unsigned long r6, unsigned long r7)
5585498ae8SGrant Likely {
5685498ae8SGrant Likely CUBOOT_INIT();
572f0dfeaaSDavid Gibson fdt_init(_dtb_start);
5885498ae8SGrant Likely serial_console_init();
5985498ae8SGrant Likely platform_ops.fixups = platform_fixups;
6085498ae8SGrant Likely }
61