185498ae8SGrant Likely /* 285498ae8SGrant Likely * Old U-boot compatibility for MPC5200 385498ae8SGrant Likely * 485498ae8SGrant Likely * Author: Grant Likely <grant.likely@secretlab.ca> 585498ae8SGrant Likely * 685498ae8SGrant Likely * Copyright (c) 2007 Secret Lab Technologies Ltd. 785498ae8SGrant Likely * Copyright (c) 2007 Freescale Semiconductor, Inc. 885498ae8SGrant Likely * 985498ae8SGrant Likely * This program is free software; you can redistribute it and/or modify it 1085498ae8SGrant Likely * under the terms of the GNU General Public License version 2 as published 1185498ae8SGrant Likely * by the Free Software Foundation. 1285498ae8SGrant Likely */ 1385498ae8SGrant Likely 1485498ae8SGrant Likely #include "ops.h" 1585498ae8SGrant Likely #include "stdio.h" 1685498ae8SGrant Likely #include "io.h" 1785498ae8SGrant Likely #include "cuboot.h" 1885498ae8SGrant Likely 1985498ae8SGrant Likely #define TARGET_PPC_MPC52xx 2085498ae8SGrant Likely #include "ppcboot.h" 2185498ae8SGrant Likely 2285498ae8SGrant Likely static bd_t bd; 2385498ae8SGrant Likely 2485498ae8SGrant Likely static void platform_fixups(void) 2585498ae8SGrant Likely { 2685498ae8SGrant Likely void *soc, *reg; 2785498ae8SGrant Likely int div; 2885498ae8SGrant Likely u32 sysfreq; 2985498ae8SGrant Likely 3085498ae8SGrant Likely 3185498ae8SGrant Likely dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); 3285498ae8SGrant Likely dt_fixup_mac_addresses(bd.bi_enetaddr); 3385498ae8SGrant Likely dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq); 3485498ae8SGrant Likely 3585498ae8SGrant Likely /* Unfortunately, the specific model number is encoded in the 3685498ae8SGrant Likely * soc node name in existing dts files -- once that is fixed, 3785498ae8SGrant Likely * this can do a simple path lookup. 3885498ae8SGrant Likely */ 3985498ae8SGrant Likely soc = find_node_by_devtype(NULL, "soc"); 40*40847993SGrant Likely if (!soc) 41*40847993SGrant Likely soc = find_node_by_compatible(NULL, "fsl,mpc5200-immr"); 42*40847993SGrant Likely if (!soc) 43*40847993SGrant Likely soc = find_node_by_compatible(NULL, "fsl,mpc5200b-immr"); 4485498ae8SGrant Likely if (soc) { 4585498ae8SGrant Likely setprop(soc, "bus-frequency", &bd.bi_ipbfreq, 4685498ae8SGrant Likely sizeof(bd.bi_ipbfreq)); 4785498ae8SGrant Likely 4885498ae8SGrant Likely if (!dt_xlate_reg(soc, 0, (void*)®, NULL)) 4985498ae8SGrant Likely return; 5085498ae8SGrant Likely div = in_8(reg + 0x204) & 0x0020 ? 8 : 4; 5185498ae8SGrant Likely sysfreq = bd.bi_busfreq * div; 5285498ae8SGrant Likely setprop(soc, "system-frequency", &sysfreq, sizeof(sysfreq)); 5385498ae8SGrant Likely } 5485498ae8SGrant Likely } 5585498ae8SGrant Likely 5685498ae8SGrant Likely void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, 5785498ae8SGrant Likely unsigned long r6, unsigned long r7) 5885498ae8SGrant Likely { 5985498ae8SGrant Likely CUBOOT_INIT(); 602f0dfeaaSDavid Gibson fdt_init(_dtb_start); 6185498ae8SGrant Likely serial_console_init(); 6285498ae8SGrant Likely platform_ops.fixups = platform_fixups; 6385498ae8SGrant Likely } 64