1*85498ae8SGrant Likely /* 2*85498ae8SGrant Likely * Old U-boot compatibility for MPC5200 3*85498ae8SGrant Likely * 4*85498ae8SGrant Likely * Author: Grant Likely <grant.likely@secretlab.ca> 5*85498ae8SGrant Likely * 6*85498ae8SGrant Likely * Copyright (c) 2007 Secret Lab Technologies Ltd. 7*85498ae8SGrant Likely * Copyright (c) 2007 Freescale Semiconductor, Inc. 8*85498ae8SGrant Likely * 9*85498ae8SGrant Likely * This program is free software; you can redistribute it and/or modify it 10*85498ae8SGrant Likely * under the terms of the GNU General Public License version 2 as published 11*85498ae8SGrant Likely * by the Free Software Foundation. 12*85498ae8SGrant Likely */ 13*85498ae8SGrant Likely 14*85498ae8SGrant Likely #include "ops.h" 15*85498ae8SGrant Likely #include "stdio.h" 16*85498ae8SGrant Likely #include "io.h" 17*85498ae8SGrant Likely #include "cuboot.h" 18*85498ae8SGrant Likely 19*85498ae8SGrant Likely #define TARGET_PPC_MPC52xx 20*85498ae8SGrant Likely #include "ppcboot.h" 21*85498ae8SGrant Likely 22*85498ae8SGrant Likely static bd_t bd; 23*85498ae8SGrant Likely 24*85498ae8SGrant Likely static void platform_fixups(void) 25*85498ae8SGrant Likely { 26*85498ae8SGrant Likely void *soc, *reg; 27*85498ae8SGrant Likely int div; 28*85498ae8SGrant Likely u32 sysfreq; 29*85498ae8SGrant Likely 30*85498ae8SGrant Likely 31*85498ae8SGrant Likely dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); 32*85498ae8SGrant Likely dt_fixup_mac_addresses(bd.bi_enetaddr); 33*85498ae8SGrant Likely dt_fixup_cpu_clocks(bd.bi_intfreq, bd.bi_busfreq / 4, bd.bi_busfreq); 34*85498ae8SGrant Likely 35*85498ae8SGrant Likely /* Unfortunately, the specific model number is encoded in the 36*85498ae8SGrant Likely * soc node name in existing dts files -- once that is fixed, 37*85498ae8SGrant Likely * this can do a simple path lookup. 38*85498ae8SGrant Likely */ 39*85498ae8SGrant Likely soc = find_node_by_devtype(NULL, "soc"); 40*85498ae8SGrant Likely if (soc) { 41*85498ae8SGrant Likely setprop(soc, "bus-frequency", &bd.bi_ipbfreq, 42*85498ae8SGrant Likely sizeof(bd.bi_ipbfreq)); 43*85498ae8SGrant Likely 44*85498ae8SGrant Likely if (!dt_xlate_reg(soc, 0, (void*)®, NULL)) 45*85498ae8SGrant Likely return; 46*85498ae8SGrant Likely div = in_8(reg + 0x204) & 0x0020 ? 8 : 4; 47*85498ae8SGrant Likely sysfreq = bd.bi_busfreq * div; 48*85498ae8SGrant Likely setprop(soc, "system-frequency", &sysfreq, sizeof(sysfreq)); 49*85498ae8SGrant Likely } 50*85498ae8SGrant Likely } 51*85498ae8SGrant Likely 52*85498ae8SGrant Likely void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, 53*85498ae8SGrant Likely unsigned long r6, unsigned long r7) 54*85498ae8SGrant Likely { 55*85498ae8SGrant Likely CUBOOT_INIT(); 56*85498ae8SGrant Likely ft_init(_dtb_start, _dtb_end - _dtb_start, 32); 57*85498ae8SGrant Likely serial_console_init(); 58*85498ae8SGrant Likely platform_ops.fixups = platform_fixups; 59*85498ae8SGrant Likely } 60