Reworked 85xx speed detection code
Changed the code to read the registers and calculate the clock rates, rather than using a "switch" statement. Idea from Andrew Klossner <andrew@cesa.opbu.xerox.com> Signed-off-by: Andy Fleming <afleming@freescale.com>
This commit is contained in:
parent
81f481ca70
commit
66ed6cca3f
|
@ -37,49 +37,21 @@ void get_sys_info (sys_info_t * sysInfo)
|
||||||
{
|
{
|
||||||
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
volatile immap_t *immap = (immap_t *)CFG_IMMR;
|
||||||
volatile ccsr_gur_t *gur = &immap->im_gur;
|
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 = (gur->porpllsr) & 0x0000003e;
|
||||||
plat_ratio >>= 1;
|
plat_ratio >>= 1;
|
||||||
switch(plat_ratio) {
|
sysInfo->freqSystemBus = plat_ratio * CONFIG_SYS_CLK_FREQ;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
e500_ratio = (gur->porpllsr) & 0x003f0000;
|
e500_ratio = (gur->porpllsr) & 0x003f0000;
|
||||||
e500_ratio >>= 16;
|
e500_ratio >>= 16;
|
||||||
switch(e500_ratio) {
|
|
||||||
case 0x04:
|
/* Divide before multiply to avoid integer
|
||||||
sysInfo->freqProcessor = 2*sysInfo->freqSystemBus;
|
* overflow for processor speeds above 2GHz */
|
||||||
break;
|
half_freqSystemBus = sysInfo->freqSystemBus/2;
|
||||||
case 0x05:
|
sysInfo->freqProcessor = e500_ratio*half_freqSystemBus;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int get_clocks (void)
|
int get_clocks (void)
|
||||||
{
|
{
|
||||||
sys_info_t sys_info;
|
sys_info_t sys_info;
|
||||||
|
|
Loading…
Reference in New Issue