summaryrefslogtreecommitdiff
path: root/cpu/mpc85xx/speed.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2007-05-05 17:33:22 +0200
committerWolfgang Denk <wd@denx.de>2007-05-05 17:33:22 +0200
commit49db23d4529d8f925f1572dbf1226f319f912580 (patch)
treeae68bc5c19965211d8921b1613cae28ab2236440 /cpu/mpc85xx/speed.c
parent5499645b3fe17a548af9dfc479ca6e2455f179a2 (diff)
parentffa621a0d12a1ccd81c936c567f8917a213787a8 (diff)
downloadu-boot-imx-49db23d4529d8f925f1572dbf1226f319f912580.zip
u-boot-imx-49db23d4529d8f925f1572dbf1226f319f912580.tar.gz
u-boot-imx-49db23d4529d8f925f1572dbf1226f319f912580.tar.bz2
Merge with /home/wd/git/u-boot/custodian/u-boot-mpc85xx
Diffstat (limited to 'cpu/mpc85xx/speed.c')
-rw-r--r--cpu/mpc85xx/speed.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/cpu/mpc85xx/speed.c b/cpu/mpc85xx/speed.c
index ca81ee7..12359a2 100644
--- a/cpu/mpc85xx/speed.c
+++ b/cpu/mpc85xx/speed.c
@@ -37,49 +37,21 @@ void get_sys_info (sys_info_t * sysInfo)
{
volatile immap_t *immap = (immap_t *)CFG_IMMR;
volatile ccsr_gur_t *gur = &immap->im_gur;
- uint plat_ratio,e500_ratio;
+ uint plat_ratio,e500_ratio,half_freqSystemBus;
plat_ratio = (gur->porpllsr) & 0x0000003e;
plat_ratio >>= 1;
- switch(plat_ratio) {
- case 0x02:
- case 0x03:
- case 0x04:
- case 0x05:
- case 0x06:
- case 0x08:
- case 0x09:
- case 0x0a:
- case 0x0c:
- case 0x10:
- sysInfo->freqSystemBus = plat_ratio * CONFIG_SYS_CLK_FREQ;
- break;
- default:
- sysInfo->freqSystemBus = 0;
- break;
- }
-
+ sysInfo->freqSystemBus = plat_ratio * CONFIG_SYS_CLK_FREQ;
e500_ratio = (gur->porpllsr) & 0x003f0000;
e500_ratio >>= 16;
- switch(e500_ratio) {
- case 0x04:
- sysInfo->freqProcessor = 2*sysInfo->freqSystemBus;
- break;
- case 0x05:
- sysInfo->freqProcessor = 5*sysInfo->freqSystemBus/2;
- break;
- case 0x06:
- sysInfo->freqProcessor = 3*sysInfo->freqSystemBus;
- break;
- case 0x07:
- sysInfo->freqProcessor = 7*sysInfo->freqSystemBus/2;
- break;
- default:
- sysInfo->freqProcessor = 0;
- break;
- }
+
+ /* Divide before multiply to avoid integer
+ * overflow for processor speeds above 2GHz */
+ half_freqSystemBus = sysInfo->freqSystemBus/2;
+ sysInfo->freqProcessor = e500_ratio*half_freqSystemBus;
}
+
int get_clocks (void)
{
sys_info_t sys_info;