MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bcm_get_cpufreq

Function bcm_get_cpufreq

freebsd/mips/broadcom/bcm_pmu.c:226–251  ·  view source on GitHub ↗

CPU clock frequency (in Hz) */

Source from the content-addressed store, hash-verified

224
225/** CPU clock frequency (in Hz) */
226uint64_t
227bcm_get_cpufreq(struct bcm_platform *bp)
228{
229 uint32_t fixed_hz;
230 uint32_t n, m;
231 bus_size_t mreg;
232 uint8_t pll_type;
233
234 /* PMU support */
235 if (bcm_has_pmu(bp))
236 return (bhnd_pmu_cpu_clock(bcm_get_pmu(bp)));
237
238 /*
239 * PWRCTL support
240 */
241 pll_type = CHIPC_GET_BITS(bp->cc_caps, CHIPC_CAP_PLL);
242 mreg = bhnd_pwrctl_cpu_clkreg_m(&bp->cid, pll_type, &fixed_hz);
243 if (mreg == 0)
244 return (fixed_hz);
245
246 n = BCM_CHIPC_READ_4(bp, CHIPC_CLKC_N);
247 m = BCM_CHIPC_READ_4(bp, mreg);
248
249 return (bhnd_pwrctl_cpu_clock_rate(&bp->cid, pll_type, n, m));
250
251}
252
253/** Backplane clock frequency (in Hz) */
254uint64_t

Callers 1

platform_startFunction · 0.85

Calls 2

bcm_has_pmuFunction · 0.85
bcm_get_pmuFunction · 0.85

Tested by

no test coverage detected