2 * Broadcom specific AMBA
3 * ChipCommon Power Management Unit driver
5 * Copyright 2009, Michael Buesch <m@bues.ch>
6 * Copyright 2007, 2011, Broadcom Corporation
7 * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de>
9 * Licensed under the GNU/GPL. See COPYING for details.
12 #include "bcma_private.h"
13 #include <linux/export.h>
14 #include <linux/bcma/bcma.h>
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);
22 EXPORT_SYMBOL_GPL(bcma_chipco_pll_read);
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);
30 EXPORT_SYMBOL_GPL(bcma_chipco_pll_write);
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);
39 EXPORT_SYMBOL_GPL(bcma_chipco_pll_maskset);
41 void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc,
42 u32 offset, u32 mask, u32 set)
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);
48 EXPORT_SYMBOL_GPL(bcma_chipco_chipctl_maskset);
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);
57 EXPORT_SYMBOL_GPL(bcma_chipco_regctl_maskset);
59 static u32 bcma_pmu_xtalfreq(struct bcma_drv_cc *cc)
63 if (!(bcma_pmu_read32(cc, BCMA_CC_PMU_STAT) &
64 BCMA_CC_PMU_STAT_EXT_LPO_AVAIL))
67 bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ,
68 BIT(BCMA_CC_PMU_XTAL_FREQ_MEASURE_SHIFT));
69 usleep_range(1000, 2000);
71 ilp_ctl = bcma_pmu_read32(cc, BCMA_CC_PMU_XTAL_FREQ);
72 ilp_ctl &= BCMA_CC_PMU_XTAL_FREQ_ILPCTL_MASK;
74 bcma_pmu_write32(cc, BCMA_CC_PMU_XTAL_FREQ, 0);
76 alp_hz = ilp_ctl * 32768 / 4;
77 return (alp_hz + 50000) / 100000 * 100;
80 static void bcma_pmu2_pll_init0(struct bcma_drv_cc *cc, u32 xtalfreq)
82 struct bcma_bus *bus = cc->core->bus;
83 u32 freq_tgt_target = 0, freq_tgt_current;
86 switch (bus->chipinfo.id) {
87 case BCMA_CHIP_ID_BCM43142:
88 /* pmu2_xtaltab0_adfll_485 */
91 freq_tgt_target = 0x50D52;
94 freq_tgt_target = 0x307FE;
97 freq_tgt_target = 0x254EA;
100 freq_tgt_target = 0x19EF8;
103 freq_tgt_target = 0x12A75;
109 if (!freq_tgt_target) {
110 bcma_err(bus, "Unknown TGT frequency for xtalfreq %d\n",
115 pll0 = bcma_chipco_pll_read(cc, BCMA_CC_PMU15_PLL_PLLCTL0);
116 freq_tgt_current = (pll0 & BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK) >>
117 BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT;
119 if (freq_tgt_current == freq_tgt_target) {
120 bcma_debug(bus, "Target TGT frequency already set\n");
125 switch (bus->chipinfo.id) {
126 case BCMA_CHIP_ID_BCM43142:
127 mask = (u32)~(BCMA_RES_4314_HT_AVAIL |
128 BCMA_RES_4314_MACPHY_CLK_AVAIL);
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,
133 BCMA_CLKCTLST_HAVEHT, 0, 20000);
137 pll0 &= ~BCMA_CC_PMU15_PLL_PC0_FREQTGT_MASK;
138 pll0 |= freq_tgt_target << BCMA_CC_PMU15_PLL_PC0_FREQTGT_SHIFT;
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);
145 /* TODO: Do we need to update OTP? */
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);
153 switch (bus->chipinfo.id) {
154 case BCMA_CHIP_ID_BCM43142:
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;
165 u32 min_msk = 0, max_msk = 0;
167 switch (bus->chipinfo.id) {
168 case BCMA_CHIP_ID_BCM4313:
172 case BCMA_CHIP_ID_BCM43142:
173 min_msk = BCMA_RES_4314_LPLDO_PU |
174 BCMA_RES_4314_PMU_SLEEP_DIS |
175 BCMA_RES_4314_PMU_BG_PU |
176 BCMA_RES_4314_CBUCK_LPOM_PU |
177 BCMA_RES_4314_CBUCK_PFM_PU |
178 BCMA_RES_4314_CLDO_PU |
179 BCMA_RES_4314_LPLDO2_LVM |
180 BCMA_RES_4314_WL_PMU_PU |
181 BCMA_RES_4314_LDO3P3_PU |
182 BCMA_RES_4314_OTP_PU |
183 BCMA_RES_4314_WL_PWRSW_PU |
184 BCMA_RES_4314_LQ_AVAIL |
185 BCMA_RES_4314_LOGIC_RET |
186 BCMA_RES_4314_MEM_SLEEP |
187 BCMA_RES_4314_MACPHY_RET |
188 BCMA_RES_4314_WL_CORE_READY;
189 max_msk = 0x3FFFFFFF;
192 bcma_debug(bus, "PMU resource config unknown or not needed for device 0x%04X\n",
196 /* Set the resource masks. */
198 bcma_pmu_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk);
200 bcma_pmu_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
203 * Add some delay; allow resources to come up and settle.
204 * Delay is required for SoC (early init).
206 usleep_range(2000, 2500);
209 /* Disable to allow reading SPROM. Don't know the advantages of enabling it. */
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);
217 val |= BCMA_CHIPCTL_4331_EXTPA_EN;
218 if (bus->chipinfo.pkg == 9 || bus->chipinfo.pkg == 11)
219 val |= BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5;
220 else if (bus->chipinfo.rev > 0)
221 val |= BCMA_CHIPCTL_4331_EXTPA_EN2;
223 val &= ~BCMA_CHIPCTL_4331_EXTPA_EN;
224 val &= ~BCMA_CHIPCTL_4331_EXTPA_EN2;
225 val &= ~BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5;
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;
234 switch (bus->chipinfo.id) {
235 case BCMA_CHIP_ID_BCM4313:
237 * enable 12 mA drive strength for 4313 and set chipControl
240 bcma_chipco_chipctl_maskset(cc, 0,
241 ~BCMA_CCTRL_4313_12MA_LED_DRIVE,
242 BCMA_CCTRL_4313_12MA_LED_DRIVE);
244 case BCMA_CHIP_ID_BCM4331:
245 case BCMA_CHIP_ID_BCM43431:
246 /* Ext PA lines must be enabled for tx on BCM4331 */
247 bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true);
249 case BCMA_CHIP_ID_BCM43224:
250 case BCMA_CHIP_ID_BCM43421:
252 * enable 12 mA drive strength for 43224 and set chipControl
255 if (bus->chipinfo.rev == 0) {
256 bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL,
257 ~BCMA_CCTRL_43224_GPIO_TOGGLE,
258 BCMA_CCTRL_43224_GPIO_TOGGLE);
259 bcma_chipco_chipctl_maskset(cc, 0,
260 ~BCMA_CCTRL_43224A0_12MA_LED_DRIVE,
261 BCMA_CCTRL_43224A0_12MA_LED_DRIVE);
263 bcma_chipco_chipctl_maskset(cc, 0,
264 ~BCMA_CCTRL_43224B0_12MA_LED_DRIVE,
265 BCMA_CCTRL_43224B0_12MA_LED_DRIVE);
269 bcma_debug(bus, "Workarounds unknown or not needed for device 0x%04X\n",
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);
283 bcma_warn(bus, "Couldn't find expected 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,
299 ~BCMA_CC_PMU_CTL_NOILPONW);
301 bcma_pmu_set32(cc, BCMA_CC_PMU_CTL,
302 BCMA_CC_PMU_CTL_NOILPONW);
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;
313 switch (bus->chipinfo.id) {
314 case BCMA_CHIP_ID_BCM4313:
315 case BCMA_CHIP_ID_BCM43224:
316 case BCMA_CHIP_ID_BCM43225:
317 case BCMA_CHIP_ID_BCM43227:
318 case BCMA_CHIP_ID_BCM43228:
319 case BCMA_CHIP_ID_BCM4331:
320 case BCMA_CHIP_ID_BCM43421:
321 case BCMA_CHIP_ID_BCM43428:
322 case BCMA_CHIP_ID_BCM43431:
323 case BCMA_CHIP_ID_BCM4716:
324 case BCMA_CHIP_ID_BCM47162:
325 case BCMA_CHIP_ID_BCM4748:
326 case BCMA_CHIP_ID_BCM4749:
327 case BCMA_CHIP_ID_BCM5357:
328 case BCMA_CHIP_ID_BCM53572:
329 case BCMA_CHIP_ID_BCM6362:
332 case BCMA_CHIP_ID_BCM4706:
333 case BCMA_CHIP_ID_BCM5356:
336 case BCMA_CHIP_ID_BCM43460:
337 case BCMA_CHIP_ID_BCM4352:
338 case BCMA_CHIP_ID_BCM4360:
339 if (cc->status & BCMA_CC_CHIPST_4360_XTAL_40MZ)
344 bcma_warn(bus, "No ALP clock specified for %04X device, pmu rev. %d, using default %d Hz\n",
345 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_ALP_CLOCK);
347 return BCMA_CC_PMU_ALP_CLOCK;
350 /* Find the output of the "m" pll divider given pll controls that start with
351 * pllreg "pll0" i.e. 12 for main 6 for phy, 0 for misc.
353 static u32 bcma_pmu_pll_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)
355 u32 tmp, div, ndiv, p1, p2, fc;
356 struct bcma_bus *bus = cc->core->bus;
358 BUG_ON((pll0 & 3) || (pll0 > BCMA_CC_PMU4716_MAINPLL_PLL0));
362 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 ||
363 bus->chipinfo.id == BCMA_CHIP_ID_BCM4749) {
364 /* Detect failure in clock setting */
365 tmp = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
367 return 133 * 1000000;
370 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_P1P2_OFF);
371 p1 = (tmp & BCMA_CC_PPL_P1_MASK) >> BCMA_CC_PPL_P1_SHIFT;
372 p2 = (tmp & BCMA_CC_PPL_P2_MASK) >> BCMA_CC_PPL_P2_SHIFT;
374 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_M14_OFF);
375 div = (tmp >> ((m - 1) * BCMA_CC_PPL_MDIV_WIDTH)) &
376 BCMA_CC_PPL_MDIV_MASK;
378 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_NM5_OFF);
379 ndiv = (tmp & BCMA_CC_PPL_NDIV_MASK) >> BCMA_CC_PPL_NDIV_SHIFT;
381 /* Do calculation in Mhz */
382 fc = bcma_pmu_get_alp_clock(cc) / 1000000;
383 fc = (p1 * ndiv * fc) / p2;
385 /* Return clock in Hertz */
386 return (fc / div) * 1000000;
389 static u32 bcma_pmu_pll_clock_bcm4706(struct bcma_drv_cc *cc, u32 pll0, u32 m)
391 u32 tmp, ndiv, p1div, p2div;
396 /* Get N, P1 and P2 dividers to determine CPU clock */
397 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PMU6_4706_PROCPLL_OFF);
398 ndiv = (tmp & BCMA_CC_PMU6_4706_PROC_NDIV_INT_MASK)
399 >> BCMA_CC_PMU6_4706_PROC_NDIV_INT_SHIFT;
400 p1div = (tmp & BCMA_CC_PMU6_4706_PROC_P1DIV_MASK)
401 >> BCMA_CC_PMU6_4706_PROC_P1DIV_SHIFT;
402 p2div = (tmp & BCMA_CC_PMU6_4706_PROC_P2DIV_MASK)
403 >> BCMA_CC_PMU6_4706_PROC_P2DIV_SHIFT;
405 tmp = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
406 if (tmp & BCMA_CC_CHIPST_4706_PKG_OPTION)
407 /* Low cost bonding: Fixed reference clock 25MHz and m = 4 */
408 clock = (25000000 / 4) * ndiv * p2div / p1div;
410 /* Fixed reference clock 25MHz and m = 2 */
411 clock = (25000000 / 2) * ndiv * p2div / p1div;
413 if (m == BCMA_CC_PMU5_MAINPLL_SSB)
419 /* query bus clock frequency for PMU-enabled chipcommon */
420 u32 bcma_pmu_get_bus_clock(struct bcma_drv_cc *cc)
422 struct bcma_bus *bus = cc->core->bus;
424 switch (bus->chipinfo.id) {
425 case BCMA_CHIP_ID_BCM4716:
426 case BCMA_CHIP_ID_BCM4748:
427 case BCMA_CHIP_ID_BCM47162:
428 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0,
429 BCMA_CC_PMU5_MAINPLL_SSB);
430 case BCMA_CHIP_ID_BCM5356:
431 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0,
432 BCMA_CC_PMU5_MAINPLL_SSB);
433 case BCMA_CHIP_ID_BCM5357:
434 case BCMA_CHIP_ID_BCM4749:
435 return bcma_pmu_pll_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0,
436 BCMA_CC_PMU5_MAINPLL_SSB);
437 case BCMA_CHIP_ID_BCM4706:
438 return bcma_pmu_pll_clock_bcm4706(cc,
439 BCMA_CC_PMU4706_MAINPLL_PLL0,
440 BCMA_CC_PMU5_MAINPLL_SSB);
441 case BCMA_CHIP_ID_BCM53572:
444 bcma_warn(bus, "No bus clock specified for %04X device, pmu rev. %d, using default %d Hz\n",
445 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK);
447 return BCMA_CC_PMU_HT_CLOCK;
449 EXPORT_SYMBOL_GPL(bcma_pmu_get_bus_clock);
451 /* query cpu clock frequency for PMU-enabled chipcommon */
452 u32 bcma_pmu_get_cpu_clock(struct bcma_drv_cc *cc)
454 struct bcma_bus *bus = cc->core->bus;
456 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572)
459 /* New PMUs can have different clock for bus and CPU */
460 if (cc->pmu.rev >= 5) {
462 switch (bus->chipinfo.id) {
463 case BCMA_CHIP_ID_BCM4706:
464 return bcma_pmu_pll_clock_bcm4706(cc,
465 BCMA_CC_PMU4706_MAINPLL_PLL0,
466 BCMA_CC_PMU5_MAINPLL_CPU);
467 case BCMA_CHIP_ID_BCM5356:
468 pll = BCMA_CC_PMU5356_MAINPLL_PLL0;
470 case BCMA_CHIP_ID_BCM5357:
471 case BCMA_CHIP_ID_BCM4749:
472 pll = BCMA_CC_PMU5357_MAINPLL_PLL0;
475 pll = BCMA_CC_PMU4716_MAINPLL_PLL0;
479 return bcma_pmu_pll_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU);
482 /* On old PMUs CPU has the same clock as the bus */
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)
496 u8 phypll_offset = 0;
497 u8 bcm5357_bcm43236_p1div[] = {0x1, 0x5, 0x5};
498 u8 bcm5357_bcm43236_ndiv[] = {0x30, 0xf6, 0xfc};
499 struct bcma_bus *bus = cc->core->bus;
501 switch (bus->chipinfo.id) {
502 case BCMA_CHIP_ID_BCM5357:
503 case BCMA_CHIP_ID_BCM4749:
504 case BCMA_CHIP_ID_BCM53572:
505 /* 5357[ab]0, 43236[ab]0, and 6362b0 */
508 * BCM5357 needs to touch PLL1_PLLCTL[02],
509 * so offset PLL0_PLLCTL[02] by 6
511 phypll_offset = (bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 ||
512 bus->chipinfo.id == BCMA_CHIP_ID_BCM4749 ||
513 bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) ? 6 : 0;
515 /* RMW only the P1 divider */
516 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR,
517 BCMA_CC_PMU_PLL_CTL0 + phypll_offset);
518 tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
519 tmp &= (~(BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK));
520 tmp |= (bcm5357_bcm43236_p1div[spuravoid] << BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT);
521 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp);
523 /* RMW only the int feedback divider */
524 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_ADDR,
525 BCMA_CC_PMU_PLL_CTL2 + phypll_offset);
526 tmp = bcma_pmu_read32(cc, BCMA_CC_PMU_PLLCTL_DATA);
527 tmp &= ~(BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK);
528 tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) << BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT;
529 bcma_pmu_write32(cc, BCMA_CC_PMU_PLLCTL_DATA, tmp);
531 tmp = BCMA_CC_PMU_CTL_PLL_UPD;
534 case BCMA_CHIP_ID_BCM4331:
535 case BCMA_CHIP_ID_BCM43431:
536 if (spuravoid == 2) {
537 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
539 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
541 } else if (spuravoid == 1) {
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,
552 tmp = BCMA_CC_PMU_CTL_PLL_UPD;
555 case BCMA_CHIP_ID_BCM43224:
556 case BCMA_CHIP_ID_BCM43225:
557 case BCMA_CHIP_ID_BCM43421:
558 if (spuravoid == 1) {
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,
585 tmp = BCMA_CC_PMU_CTL_PLL_UPD;
588 case BCMA_CHIP_ID_BCM4716:
589 case BCMA_CHIP_ID_BCM4748:
590 case BCMA_CHIP_ID_BCM47162:
591 if (spuravoid == 1) {
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,
619 tmp = BCMA_CC_PMU_CTL_PLL_UPD | BCMA_CC_PMU_CTL_NOILPONW;
622 case BCMA_CHIP_ID_BCM43131:
623 case BCMA_CHIP_ID_BCM43217:
624 case BCMA_CHIP_ID_BCM43227:
625 case BCMA_CHIP_ID_BCM43228:
626 case BCMA_CHIP_ID_BCM43428:
629 * PLL Settings for spur avoidance on/off mode,
630 * no on2 support for 43228A0
632 if (spuravoid == 1) {
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,
659 tmp = BCMA_CC_PMU_CTL_PLL_UPD;
662 bcma_err(bus, "Unknown spuravoidance settings for chip 0x%04X, not changing PLL\n",
667 tmp |= bcma_pmu_read32(cc, BCMA_CC_PMU_CTL);
668 bcma_pmu_write32(cc, BCMA_CC_PMU_CTL, tmp);
670 EXPORT_SYMBOL_GPL(bcma_pmu_spuravoid_pllupdate);