1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2009 Freescale Semiconductor, Inc.
6 #include <asm/processor.h>
7 #include <asm/global_data.h>
10 #include <linux/delay.h>
12 DECLARE_GLOBAL_DATA_PTR;
14 ulong cpu_init_f(void)
16 #ifdef CFG_SYS_INIT_L2_ADDR
17 ccsr_l2cache_t *l2cache = (void *)CFG_SYS_MPC85xx_L2_ADDR;
19 out_be32(&l2cache->l2srbar0, CFG_SYS_INIT_L2_ADDR);
21 /* set MBECCDIS=1, SBECCDIS=1 */
22 out_be32(&l2cache->l2errdis,
23 (MPC85xx_L2ERRDIS_MBECC | MPC85xx_L2ERRDIS_SBECC));
25 /* set L2E=1 & L2SRAM=001 */
26 out_be32(&l2cache->l2ctl,
27 (MPC85xx_L2CTL_L2E | MPC85xx_L2CTL_L2SRAM_ENTIRE));
33 void udelay(unsigned long usec)
35 u32 ticks_per_usec = gd->bus_clk / (CONFIG_SYS_FSL_TBCLK_DIV * 1000000);
36 u32 ticks = ticks_per_usec * usec;
37 u32 s = mfspr(SPRN_TBRL);
39 while ((mfspr(SPRN_TBRL) - s) < ticks);