Skip to content

Commit 4b4f5be

Browse files
haukelinvjw
authored andcommitted
bcma: add constants for chip ids
The chip IDs are used all over bcma and no constants where defined. This patch adds the constants and makes bcma use them. Acked-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 00eeedc commit 4b4f5be

5 files changed

Lines changed: 90 additions & 55 deletions

File tree

‎drivers/bcma/driver_chipcommon_pmu.c‎

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ static void bcma_pmu_pll_init(struct bcma_drv_cc *cc)
5959
struct bcma_bus *bus = cc->core->bus;
6060

6161
switch (bus->chipinfo.id) {
62-
case 0x4313:
63-
case 0x4331:
64-
case 43224:
65-
case 43225:
62+
case BCMA_CHIP_ID_BCM4313:
63+
case BCMA_CHIP_ID_BCM4331:
64+
case BCMA_CHIP_ID_BCM43224:
65+
case BCMA_CHIP_ID_BCM43225:
6666
break;
6767
default:
6868
pr_err("PLL init unknown for device 0x%04X\n",
@@ -76,13 +76,13 @@ static void bcma_pmu_resources_init(struct bcma_drv_cc *cc)
7676
u32 min_msk = 0, max_msk = 0;
7777

7878
switch (bus->chipinfo.id) {
79-
case 0x4313:
79+
case BCMA_CHIP_ID_BCM4313:
8080
min_msk = 0x200D;
8181
max_msk = 0xFFFF;
8282
break;
83-
case 0x4331:
84-
case 43224:
85-
case 43225:
83+
case BCMA_CHIP_ID_BCM4331:
84+
case BCMA_CHIP_ID_BCM43224:
85+
case BCMA_CHIP_ID_BCM43225:
8686
break;
8787
default:
8888
pr_err("PMU resource config unknown for device 0x%04X\n",
@@ -101,10 +101,10 @@ void bcma_pmu_swreg_init(struct bcma_drv_cc *cc)
101101
struct bcma_bus *bus = cc->core->bus;
102102

103103
switch (bus->chipinfo.id) {
104-
case 0x4313:
105-
case 0x4331:
106-
case 43224:
107-
case 43225:
104+
case BCMA_CHIP_ID_BCM4313:
105+
case BCMA_CHIP_ID_BCM4331:
106+
case BCMA_CHIP_ID_BCM43224:
107+
case BCMA_CHIP_ID_BCM43225:
108108
break;
109109
default:
110110
pr_err("PMU switch/regulators init unknown for device "
@@ -138,15 +138,15 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
138138
struct bcma_bus *bus = cc->core->bus;
139139

140140
switch (bus->chipinfo.id) {
141-
case 0x4313:
141+
case BCMA_CHIP_ID_BCM4313:
142142
bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7);
143143
break;
144-
case 0x4331:
145-
case 43431:
144+
case BCMA_CHIP_ID_BCM4331:
145+
case BCMA_CHIP_ID_BCM43431:
146146
/* Ext PA lines must be enabled for tx on BCM4331 */
147147
bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true);
148148
break;
149-
case 43224:
149+
case BCMA_CHIP_ID_BCM43224:
150150
if (bus->chipinfo.rev == 0) {
151151
pr_err("Workarounds for 43224 rev 0 not fully "
152152
"implemented\n");
@@ -155,7 +155,7 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
155155
bcma_chipco_chipctl_maskset(cc, 0, ~0, 0xF0);
156156
}
157157
break;
158-
case 43225:
158+
case BCMA_CHIP_ID_BCM43225:
159159
break;
160160
default:
161161
pr_err("Workarounds unknown for device 0x%04X\n",
@@ -194,17 +194,17 @@ u32 bcma_pmu_alp_clock(struct bcma_drv_cc *cc)
194194
struct bcma_bus *bus = cc->core->bus;
195195

196196
switch (bus->chipinfo.id) {
197-
case 0x4716:
198-
case 0x4748:
199-
case 47162:
200-
case 0x4313:
201-
case 0x5357:
202-
case 0x4749:
203-
case 53572:
197+
case BCMA_CHIP_ID_BCM4716:
198+
case BCMA_CHIP_ID_BCM4748:
199+
case BCMA_CHIP_ID_BCM47162:
200+
case BCMA_CHIP_ID_BCM4313:
201+
case BCMA_CHIP_ID_BCM5357:
202+
case BCMA_CHIP_ID_BCM4749:
203+
case BCMA_CHIP_ID_BCM53572:
204204
/* always 20Mhz */
205205
return 20000 * 1000;
206-
case 0x5356:
207-
case 0x5300:
206+
case BCMA_CHIP_ID_BCM5356:
207+
case BCMA_CHIP_ID_BCM4706:
208208
/* always 25Mhz */
209209
return 25000 * 1000;
210210
default:
@@ -227,7 +227,8 @@ static u32 bcma_pmu_clock(struct bcma_drv_cc *cc, u32 pll0, u32 m)
227227

228228
BUG_ON(!m || m > 4);
229229

230-
if (bus->chipinfo.id == 0x5357 || bus->chipinfo.id == 0x4749) {
230+
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 ||
231+
bus->chipinfo.id == BCMA_CHIP_ID_BCM4749) {
231232
/* Detect failure in clock setting */
232233
tmp = bcma_cc_read32(cc, BCMA_CC_CHIPSTAT);
233234
if (tmp & 0x40000)
@@ -259,22 +260,22 @@ u32 bcma_pmu_get_clockcontrol(struct bcma_drv_cc *cc)
259260
struct bcma_bus *bus = cc->core->bus;
260261

261262
switch (bus->chipinfo.id) {
262-
case 0x4716:
263-
case 0x4748:
264-
case 47162:
263+
case BCMA_CHIP_ID_BCM4716:
264+
case BCMA_CHIP_ID_BCM4748:
265+
case BCMA_CHIP_ID_BCM47162:
265266
return bcma_pmu_clock(cc, BCMA_CC_PMU4716_MAINPLL_PLL0,
266267
BCMA_CC_PMU5_MAINPLL_SSB);
267-
case 0x5356:
268+
case BCMA_CHIP_ID_BCM5356:
268269
return bcma_pmu_clock(cc, BCMA_CC_PMU5356_MAINPLL_PLL0,
269270
BCMA_CC_PMU5_MAINPLL_SSB);
270-
case 0x5357:
271-
case 0x4749:
271+
case BCMA_CHIP_ID_BCM5357:
272+
case BCMA_CHIP_ID_BCM4749:
272273
return bcma_pmu_clock(cc, BCMA_CC_PMU5357_MAINPLL_PLL0,
273274
BCMA_CC_PMU5_MAINPLL_SSB);
274-
case 0x5300:
275+
case BCMA_CHIP_ID_BCM4706:
275276
return bcma_pmu_clock(cc, BCMA_CC_PMU4706_MAINPLL_PLL0,
276277
BCMA_CC_PMU5_MAINPLL_SSB);
277-
case 53572:
278+
case BCMA_CHIP_ID_BCM53572:
278279
return 75000000;
279280
default:
280281
pr_warn("No backplane clock specified for %04X device, "
@@ -289,25 +290,25 @@ u32 bcma_pmu_get_clockcpu(struct bcma_drv_cc *cc)
289290
{
290291
struct bcma_bus *bus = cc->core->bus;
291292

292-
if (bus->chipinfo.id == 53572)
293+
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572)
293294
return 300000000;
294295

295296
if (cc->pmu.rev >= 5) {
296297
u32 pll;
297298
switch (bus->chipinfo.id) {
298-
case 0x5356:
299+
case BCMA_CHIP_ID_BCM5356:
299300
pll = BCMA_CC_PMU5356_MAINPLL_PLL0;
300301
break;
301-
case 0x5357:
302-
case 0x4749:
302+
case BCMA_CHIP_ID_BCM5357:
303+
case BCMA_CHIP_ID_BCM4749:
303304
pll = BCMA_CC_PMU5357_MAINPLL_PLL0;
304305
break;
305306
default:
306307
pll = BCMA_CC_PMU4716_MAINPLL_PLL0;
307308
break;
308309
}
309310

310-
/* TODO: if (bus->chipinfo.id == 0x5300)
311+
/* TODO: if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706)
311312
return si_4706_pmu_clock(sih, osh, cc, PMU4706_MAINPLL_PLL0, PMU5_MAINPLL_CPU); */
312313
return bcma_pmu_clock(cc, pll, BCMA_CC_PMU5_MAINPLL_CPU);
313314
}

‎drivers/bcma/driver_mips.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
/* The 47162a0 hangs when reading MIPS DMP registers registers */
2323
static inline bool bcma_core_mips_bcm47162a0_quirk(struct bcma_device *dev)
2424
{
25-
return dev->bus->chipinfo.id == 47162 && dev->bus->chipinfo.rev == 0 &&
26-
dev->id.id == BCMA_CORE_MIPS_74K;
25+
return dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM47162 &&
26+
dev->bus->chipinfo.rev == 0 && dev->id.id == BCMA_CORE_MIPS_74K;
2727
}
2828

2929
/* The 5357b0 hangs when reading USB20H DMP registers */
3030
static inline bool bcma_core_mips_bcm5357b0_quirk(struct bcma_device *dev)
3131
{
32-
return (dev->bus->chipinfo.id == 0x5357 ||
33-
dev->bus->chipinfo.id == 0x4749) &&
32+
return (dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 ||
33+
dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM4749) &&
3434
dev->bus->chipinfo.pkg == 11 &&
3535
dev->id.id == BCMA_CORE_USB20_HOST;
3636
}

‎drivers/bcma/driver_pci_host.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ static int bcma_extpci_write_config(struct bcma_drv_pci *pc, unsigned int dev,
215215
} else {
216216
writel(val, mmio);
217217

218-
if (chipid == 0x4716 || chipid == 0x4748)
218+
if (chipid == BCMA_CHIP_ID_BCM4716 ||
219+
chipid == BCMA_CHIP_ID_BCM4748)
219220
readl(mmio);
220221
}
221222

@@ -434,13 +435,14 @@ void __devinit bcma_core_pci_hostmode_init(struct bcma_drv_pci *pc)
434435
* as mips can't generate 64-bit address on the
435436
* backplane.
436437
*/
437-
if (bus->chipinfo.id == 0x4716 || bus->chipinfo.id == 0x4748) {
438+
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4716 ||
439+
bus->chipinfo.id == BCMA_CHIP_ID_BCM4748) {
438440
pc_host->mem_resource.start = BCMA_SOC_PCI_MEM;
439441
pc_host->mem_resource.end = BCMA_SOC_PCI_MEM +
440442
BCMA_SOC_PCI_MEM_SZ - 1;
441443
pcicore_write32(pc, BCMA_CORE_PCI_SBTOPCI0,
442444
BCMA_CORE_PCI_SBTOPCI_MEM | BCMA_SOC_PCI_MEM);
443-
} else if (bus->chipinfo.id == 0x5300) {
445+
} else if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
444446
tmp = BCMA_CORE_PCI_SBTOPCI_MEM;
445447
tmp |= BCMA_CORE_PCI_SBTOPCI_PREF;
446448
tmp |= BCMA_CORE_PCI_SBTOPCI_BURST;

‎drivers/bcma/sprom.c‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,11 @@ static bool bcma_sprom_ext_available(struct bcma_bus *bus)
468468
/* older chipcommon revisions use chip status register */
469469
chip_status = bcma_read32(bus->drv_cc.core, BCMA_CC_CHIPSTAT);
470470
switch (bus->chipinfo.id) {
471-
case 0x4313:
471+
case BCMA_CHIP_ID_BCM4313:
472472
present_mask = BCMA_CC_CHIPST_4313_SPROM_PRESENT;
473473
break;
474474

475-
case 0x4331:
475+
case BCMA_CHIP_ID_BCM4331:
476476
present_mask = BCMA_CC_CHIPST_4331_SPROM_PRESENT;
477477
break;
478478

@@ -494,16 +494,16 @@ static bool bcma_sprom_onchip_available(struct bcma_bus *bus)
494494

495495
chip_status = bcma_read32(bus->drv_cc.core, BCMA_CC_CHIPSTAT);
496496
switch (bus->chipinfo.id) {
497-
case 0x4313:
497+
case BCMA_CHIP_ID_BCM4313:
498498
present = chip_status & BCMA_CC_CHIPST_4313_OTP_PRESENT;
499499
break;
500500

501-
case 0x4331:
501+
case BCMA_CHIP_ID_BCM4331:
502502
present = chip_status & BCMA_CC_CHIPST_4331_OTP_PRESENT;
503503
break;
504504

505-
case 43224:
506-
case 43225:
505+
case BCMA_CHIP_ID_BCM43224:
506+
case BCMA_CHIP_ID_BCM43225:
507507
/* for these chips OTP is always available */
508508
present = true;
509509
break;
@@ -579,13 +579,15 @@ int bcma_sprom_get(struct bcma_bus *bus)
579579
if (!sprom)
580580
return -ENOMEM;
581581

582-
if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
582+
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 ||
583+
bus->chipinfo.id == BCMA_CHIP_ID_BCM43431)
583584
bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false);
584585

585586
pr_debug("SPROM offset 0x%x\n", offset);
586587
bcma_sprom_read(bus, offset, sprom);
587588

588-
if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
589+
if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 ||
590+
bus->chipinfo.id == BCMA_CHIP_ID_BCM43431)
589591
bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true);
590592

591593
err = bcma_sprom_valid(sprom);

‎include/linux/bcma/bcma.h‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,36 @@ struct bcma_host_ops {
137137

138138
#define BCMA_MAX_NR_CORES 16
139139

140+
/* Chip IDs of PCIe devices */
141+
#define BCMA_CHIP_ID_BCM4313 0x4313
142+
#define BCMA_CHIP_ID_BCM43224 43224
143+
#define BCMA_PKG_ID_BCM43224_FAB_CSM 0x8
144+
#define BCMA_PKG_ID_BCM43224_FAB_SMIC 0xa
145+
#define BCMA_CHIP_ID_BCM43225 43225
146+
#define BCMA_CHIP_ID_BCM43227 43227
147+
#define BCMA_CHIP_ID_BCM43228 43228
148+
#define BCMA_CHIP_ID_BCM43421 43421
149+
#define BCMA_CHIP_ID_BCM43428 43428
150+
#define BCMA_CHIP_ID_BCM43431 43431
151+
#define BCMA_CHIP_ID_BCM43460 43460
152+
#define BCMA_CHIP_ID_BCM4331 0x4331
153+
#define BCMA_CHIP_ID_BCM6362 0x6362
154+
#define BCMA_CHIP_ID_BCM4360 0x4360
155+
#define BCMA_CHIP_ID_BCM4352 0x4352
156+
157+
/* Chip IDs of SoCs */
158+
#define BCMA_CHIP_ID_BCM4706 0x5300
159+
#define BCMA_CHIP_ID_BCM4716 0x4716
160+
#define BCMA_PKG_ID_BCM4716 8
161+
#define BCMA_PKG_ID_BCM4717 9
162+
#define BCMA_PKG_ID_BCM4718 10
163+
#define BCMA_CHIP_ID_BCM47162 47162
164+
#define BCMA_CHIP_ID_BCM4748 0x4748
165+
#define BCMA_CHIP_ID_BCM4749 0x4749
166+
#define BCMA_CHIP_ID_BCM5356 0x5356
167+
#define BCMA_CHIP_ID_BCM5357 0x5357
168+
#define BCMA_CHIP_ID_BCM53572 53572
169+
140170
struct bcma_device {
141171
struct bcma_bus *bus;
142172
struct bcma_device_id id;

0 commit comments

Comments
 (0)