]>
git.ipfire.org Git - people/ms/u-boot.git/blob - cpu/mpc85xx/speed.c
2 * Copyright 2004 Freescale Semiconductor.
3 * (C) Copyright 2003 Motorola Inc.
4 * Xianghua Xiao, (X.Xiao@motorola.com)
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <ppc_asm.tmpl>
30 #include <asm/processor.h>
32 /* --------------------------------------------------------------- */
34 void get_sys_info (sys_info_t
* sysInfo
)
36 volatile immap_t
*immap
= (immap_t
*)CFG_IMMR
;
37 volatile ccsr_gur_t
*gur
= &immap
->im_gur
;
38 uint plat_ratio
,e500_ratio
;
40 plat_ratio
= (gur
->porpllsr
) & 0x0000003e;
53 sysInfo
->freqSystemBus
= plat_ratio
* CONFIG_SYS_CLK_FREQ
;
56 sysInfo
->freqSystemBus
= 0;
60 e500_ratio
= (gur
->porpllsr
) & 0x003f0000;
64 sysInfo
->freqProcessor
= 2*sysInfo
->freqSystemBus
;
67 sysInfo
->freqProcessor
= 5*sysInfo
->freqSystemBus
/2;
70 sysInfo
->freqProcessor
= 3*sysInfo
->freqSystemBus
;
73 sysInfo
->freqProcessor
= 7*sysInfo
->freqSystemBus
/2;
76 sysInfo
->freqProcessor
= 0;
83 DECLARE_GLOBAL_DATA_PTR
;
85 #if defined(CONFIG_CPM2)
86 volatile immap_t
*immap
= (immap_t
*) CFG_IMMR
;
89 /* set VCO = 4 * BRG */
90 immap
->im_cpm
.im_cpm_intctl
.sccr
&= 0xfffffffc;
91 sccr
= immap
->im_cpm
.im_cpm_intctl
.sccr
;
92 dfbrg
= (sccr
& SCCR_DFBRG_MSK
) >> SCCR_DFBRG_SHIFT
;
94 get_sys_info (&sys_info
);
95 gd
->cpu_clk
= sys_info
.freqProcessor
;
96 gd
->bus_clk
= sys_info
.freqSystemBus
;
97 #if defined(CONFIG_CPM2)
98 gd
->vco_out
= 2*sys_info
.freqSystemBus
;
99 gd
->cpm_clk
= gd
->vco_out
/ 2;
100 gd
->scc_clk
= gd
->vco_out
/ 4;
101 gd
->brg_clk
= gd
->vco_out
/ (1 << (2 * (dfbrg
+ 1)));
104 if(gd
->cpu_clk
!= 0) return (0);
109 /********************************************
111 * return system bus freq in Hz
112 *********************************************/
113 ulong
get_bus_freq (ulong dummy
)
119 get_sys_info (&sys_info
);
120 val
= sys_info
.freqSystemBus
;