blob: 35c9130746fb057b64087c91e5b2f2bd8a6c2b4e [file] [log] [blame]
Rafał Miłecki8369ae32011-05-09 18:56:46 +02001/*
2 * Broadcom specific AMBA
3 * ChipCommon Power Management Unit driver
4 *
Michael Büscheb032b92011-07-04 20:50:05 +02005 * Copyright 2009, Michael Buesch <m@bues.ch>
Hauke Mehrtensc586e102012-06-30 01:44:44 +02006 * Copyright 2007, 2011, Broadcom Corporation
7 * Copyright 2011, 2012, Hauke Mehrtens <hauke@hauke-m.de>
Rafał Miłecki8369ae32011-05-09 18:56:46 +02008 *
9 * Licensed under the GNU/GPL. See COPYING for details.
10 */
11
12#include "bcma_private.h"
Paul Gortmaker44a8e372011-07-27 21:21:04 -040013#include <linux/export.h>
Rafał Miłecki8369ae32011-05-09 18:56:46 +020014#include <linux/bcma/bcma.h>
15
Hauke Mehrtens908debc2011-07-23 01:20:11 +020016static u32 bcma_chipco_pll_read(struct bcma_drv_cc *cc, u32 offset)
17{
18 bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
19 bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
20 return bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
21}
22
Rafał Miłecki3861b2c2011-09-16 12:33:58 +020023void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, u32 value)
Rafał Miłecki8369ae32011-05-09 18:56:46 +020024{
Rafał Miłecki3861b2c2011-09-16 12:33:58 +020025 bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
26 bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
27 bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value);
28}
29EXPORT_SYMBOL_GPL(bcma_chipco_pll_write);
Rafał Miłecki8369ae32011-05-09 18:56:46 +020030
Rafał Miłecki3861b2c2011-09-16 12:33:58 +020031void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask,
32 u32 set)
33{
34 bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
35 bcma_cc_read32(cc, BCMA_CC_PLLCTL_ADDR);
36 bcma_cc_maskset32(cc, BCMA_CC_PLLCTL_DATA, mask, set);
37}
38EXPORT_SYMBOL_GPL(bcma_chipco_pll_maskset);
39
40void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc,
41 u32 offset, u32 mask, u32 set)
42{
Rafał Miłecki8369ae32011-05-09 18:56:46 +020043 bcma_cc_write32(cc, BCMA_CC_CHIPCTL_ADDR, offset);
44 bcma_cc_read32(cc, BCMA_CC_CHIPCTL_ADDR);
Rafał Miłecki3861b2c2011-09-16 12:33:58 +020045 bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL_DATA, mask, set);
Rafał Miłecki8369ae32011-05-09 18:56:46 +020046}
Rafał Miłecki3861b2c2011-09-16 12:33:58 +020047EXPORT_SYMBOL_GPL(bcma_chipco_chipctl_maskset);
48
49void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, u32 offset, u32 mask,
50 u32 set)
51{
52 bcma_cc_write32(cc, BCMA_CC_REGCTL_ADDR, offset);
53 bcma_cc_read32(cc, BCMA_CC_REGCTL_ADDR);
54 bcma_cc_maskset32(cc, BCMA_CC_REGCTL_DATA, mask, set);
55}
56EXPORT_SYMBOL_GPL(bcma_chipco_regctl_maskset);
Rafał Miłecki8369ae32011-05-09 18:56:46 +020057
Rafał Miłecki8369ae32011-05-09 18:56:46 +020058static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)
59{
60 struct bcma_bus *bus = cc->core->bus;
61 u32 min_msk = 0, max_msk = 0;
62
63 switch (bus->chipinfo.id) {
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +020064 case BCMA_CHIP_ID_BCM4313:
Rafał Miłecki8369ae32011-05-09 18:56:46 +020065 min_msk = 0x200D;
66 max_msk = 0xFFFF;
67 break;
Rafał Miłecki8369ae32011-05-09 18:56:46 +020068 default:
Hauke Mehrtens6270d1c2012-06-30 01:44:43 +020069 pr_debug("PMU resource config unknown or not needed for device 0x%04X\n",
70 bus->chipinfo.id);
Rafał Miłecki8369ae32011-05-09 18:56:46 +020071 }
72
73 /* Set the resource masks. */
74 if (min_msk)
75 bcma_cc_write32(cc, BCMA_CC_PMU_MINRES_MSK, min_msk);
76 if (max_msk)
77 bcma_cc_write32(cc, BCMA_CC_PMU_MAXRES_MSK, max_msk);
78}
79
Rafał Miłecki984e5be2011-08-11 23:46:44 +020080/* Disable to allow reading SPROM. Don't know the adventages of enabling it. */
81void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable)
82{
83 struct bcma_bus *bus = cc->core->bus;
84 u32 val;
85
86 val = bcma_cc_read32(cc, BCMA_CC_CHIPCTL);
87 if (enable) {
88 val |= BCMA_CHIPCTL_4331_EXTPA_EN;
89 if (bus->chipinfo.pkg == 9 || bus->chipinfo.pkg == 11)
90 val |= BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5;
Hauke Mehrtens00eeedc2012-06-30 01:44:37 +020091 else if (bus->chipinfo.rev > 0)
92 val |= BCMA_CHIPCTL_4331_EXTPA_EN2;
Rafał Miłecki984e5be2011-08-11 23:46:44 +020093 } else {
94 val &= ~BCMA_CHIPCTL_4331_EXTPA_EN;
Hauke Mehrtens00eeedc2012-06-30 01:44:37 +020095 val &= ~BCMA_CHIPCTL_4331_EXTPA_EN2;
Rafał Miłecki984e5be2011-08-11 23:46:44 +020096 val &= ~BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5;
97 }
98 bcma_cc_write32(cc, BCMA_CC_CHIPCTL, val);
99}
100
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200101void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
102{
103 struct bcma_bus *bus = cc->core->bus;
104
105 switch (bus->chipinfo.id) {
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200106 case BCMA_CHIP_ID_BCM4313:
Hauke Mehrtensb9562542012-06-30 01:44:41 +0200107 /* enable 12 mA drive strenth for 4313 and set chipControl
108 register bit 1 */
109 bcma_chipco_chipctl_maskset(cc, 0,
110 BCMA_CCTRL_4313_12MA_LED_DRIVE,
111 BCMA_CCTRL_4313_12MA_LED_DRIVE);
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200112 break;
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200113 case BCMA_CHIP_ID_BCM4331:
114 case BCMA_CHIP_ID_BCM43431:
Seth Forshee69aaedd2012-06-01 09:13:17 -0500115 /* Ext PA lines must be enabled for tx on BCM4331 */
116 bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true);
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200117 break;
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200118 case BCMA_CHIP_ID_BCM43224:
Hauke Mehrtensb9562542012-06-30 01:44:41 +0200119 case BCMA_CHIP_ID_BCM43421:
120 /* enable 12 mA drive strenth for 43224 and set chipControl
121 register bit 15 */
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200122 if (bus->chipinfo.rev == 0) {
Hauke Mehrtensb9562542012-06-30 01:44:41 +0200123 bcma_cc_maskset32(cc, BCMA_CC_CHIPCTL,
124 BCMA_CCTRL_43224_GPIO_TOGGLE,
125 BCMA_CCTRL_43224_GPIO_TOGGLE);
126 bcma_chipco_chipctl_maskset(cc, 0,
127 BCMA_CCTRL_43224A0_12MA_LED_DRIVE,
128 BCMA_CCTRL_43224A0_12MA_LED_DRIVE);
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200129 } else {
Hauke Mehrtensb9562542012-06-30 01:44:41 +0200130 bcma_chipco_chipctl_maskset(cc, 0,
131 BCMA_CCTRL_43224B0_12MA_LED_DRIVE,
132 BCMA_CCTRL_43224B0_12MA_LED_DRIVE);
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200133 }
134 break;
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200135 default:
Hauke Mehrtens6270d1c2012-06-30 01:44:43 +0200136 pr_debug("Workarounds unknown or not needed for device 0x%04X\n",
137 bus->chipinfo.id);
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200138 }
139}
140
141void bcma_pmu_init(struct bcma_drv_cc *cc)
142{
143 u32 pmucap;
144
145 pmucap = bcma_cc_read32(cc, BCMA_CC_PMU_CAP);
146 cc->pmu.rev = (pmucap & BCMA_CC_PMU_CAP_REVISION);
147
148 pr_debug("Found rev %u PMU (capabilities 0x%08X)\n", cc->pmu.rev,
149 pmucap);
150
151 if (cc->pmu.rev == 1)
152 bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
153 ~BCMA_CC_PMU_CTL_NOILPONW);
154 else
155 bcma_cc_set32(cc, BCMA_CC_PMU_CTL,
156 BCMA_CC_PMU_CTL_NOILPONW);
157
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200158 bcma_pmu_resources_init(cc);
Rafał Miłecki8369ae32011-05-09 18:56:46 +0200159 bcma_pmu_workarounds(cc);
160}
Hauke Mehrtense3afe0e2011-07-23 01:20:10 +0200161
162u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc)
163{
164 struct bcma_bus *bus = cc->core->bus;
165
166 switch (bus->chipinfo.id) {
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200167 case BCMA_CHIP_ID_BCM4716:
168 case BCMA_CHIP_ID_BCM4748:
169 case BCMA_CHIP_ID_BCM47162:
170 case BCMA_CHIP_ID_BCM4313:
171 case BCMA_CHIP_ID_BCM5357:
172 case BCMA_CHIP_ID_BCM4749:
173 case BCMA_CHIP_ID_BCM53572:
Hauke Mehrtense3afe0e2011-07-23 01:20:10 +0200174 /* always 20Mhz */
175 return 20000 * 1000;
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200176 case BCMA_CHIP_ID_BCM5356:
177 case BCMA_CHIP_ID_BCM4706:
Hauke Mehrtense3afe0e2011-07-23 01:20:10 +0200178 /* always 25Mhz */
179 return 25000 * 1000;
180 default:
181 pr_warn("No ALP clock specified for %04X device, "
182 "pmu rev. %d, using default %d Hz\n",
183 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_ALP_CLOCK);
184 }
185 return BCMA_CC_PMU_ALP_CLOCK;
186}
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200187
188/* Find the output of the "m" pll divider given pll controls that start with
189 * pllreg "pll0" i.e. 12 for main 6 for phy, 0 for misc.
190 */
191static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)
192{
193 u32 tmp, div, ndiv, p1, p2, fc;
194 struct bcma_bus *bus = cc->core->bus;
195
196 BUG_ON((pll0 & 3) || (pll0 > BCMA_CC_PMU4716_MAINPLL_PLL0));
197
198 BUG_ON(!m || m > 4);
199
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200200 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 ||
201 bus->chipinfo.id == BCMA_CHIP_ID_BCM4749) {
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200202 /* Detect failure in clock setting */
203 tmp = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
204 if (tmp & 0x40000)
205 return 133 * 1000000;
206 }
207
208 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_P1P2_OFF);
209 p1 = (tmp & BCMA_CC_PPL_P1_MASK) >> BCMA_CC_PPL_P1_SHIFT;
210 p2 = (tmp & BCMA_CC_PPL_P2_MASK) >> BCMA_CC_PPL_P2_SHIFT;
211
212 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_M14_OFF);
213 div = (tmp >> ((m - 1) * BCMA_CC_PPL_MDIV_WIDTH)) &
214 BCMA_CC_PPL_MDIV_MASK;
215
216 tmp = bcma_chipco_pll_read(cc, pll0 + BCMA_CC_PPL_NM5_OFF);
217 ndiv = (tmp & BCMA_CC_PPL_NDIV_MASK) >> BCMA_CC_PPL_NDIV_SHIFT;
218
219 /* Do calculation in Mhz */
220 fc = bcma_pmu_alp_clock(cc) / 1000000;
221 fc = (p1 * ndiv * fc) / p2;
222
223 /* Return clock in Hertz */
224 return (fc / div) * 1000000;
225}
226
227/* query bus clock frequency for PMU-enabled chipcommon */
228u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)
229{
230 struct bcma_bus *bus = cc->core->bus;
231
232 switch (bus->chipinfo.id) {
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200233 case BCMA_CHIP_ID_BCM4716:
234 case BCMA_CHIP_ID_BCM4748:
235 case BCMA_CHIP_ID_BCM47162:
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200236 return bcma_pmu_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0,
237 BCMA_CC_PMU5_MAINPLL_SSB);
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200238 case BCMA_CHIP_ID_BCM5356:
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200239 return bcma_pmu_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0,
240 BCMA_CC_PMU5_MAINPLL_SSB);
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200241 case BCMA_CHIP_ID_BCM5357:
242 case BCMA_CHIP_ID_BCM4749:
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200243 return bcma_pmu_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0,
244 BCMA_CC_PMU5_MAINPLL_SSB);
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200245 case BCMA_CHIP_ID_BCM4706:
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200246 return bcma_pmu_clock(cc, BCMA_CC_PMU4706_MAINPLL_PLL0,
247 BCMA_CC_PMU5_MAINPLL_SSB);
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200248 case BCMA_CHIP_ID_BCM53572:
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200249 return 75000000;
250 default:
251 pr_warn("No backplane clock specified for %04X device, "
252 "pmu rev. %d, using default %d Hz\n",
253 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK);
254 }
255 return BCMA_CC_PMU_HT_CLOCK;
256}
257
258/* query cpu clock frequency for PMU-enabled chipcommon */
259u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc)
260{
261 struct bcma_bus *bus = cc->core->bus;
262
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200263 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572)
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200264 return 300000000;
265
266 if (cc->pmu.rev >= 5) {
267 u32 pll;
268 switch (bus->chipinfo.id) {
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200269 case BCMA_CHIP_ID_BCM5356:
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200270 pll = BCMA_CC_PMU5356_MAINPLL_PLL0;
271 break;
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200272 case BCMA_CHIP_ID_BCM5357:
273 case BCMA_CHIP_ID_BCM4749:
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200274 pll = BCMA_CC_PMU5357_MAINPLL_PLL0;
275 break;
276 default:
277 pll = BCMA_CC_PMU4716_MAINPLL_PLL0;
278 break;
279 }
280
Hauke Mehrtens4b4f5be2012-06-30 01:44:38 +0200281 /* TODO: if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
Hauke Mehrtens908debc2011-07-23 01:20:11 +0200282 return si_4706_pmu_clock(sih, osh, cc, PMU4706_MAINPLL_PLL0, PMU5_MAINPLL_CPU); */
283 return bcma_pmu_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU);
284 }
285
286 return bcma_pmu_get_clockcontrol(cc);
287}
Hauke Mehrtensc586e102012-06-30 01:44:44 +0200288
289static void bcma_pmu_spuravoid_pll_write(struct bcma_drv_cc *cc, u32 offset,
290 u32 value)
291{
292 bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR, offset);
293 bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, value);
294}
295
296void bcma_pmu_spuravoid_pllupdate(struct bcma_drv_cc *cc, int spuravoid)
297{
298 u32 tmp = 0;
299 u8 phypll_offset = 0;
300 u8 bcm5357_bcm43236_p1div[] = {0x1, 0x5, 0x5};
301 u8 bcm5357_bcm43236_ndiv[] = {0x30, 0xf6, 0xfc};
302 struct bcma_bus *bus = cc->core->bus;
303
304 switch (bus->chipinfo.id) {
305 case BCMA_CHIP_ID_BCM5357:
306 case BCMA_CHIP_ID_BCM4749:
307 case BCMA_CHIP_ID_BCM53572:
308 /* 5357[ab]0, 43236[ab]0, and 6362b0 */
309
310 /* BCM5357 needs to touch PLL1_PLLCTL[02],
311 so offset PLL0_PLLCTL[02] by 6 */
312 phypll_offset = (bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 ||
313 bus->chipinfo.id == BCMA_CHIP_ID_BCM4749 ||
314 bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) ? 6 : 0;
315
316 /* RMW only the P1 divider */
317 bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR,
318 BCMA_CC_PMU_PLL_CTL0 + phypll_offset);
319 tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
320 tmp &= (~(BCMA_CC_PMU1_PLL0_PC0_P1DIV_MASK));
321 tmp |= (bcm5357_bcm43236_p1div[spuravoid] << BCMA_CC_PMU1_PLL0_PC0_P1DIV_SHIFT);
322 bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp);
323
324 /* RMW only the int feedback divider */
325 bcma_cc_write32(cc, BCMA_CC_PLLCTL_ADDR,
326 BCMA_CC_PMU_PLL_CTL2 + phypll_offset);
327 tmp = bcma_cc_read32(cc, BCMA_CC_PLLCTL_DATA);
328 tmp &= ~(BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_MASK);
329 tmp |= (bcm5357_bcm43236_ndiv[spuravoid]) << BCMA_CC_PMU1_PLL0_PC2_NDIV_INT_SHIFT;
330 bcma_cc_write32(cc, BCMA_CC_PLLCTL_DATA, tmp);
331
332 tmp = 1 << 10;
333 break;
334
335 case BCMA_CHIP_ID_BCM4331:
336 case BCMA_CHIP_ID_BCM43431:
337 if (spuravoid == 2) {
338 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
339 0x11500014);
340 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
341 0x0FC00a08);
342 } else if (spuravoid == 1) {
343 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
344 0x11500014);
345 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
346 0x0F600a08);
347 } else {
348 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
349 0x11100014);
350 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
351 0x03000a08);
352 }
353 tmp = 1 << 10;
354 break;
355
356 case BCMA_CHIP_ID_BCM43224:
357 case BCMA_CHIP_ID_BCM43225:
358 case BCMA_CHIP_ID_BCM43421:
359 if (spuravoid == 1) {
360 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
361 0x11500010);
362 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1,
363 0x000C0C06);
364 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
365 0x0F600a08);
366 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3,
367 0x00000000);
368 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4,
369 0x2001E920);
370 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
371 0x88888815);
372 } else {
373 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
374 0x11100010);
375 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1,
376 0x000c0c06);
377 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
378 0x03000a08);
379 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3,
380 0x00000000);
381 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4,
382 0x200005c0);
383 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
384 0x88888815);
385 }
386 tmp = 1 << 10;
387 break;
388
389 case BCMA_CHIP_ID_BCM4716:
390 case BCMA_CHIP_ID_BCM4748:
391 case BCMA_CHIP_ID_BCM47162:
392 if (spuravoid == 1) {
393 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
394 0x11500060);
395 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1,
396 0x080C0C06);
397 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
398 0x0F600000);
399 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3,
400 0x00000000);
401 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4,
402 0x2001E924);
403 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
404 0x88888815);
405 } else {
406 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
407 0x11100060);
408 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1,
409 0x080c0c06);
410 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
411 0x03000000);
412 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3,
413 0x00000000);
414 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4,
415 0x200005c0);
416 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
417 0x88888815);
418 }
419
420 tmp = 3 << 9;
421 break;
422
423 case BCMA_CHIP_ID_BCM43227:
424 case BCMA_CHIP_ID_BCM43228:
425 case BCMA_CHIP_ID_BCM43428:
426 /* LCNXN */
427 /* PLL Settings for spur avoidance on/off mode,
428 no on2 support for 43228A0 */
429 if (spuravoid == 1) {
430 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
431 0x01100014);
432 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1,
433 0x040C0C06);
434 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
435 0x03140A08);
436 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3,
437 0x00333333);
438 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4,
439 0x202C2820);
440 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
441 0x88888815);
442 } else {
443 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL0,
444 0x11100014);
445 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL1,
446 0x040c0c06);
447 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL2,
448 0x03000a08);
449 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL3,
450 0x00000000);
451 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL4,
452 0x200005c0);
453 bcma_pmu_spuravoid_pll_write(cc, BCMA_CC_PMU_PLL_CTL5,
454 0x88888815);
455 }
456 tmp = 1 << 10;
457 break;
458 default:
459 pr_err("unknown spuravoidance settings for chip 0x%04X, not changing PLL\n",
460 bus->chipinfo.id);
461 break;
462 }
463
464 tmp |= bcma_cc_read32(cc, BCMA_CC_PMU_CTL);
465 bcma_cc_write32(cc, BCMA_CC_PMU_CTL, tmp);
466}
467EXPORT_SYMBOL_GPL(bcma_pmu_spuravoid_pllupdate);