Lines Matching refs:cc

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