Lines Matching refs:cc

16 u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)  in bcma_chipco_pll_read()  argument
18 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); in bcma_chipco_pll_read()
19 bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); in bcma_chipco_pll_read()
20 return bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); in bcma_chipco_pll_read()
24 void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value) in bcma_chipco_pll_write() argument
26 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); in bcma_chipco_pll_write()
27 bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); in bcma_chipco_pll_write()
28 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value); in bcma_chipco_pll_write()
32 void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, in bcma_chipco_pll_maskset() argument
35 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); in bcma_chipco_pll_maskset()
36 bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_ADDR); in bcma_chipco_pll_maskset()
37 bcma_pmu_maskset32(cc, BCMA_CC_PMU_PLLCTL_DATA, mask, set); in bcma_chipco_pll_maskset()
41 void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc, in bcma_chipco_chipctl_maskset() argument
44 bcma_pmu_write32(cc, BCMA_CC_PMU_CHIPCTL_ADDR, offset); in bcma_chipco_chipctl_maskset()
45 bcma_pmu_read32(cc, BCMA_CC_PMU_CHIPCTL_ADDR); in bcma_chipco_chipctl_maskset()
46 bcma_pmu_maskset32(cc, BCMA_CC_PMU_CHIPCTL_DATA, mask, set); in bcma_chipco_chipctl_maskset()
50 void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask, in bcma_chipco_regctl_maskset() argument
53 bcma_pmu_write32(cc, BCMA_CC_PMU_REGCTL_ADDR, offset); in bcma_chipco_regctl_maskset()
54 bcma_pmu_read32(cc, BCMA_CC_PMU_REGCTL_ADDR); in bcma_chipco_regctl_maskset()
55 bcma_pmu_maskset32(cc, BCMA_CC_PMU_REGCTL_DATA, mask, set); in bcma_chipco_regctl_maskset()
59 static u32 bcma_pmu_xtalfreq(struct bcma_drv_cc *cc) in bcma_pmu_xtalfreq() argument
63 if (!(bcma_pmu_read32(cc, BCMA_CC_PMU_STAT) & in bcma_pmu_xtalfreq()
67 bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, in bcma_pmu_xtalfreq()
71 ilp_ctl = bcma_pmu_read32(cc, BCMA_CC_PMU_XTAL_FREQ); in bcma_pmu_xtalfreq()
74 bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0); in bcma_pmu_xtalfreq()
80 static void bcma_pmu2_pll_init0(struct bcma_drv_cc *cc, u32 xtalfreq) in bcma_pmu2_pll_init0() argument
82 struct bcma_bus *bus = cc->core->bus; in bcma_pmu2_pll_init0()
115 pll0 = bcma_chipco_pll_read(cc, BCMA_CC_PMU15_PLL_PLLCTL0); in bcma_pmu2_pll_init0()
130 bcma_pmu_mask32(cc, BCMA_CC_PMU_MINRES_MSK, mask); in bcma_pmu2_pll_init0()
131 bcma_pmu_mask32(cc, BCMA_CC_PMU_MAXRES_MSK, mask); in bcma_pmu2_pll_init0()
132 bcma_wait_value(cc->core, BCMA_CLKCTLST, in bcma_pmu2_pll_init0()
139 bcma_chipco_pll_write(cc, BCMA_CC_PMU15_PLL_PLLCTL0, pll0); in bcma_pmu2_pll_init0()
142 if (cc->pmu.rev >= 2) in bcma_pmu2_pll_init0()
143 bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, BCMA_CC_PMU_CTL_PLL_UPD); in bcma_pmu2_pll_init0()
148 static void bcma_pmu_pll_init(struct bcma_drv_cc *cc) in bcma_pmu_pll_init() argument
150 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_pll_init()
151 u32 xtalfreq = bcma_pmu_xtalfreq(cc); in bcma_pmu_pll_init()
157 bcma_pmu2_pll_init0(cc, xtalfreq); in bcma_pmu_pll_init()
162 static void bcma_pmu_resources_init(struct bcma_drv_cc *cc) in bcma_pmu_resources_init() argument
164 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_resources_init()
198 bcma_pmu_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk); in bcma_pmu_resources_init()
200 bcma_pmu_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk); in bcma_pmu_resources_init()
210 void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable) in bcma_chipco_bcm4331_ext_pa_lines_ctl() argument
212 struct bcma_bus *bus = cc->core->bus; in bcma_chipco_bcm4331_ext_pa_lines_ctl()
215 val = bcma_cc_read32(cc, BCMA_CC_CHIPCTL); in bcma_chipco_bcm4331_ext_pa_lines_ctl()
227 bcma_cc_write32(cc, BCMA_CC_CHIPCTL, val); in bcma_chipco_bcm4331_ext_pa_lines_ctl()
230 static void bcma_pmu_workarounds(struct bcma_drv_cc *cc) in bcma_pmu_workarounds() argument
232 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_workarounds()
240 bcma_chipco_chipctl_maskset(cc, 0, in bcma_pmu_workarounds()
247 bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true); in bcma_pmu_workarounds()
256 bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL, in bcma_pmu_workarounds()
259 bcma_chipco_chipctl_maskset(cc, 0, in bcma_pmu_workarounds()
263 bcma_chipco_chipctl_maskset(cc, 0, in bcma_pmu_workarounds()
274 void bcma_pmu_early_init(struct bcma_drv_cc *cc) in bcma_pmu_early_init() argument
276 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_early_init()
279 if (cc->core->id.rev >= 35 && in bcma_pmu_early_init()
280 cc->capabilities_ext & BCMA_CC_CAP_EXT_AOB_PRESENT) { in bcma_pmu_early_init()
281 cc->pmu.core = bcma_find_core(bus, BCMA_CORE_PMU); in bcma_pmu_early_init()
282 if (!cc->pmu.core) in bcma_pmu_early_init()
285 if (!cc->pmu.core) in bcma_pmu_early_init()
286 cc->pmu.core = cc->core; in bcma_pmu_early_init()
288 pmucap = bcma_pmu_read32(cc, BCMA_CC_PMU_CAP); in bcma_pmu_early_init()
289 cc->pmu.rev = (pmucap & BCMA_CC_PMU_CAP_REVISION); in bcma_pmu_early_init()
291 bcma_debug(bus, "Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev, in bcma_pmu_early_init()
295 void bcma_pmu_init(struct bcma_drv_cc *cc) in bcma_pmu_init() argument
297 if (cc->pmu.rev == 1) in bcma_pmu_init()
298 bcma_pmu_mask32(cc, BCMA_CC_PMU_CTL, in bcma_pmu_init()
301 bcma_pmu_set32(cc, BCMA_CC_PMU_CTL, in bcma_pmu_init()
304 bcma_pmu_pll_init(cc); in bcma_pmu_init()
305 bcma_pmu_resources_init(cc); in bcma_pmu_init()
306 bcma_pmu_workarounds(cc); in bcma_pmu_init()
309 u32 bcma_pmu_get_alp_clock(struct bcma_drv_cc *cc) in bcma_pmu_get_alp_clock() argument
311 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_get_alp_clock()
339 if (cc->status & BCMA_CC_CHIPST_4360_XTAL_40MZ) in bcma_pmu_get_alp_clock()
345 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_ALP_CLOCK); in bcma_pmu_get_alp_clock()
353 static u32 bcma_pmu_pll_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m) in bcma_pmu_pll_clock() argument
356 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_pll_clock()
365 tmp = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT); in bcma_pmu_pll_clock()
370 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_P1P2_OFF); in bcma_pmu_pll_clock()
374 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_M14_OFF); in bcma_pmu_pll_clock()
378 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_NM5_OFF); in bcma_pmu_pll_clock()
382 fc = bcma_pmu_get_alp_clock(cc) / 1000000; in bcma_pmu_pll_clock()
389 static u32 bcma_pmu_pll_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m) in bcma_pmu_pll_clock_bcm4706() argument
397 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PMU6_4706_PROCPLL_OFF); in bcma_pmu_pll_clock_bcm4706()
405 tmp = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT); in bcma_pmu_pll_clock_bcm4706()
420 u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc) in bcma_pmu_get_bus_clock() argument
422 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_get_bus_clock()
428 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0, in bcma_pmu_get_bus_clock()
431 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0, in bcma_pmu_get_bus_clock()
435 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0, in bcma_pmu_get_bus_clock()
438 return bcma_pmu_pll_clock_bcm4706(cc, in bcma_pmu_get_bus_clock()
445 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK); in bcma_pmu_get_bus_clock()
452 u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc) in bcma_pmu_get_cpu_clock() argument
454 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_get_cpu_clock()
460 if (cc->pmu.rev >= 5) { in bcma_pmu_get_cpu_clock()
464 return bcma_pmu_pll_clock_bcm4706(cc, in bcma_pmu_get_cpu_clock()
479 return bcma_pmu_pll_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU); in bcma_pmu_get_cpu_clock()
483 return bcma_pmu_get_bus_clock(cc); in bcma_pmu_get_cpu_clock()
486 static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset, in bcma_pmu_spuravoid_pll_write() argument
489 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, offset); in bcma_pmu_spuravoid_pll_write()
490 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, value); in bcma_pmu_spuravoid_pll_write()
493 void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid) in bcma_pmu_spuravoid_pllupdate() argument
499 struct bcma_bus *bus = cc->core->bus; in bcma_pmu_spuravoid_pllupdate()
516 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, in bcma_pmu_spuravoid_pllupdate()
518 tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); in bcma_pmu_spuravoid_pllupdate()
521 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp); in bcma_pmu_spuravoid_pllupdate()
524 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR, in bcma_pmu_spuravoid_pllupdate()
526 tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA); in bcma_pmu_spuravoid_pllupdate()
529 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp); in bcma_pmu_spuravoid_pllupdate()
537 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
539 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
542 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
544 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
547 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
549 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
559 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
561 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1, in bcma_pmu_spuravoid_pllupdate()
563 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
565 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3, in bcma_pmu_spuravoid_pllupdate()
567 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4, in bcma_pmu_spuravoid_pllupdate()
569 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5, in bcma_pmu_spuravoid_pllupdate()
572 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
574 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1, in bcma_pmu_spuravoid_pllupdate()
576 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
578 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3, in bcma_pmu_spuravoid_pllupdate()
580 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4, in bcma_pmu_spuravoid_pllupdate()
582 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5, in bcma_pmu_spuravoid_pllupdate()
592 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
594 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1, in bcma_pmu_spuravoid_pllupdate()
596 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
598 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3, in bcma_pmu_spuravoid_pllupdate()
600 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4, in bcma_pmu_spuravoid_pllupdate()
602 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5, in bcma_pmu_spuravoid_pllupdate()
605 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
607 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1, in bcma_pmu_spuravoid_pllupdate()
609 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
611 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3, in bcma_pmu_spuravoid_pllupdate()
613 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4, in bcma_pmu_spuravoid_pllupdate()
615 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5, in bcma_pmu_spuravoid_pllupdate()
633 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
635 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1, in bcma_pmu_spuravoid_pllupdate()
637 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
639 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3, in bcma_pmu_spuravoid_pllupdate()
641 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4, in bcma_pmu_spuravoid_pllupdate()
643 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5, in bcma_pmu_spuravoid_pllupdate()
646 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0, in bcma_pmu_spuravoid_pllupdate()
648 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1, in bcma_pmu_spuravoid_pllupdate()
650 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2, in bcma_pmu_spuravoid_pllupdate()
652 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3, in bcma_pmu_spuravoid_pllupdate()
654 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4, in bcma_pmu_spuravoid_pllupdate()
656 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5, in bcma_pmu_spuravoid_pllupdate()
667 tmp |= bcma_pmu_read32(cc, BCMA_CC_PMU_CTL); in bcma_pmu_spuravoid_pllupdate()
668 bcma_pmu_write32(cc, BCMA_CC_PMU_CTL, tmp); in bcma_pmu_spuravoid_pllupdate()