CPU clock frequency (in Hz) */
| 224 | |
| 225 | /** CPU clock frequency (in Hz) */ |
| 226 | uint64_t |
| 227 | bcm_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) */ |
| 254 | uint64_t |
no test coverage detected