Add a helper function to get system reference clock
Many devices are clocked from the SoC's platform clock / 2. Some device nodes include their own clock-frequency property, while others are dependent on the SoC's bus-frequency property instead. To simplify, add a helper function to get this clock.
This commit is contained in:
parent
4f21cbf86c
commit
28c3245193
@ -436,3 +436,18 @@ mpc85xx_fix_errata(vm_offset_t va_ccsr)
|
||||
err:
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
mpc85xx_get_system_clock(void)
|
||||
{
|
||||
phandle_t soc;
|
||||
uint32_t freq;
|
||||
|
||||
soc = OF_finddevice("/soc");
|
||||
freq = 0;
|
||||
|
||||
/* freq isn't modified on error. */
|
||||
OF_getencprop(soc, "bus-frequency", (void *)&freq, sizeof(freq));
|
||||
|
||||
return (freq / 2);
|
||||
}
|
||||
|
@ -171,5 +171,6 @@ 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_system_clock(void);
|
||||
|
||||
#endif /* _MPC85XX_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user