Actually add the mpc85xx_get_platform_clock() function.

Follow up r319935 by actually committing the mpc85xx_get_platform_clock()
function.  This function was created to facilitate other development, and I
thought I had committed it earlier.

Some blocks depend on the platform clock rather than the system clock.
The System clock is derived from the platform clock as one-half the
platform clock.  Rewrite mpc85xx_get_system_clock() to use the new
function.

Pointy-hat to:	jhibbits
This commit is contained in:
Justin Hibbits 2017-06-14 04:26:37 +00:00
parent 3c804fef82
commit 37ea599bf7
2 changed files with 16 additions and 3 deletions

View File

@ -438,16 +438,28 @@ mpc85xx_fix_errata(vm_offset_t va_ccsr)
}
uint32_t
mpc85xx_get_system_clock(void)
mpc85xx_get_platform_clock(void)
{
phandle_t soc;
uint32_t freq;
static uint32_t freq;
if (freq != 0)
return (freq);
soc = OF_finddevice("/soc");
freq = 0;
/* freq isn't modified on error. */
OF_getencprop(soc, "bus-frequency", (void *)&freq, sizeof(freq));
return (freq);
}
uint32_t
mpc85xx_get_system_clock(void)
{
uint32_t freq;
freq = mpc85xx_get_platform_clock();
return (freq / 2);
}

View File

@ -171,6 +171,7 @@ void mpc85xx_enable_l3_cache(void);
void mpc85xx_fix_errata(vm_offset_t);
void dataloss_erratum_access(vm_offset_t, uint32_t);
int mpc85xx_is_qoriq(void);
uint32_t mpc85xx_get_platform_clock(void);
uint32_t mpc85xx_get_system_clock(void);
#endif /* _MPC85XX_H_ */