1 --- a/drivers/ssb/driver_chipcommon.c
2 +++ b/drivers/ssb/driver_chipcommon.c
3 @@ -46,40 +46,66 @@ void ssb_chipco_set_clockmode(struct ssb
8 + /* We support SLOW only on 6..9 */
9 + if (ccdev->id.revision >= 10 && mode == SSB_CLKMODE_SLOW)
10 + mode = SSB_CLKMODE_DYNAMIC;
12 + if (cc->capabilities & SSB_CHIPCO_CAP_PMU)
13 + return; /* PMU controls clockmode, separated function needed */
14 + SSB_WARN_ON(ccdev->id.revision >= 20);
16 /* chipcommon cores prior to rev6 don't support dynamic clock control */
17 if (ccdev->id.revision < 6)
19 - /* chipcommon cores rev10 are a whole new ball game */
21 + /* ChipCommon cores rev10+ need testing */
22 if (ccdev->id.revision >= 10)
25 if (!(cc->capabilities & SSB_CHIPCO_CAP_PCTL))
29 - case SSB_CLKMODE_SLOW:
30 + case SSB_CLKMODE_SLOW: /* For revs 6..9 only */
31 tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
32 tmp |= SSB_CHIPCO_SLOWCLKCTL_FSLOW;
33 chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
35 case SSB_CLKMODE_FAST:
36 - ssb_pci_xtal(bus, SSB_GPIO_XTAL, 1); /* Force crystal on */
37 - tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
38 - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
39 - tmp |= SSB_CHIPCO_SLOWCLKCTL_IPLL;
40 - chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
41 + if (ccdev->id.revision < 10) {
42 + ssb_pci_xtal(bus, SSB_GPIO_XTAL, 1); /* Force crystal on */
43 + tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
44 + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
45 + tmp |= SSB_CHIPCO_SLOWCLKCTL_IPLL;
46 + chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
48 + chipco_write32(cc, SSB_CHIPCO_SYSCLKCTL,
49 + (chipco_read32(cc, SSB_CHIPCO_SYSCLKCTL) |
50 + SSB_CHIPCO_SYSCLKCTL_FORCEHT));
51 + /* udelay(150); TODO: not available in early init */
54 case SSB_CLKMODE_DYNAMIC:
55 - tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
56 - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
57 - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_IPLL;
58 - tmp &= ~SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
59 - if ((tmp & SSB_CHIPCO_SLOWCLKCTL_SRC) != SSB_CHIPCO_SLOWCLKCTL_SRC_XTAL)
60 - tmp |= SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
61 - chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
63 - /* for dynamic control, we have to release our xtal_pu "force on" */
64 - if (tmp & SSB_CHIPCO_SLOWCLKCTL_ENXTAL)
65 - ssb_pci_xtal(bus, SSB_GPIO_XTAL, 0);
66 + if (ccdev->id.revision < 10) {
67 + tmp = chipco_read32(cc, SSB_CHIPCO_SLOWCLKCTL);
68 + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_FSLOW;
69 + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_IPLL;
70 + tmp &= ~SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
71 + if ((tmp & SSB_CHIPCO_SLOWCLKCTL_SRC) !=
72 + SSB_CHIPCO_SLOWCLKCTL_SRC_XTAL)
73 + tmp |= SSB_CHIPCO_SLOWCLKCTL_ENXTAL;
74 + chipco_write32(cc, SSB_CHIPCO_SLOWCLKCTL, tmp);
76 + /* For dynamic control, we have to release our xtal_pu
78 + if (tmp & SSB_CHIPCO_SLOWCLKCTL_ENXTAL)
79 + ssb_pci_xtal(bus, SSB_GPIO_XTAL, 0);
81 + chipco_write32(cc, SSB_CHIPCO_SYSCLKCTL,
82 + (chipco_read32(cc, SSB_CHIPCO_SYSCLKCTL) &
83 + ~SSB_CHIPCO_SYSCLKCTL_FORCEHT));
88 @@ -209,6 +235,24 @@ static void chipco_powercontrol_init(str
92 +/* http://bcm-v4.sipsolutions.net/802.11/PmuFastPwrupDelay */
93 +static u16 pmu_fast_powerup_delay(struct ssb_chipcommon *cc)
95 + struct ssb_bus *bus = cc->dev->bus;
97 + switch (bus->chip_id) {
109 +/* http://bcm-v4.sipsolutions.net/802.11/ClkctlFastPwrupDelay */
110 static void calc_fast_powerup_delay(struct ssb_chipcommon *cc)
112 struct ssb_bus *bus = cc->dev->bus;
113 @@ -218,6 +262,12 @@ static void calc_fast_powerup_delay(stru
115 if (bus->bustype != SSB_BUSTYPE_PCI)
118 + if (cc->capabilities & SSB_CHIPCO_CAP_PMU) {
119 + cc->fast_pwrup_delay = pmu_fast_powerup_delay(cc);
123 if (!(cc->capabilities & SSB_CHIPCO_CAP_PCTL))
126 @@ -236,6 +286,12 @@ void ssb_chipcommon_init(struct ssb_chip
127 if (cc->dev->id.revision >= 11)
128 cc->status = chipco_read32(cc, SSB_CHIPCO_CHIPSTAT);
129 ssb_dprintk(KERN_INFO PFX "chipcommon status is 0x%x\n", cc->status);
131 + if (cc->dev->id.revision >= 20) {
132 + chipco_write32(cc, SSB_CHIPCO_GPIOPULLUP, 0);
133 + chipco_write32(cc, SSB_CHIPCO_GPIOPULLDOWN, 0);
137 chipco_powercontrol_init(cc);
138 ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST);
139 @@ -373,6 +429,7 @@ u32 ssb_chipco_gpio_control(struct ssb_c
141 return chipco_write32_masked(cc, SSB_CHIPCO_GPIOCTL, mask, value);
143 +EXPORT_SYMBOL(ssb_chipco_gpio_control);
145 u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value)
147 --- a/drivers/ssb/driver_chipcommon_pmu.c
148 +++ b/drivers/ssb/driver_chipcommon_pmu.c
149 @@ -332,6 +332,12 @@ static void ssb_pmu_pll_init(struct ssb_
151 ssb_pmu0_pllinit_r0(cc, crystalfreq);
154 + if (cc->pmu.rev == 2) {
155 + chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, 0x0000000A);
156 + chipco_write32(cc, SSB_CHIPCO_PLLCTL_DATA, 0x380005C0);
160 ssb_printk(KERN_ERR PFX
161 "ERROR: PLL init unknown for device %04X\n",
162 @@ -411,12 +417,15 @@ static void ssb_pmu_resources_init(struc
163 u32 min_msk = 0, max_msk = 0;
165 const struct pmu_res_updown_tab_entry *updown_tab = NULL;
166 - unsigned int updown_tab_size;
167 + unsigned int updown_tab_size = 0;
168 const struct pmu_res_depend_tab_entry *depend_tab = NULL;
169 - unsigned int depend_tab_size;
170 + unsigned int depend_tab_size = 0;
172 switch (bus->chip_id) {
177 /* We keep the default settings:
180 @@ -495,9 +504,9 @@ static void ssb_pmu_resources_init(struc
181 chipco_write32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, max_msk);
184 +/* http://bcm-v4.sipsolutions.net/802.11/SSB/PmuInit */
185 void ssb_pmu_init(struct ssb_chipcommon *cc)
187 - struct ssb_bus *bus = cc->dev->bus;
190 if (!(cc->capabilities & SSB_CHIPCO_CAP_PMU))
191 @@ -509,15 +518,12 @@ void ssb_pmu_init(struct ssb_chipcommon
192 ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n",
193 cc->pmu.rev, pmucap);
195 - if (cc->pmu.rev >= 1) {
196 - if ((bus->chip_id == 0x4325) && (bus->chip_rev < 2)) {
197 - chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
198 - ~SSB_CHIPCO_PMU_CTL_NOILPONW);
200 - chipco_set32(cc, SSB_CHIPCO_PMU_CTL,
201 - SSB_CHIPCO_PMU_CTL_NOILPONW);
204 + if (cc->pmu.rev == 1)
205 + chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
206 + ~SSB_CHIPCO_PMU_CTL_NOILPONW);
208 + chipco_set32(cc, SSB_CHIPCO_PMU_CTL,
209 + SSB_CHIPCO_PMU_CTL_NOILPONW);
210 ssb_pmu_pll_init(cc);
211 ssb_pmu_resources_init(cc);
213 --- a/drivers/ssb/driver_gige.c
214 +++ b/drivers/ssb/driver_gige.c
216 #include <linux/ssb/ssb_driver_gige.h>
217 #include <linux/pci.h>
218 #include <linux/pci_regs.h>
219 +#include <linux/slab.h>
223 @@ -105,8 +106,9 @@ void gige_pcicfg_write32(struct ssb_gige
224 gige_write32(dev, SSB_GIGE_PCICFG + offset, value);
227 -static int ssb_gige_pci_read_config(struct pci_bus *bus, unsigned int devfn,
228 - int reg, int size, u32 *val)
229 +static int __devinit ssb_gige_pci_read_config(struct pci_bus *bus,
230 + unsigned int devfn, int reg,
231 + int size, u32 *val)
233 struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
235 @@ -135,8 +137,9 @@ static int ssb_gige_pci_read_config(stru
236 return PCIBIOS_SUCCESSFUL;
239 -static int ssb_gige_pci_write_config(struct pci_bus *bus, unsigned int devfn,
240 - int reg, int size, u32 val)
241 +static int __devinit ssb_gige_pci_write_config(struct pci_bus *bus,
242 + unsigned int devfn, int reg,
245 struct ssb_gige *dev = container_of(bus->ops, struct ssb_gige, pci_ops);
247 @@ -165,7 +168,8 @@ static int ssb_gige_pci_write_config(str
248 return PCIBIOS_SUCCESSFUL;
251 -static int ssb_gige_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
252 +static int __devinit ssb_gige_probe(struct ssb_device *sdev,
253 + const struct ssb_device_id *id)
255 struct ssb_gige *dev;
256 u32 base, tmslow, tmshigh;
257 --- a/drivers/ssb/driver_mipscore.c
258 +++ b/drivers/ssb/driver_mipscore.c
259 @@ -270,7 +270,6 @@ void ssb_mipscore_init(struct ssb_mipsco
265 case SSB_DEV_ETHERNET:
266 case SSB_DEV_ETHERNET_GBIT:
267 @@ -281,6 +280,10 @@ void ssb_mipscore_init(struct ssb_mipsco
272 + case SSB_DEV_EXTIF:
277 ssb_dprintk(KERN_INFO PFX "after irq reconfiguration\n");
278 --- a/drivers/ssb/driver_pcicore.c
279 +++ b/drivers/ssb/driver_pcicore.c
282 #include "ssb_private.h"
284 +static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address);
285 +static void ssb_pcie_write(struct ssb_pcicore *pc, u32 address, u32 data);
286 +static u16 ssb_pcie_mdio_read(struct ssb_pcicore *pc, u8 device, u8 address);
287 +static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
288 + u8 address, u16 data);
291 u32 pcicore_read32(struct ssb_pcicore *pc, u16 offset)
292 @@ -246,20 +251,12 @@ static struct pci_controller ssb_pcicore
293 .pci_ops = &ssb_pcicore_pciops,
294 .io_resource = &ssb_pcicore_io_resource,
295 .mem_resource = &ssb_pcicore_mem_resource,
296 - .mem_offset = 0x24000000,
299 -static u32 ssb_pcicore_pcibus_iobase = 0x100;
300 -static u32 ssb_pcicore_pcibus_membase = SSB_PCI_DMA;
302 /* This function is called when doing a pci_enable_device().
303 * We must first check if the device is a device on the PCI-core bridge. */
304 int ssb_pcicore_plat_dev_init(struct pci_dev *d)
306 - struct resource *res;
310 if (d->bus->ops != &ssb_pcicore_pciops) {
311 /* This is not a device on the PCI-core bridge. */
313 @@ -268,27 +265,6 @@ int ssb_pcicore_plat_dev_init(struct pci
314 ssb_printk(KERN_INFO "PCI: Fixing up device %s\n",
317 - /* Fix up resource bases */
318 - for (pos = 0; pos < 6; pos++) {
319 - res = &d->resource[pos];
320 - if (res->flags & IORESOURCE_IO)
321 - base = &ssb_pcicore_pcibus_iobase;
323 - base = &ssb_pcicore_pcibus_membase;
324 - res->flags |= IORESOURCE_PCI_FIXED;
326 - size = res->end - res->start + 1;
327 - if (*base & (size - 1))
328 - *base = (*base + size) & ~(size - 1);
329 - res->start = *base;
330 - res->end = res->start + size - 1;
332 - pci_write_config_dword(d, PCI_BASE_ADDRESS_0 + (pos << 2), res->start);
334 - /* Fix up PCI bridge BAR0 only */
335 - if (d->bus->number == 0 && PCI_SLOT(d->devfn) == 0)
338 /* Fix up interrupt lines */
339 d->irq = ssb_mips_irq(extpci_core->dev) + 2;
340 pci_write_config_byte(d, PCI_INTERRUPT_LINE, d->irq);
341 @@ -338,7 +314,7 @@ int ssb_pcicore_pcibios_map_irq(const st
342 return ssb_mips_irq(extpci_core->dev) + 2;
345 -static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
346 +static void __devinit ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
350 @@ -403,7 +379,7 @@ static void ssb_pcicore_init_hostmode(st
351 register_pci_controller(&ssb_pcicore_controller);
354 -static int pcicore_is_in_hostmode(struct ssb_pcicore *pc)
355 +static int __devinit pcicore_is_in_hostmode(struct ssb_pcicore *pc)
357 struct ssb_bus *bus = pc->dev->bus;
359 @@ -432,25 +408,133 @@ static int pcicore_is_in_hostmode(struct
361 #endif /* CONFIG_SSB_PCICORE_HOSTMODE */
363 +/**************************************************
365 + **************************************************/
367 +static void __devinit ssb_pcicore_fix_sprom_core_index(struct ssb_pcicore *pc)
369 + u16 tmp = pcicore_read16(pc, SSB_PCICORE_SPROM(0));
370 + if (((tmp & 0xF000) >> 12) != pc->dev->core_index) {
372 + tmp |= (pc->dev->core_index << 12);
373 + pcicore_write16(pc, SSB_PCICORE_SPROM(0), tmp);
377 +static u8 ssb_pcicore_polarity_workaround(struct ssb_pcicore *pc)
379 + return (ssb_pcie_read(pc, 0x204) & 0x10) ? 0xC0 : 0x80;
382 +static void ssb_pcicore_serdes_workaround(struct ssb_pcicore *pc)
384 + const u8 serdes_pll_device = 0x1D;
385 + const u8 serdes_rx_device = 0x1F;
388 + ssb_pcie_mdio_write(pc, serdes_rx_device, 1 /* Control */,
389 + ssb_pcicore_polarity_workaround(pc));
390 + tmp = ssb_pcie_mdio_read(pc, serdes_pll_device, 1 /* Control */);
392 + ssb_pcie_mdio_write(pc, serdes_pll_device, 1, tmp & ~0x4000);
395 +static void ssb_pcicore_pci_setup_workarounds(struct ssb_pcicore *pc)
397 + struct ssb_device *pdev = pc->dev;
398 + struct ssb_bus *bus = pdev->bus;
401 + tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
402 + tmp |= SSB_PCICORE_SBTOPCI_PREF;
403 + tmp |= SSB_PCICORE_SBTOPCI_BURST;
404 + pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
406 + if (pdev->id.revision < 5) {
407 + tmp = ssb_read32(pdev, SSB_IMCFGLO);
408 + tmp &= ~SSB_IMCFGLO_SERTO;
410 + tmp &= ~SSB_IMCFGLO_REQTO;
411 + tmp |= 3 << SSB_IMCFGLO_REQTO_SHIFT;
412 + ssb_write32(pdev, SSB_IMCFGLO, tmp);
413 + ssb_commit_settings(bus);
414 + } else if (pdev->id.revision >= 11) {
415 + tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
416 + tmp |= SSB_PCICORE_SBTOPCI_MRM;
417 + pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
421 +static void ssb_pcicore_pcie_setup_workarounds(struct ssb_pcicore *pc)
424 + u8 rev = pc->dev->id.revision;
426 + if (rev == 0 || rev == 1) {
427 + /* TLP Workaround register. */
428 + tmp = ssb_pcie_read(pc, 0x4);
430 + ssb_pcie_write(pc, 0x4, tmp);
433 + /* DLLP Link Control register. */
434 + tmp = ssb_pcie_read(pc, 0x100);
436 + ssb_pcie_write(pc, 0x100, tmp);
440 + const u8 serdes_rx_device = 0x1F;
442 + ssb_pcie_mdio_write(pc, serdes_rx_device,
443 + 2 /* Timer */, 0x8128);
444 + ssb_pcie_mdio_write(pc, serdes_rx_device,
445 + 6 /* CDR */, 0x0100);
446 + ssb_pcie_mdio_write(pc, serdes_rx_device,
447 + 7 /* CDR BW */, 0x1466);
448 + } else if (rev == 3 || rev == 4 || rev == 5) {
449 + /* TODO: DLLP Power Management Threshold */
450 + ssb_pcicore_serdes_workaround(pc);
452 + } else if (rev == 7) {
453 + /* TODO: No PLL down */
457 + /* Miscellaneous Configuration Fixup */
458 + tmp = pcicore_read16(pc, SSB_PCICORE_SPROM(5));
459 + if (!(tmp & 0x8000))
460 + pcicore_write16(pc, SSB_PCICORE_SPROM(5),
465 /**************************************************
466 * Generic and Clientmode operation code.
467 **************************************************/
469 -static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
470 +static void __devinit ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
472 + ssb_pcicore_fix_sprom_core_index(pc);
474 /* Disable PCI interrupts. */
475 ssb_write32(pc->dev, SSB_INTVEC, 0);
477 + /* Additional PCIe always once-executed workarounds */
478 + if (pc->dev->id.coreid == SSB_DEV_PCIE) {
479 + ssb_pcicore_serdes_workaround(pc);
481 + /* TODO: Clock Request Update */
485 -void ssb_pcicore_init(struct ssb_pcicore *pc)
486 +void __devinit ssb_pcicore_init(struct ssb_pcicore *pc)
488 struct ssb_device *dev = pc->dev;
489 - struct ssb_bus *bus;
494 if (!ssb_device_is_enabled(dev))
495 ssb_device_enable(dev, 0);
497 @@ -475,58 +559,104 @@ static void ssb_pcie_write(struct ssb_pc
498 pcicore_write32(pc, 0x134, data);
501 -static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
502 - u8 address, u16 data)
503 +static void ssb_pcie_mdio_set_phy(struct ssb_pcicore *pc, u8 phy)
505 const u16 mdio_control = 0x128;
506 const u16 mdio_data = 0x12C;
510 + v = (1 << 30); /* Start of Transaction */
511 + v |= (1 << 28); /* Write Transaction */
512 + v |= (1 << 17); /* Turnaround */
515 + pcicore_write32(pc, mdio_data, v);
518 + for (i = 0; i < 200; i++) {
519 + v = pcicore_read32(pc, mdio_control);
520 + if (v & 0x100 /* Trans complete */)
526 +static u16 ssb_pcie_mdio_read(struct ssb_pcicore *pc, u8 device, u8 address)
528 + const u16 mdio_control = 0x128;
529 + const u16 mdio_data = 0x12C;
530 + int max_retries = 10;
535 v = 0x80; /* Enable Preamble Sequence */
536 v |= 0x2; /* MDIO Clock Divisor */
537 pcicore_write32(pc, mdio_control, v);
539 + if (pc->dev->id.revision >= 10) {
541 + ssb_pcie_mdio_set_phy(pc, device);
544 v = (1 << 30); /* Start of Transaction */
545 - v |= (1 << 28); /* Write Transaction */
546 + v |= (1 << 29); /* Read Transaction */
547 v |= (1 << 17); /* Turnaround */
548 - v |= (u32)device << 22;
549 + if (pc->dev->id.revision < 10)
550 + v |= (u32)device << 22;
551 v |= (u32)address << 18;
553 pcicore_write32(pc, mdio_data, v);
554 /* Wait for the device to complete the transaction */
556 - for (i = 0; i < 10; i++) {
557 + for (i = 0; i < max_retries; i++) {
558 v = pcicore_read32(pc, mdio_control);
559 - if (v & 0x100 /* Trans complete */)
560 + if (v & 0x100 /* Trans complete */) {
562 + ret = pcicore_read32(pc, mdio_data);
567 pcicore_write32(pc, mdio_control, 0);
571 -static void ssb_broadcast_value(struct ssb_device *dev,
572 - u32 address, u32 data)
573 +static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
574 + u8 address, u16 data)
576 - /* This is used for both, PCI and ChipCommon core, so be careful. */
577 - BUILD_BUG_ON(SSB_PCICORE_BCAST_ADDR != SSB_CHIPCO_BCAST_ADDR);
578 - BUILD_BUG_ON(SSB_PCICORE_BCAST_DATA != SSB_CHIPCO_BCAST_DATA);
579 + const u16 mdio_control = 0x128;
580 + const u16 mdio_data = 0x12C;
581 + int max_retries = 10;
585 - ssb_write32(dev, SSB_PCICORE_BCAST_ADDR, address);
586 - ssb_read32(dev, SSB_PCICORE_BCAST_ADDR); /* flush */
587 - ssb_write32(dev, SSB_PCICORE_BCAST_DATA, data);
588 - ssb_read32(dev, SSB_PCICORE_BCAST_DATA); /* flush */
590 + v = 0x80; /* Enable Preamble Sequence */
591 + v |= 0x2; /* MDIO Clock Divisor */
592 + pcicore_write32(pc, mdio_control, v);
594 -static void ssb_commit_settings(struct ssb_bus *bus)
596 - struct ssb_device *dev;
597 + if (pc->dev->id.revision >= 10) {
599 + ssb_pcie_mdio_set_phy(pc, device);
602 - dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev;
605 - /* This forces an update of the cached registers. */
606 - ssb_broadcast_value(dev, 0xFD8, 0);
607 + v = (1 << 30); /* Start of Transaction */
608 + v |= (1 << 28); /* Write Transaction */
609 + v |= (1 << 17); /* Turnaround */
610 + if (pc->dev->id.revision < 10)
611 + v |= (u32)device << 22;
612 + v |= (u32)address << 18;
614 + pcicore_write32(pc, mdio_data, v);
615 + /* Wait for the device to complete the transaction */
617 + for (i = 0; i < max_retries; i++) {
618 + v = pcicore_read32(pc, mdio_control);
619 + if (v & 0x100 /* Trans complete */)
623 + pcicore_write32(pc, mdio_control, 0);
626 int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
627 @@ -551,13 +681,13 @@ int ssb_pcicore_dev_irqvecs_enable(struc
628 might_sleep_if(pdev->id.coreid != SSB_DEV_PCI);
630 /* Enable interrupts for this device. */
631 - if (bus->host_pci &&
632 - ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE))) {
633 + if ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE)) {
636 /* Calculate the "coremask" for the device. */
637 coremask = (1 << dev->core_index);
639 + SSB_WARN_ON(bus->bustype != SSB_BUSTYPE_PCI);
640 err = pci_read_config_dword(bus->host_pci, SSB_PCI_IRQMASK, &tmp);
643 @@ -579,48 +709,10 @@ int ssb_pcicore_dev_irqvecs_enable(struc
646 if (pdev->id.coreid == SSB_DEV_PCI) {
647 - tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
648 - tmp |= SSB_PCICORE_SBTOPCI_PREF;
649 - tmp |= SSB_PCICORE_SBTOPCI_BURST;
650 - pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
652 - if (pdev->id.revision < 5) {
653 - tmp = ssb_read32(pdev, SSB_IMCFGLO);
654 - tmp &= ~SSB_IMCFGLO_SERTO;
656 - tmp &= ~SSB_IMCFGLO_REQTO;
657 - tmp |= 3 << SSB_IMCFGLO_REQTO_SHIFT;
658 - ssb_write32(pdev, SSB_IMCFGLO, tmp);
659 - ssb_commit_settings(bus);
660 - } else if (pdev->id.revision >= 11) {
661 - tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
662 - tmp |= SSB_PCICORE_SBTOPCI_MRM;
663 - pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
665 + ssb_pcicore_pci_setup_workarounds(pc);
667 WARN_ON(pdev->id.coreid != SSB_DEV_PCIE);
668 - //TODO: Better make defines for all these magic PCIE values.
669 - if ((pdev->id.revision == 0) || (pdev->id.revision == 1)) {
670 - /* TLP Workaround register. */
671 - tmp = ssb_pcie_read(pc, 0x4);
673 - ssb_pcie_write(pc, 0x4, tmp);
675 - if (pdev->id.revision == 0) {
676 - const u8 serdes_rx_device = 0x1F;
678 - ssb_pcie_mdio_write(pc, serdes_rx_device,
679 - 2 /* Timer */, 0x8128);
680 - ssb_pcie_mdio_write(pc, serdes_rx_device,
681 - 6 /* CDR */, 0x0100);
682 - ssb_pcie_mdio_write(pc, serdes_rx_device,
683 - 7 /* CDR BW */, 0x1466);
684 - } else if (pdev->id.revision == 1) {
685 - /* DLLP Link Control register. */
686 - tmp = ssb_pcie_read(pc, 0x100);
688 - ssb_pcie_write(pc, 0x100, tmp);
690 + ssb_pcicore_pcie_setup_workarounds(pc);
694 --- a/drivers/ssb/main.c
695 +++ b/drivers/ssb/main.c
697 #include <linux/dma-mapping.h>
698 #include <linux/pci.h>
699 #include <linux/mmc/sdio_func.h>
700 +#include <linux/slab.h>
702 #include <pcmcia/cs_types.h>
703 #include <pcmcia/cs.h>
704 @@ -140,6 +141,19 @@ static void ssb_device_put(struct ssb_de
705 put_device(dev->dev);
708 +static inline struct ssb_driver *ssb_driver_get(struct ssb_driver *drv)
711 + get_driver(&drv->drv);
715 +static inline void ssb_driver_put(struct ssb_driver *drv)
718 + put_driver(&drv->drv);
721 static int ssb_device_resume(struct device *dev)
723 struct ssb_device *ssb_dev = dev_to_ssb_dev(dev);
724 @@ -210,90 +224,81 @@ int ssb_bus_suspend(struct ssb_bus *bus)
725 EXPORT_SYMBOL(ssb_bus_suspend);
727 #ifdef CONFIG_SSB_SPROM
728 -int ssb_devices_freeze(struct ssb_bus *bus)
729 +/** ssb_devices_freeze - Freeze all devices on the bus.
731 + * After freezing no device driver will be handling a device
732 + * on this bus anymore. ssb_devices_thaw() must be called after
733 + * a successful freeze to reactivate the devices.
736 + * @ctx: Context structure. Pass this to ssb_devices_thaw().
738 +int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx)
740 - struct ssb_device *dev;
741 - struct ssb_driver *drv;
744 - pm_message_t state = PMSG_FREEZE;
745 + struct ssb_device *sdev;
746 + struct ssb_driver *sdrv;
749 + memset(ctx, 0, sizeof(*ctx));
751 + SSB_WARN_ON(bus->nr_devices > ARRAY_SIZE(ctx->device_frozen));
753 - /* First check that we are capable to freeze all devices. */
754 for (i = 0; i < bus->nr_devices; i++) {
755 - dev = &(bus->devices[i]);
757 - !dev->dev->driver ||
758 - !device_is_registered(dev->dev))
760 - drv = drv_to_ssb_drv(dev->dev->driver);
762 + sdev = ssb_device_get(&bus->devices[i]);
764 + if (!sdev->dev || !sdev->dev->driver ||
765 + !device_is_registered(sdev->dev)) {
766 + ssb_device_put(sdev);
768 - if (!drv->suspend) {
769 - /* Nope, can't suspend this one. */
770 - return -EOPNOTSUPP;
773 - /* Now suspend all devices */
774 - for (i = 0; i < bus->nr_devices; i++) {
775 - dev = &(bus->devices[i]);
777 - !dev->dev->driver ||
778 - !device_is_registered(dev->dev))
780 - drv = drv_to_ssb_drv(dev->dev->driver);
782 + sdrv = ssb_driver_get(drv_to_ssb_drv(sdev->dev->driver));
783 + if (!sdrv || SSB_WARN_ON(!sdrv->remove)) {
784 + ssb_device_put(sdev);
786 - err = drv->suspend(dev, state);
788 - ssb_printk(KERN_ERR PFX "Failed to freeze device %s\n",
789 - dev_name(dev->dev));
792 + sdrv->remove(sdev);
793 + ctx->device_frozen[i] = 1;
798 - for (i--; i >= 0; i--) {
799 - dev = &(bus->devices[i]);
801 - !dev->dev->driver ||
802 - !device_is_registered(dev->dev))
804 - drv = drv_to_ssb_drv(dev->dev->driver);
813 -int ssb_devices_thaw(struct ssb_bus *bus)
814 +/** ssb_devices_thaw - Unfreeze all devices on the bus.
816 + * This will re-attach the device drivers and re-init the devices.
818 + * @ctx: The context structure from ssb_devices_freeze()
820 +int ssb_devices_thaw(struct ssb_freeze_context *ctx)
822 - struct ssb_device *dev;
823 - struct ssb_driver *drv;
826 + struct ssb_bus *bus = ctx->bus;
827 + struct ssb_device *sdev;
828 + struct ssb_driver *sdrv;
830 + int err, result = 0;
832 for (i = 0; i < bus->nr_devices; i++) {
833 - dev = &(bus->devices[i]);
835 - !dev->dev->driver ||
836 - !device_is_registered(dev->dev))
837 + if (!ctx->device_frozen[i])
839 - drv = drv_to_ssb_drv(dev->dev->driver);
841 + sdev = &bus->devices[i];
843 + if (SSB_WARN_ON(!sdev->dev || !sdev->dev->driver))
845 - if (SSB_WARN_ON(!drv->resume))
846 + sdrv = drv_to_ssb_drv(sdev->dev->driver);
847 + if (SSB_WARN_ON(!sdrv || !sdrv->probe))
849 - err = drv->resume(dev);
851 + err = sdrv->probe(sdev, &sdev->id);
853 ssb_printk(KERN_ERR PFX "Failed to thaw device %s\n",
854 - dev_name(dev->dev));
855 + dev_name(sdev->dev));
858 + ssb_driver_put(sdrv);
859 + ssb_device_put(sdev);
865 #endif /* CONFIG_SSB_SPROM */
867 @@ -380,6 +385,35 @@ static int ssb_device_uevent(struct devi
868 ssb_dev->id.revision);
871 +#define ssb_config_attr(attrib, field, format_string) \
873 +attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
875 + return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
878 +ssb_config_attr(core_num, core_index, "%u\n")
879 +ssb_config_attr(coreid, id.coreid, "0x%04x\n")
880 +ssb_config_attr(vendor, id.vendor, "0x%04x\n")
881 +ssb_config_attr(revision, id.revision, "%u\n")
882 +ssb_config_attr(irq, irq, "%u\n")
884 +name_show(struct device *dev, struct device_attribute *attr, char *buf)
886 + return sprintf(buf, "%s\n",
887 + ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
890 +static struct device_attribute ssb_device_attrs[] = {
892 + __ATTR_RO(core_num),
895 + __ATTR_RO(revision),
900 static struct bus_type ssb_bustype = {
902 .match = ssb_bus_match,
903 @@ -389,6 +423,7 @@ static struct bus_type ssb_bustype = {
904 .suspend = ssb_device_suspend,
905 .resume = ssb_device_resume,
906 .uevent = ssb_device_uevent,
907 + .dev_attrs = ssb_device_attrs,
910 static void ssb_buses_lock(void)
911 @@ -481,6 +516,7 @@ static int ssb_devices_register(struct s
912 #ifdef CONFIG_SSB_PCIHOST
913 sdev->irq = bus->host_pci->irq;
914 dev->parent = &bus->host_pci->dev;
915 + sdev->dma_dev = dev->parent;
918 case SSB_BUSTYPE_PCMCIA:
919 @@ -490,13 +526,13 @@ static int ssb_devices_register(struct s
922 case SSB_BUSTYPE_SDIO:
923 -#ifdef CONFIG_SSB_SDIO
924 - sdev->irq = bus->host_sdio->dev.irq;
925 +#ifdef CONFIG_SSB_SDIOHOST
926 dev->parent = &bus->host_sdio->dev;
929 case SSB_BUSTYPE_SSB:
930 dev->dma_mask = &dev->coherent_dma_mask;
931 + sdev->dma_dev = dev;
935 @@ -523,7 +559,7 @@ error:
938 /* Needs ssb_buses_lock() */
939 -static int ssb_attach_queued_buses(void)
940 +static int __devinit ssb_attach_queued_buses(void)
942 struct ssb_bus *bus, *n;
944 @@ -734,9 +770,9 @@ out:
948 -static int ssb_bus_register(struct ssb_bus *bus,
949 - ssb_invariants_func_t get_invariants,
950 - unsigned long baseaddr)
951 +static int __devinit ssb_bus_register(struct ssb_bus *bus,
952 + ssb_invariants_func_t get_invariants,
953 + unsigned long baseaddr)
957 @@ -817,8 +853,8 @@ err_disable_xtal:
960 #ifdef CONFIG_SSB_PCIHOST
961 -int ssb_bus_pcibus_register(struct ssb_bus *bus,
962 - struct pci_dev *host_pci)
963 +int __devinit ssb_bus_pcibus_register(struct ssb_bus *bus,
964 + struct pci_dev *host_pci)
968 @@ -830,6 +866,9 @@ int ssb_bus_pcibus_register(struct ssb_b
970 ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on "
971 "PCI device %s\n", dev_name(&host_pci->dev));
973 + ssb_printk(KERN_ERR PFX "Failed to register PCI version"
974 + " of SSB with error %d\n", err);
978 @@ -838,9 +877,9 @@ EXPORT_SYMBOL(ssb_bus_pcibus_register);
979 #endif /* CONFIG_SSB_PCIHOST */
981 #ifdef CONFIG_SSB_PCMCIAHOST
982 -int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
983 - struct pcmcia_device *pcmcia_dev,
984 - unsigned long baseaddr)
985 +int __devinit ssb_bus_pcmciabus_register(struct ssb_bus *bus,
986 + struct pcmcia_device *pcmcia_dev,
987 + unsigned long baseaddr)
991 @@ -860,8 +899,9 @@ EXPORT_SYMBOL(ssb_bus_pcmciabus_register
992 #endif /* CONFIG_SSB_PCMCIAHOST */
994 #ifdef CONFIG_SSB_SDIOHOST
995 -int ssb_bus_sdiobus_register(struct ssb_bus *bus, struct sdio_func *func,
996 - unsigned int quirks)
997 +int __devinit ssb_bus_sdiobus_register(struct ssb_bus *bus,
998 + struct sdio_func *func,
999 + unsigned int quirks)
1003 @@ -881,9 +921,9 @@ int ssb_bus_sdiobus_register(struct ssb_
1004 EXPORT_SYMBOL(ssb_bus_sdiobus_register);
1005 #endif /* CONFIG_SSB_PCMCIAHOST */
1007 -int ssb_bus_ssbbus_register(struct ssb_bus *bus,
1008 - unsigned long baseaddr,
1009 - ssb_invariants_func_t get_invariants)
1010 +int __devinit ssb_bus_ssbbus_register(struct ssb_bus *bus,
1011 + unsigned long baseaddr,
1012 + ssb_invariants_func_t get_invariants)
1016 @@ -964,8 +1004,8 @@ u32 ssb_calc_clock_rate(u32 plltype, u32
1018 case SSB_PLLTYPE_6: /* 100/200 or 120/240 only */
1019 if (m & SSB_CHIPCO_CLK_T6_MMASK)
1020 - return SSB_CHIPCO_CLK_T6_M0;
1021 - return SSB_CHIPCO_CLK_T6_M1;
1022 + return SSB_CHIPCO_CLK_T6_M1;
1023 + return SSB_CHIPCO_CLK_T6_M0;
1024 case SSB_PLLTYPE_1: /* 48Mhz base, 3 dividers */
1025 case SSB_PLLTYPE_3: /* 25Mhz, 2 dividers */
1026 case SSB_PLLTYPE_4: /* 48Mhz, 4 dividers */
1027 @@ -1080,23 +1120,22 @@ static u32 ssb_tmslow_reject_bitmask(str
1029 u32 rev = ssb_read32(dev, SSB_IDLOW) & SSB_IDLOW_SSBREV;
1031 - /* The REJECT bit changed position in TMSLOW between
1032 - * Backplane revisions. */
1033 + /* The REJECT bit seems to be different for Backplane rev 2.3 */
1035 case SSB_IDLOW_SSBREV_22:
1036 - return SSB_TMSLOW_REJECT_22;
1037 + case SSB_IDLOW_SSBREV_24:
1038 + case SSB_IDLOW_SSBREV_26:
1039 + return SSB_TMSLOW_REJECT;
1040 case SSB_IDLOW_SSBREV_23:
1041 return SSB_TMSLOW_REJECT_23;
1042 - case SSB_IDLOW_SSBREV_24: /* TODO - find the proper REJECT bits */
1043 - case SSB_IDLOW_SSBREV_25: /* same here */
1044 - case SSB_IDLOW_SSBREV_26: /* same here */
1045 + case SSB_IDLOW_SSBREV_25: /* TODO - find the proper REJECT bit */
1046 case SSB_IDLOW_SSBREV_27: /* same here */
1047 - return SSB_TMSLOW_REJECT_23; /* this is a guess */
1048 + return SSB_TMSLOW_REJECT; /* this is a guess */
1050 printk(KERN_INFO "ssb: Backplane Revision 0x%.8X\n", rev);
1053 - return (SSB_TMSLOW_REJECT_22 | SSB_TMSLOW_REJECT_23);
1054 + return (SSB_TMSLOW_REJECT | SSB_TMSLOW_REJECT_23);
1057 int ssb_device_is_enabled(struct ssb_device *dev)
1058 @@ -1155,10 +1194,10 @@ void ssb_device_enable(struct ssb_device
1060 EXPORT_SYMBOL(ssb_device_enable);
1062 -/* Wait for a bit in a register to get set or unset.
1063 +/* Wait for bitmask in a register to get set or cleared.
1064 * timeout is in units of ten-microseconds */
1065 -static int ssb_wait_bit(struct ssb_device *dev, u16 reg, u32 bitmask,
1066 - int timeout, int set)
1067 +static int ssb_wait_bits(struct ssb_device *dev, u16 reg, u32 bitmask,
1068 + int timeout, int set)
1072 @@ -1166,7 +1205,7 @@ static int ssb_wait_bit(struct ssb_devic
1073 for (i = 0; i < timeout; i++) {
1074 val = ssb_read32(dev, reg);
1076 - if (val & bitmask)
1077 + if ((val & bitmask) == bitmask)
1080 if (!(val & bitmask))
1081 @@ -1183,20 +1222,38 @@ static int ssb_wait_bit(struct ssb_devic
1083 void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags)
1088 if (ssb_read32(dev, SSB_TMSLOW) & SSB_TMSLOW_RESET)
1091 reject = ssb_tmslow_reject_bitmask(dev);
1092 - ssb_write32(dev, SSB_TMSLOW, reject | SSB_TMSLOW_CLOCK);
1093 - ssb_wait_bit(dev, SSB_TMSLOW, reject, 1000, 1);
1094 - ssb_wait_bit(dev, SSB_TMSHIGH, SSB_TMSHIGH_BUSY, 1000, 0);
1095 - ssb_write32(dev, SSB_TMSLOW,
1096 - SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK |
1097 - reject | SSB_TMSLOW_RESET |
1098 - core_specific_flags);
1099 - ssb_flush_tmslow(dev);
1101 + if (ssb_read32(dev, SSB_TMSLOW) & SSB_TMSLOW_CLOCK) {
1102 + ssb_write32(dev, SSB_TMSLOW, reject | SSB_TMSLOW_CLOCK);
1103 + ssb_wait_bits(dev, SSB_TMSLOW, reject, 1000, 1);
1104 + ssb_wait_bits(dev, SSB_TMSHIGH, SSB_TMSHIGH_BUSY, 1000, 0);
1106 + if (ssb_read32(dev, SSB_IDLOW) & SSB_IDLOW_INITIATOR) {
1107 + val = ssb_read32(dev, SSB_IMSTATE);
1108 + val |= SSB_IMSTATE_REJECT;
1109 + ssb_write32(dev, SSB_IMSTATE, val);
1110 + ssb_wait_bits(dev, SSB_IMSTATE, SSB_IMSTATE_BUSY, 1000,
1114 + ssb_write32(dev, SSB_TMSLOW,
1115 + SSB_TMSLOW_FGC | SSB_TMSLOW_CLOCK |
1116 + reject | SSB_TMSLOW_RESET |
1117 + core_specific_flags);
1118 + ssb_flush_tmslow(dev);
1120 + if (ssb_read32(dev, SSB_IDLOW) & SSB_IDLOW_INITIATOR) {
1121 + val = ssb_read32(dev, SSB_IMSTATE);
1122 + val &= ~SSB_IMSTATE_REJECT;
1123 + ssb_write32(dev, SSB_IMSTATE, val);
1127 ssb_write32(dev, SSB_TMSLOW,
1128 reject | SSB_TMSLOW_RESET |
1129 @@ -1211,7 +1268,10 @@ u32 ssb_dma_translation(struct ssb_devic
1130 case SSB_BUSTYPE_SSB:
1132 case SSB_BUSTYPE_PCI:
1133 - return SSB_PCI_DMA;
1134 + if (ssb_read32(dev, SSB_TMSHIGH) & SSB_TMSHIGH_DMA64)
1135 + return SSB_PCIE_DMA_H32;
1137 + return SSB_PCI_DMA;
1139 __ssb_dma_not_implemented(dev);
1141 @@ -1328,20 +1388,20 @@ EXPORT_SYMBOL(ssb_bus_may_powerdown);
1143 int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl)
1145 - struct ssb_chipcommon *cc;
1147 enum ssb_clkmode mode;
1149 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1);
1152 - cc = &bus->chipco;
1153 - mode = dynamic_pctl ? SSB_CLKMODE_DYNAMIC : SSB_CLKMODE_FAST;
1154 - ssb_chipco_set_clockmode(cc, mode);
1156 #ifdef CONFIG_SSB_DEBUG
1157 bus->powered_up = 1;
1160 + mode = dynamic_pctl ? SSB_CLKMODE_DYNAMIC : SSB_CLKMODE_FAST;
1161 + ssb_chipco_set_clockmode(&bus->chipco, mode);
1165 ssb_printk(KERN_ERR PFX "Bus powerup failed\n");
1166 @@ -1349,6 +1409,37 @@ error:
1168 EXPORT_SYMBOL(ssb_bus_powerup);
1170 +static void ssb_broadcast_value(struct ssb_device *dev,
1171 + u32 address, u32 data)
1173 +#ifdef CONFIG_SSB_DRIVER_PCICORE
1174 + /* This is used for both, PCI and ChipCommon core, so be careful. */
1175 + BUILD_BUG_ON(SSB_PCICORE_BCAST_ADDR != SSB_CHIPCO_BCAST_ADDR);
1176 + BUILD_BUG_ON(SSB_PCICORE_BCAST_DATA != SSB_CHIPCO_BCAST_DATA);
1179 + ssb_write32(dev, SSB_CHIPCO_BCAST_ADDR, address);
1180 + ssb_read32(dev, SSB_CHIPCO_BCAST_ADDR); /* flush */
1181 + ssb_write32(dev, SSB_CHIPCO_BCAST_DATA, data);
1182 + ssb_read32(dev, SSB_CHIPCO_BCAST_DATA); /* flush */
1185 +void ssb_commit_settings(struct ssb_bus *bus)
1187 + struct ssb_device *dev;
1189 +#ifdef CONFIG_SSB_DRIVER_PCICORE
1190 + dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev;
1192 + dev = bus->chipco.dev;
1194 + if (WARN_ON(!dev))
1196 + /* This forces an update of the cached registers. */
1197 + ssb_broadcast_value(dev, 0xFD8, 0);
1199 +EXPORT_SYMBOL(ssb_commit_settings);
1201 u32 ssb_admatch_base(u32 adm)
1204 --- a/drivers/ssb/pci.c
1205 +++ b/drivers/ssb/pci.c
1208 #include <linux/ssb/ssb.h>
1209 #include <linux/ssb/ssb_regs.h>
1210 +#include <linux/slab.h>
1211 #include <linux/pci.h>
1212 #include <linux/delay.h>
1214 @@ -167,7 +168,7 @@ err_pci:
1217 /* Get the word-offset for a SSB_SPROM_XXX define. */
1218 -#define SPOFF(offset) (((offset) - SSB_SPROM_BASE1) / sizeof(u16))
1219 +#define SPOFF(offset) ((offset) / sizeof(u16))
1220 /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */
1221 #define SPEX16(_outvar, _offset, _mask, _shift) \
1222 out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift))
1223 @@ -405,6 +406,46 @@ static void sprom_extract_r123(struct ss
1224 out->antenna_gain.ghz5.a3 = gain;
1227 +/* Revs 4 5 and 8 have partially shared layout */
1228 +static void sprom_extract_r458(struct ssb_sprom *out, const u16 *in)
1230 + SPEX(txpid2g[0], SSB_SPROM4_TXPID2G01,
1231 + SSB_SPROM4_TXPID2G0, SSB_SPROM4_TXPID2G0_SHIFT);
1232 + SPEX(txpid2g[1], SSB_SPROM4_TXPID2G01,
1233 + SSB_SPROM4_TXPID2G1, SSB_SPROM4_TXPID2G1_SHIFT);
1234 + SPEX(txpid2g[2], SSB_SPROM4_TXPID2G23,
1235 + SSB_SPROM4_TXPID2G2, SSB_SPROM4_TXPID2G2_SHIFT);
1236 + SPEX(txpid2g[3], SSB_SPROM4_TXPID2G23,
1237 + SSB_SPROM4_TXPID2G3, SSB_SPROM4_TXPID2G3_SHIFT);
1239 + SPEX(txpid5gl[0], SSB_SPROM4_TXPID5GL01,
1240 + SSB_SPROM4_TXPID5GL0, SSB_SPROM4_TXPID5GL0_SHIFT);
1241 + SPEX(txpid5gl[1], SSB_SPROM4_TXPID5GL01,
1242 + SSB_SPROM4_TXPID5GL1, SSB_SPROM4_TXPID5GL1_SHIFT);
1243 + SPEX(txpid5gl[2], SSB_SPROM4_TXPID5GL23,
1244 + SSB_SPROM4_TXPID5GL2, SSB_SPROM4_TXPID5GL2_SHIFT);
1245 + SPEX(txpid5gl[3], SSB_SPROM4_TXPID5GL23,
1246 + SSB_SPROM4_TXPID5GL3, SSB_SPROM4_TXPID5GL3_SHIFT);
1248 + SPEX(txpid5g[0], SSB_SPROM4_TXPID5G01,
1249 + SSB_SPROM4_TXPID5G0, SSB_SPROM4_TXPID5G0_SHIFT);
1250 + SPEX(txpid5g[1], SSB_SPROM4_TXPID5G01,
1251 + SSB_SPROM4_TXPID5G1, SSB_SPROM4_TXPID5G1_SHIFT);
1252 + SPEX(txpid5g[2], SSB_SPROM4_TXPID5G23,
1253 + SSB_SPROM4_TXPID5G2, SSB_SPROM4_TXPID5G2_SHIFT);
1254 + SPEX(txpid5g[3], SSB_SPROM4_TXPID5G23,
1255 + SSB_SPROM4_TXPID5G3, SSB_SPROM4_TXPID5G3_SHIFT);
1257 + SPEX(txpid5gh[0], SSB_SPROM4_TXPID5GH01,
1258 + SSB_SPROM4_TXPID5GH0, SSB_SPROM4_TXPID5GH0_SHIFT);
1259 + SPEX(txpid5gh[1], SSB_SPROM4_TXPID5GH01,
1260 + SSB_SPROM4_TXPID5GH1, SSB_SPROM4_TXPID5GH1_SHIFT);
1261 + SPEX(txpid5gh[2], SSB_SPROM4_TXPID5GH23,
1262 + SSB_SPROM4_TXPID5GH2, SSB_SPROM4_TXPID5GH2_SHIFT);
1263 + SPEX(txpid5gh[3], SSB_SPROM4_TXPID5GH23,
1264 + SSB_SPROM4_TXPID5GH3, SSB_SPROM4_TXPID5GH3_SHIFT);
1267 static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
1270 @@ -427,10 +468,14 @@ static void sprom_extract_r45(struct ssb
1271 SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0);
1272 SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0);
1273 SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0);
1274 + SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0);
1275 + SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0);
1277 SPEX(country_code, SSB_SPROM5_CCODE, 0xFFFF, 0);
1278 SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0);
1279 SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0);
1280 + SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0);
1281 + SPEX(boardflags2_hi, SSB_SPROM5_BFL2HI, 0xFFFF, 0);
1283 SPEX(ant_available_a, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_A,
1284 SSB_SPROM4_ANTAVAIL_A_SHIFT);
1285 @@ -470,6 +515,8 @@ static void sprom_extract_r45(struct ssb
1286 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
1287 sizeof(out->antenna_gain.ghz5));
1289 + sprom_extract_r458(out, in);
1291 /* TODO - get remaining rev 4 stuff needed */
1294 @@ -560,6 +607,8 @@ static void sprom_extract_r8(struct ssb_
1295 memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
1296 sizeof(out->antenna_gain.ghz5));
1298 + sprom_extract_r458(out, in);
1300 /* TODO - get remaining rev 8 stuff needed */
1303 @@ -572,37 +621,34 @@ static int sprom_extract(struct ssb_bus
1304 ssb_dprintk(KERN_DEBUG PFX "SPROM revision %d detected.\n", out->revision);
1305 memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */
1306 memset(out->et1mac, 0xFF, 6);
1308 if ((bus->chip_id & 0xFF00) == 0x4400) {
1309 /* Workaround: The BCM44XX chip has a stupid revision
1310 * number stored in the SPROM.
1311 * Always extract r1. */
1313 + ssb_dprintk(KERN_DEBUG PFX "SPROM treated as revision %d\n", out->revision);
1316 + switch (out->revision) {
1320 sprom_extract_r123(out, in);
1321 - } else if (bus->chip_id == 0x4321) {
1322 - /* the BCM4328 has a chipid == 0x4321 and a rev 4 SPROM */
1323 - out->revision = 4;
1327 sprom_extract_r45(out, in);
1329 - switch (out->revision) {
1333 - sprom_extract_r123(out, in);
1337 - sprom_extract_r45(out, in);
1340 - sprom_extract_r8(out, in);
1343 - ssb_printk(KERN_WARNING PFX "Unsupported SPROM"
1344 - " revision %d detected. Will extract"
1345 - " v1\n", out->revision);
1346 - out->revision = 1;
1347 - sprom_extract_r123(out, in);
1351 + sprom_extract_r8(out, in);
1354 + ssb_printk(KERN_WARNING PFX "Unsupported SPROM"
1355 + " revision %d detected. Will extract"
1356 + " v1\n", out->revision);
1357 + out->revision = 1;
1358 + sprom_extract_r123(out, in);
1361 if (out->boardflags_lo == 0xFFFF)
1362 @@ -616,15 +662,14 @@ static int sprom_extract(struct ssb_bus
1363 static int ssb_pci_sprom_get(struct ssb_bus *bus,
1364 struct ssb_sprom *sprom)
1366 - const struct ssb_sprom *fallback;
1367 - int err = -ENOMEM;
1371 if (!ssb_is_sprom_available(bus)) {
1372 ssb_printk(KERN_ERR PFX "No SPROM available!\n");
1375 - if (bus->chipco.dev) { /* can be unavailible! */
1376 + if (bus->chipco.dev) { /* can be unavailable! */
1378 * get SPROM offset: SSB_SPROM_BASE1 except for
1379 * chipcommon rev >= 31 or chip ID is 0x4312 and
1380 @@ -644,7 +689,7 @@ static int ssb_pci_sprom_get(struct ssb_
1382 buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
1386 bus->sprom_size = SSB_SPROMSIZE_WORDS_R123;
1387 sprom_do_read(bus, buf);
1388 err = sprom_check_crc(buf, bus->sprom_size);
1389 @@ -654,17 +699,24 @@ static int ssb_pci_sprom_get(struct ssb_
1390 buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
1395 bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
1396 sprom_do_read(bus, buf);
1397 err = sprom_check_crc(buf, bus->sprom_size);
1399 /* All CRC attempts failed.
1400 * Maybe there is no SPROM on the device?
1401 - * If we have a fallback, use that. */
1402 - fallback = ssb_get_fallback_sprom();
1404 - memcpy(sprom, fallback, sizeof(*sprom));
1405 + * Now we ask the arch code if there is some sprom
1406 + * available for this device in some other storage */
1407 + err = ssb_fill_sprom_with_fallback(bus, sprom);
1409 + ssb_printk(KERN_WARNING PFX "WARNING: Using"
1410 + " fallback SPROM failed (err %d)\n",
1413 + ssb_dprintk(KERN_DEBUG PFX "Using SPROM"
1414 + " revision %d provided by"
1415 + " platform.\n", sprom->revision);
1419 @@ -676,19 +728,15 @@ static int ssb_pci_sprom_get(struct ssb_
1427 static void ssb_pci_get_boardinfo(struct ssb_bus *bus,
1428 struct ssb_boardinfo *bi)
1430 - pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_VENDOR_ID,
1432 - pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
1434 - pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
1436 + bi->vendor = bus->host_pci->subsystem_vendor;
1437 + bi->type = bus->host_pci->subsystem_device;
1438 + bi->rev = bus->host_pci->revision;
1441 int ssb_pci_get_invariants(struct ssb_bus *bus,
1442 --- a/drivers/ssb/pcihost_wrapper.c
1443 +++ b/drivers/ssb/pcihost_wrapper.c
1447 #include <linux/pci.h>
1448 +#include <linux/slab.h>
1449 #include <linux/ssb/ssb.h>
1452 @@ -52,12 +53,13 @@ static int ssb_pcihost_resume(struct pci
1453 # define ssb_pcihost_resume NULL
1454 #endif /* CONFIG_PM */
1456 -static int ssb_pcihost_probe(struct pci_dev *dev,
1457 - const struct pci_device_id *id)
1458 +static int __devinit ssb_pcihost_probe(struct pci_dev *dev,
1459 + const struct pci_device_id *id)
1461 struct ssb_bus *ssb;
1466 ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
1468 @@ -73,6 +75,12 @@ static int ssb_pcihost_probe(struct pci_
1469 goto err_pci_disable;
1470 pci_set_master(dev);
1472 + /* Disable the RETRY_TIMEOUT register (0x41) to keep
1473 + * PCI Tx retries from interfering with C3 CPU state */
1474 + pci_read_config_dword(dev, 0x40, &val);
1475 + if ((val & 0x0000ff00) != 0)
1476 + pci_write_config_dword(dev, 0x40, val & 0xffff00ff);
1478 err = ssb_bus_pcibus_register(ssb, dev);
1480 goto err_pci_release_regions;
1481 @@ -102,7 +110,7 @@ static void ssb_pcihost_remove(struct pc
1482 pci_set_drvdata(dev, NULL);
1485 -int ssb_pcihost_register(struct pci_driver *driver)
1486 +int __devinit ssb_pcihost_register(struct pci_driver *driver)
1488 driver->probe = ssb_pcihost_probe;
1489 driver->remove = ssb_pcihost_remove;
1490 --- a/drivers/ssb/pcmcia.c
1491 +++ b/drivers/ssb/pcmcia.c
1492 @@ -617,136 +617,140 @@ static int ssb_pcmcia_sprom_check_crc(co
1496 -int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
1497 - struct ssb_init_invariants *iv)
1498 +static int ssb_pcmcia_get_mac(struct pcmcia_device *p_dev,
1504 - unsigned char buf[32];
1505 + struct ssb_sprom *sprom = priv;
1507 + if (tuple->TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID)
1509 + if (tuple->TupleDataLen != ETH_ALEN + 2)
1511 + if (tuple->TupleData[1] != ETH_ALEN)
1513 + memcpy(sprom->il0mac, &tuple->TupleData[2], ETH_ALEN);
1517 +static int ssb_pcmcia_do_get_invariants(struct pcmcia_device *p_dev,
1521 + struct ssb_init_invariants *iv = priv;
1522 struct ssb_sprom *sprom = &iv->sprom;
1523 struct ssb_boardinfo *bi = &iv->boardinfo;
1524 const char *error_description;
1526 + GOTO_ERROR_ON(tuple->TupleDataLen < 1, "VEN tpl < 1");
1527 + switch (tuple->TupleData[0]) {
1528 + case SSB_PCMCIA_CIS_ID:
1529 + GOTO_ERROR_ON((tuple->TupleDataLen != 5) &&
1530 + (tuple->TupleDataLen != 7),
1532 + bi->vendor = tuple->TupleData[1] |
1533 + ((u16)tuple->TupleData[2] << 8);
1535 + case SSB_PCMCIA_CIS_BOARDREV:
1536 + GOTO_ERROR_ON(tuple->TupleDataLen != 2,
1537 + "boardrev tpl size");
1538 + sprom->board_rev = tuple->TupleData[1];
1540 + case SSB_PCMCIA_CIS_PA:
1541 + GOTO_ERROR_ON((tuple->TupleDataLen != 9) &&
1542 + (tuple->TupleDataLen != 10),
1544 + sprom->pa0b0 = tuple->TupleData[1] |
1545 + ((u16)tuple->TupleData[2] << 8);
1546 + sprom->pa0b1 = tuple->TupleData[3] |
1547 + ((u16)tuple->TupleData[4] << 8);
1548 + sprom->pa0b2 = tuple->TupleData[5] |
1549 + ((u16)tuple->TupleData[6] << 8);
1550 + sprom->itssi_a = tuple->TupleData[7];
1551 + sprom->itssi_bg = tuple->TupleData[7];
1552 + sprom->maxpwr_a = tuple->TupleData[8];
1553 + sprom->maxpwr_bg = tuple->TupleData[8];
1555 + case SSB_PCMCIA_CIS_OEMNAME:
1556 + /* We ignore this. */
1558 + case SSB_PCMCIA_CIS_CCODE:
1559 + GOTO_ERROR_ON(tuple->TupleDataLen != 2,
1560 + "ccode tpl size");
1561 + sprom->country_code = tuple->TupleData[1];
1563 + case SSB_PCMCIA_CIS_ANTENNA:
1564 + GOTO_ERROR_ON(tuple->TupleDataLen != 2,
1566 + sprom->ant_available_a = tuple->TupleData[1];
1567 + sprom->ant_available_bg = tuple->TupleData[1];
1569 + case SSB_PCMCIA_CIS_ANTGAIN:
1570 + GOTO_ERROR_ON(tuple->TupleDataLen != 2,
1572 + sprom->antenna_gain.ghz24.a0 = tuple->TupleData[1];
1573 + sprom->antenna_gain.ghz24.a1 = tuple->TupleData[1];
1574 + sprom->antenna_gain.ghz24.a2 = tuple->TupleData[1];
1575 + sprom->antenna_gain.ghz24.a3 = tuple->TupleData[1];
1576 + sprom->antenna_gain.ghz5.a0 = tuple->TupleData[1];
1577 + sprom->antenna_gain.ghz5.a1 = tuple->TupleData[1];
1578 + sprom->antenna_gain.ghz5.a2 = tuple->TupleData[1];
1579 + sprom->antenna_gain.ghz5.a3 = tuple->TupleData[1];
1581 + case SSB_PCMCIA_CIS_BFLAGS:
1582 + GOTO_ERROR_ON((tuple->TupleDataLen != 3) &&
1583 + (tuple->TupleDataLen != 5),
1585 + sprom->boardflags_lo = tuple->TupleData[1] |
1586 + ((u16)tuple->TupleData[2] << 8);
1588 + case SSB_PCMCIA_CIS_LEDS:
1589 + GOTO_ERROR_ON(tuple->TupleDataLen != 5,
1591 + sprom->gpio0 = tuple->TupleData[1];
1592 + sprom->gpio1 = tuple->TupleData[2];
1593 + sprom->gpio2 = tuple->TupleData[3];
1594 + sprom->gpio3 = tuple->TupleData[4];
1597 + return -ENOSPC; /* continue with next entry */
1600 + ssb_printk(KERN_ERR PFX
1601 + "PCMCIA: Failed to fetch device invariants: %s\n",
1602 + error_description);
1607 +int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
1608 + struct ssb_init_invariants *iv)
1610 + struct ssb_sprom *sprom = &iv->sprom;
1613 memset(sprom, 0xFF, sizeof(*sprom));
1614 sprom->revision = 1;
1615 sprom->boardflags_lo = 0;
1616 sprom->boardflags_hi = 0;
1618 /* First fetch the MAC address. */
1619 - memset(&tuple, 0, sizeof(tuple));
1620 - tuple.DesiredTuple = CISTPL_FUNCE;
1621 - tuple.TupleData = buf;
1622 - tuple.TupleDataMax = sizeof(buf);
1623 - res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple);
1624 - GOTO_ERROR_ON(res != 0, "MAC first tpl");
1625 - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple);
1626 - GOTO_ERROR_ON(res != 0, "MAC first tpl data");
1628 - GOTO_ERROR_ON(tuple.TupleDataLen < 1, "MAC tpl < 1");
1629 - if (tuple.TupleData[0] == CISTPL_FUNCE_LAN_NODE_ID)
1631 - res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple);
1632 - GOTO_ERROR_ON(res != 0, "MAC next tpl");
1633 - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple);
1634 - GOTO_ERROR_ON(res != 0, "MAC next tpl data");
1635 + res = pcmcia_loop_tuple(bus->host_pcmcia, CISTPL_FUNCE,
1636 + ssb_pcmcia_get_mac, sprom);
1638 + ssb_printk(KERN_ERR PFX
1639 + "PCMCIA: Failed to fetch MAC address\n");
1642 - GOTO_ERROR_ON(tuple.TupleDataLen != ETH_ALEN + 2, "MAC tpl size");
1643 - memcpy(sprom->il0mac, &tuple.TupleData[2], ETH_ALEN);
1645 /* Fetch the vendor specific tuples. */
1646 - memset(&tuple, 0, sizeof(tuple));
1647 - tuple.DesiredTuple = SSB_PCMCIA_CIS;
1648 - tuple.TupleData = buf;
1649 - tuple.TupleDataMax = sizeof(buf);
1650 - res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple);
1651 - GOTO_ERROR_ON(res != 0, "VEN first tpl");
1652 - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple);
1653 - GOTO_ERROR_ON(res != 0, "VEN first tpl data");
1655 - GOTO_ERROR_ON(tuple.TupleDataLen < 1, "VEN tpl < 1");
1656 - switch (tuple.TupleData[0]) {
1657 - case SSB_PCMCIA_CIS_ID:
1658 - GOTO_ERROR_ON((tuple.TupleDataLen != 5) &&
1659 - (tuple.TupleDataLen != 7),
1661 - bi->vendor = tuple.TupleData[1] |
1662 - ((u16)tuple.TupleData[2] << 8);
1664 - case SSB_PCMCIA_CIS_BOARDREV:
1665 - GOTO_ERROR_ON(tuple.TupleDataLen != 2,
1666 - "boardrev tpl size");
1667 - sprom->board_rev = tuple.TupleData[1];
1669 - case SSB_PCMCIA_CIS_PA:
1670 - GOTO_ERROR_ON((tuple.TupleDataLen != 9) &&
1671 - (tuple.TupleDataLen != 10),
1673 - sprom->pa0b0 = tuple.TupleData[1] |
1674 - ((u16)tuple.TupleData[2] << 8);
1675 - sprom->pa0b1 = tuple.TupleData[3] |
1676 - ((u16)tuple.TupleData[4] << 8);
1677 - sprom->pa0b2 = tuple.TupleData[5] |
1678 - ((u16)tuple.TupleData[6] << 8);
1679 - sprom->itssi_a = tuple.TupleData[7];
1680 - sprom->itssi_bg = tuple.TupleData[7];
1681 - sprom->maxpwr_a = tuple.TupleData[8];
1682 - sprom->maxpwr_bg = tuple.TupleData[8];
1684 - case SSB_PCMCIA_CIS_OEMNAME:
1685 - /* We ignore this. */
1687 - case SSB_PCMCIA_CIS_CCODE:
1688 - GOTO_ERROR_ON(tuple.TupleDataLen != 2,
1689 - "ccode tpl size");
1690 - sprom->country_code = tuple.TupleData[1];
1692 - case SSB_PCMCIA_CIS_ANTENNA:
1693 - GOTO_ERROR_ON(tuple.TupleDataLen != 2,
1695 - sprom->ant_available_a = tuple.TupleData[1];
1696 - sprom->ant_available_bg = tuple.TupleData[1];
1698 - case SSB_PCMCIA_CIS_ANTGAIN:
1699 - GOTO_ERROR_ON(tuple.TupleDataLen != 2,
1701 - sprom->antenna_gain.ghz24.a0 = tuple.TupleData[1];
1702 - sprom->antenna_gain.ghz24.a1 = tuple.TupleData[1];
1703 - sprom->antenna_gain.ghz24.a2 = tuple.TupleData[1];
1704 - sprom->antenna_gain.ghz24.a3 = tuple.TupleData[1];
1705 - sprom->antenna_gain.ghz5.a0 = tuple.TupleData[1];
1706 - sprom->antenna_gain.ghz5.a1 = tuple.TupleData[1];
1707 - sprom->antenna_gain.ghz5.a2 = tuple.TupleData[1];
1708 - sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1];
1710 - case SSB_PCMCIA_CIS_BFLAGS:
1711 - GOTO_ERROR_ON((tuple.TupleDataLen != 3) &&
1712 - (tuple.TupleDataLen != 5),
1714 - sprom->boardflags_lo = tuple.TupleData[1] |
1715 - ((u16)tuple.TupleData[2] << 8);
1717 - case SSB_PCMCIA_CIS_LEDS:
1718 - GOTO_ERROR_ON(tuple.TupleDataLen != 5,
1720 - sprom->gpio0 = tuple.TupleData[1];
1721 - sprom->gpio1 = tuple.TupleData[2];
1722 - sprom->gpio2 = tuple.TupleData[3];
1723 - sprom->gpio3 = tuple.TupleData[4];
1726 - res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple);
1727 - if (res == -ENOSPC)
1729 - GOTO_ERROR_ON(res != 0, "VEN next tpl");
1730 - res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple);
1731 - GOTO_ERROR_ON(res != 0, "VEN next tpl data");
1733 + res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS,
1734 + ssb_pcmcia_do_get_invariants, iv);
1735 + if ((res == 0) || (res == -ENOSPC))
1740 ssb_printk(KERN_ERR PFX
1741 - "PCMCIA: Failed to fetch device invariants: %s\n",
1742 - error_description);
1743 + "PCMCIA: Failed to fetch device invariants\n");
1747 --- a/drivers/ssb/scan.c
1748 +++ b/drivers/ssb/scan.c
1749 @@ -260,7 +260,10 @@ static int we_support_multiple_80211_cor
1750 #ifdef CONFIG_SSB_PCIHOST
1751 if (bus->bustype == SSB_BUSTYPE_PCI) {
1752 if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM &&
1753 - bus->host_pci->device == 0x4324)
1754 + ((bus->host_pci->device == 0x4313) ||
1755 + (bus->host_pci->device == 0x431A) ||
1756 + (bus->host_pci->device == 0x4321) ||
1757 + (bus->host_pci->device == 0x4324)))
1760 #endif /* CONFIG_SSB_PCIHOST */
1761 @@ -309,8 +312,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
1763 if (bus->bustype == SSB_BUSTYPE_PCI) {
1764 bus->chip_id = pcidev_to_chipid(bus->host_pci);
1765 - pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
1767 + bus->chip_rev = bus->host_pci->revision;
1768 bus->chip_package = 0;
1770 bus->chip_id = 0x4710;
1771 @@ -354,7 +356,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
1773 dev->ops = bus->ops;
1775 - ssb_dprintk(KERN_INFO PFX
1776 + printk(KERN_DEBUG PFX
1777 "Core %d found: %s "
1778 "(cc 0x%03X, rev 0x%02X, vendor 0x%04X)\n",
1779 i, ssb_core_name(dev->id.coreid),
1780 @@ -422,6 +424,16 @@ int ssb_bus_scan(struct ssb_bus *bus,
1781 bus->pcicore.dev = dev;
1782 #endif /* CONFIG_SSB_DRIVER_PCICORE */
1784 + case SSB_DEV_ETHERNET:
1785 + if (bus->bustype == SSB_BUSTYPE_PCI) {
1786 + if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM &&
1787 + (bus->host_pci->device & 0xFF00) == 0x4300) {
1788 + /* This is a dangling ethernet core on a
1789 + * wireless device. Ignore it. */
1797 --- a/drivers/ssb/sprom.c
1798 +++ b/drivers/ssb/sprom.c
1800 #include "ssb_private.h"
1802 #include <linux/ctype.h>
1803 +#include <linux/slab.h>
1806 -static const struct ssb_sprom *fallback_sprom;
1807 +static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out);
1810 static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
1811 @@ -102,6 +103,7 @@ ssize_t ssb_attr_sprom_store(struct ssb_
1813 int res = 0, err = -ENOMEM;
1814 size_t sprom_size_words = bus->sprom_size;
1815 + struct ssb_freeze_context freeze;
1817 sprom = kcalloc(bus->sprom_size, sizeof(u16), GFP_KERNEL);
1819 @@ -123,18 +125,13 @@ ssize_t ssb_attr_sprom_store(struct ssb_
1821 if (mutex_lock_interruptible(&bus->sprom_mutex))
1823 - err = ssb_devices_freeze(bus);
1824 - if (err == -EOPNOTSUPP) {
1825 - ssb_printk(KERN_ERR PFX "SPROM write: Could not freeze devices. "
1826 - "No suspend support. Is CONFIG_PM enabled?\n");
1829 + err = ssb_devices_freeze(bus, &freeze);
1831 ssb_printk(KERN_ERR PFX "SPROM write: Could not freeze all devices\n");
1834 res = sprom_write(bus, sprom);
1835 - err = ssb_devices_thaw(bus);
1836 + err = ssb_devices_thaw(&freeze);
1838 ssb_printk(KERN_ERR PFX "SPROM write: Could not thaw all devices\n");
1840 @@ -148,36 +145,43 @@ out:
1844 - * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
1845 + * ssb_arch_register_fallback_sprom - Registers a method providing a
1846 + * fallback SPROM if no SPROM is found.
1848 - * @sprom: The SPROM data structure to register.
1849 + * @sprom_callback: The callback function.
1851 - * With this function the architecture implementation may register a fallback
1852 - * SPROM data structure. The fallback is only used for PCI based SSB devices,
1853 - * where no valid SPROM can be found in the shadow registers.
1854 + * With this function the architecture implementation may register a
1855 + * callback handler which fills the SPROM data structure. The fallback is
1856 + * only used for PCI based SSB devices, where no valid SPROM can be found
1857 + * in the shadow registers.
1859 - * This function is useful for weird architectures that have a half-assed SSB device
1860 - * hardwired to their PCI bus.
1861 + * This function is useful for weird architectures that have a half-assed
1862 + * SSB device hardwired to their PCI bus.
1864 - * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently
1865 - * don't use this fallback.
1866 - * Architectures must provide the SPROM for native SSB devices anyway,
1867 - * so the fallback also isn't used for native devices.
1868 + * Note that it does only work with PCI attached SSB devices. PCMCIA
1869 + * devices currently don't use this fallback.
1870 + * Architectures must provide the SPROM for native SSB devices anyway, so
1871 + * the fallback also isn't used for native devices.
1873 - * This function is available for architecture code, only. So it is not exported.
1874 + * This function is available for architecture code, only. So it is not
1877 -int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
1878 +int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus,
1879 + struct ssb_sprom *out))
1881 - if (fallback_sprom)
1882 + if (get_fallback_sprom)
1884 - fallback_sprom = sprom;
1885 + get_fallback_sprom = sprom_callback;
1890 -const struct ssb_sprom *ssb_get_fallback_sprom(void)
1891 +int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out)
1893 - return fallback_sprom;
1894 + if (!get_fallback_sprom)
1897 + return get_fallback_sprom(bus, out);
1900 /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
1901 @@ -188,7 +192,7 @@ bool ssb_is_sprom_available(struct ssb_b
1902 /* this routine differs from specs as we do not access SPROM directly
1904 if (bus->bustype == SSB_BUSTYPE_PCI &&
1905 - bus->chipco.dev && /* can be unavailible! */
1906 + bus->chipco.dev && /* can be unavailable! */
1907 bus->chipco.dev->id.revision >= 31)
1908 return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM;
1910 --- a/drivers/ssb/ssb_private.h
1911 +++ b/drivers/ssb/ssb_private.h
1912 @@ -171,24 +171,33 @@ ssize_t ssb_attr_sprom_store(struct ssb_
1913 const char *buf, size_t count,
1914 int (*sprom_check_crc)(const u16 *sprom, size_t size),
1915 int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
1916 -extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
1917 +extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus,
1918 + struct ssb_sprom *out);
1922 extern u32 ssb_calc_clock_rate(u32 plltype, u32 n, u32 m);
1923 -extern int ssb_devices_freeze(struct ssb_bus *bus);
1924 -extern int ssb_devices_thaw(struct ssb_bus *bus);
1925 extern struct ssb_bus *ssb_pci_dev_to_bus(struct pci_dev *pdev);
1926 int ssb_for_each_bus_call(unsigned long data,
1927 int (*func)(struct ssb_bus *bus, unsigned long data));
1928 extern struct ssb_bus *ssb_pcmcia_dev_to_bus(struct pcmcia_device *pdev);
1930 +struct ssb_freeze_context {
1931 + /* Pointer to the bus */
1932 + struct ssb_bus *bus;
1933 + /* Boolean list to indicate whether a device is frozen on this bus. */
1934 + bool device_frozen[SSB_MAX_NR_CORES];
1936 +extern int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx);
1937 +extern int ssb_devices_thaw(struct ssb_freeze_context *ctx);
1941 /* b43_pci_bridge.c */
1942 #ifdef CONFIG_SSB_B43_PCI_BRIDGE
1943 extern int __init b43_pci_ssb_bridge_init(void);
1944 extern void __exit b43_pci_ssb_bridge_exit(void);
1945 -#else /* CONFIG_SSB_B43_PCI_BRIDGR */
1946 +#else /* CONFIG_SSB_B43_PCI_BRIDGE */
1947 static inline int b43_pci_ssb_bridge_init(void)
1950 @@ -196,6 +205,6 @@ static inline int b43_pci_ssb_bridge_ini
1951 static inline void b43_pci_ssb_bridge_exit(void)
1954 -#endif /* CONFIG_SSB_PCIHOST */
1955 +#endif /* CONFIG_SSB_B43_PCI_BRIDGE */
1957 #endif /* LINUX_SSB_PRIVATE_H_ */
1958 --- a/include/linux/ssb/ssb.h
1959 +++ b/include/linux/ssb/ssb.h
1960 @@ -27,6 +27,8 @@ struct ssb_sprom {
1961 u8 et1mdcport; /* MDIO for enet1 */
1962 u8 board_rev; /* Board revision number from SPROM. */
1963 u8 country_code; /* Country Code */
1964 + u16 leddc_on_time; /* LED Powersave Duty Cycle On Count */
1965 + u16 leddc_off_time; /* LED Powersave Duty Cycle Off Count */
1966 u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */
1967 u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */
1969 @@ -55,6 +57,10 @@ struct ssb_sprom {
1970 u8 tri5gl; /* 5.2GHz TX isolation */
1971 u8 tri5g; /* 5.3GHz TX isolation */
1972 u8 tri5gh; /* 5.8GHz TX isolation */
1973 + u8 txpid2g[4]; /* 2GHz TX power index */
1974 + u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */
1975 + u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */
1976 + u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */
1977 u8 rxpo2g; /* 2GHz RX power offset */
1978 u8 rxpo5g; /* 5GHz RX power offset */
1979 u8 rssisav2g; /* 2GHz RSSI params */
1980 @@ -95,7 +101,7 @@ struct ssb_sprom {
1981 struct ssb_boardinfo {
1989 @@ -167,7 +173,7 @@ struct ssb_device {
1990 * is an optimization. */
1991 const struct ssb_bus_ops *ops;
1993 - struct device *dev;
1994 + struct device *dev, *dma_dev;
1996 struct ssb_bus *bus;
1997 struct ssb_device_id id;
1998 @@ -269,7 +275,8 @@ struct ssb_bus {
2000 const struct ssb_bus_ops *ops;
2002 - /* The core in the basic address register window. (PCI bus only) */
2003 + /* The core currently mapped into the MMIO window.
2004 + * Not valid on all host-buses. So don't use outside of SSB. */
2005 struct ssb_device *mapped_device;
2007 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */
2008 @@ -281,14 +288,17 @@ struct ssb_bus {
2009 * On PCMCIA-host busses this is used to protect the whole MMIO access. */
2010 spinlock_t bar_lock;
2012 - /* The bus this backplane is running on. */
2013 + /* The host-bus this backplane is running on. */
2014 enum ssb_bustype bustype;
2015 - /* Pointer to the PCI bus (only valid if bustype == SSB_BUSTYPE_PCI). */
2016 - struct pci_dev *host_pci;
2017 - /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
2018 - struct pcmcia_device *host_pcmcia;
2019 - /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */
2020 - struct sdio_func *host_sdio;
2021 + /* Pointers to the host-bus. Check bustype before using any of these pointers. */
2023 + /* Pointer to the PCI bus (only valid if bustype == SSB_BUSTYPE_PCI). */
2024 + struct pci_dev *host_pci;
2025 + /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
2026 + struct pcmcia_device *host_pcmcia;
2027 + /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */
2028 + struct sdio_func *host_sdio;
2031 /* See enum ssb_quirks */
2032 unsigned int quirks;
2033 @@ -300,7 +310,7 @@ struct ssb_bus {
2035 /* ID information about the Chip. */
2040 u16 sprom_size; /* number of words in sprom */
2042 @@ -396,7 +406,9 @@ extern bool ssb_is_sprom_available(struc
2044 /* Set a fallback SPROM.
2045 * See kdoc at the function definition for complete documentation. */
2046 -extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
2047 +extern int ssb_arch_register_fallback_sprom(
2048 + int (*sprom_callback)(struct ssb_bus *bus,
2049 + struct ssb_sprom *out));
2051 /* Suspend a SSB bus.
2052 * Call this from the parent bus suspend routine. */
2053 @@ -667,6 +679,7 @@ extern int ssb_bus_may_powerdown(struct
2054 * Otherwise static always-on powercontrol will be used. */
2055 extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
2057 +extern void ssb_commit_settings(struct ssb_bus *bus);
2059 /* Various helper functions */
2060 extern u32 ssb_admatch_base(u32 adm);
2061 --- a/include/linux/ssb/ssb_regs.h
2062 +++ b/include/linux/ssb/ssb_regs.h
2064 #define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */
2065 #define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */
2066 #define SSB_IMSTATE_TO 0x00040000 /* Timeout */
2067 +#define SSB_IMSTATE_BUSY 0x01800000 /* Busy (Backplane rev >= 2.3 only) */
2068 +#define SSB_IMSTATE_REJECT 0x02000000 /* Reject (Backplane rev >= 2.3 only) */
2069 #define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */
2070 #define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */
2071 #define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */
2073 #define SSB_INTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */
2074 #define SSB_TMSLOW 0x0F98 /* SB Target State Low */
2075 #define SSB_TMSLOW_RESET 0x00000001 /* Reset */
2076 -#define SSB_TMSLOW_REJECT_22 0x00000002 /* Reject (Backplane rev 2.2) */
2077 +#define SSB_TMSLOW_REJECT 0x00000002 /* Reject (Standard Backplane) */
2078 #define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */
2079 #define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */
2080 #define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */
2081 @@ -172,25 +174,25 @@
2082 #define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
2083 #define SSB_SPROM_BASE1 0x1000
2084 #define SSB_SPROM_BASE31 0x0800
2085 -#define SSB_SPROM_REVISION 0x107E
2086 +#define SSB_SPROM_REVISION 0x007E
2087 #define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
2088 #define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
2089 #define SSB_SPROM_REVISION_CRC_SHIFT 8
2091 /* SPROM Revision 1 */
2092 -#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */
2093 -#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */
2094 -#define SSB_SPROM1_PID 0x1008 /* Product ID for PCI */
2095 -#define SSB_SPROM1_IL0MAC 0x1048 /* 6 bytes MAC address for 802.11b/g */
2096 -#define SSB_SPROM1_ET0MAC 0x104E /* 6 bytes MAC address for Ethernet */
2097 -#define SSB_SPROM1_ET1MAC 0x1054 /* 6 bytes MAC address for 802.11a */
2098 -#define SSB_SPROM1_ETHPHY 0x105A /* Ethernet PHY settings */
2099 +#define SSB_SPROM1_SPID 0x0004 /* Subsystem Product ID for PCI */
2100 +#define SSB_SPROM1_SVID 0x0006 /* Subsystem Vendor ID for PCI */
2101 +#define SSB_SPROM1_PID 0x0008 /* Product ID for PCI */
2102 +#define SSB_SPROM1_IL0MAC 0x0048 /* 6 bytes MAC address for 802.11b/g */
2103 +#define SSB_SPROM1_ET0MAC 0x004E /* 6 bytes MAC address for Ethernet */
2104 +#define SSB_SPROM1_ET1MAC 0x0054 /* 6 bytes MAC address for 802.11a */
2105 +#define SSB_SPROM1_ETHPHY 0x005A /* Ethernet PHY settings */
2106 #define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
2107 #define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
2108 #define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5
2109 #define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
2110 #define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
2111 -#define SSB_SPROM1_BINF 0x105C /* Board info */
2112 +#define SSB_SPROM1_BINF 0x005C /* Board info */
2113 #define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
2114 #define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
2115 #define SSB_SPROM1_BINF_CCODE_SHIFT 8
2116 @@ -198,63 +200,63 @@
2117 #define SSB_SPROM1_BINF_ANTBG_SHIFT 12
2118 #define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */
2119 #define SSB_SPROM1_BINF_ANTA_SHIFT 14
2120 -#define SSB_SPROM1_PA0B0 0x105E
2121 -#define SSB_SPROM1_PA0B1 0x1060
2122 -#define SSB_SPROM1_PA0B2 0x1062
2123 -#define SSB_SPROM1_GPIOA 0x1064 /* General Purpose IO pins 0 and 1 */
2124 +#define SSB_SPROM1_PA0B0 0x005E
2125 +#define SSB_SPROM1_PA0B1 0x0060
2126 +#define SSB_SPROM1_PA0B2 0x0062
2127 +#define SSB_SPROM1_GPIOA 0x0064 /* General Purpose IO pins 0 and 1 */
2128 #define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */
2129 #define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */
2130 #define SSB_SPROM1_GPIOA_P1_SHIFT 8
2131 -#define SSB_SPROM1_GPIOB 0x1066 /* General Purpuse IO pins 2 and 3 */
2132 +#define SSB_SPROM1_GPIOB 0x0066 /* General Purpuse IO pins 2 and 3 */
2133 #define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */
2134 #define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */
2135 #define SSB_SPROM1_GPIOB_P3_SHIFT 8
2136 -#define SSB_SPROM1_MAXPWR 0x1068 /* Power Amplifier Max Power */
2137 +#define SSB_SPROM1_MAXPWR 0x0068 /* Power Amplifier Max Power */
2138 #define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */
2139 #define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */
2140 #define SSB_SPROM1_MAXPWR_A_SHIFT 8
2141 -#define SSB_SPROM1_PA1B0 0x106A
2142 -#define SSB_SPROM1_PA1B1 0x106C
2143 -#define SSB_SPROM1_PA1B2 0x106E
2144 -#define SSB_SPROM1_ITSSI 0x1070 /* Idle TSSI Target */
2145 +#define SSB_SPROM1_PA1B0 0x006A
2146 +#define SSB_SPROM1_PA1B1 0x006C
2147 +#define SSB_SPROM1_PA1B2 0x006E
2148 +#define SSB_SPROM1_ITSSI 0x0070 /* Idle TSSI Target */
2149 #define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/
2150 #define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */
2151 #define SSB_SPROM1_ITSSI_A_SHIFT 8
2152 -#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */
2153 -#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */
2154 +#define SSB_SPROM1_BFLLO 0x0072 /* Boardflags (low 16 bits) */
2155 +#define SSB_SPROM1_AGAIN 0x0074 /* Antenna Gain (in dBm Q5.2) */
2156 #define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */
2157 #define SSB_SPROM1_AGAIN_BG_SHIFT 0
2158 #define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
2159 #define SSB_SPROM1_AGAIN_A_SHIFT 8
2161 /* SPROM Revision 2 (inherits from rev 1) */
2162 -#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */
2163 -#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */
2164 +#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */
2165 +#define SSB_SPROM2_MAXP_A 0x003A /* A-PHY Max Power */
2166 #define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */
2167 #define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */
2168 #define SSB_SPROM2_MAXP_A_LO_SHIFT 8
2169 -#define SSB_SPROM2_PA1LOB0 0x103C /* A-PHY PowerAmplifier Low Settings */
2170 -#define SSB_SPROM2_PA1LOB1 0x103E /* A-PHY PowerAmplifier Low Settings */
2171 -#define SSB_SPROM2_PA1LOB2 0x1040 /* A-PHY PowerAmplifier Low Settings */
2172 -#define SSB_SPROM2_PA1HIB0 0x1042 /* A-PHY PowerAmplifier High Settings */
2173 -#define SSB_SPROM2_PA1HIB1 0x1044 /* A-PHY PowerAmplifier High Settings */
2174 -#define SSB_SPROM2_PA1HIB2 0x1046 /* A-PHY PowerAmplifier High Settings */
2175 -#define SSB_SPROM2_OPO 0x1078 /* OFDM Power Offset from CCK Level */
2176 +#define SSB_SPROM2_PA1LOB0 0x003C /* A-PHY PowerAmplifier Low Settings */
2177 +#define SSB_SPROM2_PA1LOB1 0x003E /* A-PHY PowerAmplifier Low Settings */
2178 +#define SSB_SPROM2_PA1LOB2 0x0040 /* A-PHY PowerAmplifier Low Settings */
2179 +#define SSB_SPROM2_PA1HIB0 0x0042 /* A-PHY PowerAmplifier High Settings */
2180 +#define SSB_SPROM2_PA1HIB1 0x0044 /* A-PHY PowerAmplifier High Settings */
2181 +#define SSB_SPROM2_PA1HIB2 0x0046 /* A-PHY PowerAmplifier High Settings */
2182 +#define SSB_SPROM2_OPO 0x0078 /* OFDM Power Offset from CCK Level */
2183 #define SSB_SPROM2_OPO_VALUE 0x00FF
2184 #define SSB_SPROM2_OPO_UNUSED 0xFF00
2185 -#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */
2186 +#define SSB_SPROM2_CCODE 0x007C /* Two char Country Code */
2188 /* SPROM Revision 3 (inherits most data from rev 2) */
2189 -#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */
2190 -#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
2191 -#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
2192 -#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
2193 -#define SSB_SPROM3_GPIOLDC 0x1042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
2194 +#define SSB_SPROM3_OFDMAPO 0x002C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
2195 +#define SSB_SPROM3_OFDMALPO 0x0030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
2196 +#define SSB_SPROM3_OFDMAHPO 0x0034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
2197 +#define SSB_SPROM3_GPIOLDC 0x0042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */
2198 #define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */
2199 #define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8
2200 #define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */
2201 #define SSB_SPROM3_GPIOLDC_ON_SHIFT 16
2202 -#define SSB_SPROM3_CCKPO 0x1078 /* CCK Power Offset */
2203 +#define SSB_SPROM3_IL0MAC 0x004A /* 6 bytes MAC address for 802.11b/g */
2204 +#define SSB_SPROM3_CCKPO 0x0078 /* CCK Power Offset */
2205 #define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */
2206 #define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */
2207 #define SSB_SPROM3_CCKPO_2M_SHIFT 4
2208 @@ -265,100 +267,144 @@
2209 #define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
2211 /* SPROM Revision 4 */
2212 -#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */
2213 -#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */
2214 +#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */
2215 +#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */
2216 +#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */
2217 +#define SSB_SPROM4_BFL2HI 0x004A /* Board flags 2 Hi */
2218 +#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */
2219 +#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */
2220 +#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */
2221 +#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
2222 +#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
2223 +#define SSB_SPROM4_GPIOA_P1_SHIFT 8
2224 +#define SSB_SPROM4_GPIOB 0x0058 /* Gen. Purpose IO # 2 and 3 */
2225 +#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
2226 +#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
2227 +#define SSB_SPROM4_GPIOB_P3_SHIFT 8
2228 +#define SSB_SPROM4_ETHPHY 0x005A /* Ethernet PHY settings ?? */
2229 #define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
2230 #define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
2231 #define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
2232 #define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
2233 #define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
2234 -#define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */
2235 -#define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */
2236 -#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
2237 -#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
2238 -#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
2239 -#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
2240 -#define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */
2241 -#define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */
2242 +#define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */
2243 +#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
2244 +#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
2245 +#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
2246 +#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
2247 +#define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */
2248 #define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
2249 #define SSB_SPROM4_AGAIN0_SHIFT 0
2250 #define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */
2251 #define SSB_SPROM4_AGAIN1_SHIFT 8
2252 -#define SSB_SPROM4_AGAIN23 0x1060
2253 +#define SSB_SPROM4_AGAIN23 0x0060
2254 #define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */
2255 #define SSB_SPROM4_AGAIN2_SHIFT 0
2256 #define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
2257 #define SSB_SPROM4_AGAIN3_SHIFT 8
2258 -#define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */
2259 -#define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */
2260 +#define SSB_SPROM4_TXPID2G01 0x0062 /* TX Power Index 2GHz */
2261 +#define SSB_SPROM4_TXPID2G0 0x00FF
2262 +#define SSB_SPROM4_TXPID2G0_SHIFT 0
2263 +#define SSB_SPROM4_TXPID2G1 0xFF00
2264 +#define SSB_SPROM4_TXPID2G1_SHIFT 8
2265 +#define SSB_SPROM4_TXPID2G23 0x0064 /* TX Power Index 2GHz */
2266 +#define SSB_SPROM4_TXPID2G2 0x00FF
2267 +#define SSB_SPROM4_TXPID2G2_SHIFT 0
2268 +#define SSB_SPROM4_TXPID2G3 0xFF00
2269 +#define SSB_SPROM4_TXPID2G3_SHIFT 8
2270 +#define SSB_SPROM4_TXPID5G01 0x0066 /* TX Power Index 5GHz middle subband */
2271 +#define SSB_SPROM4_TXPID5G0 0x00FF
2272 +#define SSB_SPROM4_TXPID5G0_SHIFT 0
2273 +#define SSB_SPROM4_TXPID5G1 0xFF00
2274 +#define SSB_SPROM4_TXPID5G1_SHIFT 8
2275 +#define SSB_SPROM4_TXPID5G23 0x0068 /* TX Power Index 5GHz middle subband */
2276 +#define SSB_SPROM4_TXPID5G2 0x00FF
2277 +#define SSB_SPROM4_TXPID5G2_SHIFT 0
2278 +#define SSB_SPROM4_TXPID5G3 0xFF00
2279 +#define SSB_SPROM4_TXPID5G3_SHIFT 8
2280 +#define SSB_SPROM4_TXPID5GL01 0x006A /* TX Power Index 5GHz low subband */
2281 +#define SSB_SPROM4_TXPID5GL0 0x00FF
2282 +#define SSB_SPROM4_TXPID5GL0_SHIFT 0
2283 +#define SSB_SPROM4_TXPID5GL1 0xFF00
2284 +#define SSB_SPROM4_TXPID5GL1_SHIFT 8
2285 +#define SSB_SPROM4_TXPID5GL23 0x006C /* TX Power Index 5GHz low subband */
2286 +#define SSB_SPROM4_TXPID5GL2 0x00FF
2287 +#define SSB_SPROM4_TXPID5GL2_SHIFT 0
2288 +#define SSB_SPROM4_TXPID5GL3 0xFF00
2289 +#define SSB_SPROM4_TXPID5GL3_SHIFT 8
2290 +#define SSB_SPROM4_TXPID5GH01 0x006E /* TX Power Index 5GHz high subband */
2291 +#define SSB_SPROM4_TXPID5GH0 0x00FF
2292 +#define SSB_SPROM4_TXPID5GH0_SHIFT 0
2293 +#define SSB_SPROM4_TXPID5GH1 0xFF00
2294 +#define SSB_SPROM4_TXPID5GH1_SHIFT 8
2295 +#define SSB_SPROM4_TXPID5GH23 0x0070 /* TX Power Index 5GHz high subband */
2296 +#define SSB_SPROM4_TXPID5GH2 0x00FF
2297 +#define SSB_SPROM4_TXPID5GH2_SHIFT 0
2298 +#define SSB_SPROM4_TXPID5GH3 0xFF00
2299 +#define SSB_SPROM4_TXPID5GH3_SHIFT 8
2300 +#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */
2301 #define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
2302 #define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
2303 #define SSB_SPROM4_ITSSI_BG_SHIFT 8
2304 -#define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */
2305 +#define SSB_SPROM4_MAXP_A 0x008A /* Max Power A in path 1 */
2306 #define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
2307 #define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
2308 #define SSB_SPROM4_ITSSI_A_SHIFT 8
2309 -#define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */
2310 -#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
2311 -#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
2312 -#define SSB_SPROM4_GPIOA_P1_SHIFT 8
2313 -#define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */
2314 -#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
2315 -#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
2316 -#define SSB_SPROM4_GPIOB_P3_SHIFT 8
2317 -#define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */
2318 -#define SSB_SPROM4_PA0B1 0x1084 /* only guesses */
2319 -#define SSB_SPROM4_PA0B2 0x1086
2320 -#define SSB_SPROM4_PA1B0 0x108E
2321 -#define SSB_SPROM4_PA1B1 0x1090
2322 -#define SSB_SPROM4_PA1B2 0x1092
2323 +#define SSB_SPROM4_PA0B0 0x0082 /* The paXbY locations are */
2324 +#define SSB_SPROM4_PA0B1 0x0084 /* only guesses */
2325 +#define SSB_SPROM4_PA0B2 0x0086
2326 +#define SSB_SPROM4_PA1B0 0x008E
2327 +#define SSB_SPROM4_PA1B1 0x0090
2328 +#define SSB_SPROM4_PA1B2 0x0092
2330 /* SPROM Revision 5 (inherits most data from rev 4) */
2331 -#define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */
2332 -#define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */
2333 -#define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */
2334 -#define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */
2335 -#define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */
2336 +#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */
2337 +#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */
2338 +#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */
2339 +#define SSB_SPROM5_BFL2LO 0x004E /* Board flags 2 (low 16 bits) */
2340 +#define SSB_SPROM5_BFL2HI 0x0050 /* Board flags 2 Hi */
2341 +#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */
2342 +#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */
2343 #define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
2344 #define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */
2345 #define SSB_SPROM5_GPIOA_P1_SHIFT 8
2346 -#define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */
2347 +#define SSB_SPROM5_GPIOB 0x0078 /* Gen. Purpose IO # 2 and 3 */
2348 #define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */
2349 #define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
2350 #define SSB_SPROM5_GPIOB_P3_SHIFT 8
2352 /* SPROM Revision 8 */
2353 -#define SSB_SPROM8_BOARDREV 0x1082 /* Board revision */
2354 -#define SSB_SPROM8_BFLLO 0x1084 /* Board flags (bits 0-15) */
2355 -#define SSB_SPROM8_BFLHI 0x1086 /* Board flags (bits 16-31) */
2356 -#define SSB_SPROM8_BFL2LO 0x1088 /* Board flags (bits 32-47) */
2357 -#define SSB_SPROM8_BFL2HI 0x108A /* Board flags (bits 48-63) */
2358 -#define SSB_SPROM8_IL0MAC 0x108C /* 6 byte MAC address */
2359 -#define SSB_SPROM8_CCODE 0x1092 /* 2 byte country code */
2360 -#define SSB_SPROM8_ANTAVAIL 0x109C /* Antenna available bitfields*/
2361 -#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
2362 -#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
2363 -#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
2364 -#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0
2365 -#define SSB_SPROM8_AGAIN01 0x109E /* Antenna Gain (in dBm Q5.2) */
2366 +#define SSB_SPROM8_BOARDREV 0x0082 /* Board revision */
2367 +#define SSB_SPROM8_BFLLO 0x0084 /* Board flags (bits 0-15) */
2368 +#define SSB_SPROM8_BFLHI 0x0086 /* Board flags (bits 16-31) */
2369 +#define SSB_SPROM8_BFL2LO 0x0088 /* Board flags (bits 32-47) */
2370 +#define SSB_SPROM8_BFL2HI 0x008A /* Board flags (bits 48-63) */
2371 +#define SSB_SPROM8_IL0MAC 0x008C /* 6 byte MAC address */
2372 +#define SSB_SPROM8_CCODE 0x0092 /* 2 byte country code */
2373 +#define SSB_SPROM8_GPIOA 0x0096 /*Gen. Purpose IO # 0 and 1 */
2374 +#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
2375 +#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
2376 +#define SSB_SPROM8_GPIOA_P1_SHIFT 8
2377 +#define SSB_SPROM8_GPIOB 0x0098 /* Gen. Purpose IO # 2 and 3 */
2378 +#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
2379 +#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
2380 +#define SSB_SPROM8_GPIOB_P3_SHIFT 8
2381 +#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/
2382 +#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */
2383 +#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8
2384 +#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */
2385 +#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0
2386 +#define SSB_SPROM8_AGAIN01 0x009E /* Antenna Gain (in dBm Q5.2) */
2387 #define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */
2388 #define SSB_SPROM8_AGAIN0_SHIFT 0
2389 #define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */
2390 #define SSB_SPROM8_AGAIN1_SHIFT 8
2391 -#define SSB_SPROM8_AGAIN23 0x10A0
2392 +#define SSB_SPROM8_AGAIN23 0x00A0
2393 #define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */
2394 #define SSB_SPROM8_AGAIN2_SHIFT 0
2395 #define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */
2396 #define SSB_SPROM8_AGAIN3_SHIFT 8
2397 -#define SSB_SPROM8_GPIOA 0x1096 /*Gen. Purpose IO # 0 and 1 */
2398 -#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */
2399 -#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */
2400 -#define SSB_SPROM8_GPIOA_P1_SHIFT 8
2401 -#define SSB_SPROM8_GPIOB 0x1098 /* Gen. Purpose IO # 2 and 3 */
2402 -#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */
2403 -#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */
2404 -#define SSB_SPROM8_GPIOB_P3_SHIFT 8
2405 -#define SSB_SPROM8_RSSIPARM2G 0x10A4 /* RSSI params for 2GHz */
2406 +#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */
2407 #define SSB_SPROM8_RSSISMF2G 0x000F
2408 #define SSB_SPROM8_RSSISMC2G 0x00F0
2409 #define SSB_SPROM8_RSSISMC2G_SHIFT 4
2411 #define SSB_SPROM8_RSSISAV2G_SHIFT 8
2412 #define SSB_SPROM8_BXA2G 0x1800
2413 #define SSB_SPROM8_BXA2G_SHIFT 11
2414 -#define SSB_SPROM8_RSSIPARM5G 0x10A6 /* RSSI params for 5GHz */
2415 +#define SSB_SPROM8_RSSIPARM5G 0x00A6 /* RSSI params for 5GHz */
2416 #define SSB_SPROM8_RSSISMF5G 0x000F
2417 #define SSB_SPROM8_RSSISMC5G 0x00F0
2418 #define SSB_SPROM8_RSSISMC5G_SHIFT 4
2419 @@ -374,47 +420,47 @@
2420 #define SSB_SPROM8_RSSISAV5G_SHIFT 8
2421 #define SSB_SPROM8_BXA5G 0x1800
2422 #define SSB_SPROM8_BXA5G_SHIFT 11
2423 -#define SSB_SPROM8_TRI25G 0x10A8 /* TX isolation 2.4&5.3GHz */
2424 +#define SSB_SPROM8_TRI25G 0x00A8 /* TX isolation 2.4&5.3GHz */
2425 #define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */
2426 #define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */
2427 #define SSB_SPROM8_TRI5G_SHIFT 8
2428 -#define SSB_SPROM8_TRI5GHL 0x10AA /* TX isolation 5.2/5.8GHz */
2429 +#define SSB_SPROM8_TRI5GHL 0x00AA /* TX isolation 5.2/5.8GHz */
2430 #define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */
2431 #define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */
2432 #define SSB_SPROM8_TRI5GH_SHIFT 8
2433 -#define SSB_SPROM8_RXPO 0x10AC /* RX power offsets */
2434 +#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */
2435 #define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */
2436 #define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */
2437 #define SSB_SPROM8_RXPO5G_SHIFT 8
2438 -#define SSB_SPROM8_MAXP_BG 0x10C0 /* Max Power 2GHz in path 1 */
2439 +#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */
2440 #define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */
2441 #define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
2442 #define SSB_SPROM8_ITSSI_BG_SHIFT 8
2443 -#define SSB_SPROM8_PA0B0 0x10C2 /* 2GHz power amp settings */
2444 -#define SSB_SPROM8_PA0B1 0x10C4
2445 -#define SSB_SPROM8_PA0B2 0x10C6
2446 -#define SSB_SPROM8_MAXP_A 0x10C8 /* Max Power 5.3GHz */
2447 +#define SSB_SPROM8_PA0B0 0x00C2 /* 2GHz power amp settings */
2448 +#define SSB_SPROM8_PA0B1 0x00C4
2449 +#define SSB_SPROM8_PA0B2 0x00C6
2450 +#define SSB_SPROM8_MAXP_A 0x00C8 /* Max Power 5.3GHz */
2451 #define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */
2452 #define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
2453 #define SSB_SPROM8_ITSSI_A_SHIFT 8
2454 -#define SSB_SPROM8_MAXP_AHL 0x10CA /* Max Power 5.2/5.8GHz */
2455 +#define SSB_SPROM8_MAXP_AHL 0x00CA /* Max Power 5.2/5.8GHz */
2456 #define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */
2457 #define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */
2458 #define SSB_SPROM8_MAXP_AL_SHIFT 8
2459 -#define SSB_SPROM8_PA1B0 0x10CC /* 5.3GHz power amp settings */
2460 -#define SSB_SPROM8_PA1B1 0x10CE
2461 -#define SSB_SPROM8_PA1B2 0x10D0
2462 -#define SSB_SPROM8_PA1LOB0 0x10D2 /* 5.2GHz power amp settings */
2463 -#define SSB_SPROM8_PA1LOB1 0x10D4
2464 -#define SSB_SPROM8_PA1LOB2 0x10D6
2465 -#define SSB_SPROM8_PA1HIB0 0x10D8 /* 5.8GHz power amp settings */
2466 -#define SSB_SPROM8_PA1HIB1 0x10DA
2467 -#define SSB_SPROM8_PA1HIB2 0x10DC
2468 -#define SSB_SPROM8_CCK2GPO 0x1140 /* CCK power offset */
2469 -#define SSB_SPROM8_OFDM2GPO 0x1142 /* 2.4GHz OFDM power offset */
2470 -#define SSB_SPROM8_OFDM5GPO 0x1146 /* 5.3GHz OFDM power offset */
2471 -#define SSB_SPROM8_OFDM5GLPO 0x114A /* 5.2GHz OFDM power offset */
2472 -#define SSB_SPROM8_OFDM5GHPO 0x114E /* 5.8GHz OFDM power offset */
2473 +#define SSB_SPROM8_PA1B0 0x00CC /* 5.3GHz power amp settings */
2474 +#define SSB_SPROM8_PA1B1 0x00CE
2475 +#define SSB_SPROM8_PA1B2 0x00D0
2476 +#define SSB_SPROM8_PA1LOB0 0x00D2 /* 5.2GHz power amp settings */
2477 +#define SSB_SPROM8_PA1LOB1 0x00D4
2478 +#define SSB_SPROM8_PA1LOB2 0x00D6
2479 +#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */
2480 +#define SSB_SPROM8_PA1HIB1 0x00DA
2481 +#define SSB_SPROM8_PA1HIB2 0x00DC
2482 +#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */
2483 +#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */
2484 +#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */
2485 +#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */
2486 +#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */
2488 /* Values for SSB_SPROM1_BINF_CCODE */
2490 --- a/include/linux/ssb/ssb_driver_chipcommon.h
2491 +++ b/include/linux/ssb/ssb_driver_chipcommon.h
2493 #define SSB_CHIPCO_FLASHDATA 0x0048
2494 #define SSB_CHIPCO_BCAST_ADDR 0x0050
2495 #define SSB_CHIPCO_BCAST_DATA 0x0054
2496 +#define SSB_CHIPCO_GPIOPULLUP 0x0058 /* Rev >= 20 only */
2497 +#define SSB_CHIPCO_GPIOPULLDOWN 0x005C /* Rev >= 20 only */
2498 #define SSB_CHIPCO_GPIOIN 0x0060
2499 #define SSB_CHIPCO_GPIOOUT 0x0064
2500 #define SSB_CHIPCO_GPIOOUTEN 0x0068
2502 #define SSB_CHIPCO_GPIOIRQ 0x0074
2503 #define SSB_CHIPCO_WATCHDOG 0x0080
2504 #define SSB_CHIPCO_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */
2505 +#define SSB_CHIPCO_GPIOTIMER_OFFTIME 0x0000FFFF
2506 +#define SSB_CHIPCO_GPIOTIMER_OFFTIME_SHIFT 0
2507 +#define SSB_CHIPCO_GPIOTIMER_ONTIME 0xFFFF0000
2508 #define SSB_CHIPCO_GPIOTIMER_ONTIME_SHIFT 16
2509 #define SSB_CHIPCO_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */
2510 #define SSB_CHIPCO_CLOCK_N 0x0090
2511 @@ -189,8 +194,10 @@
2512 #define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */
2513 #define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
2514 #define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */
2515 -#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00010000 /* HT available */
2516 -#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00020000 /* APL available */
2517 +#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00010000 /* ALP available */
2518 +#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00020000 /* HT available */
2519 +#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */
2520 +#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
2521 #define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */
2522 #define SSB_CHIPCO_UART0_DATA 0x0300
2523 #define SSB_CHIPCO_UART0_IMR 0x0304