aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ssb')
-rw-r--r--drivers/ssb/driver_chipcommon.c2
-rw-r--r--drivers/ssb/driver_chipcommon_pmu.c41
-rw-r--r--drivers/ssb/driver_mipscore.c25
-rw-r--r--drivers/ssb/driver_pcicore.c15
-rw-r--r--drivers/ssb/embedded.c5
-rw-r--r--drivers/ssb/main.c51
-rw-r--r--drivers/ssb/pci.c120
-rw-r--r--drivers/ssb/pcmcia.c46
-rw-r--r--drivers/ssb/scan.c31
-rw-r--r--drivers/ssb/sprom.c4
-rw-r--r--drivers/ssb/ssb_private.h19
11 files changed, 174 insertions, 185 deletions
diff --git a/drivers/ssb/driver_chipcommon.c b/drivers/ssb/driver_chipcommon.c
index 71098a7b5fed..7cb7d2c8fd86 100644
--- a/drivers/ssb/driver_chipcommon.c
+++ b/drivers/ssb/driver_chipcommon.c
@@ -354,7 +354,7 @@ void ssb_chipcommon_init(struct ssb_chipcommon *cc)
354 354
355 if (cc->dev->id.revision >= 11) 355 if (cc->dev->id.revision >= 11)
356 cc->status = chipco_read32(cc, SSB_CHIPCO_CHIPSTAT); 356 cc->status = chipco_read32(cc, SSB_CHIPCO_CHIPSTAT);
357 ssb_dprintk(KERN_INFO PFX "chipcommon status is 0x%x\n", cc->status); 357 ssb_dbg("chipcommon status is 0x%x\n", cc->status);
358 358
359 if (cc->dev->id.revision >= 20) { 359 if (cc->dev->id.revision >= 20) {
360 chipco_write32(cc, SSB_CHIPCO_GPIOPULLUP, 0); 360 chipco_write32(cc, SSB_CHIPCO_GPIOPULLUP, 0);
diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
index 7b0bce936762..23c5dbfea115 100644
--- a/drivers/ssb/driver_chipcommon_pmu.c
+++ b/drivers/ssb/driver_chipcommon_pmu.c
@@ -110,8 +110,8 @@ static void ssb_pmu0_pllinit_r0(struct ssb_chipcommon *cc,
110 return; 110 return;
111 } 111 }
112 112
113 ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n", 113 ssb_info("Programming PLL to %u.%03u MHz\n",
114 (crystalfreq / 1000), (crystalfreq % 1000)); 114 crystalfreq / 1000, crystalfreq % 1000);
115 115
116 /* First turn the PLL off. */ 116 /* First turn the PLL off. */
117 switch (bus->chip_id) { 117 switch (bus->chip_id) {
@@ -138,7 +138,7 @@ static void ssb_pmu0_pllinit_r0(struct ssb_chipcommon *cc,
138 } 138 }
139 tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); 139 tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
140 if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT) 140 if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)
141 ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n"); 141 ssb_emerg("Failed to turn the PLL off!\n");
142 142
143 /* Set PDIV in PLL control 0. */ 143 /* Set PDIV in PLL control 0. */
144 pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL0); 144 pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL0);
@@ -249,8 +249,8 @@ static void ssb_pmu1_pllinit_r0(struct ssb_chipcommon *cc,
249 return; 249 return;
250 } 250 }
251 251
252 ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n", 252 ssb_info("Programming PLL to %u.%03u MHz\n",
253 (crystalfreq / 1000), (crystalfreq % 1000)); 253 crystalfreq / 1000, crystalfreq % 1000);
254 254
255 /* First turn the PLL off. */ 255 /* First turn the PLL off. */
256 switch (bus->chip_id) { 256 switch (bus->chip_id) {
@@ -275,7 +275,7 @@ static void ssb_pmu1_pllinit_r0(struct ssb_chipcommon *cc,
275 } 275 }
276 tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST); 276 tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
277 if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT) 277 if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)
278 ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n"); 278 ssb_emerg("Failed to turn the PLL off!\n");
279 279
280 /* Set p1div and p2div. */ 280 /* Set p1div and p2div. */
281 pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL0); 281 pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL0);
@@ -349,9 +349,8 @@ static void ssb_pmu_pll_init(struct ssb_chipcommon *cc)
349 case 43222: 349 case 43222:
350 break; 350 break;
351 default: 351 default:
352 ssb_printk(KERN_ERR PFX 352 ssb_err("ERROR: PLL init unknown for device %04X\n",
353 "ERROR: PLL init unknown for device %04X\n", 353 bus->chip_id);
354 bus->chip_id);
355 } 354 }
356} 355}
357 356
@@ -472,9 +471,8 @@ static void ssb_pmu_resources_init(struct ssb_chipcommon *cc)
472 max_msk = 0xFFFFF; 471 max_msk = 0xFFFFF;
473 break; 472 break;
474 default: 473 default:
475 ssb_printk(KERN_ERR PFX 474 ssb_err("ERROR: PMU resource config unknown for device %04X\n",
476 "ERROR: PMU resource config unknown for device %04X\n", 475 bus->chip_id);
477 bus->chip_id);
478 } 476 }
479 477
480 if (updown_tab) { 478 if (updown_tab) {
@@ -526,8 +524,8 @@ void ssb_pmu_init(struct ssb_chipcommon *cc)
526 pmucap = chipco_read32(cc, SSB_CHIPCO_PMU_CAP); 524 pmucap = chipco_read32(cc, SSB_CHIPCO_PMU_CAP);
527 cc->pmu.rev = (pmucap & SSB_CHIPCO_PMU_CAP_REVISION); 525 cc->pmu.rev = (pmucap & SSB_CHIPCO_PMU_CAP_REVISION);
528 526
529 ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n", 527 ssb_dbg("Found rev %u PMU (capabilities 0x%08X)\n",
530 cc->pmu.rev, pmucap); 528 cc->pmu.rev, pmucap);
531 529
532 if (cc->pmu.rev == 1) 530 if (cc->pmu.rev == 1)
533 chipco_mask32(cc, SSB_CHIPCO_PMU_CTL, 531 chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
@@ -638,9 +636,8 @@ u32 ssb_pmu_get_alp_clock(struct ssb_chipcommon *cc)
638 case 0x5354: 636 case 0x5354:
639 ssb_pmu_get_alp_clock_clk0(cc); 637 ssb_pmu_get_alp_clock_clk0(cc);
640 default: 638 default:
641 ssb_printk(KERN_ERR PFX 639 ssb_err("ERROR: PMU alp clock unknown for device %04X\n",
642 "ERROR: PMU alp clock unknown for device %04X\n", 640 bus->chip_id);
643 bus->chip_id);
644 return 0; 641 return 0;
645 } 642 }
646} 643}
@@ -654,9 +651,8 @@ u32 ssb_pmu_get_cpu_clock(struct ssb_chipcommon *cc)
654 /* 5354 chip uses a non programmable PLL of frequency 240MHz */ 651 /* 5354 chip uses a non programmable PLL of frequency 240MHz */
655 return 240000000; 652 return 240000000;
656 default: 653 default:
657 ssb_printk(KERN_ERR PFX 654 ssb_err("ERROR: PMU cpu clock unknown for device %04X\n",
658 "ERROR: PMU cpu clock unknown for device %04X\n", 655 bus->chip_id);
659 bus->chip_id);
660 return 0; 656 return 0;
661 } 657 }
662} 658}
@@ -669,9 +665,8 @@ u32 ssb_pmu_get_controlclock(struct ssb_chipcommon *cc)
669 case 0x5354: 665 case 0x5354:
670 return 120000000; 666 return 120000000;
671 default: 667 default:
672 ssb_printk(KERN_ERR PFX 668 ssb_err("ERROR: PMU controlclock unknown for device %04X\n",
673 "ERROR: PMU controlclock unknown for device %04X\n", 669 bus->chip_id);
674 bus->chip_id);
675 return 0; 670 return 0;
676 } 671 }
677} 672}
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index 33b37dac40bd..fa385a368a56 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -167,21 +167,22 @@ static void set_irq(struct ssb_device *dev, unsigned int irq)
167 irqflag |= (ipsflag & ~ipsflag_irq_mask[irq]); 167 irqflag |= (ipsflag & ~ipsflag_irq_mask[irq]);
168 ssb_write32(mdev, SSB_IPSFLAG, irqflag); 168 ssb_write32(mdev, SSB_IPSFLAG, irqflag);
169 } 169 }
170 ssb_dprintk(KERN_INFO PFX 170 ssb_dbg("set_irq: core 0x%04x, irq %d => %d\n",
171 "set_irq: core 0x%04x, irq %d => %d\n", 171 dev->id.coreid, oldirq+2, irq+2);
172 dev->id.coreid, oldirq+2, irq+2);
173} 172}
174 173
175static void print_irq(struct ssb_device *dev, unsigned int irq) 174static void print_irq(struct ssb_device *dev, unsigned int irq)
176{ 175{
177 int i;
178 static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"}; 176 static const char *irq_name[] = {"2(S)", "3", "4", "5", "6", "D", "I"};
179 ssb_dprintk(KERN_INFO PFX 177 ssb_dbg("core 0x%04x, irq : %s%s %s%s %s%s %s%s %s%s %s%s %s%s\n",
180 "core 0x%04x, irq :", dev->id.coreid); 178 dev->id.coreid,
181 for (i = 0; i <= 6; i++) { 179 irq_name[0], irq == 0 ? "*" : " ",
182 ssb_dprintk(" %s%s", irq_name[i], i==irq?"*":" "); 180 irq_name[1], irq == 1 ? "*" : " ",
183 } 181 irq_name[2], irq == 2 ? "*" : " ",
184 ssb_dprintk("\n"); 182 irq_name[3], irq == 3 ? "*" : " ",
183 irq_name[4], irq == 4 ? "*" : " ",
184 irq_name[5], irq == 5 ? "*" : " ",
185 irq_name[6], irq == 6 ? "*" : " ");
185} 186}
186 187
187static void dump_irq(struct ssb_bus *bus) 188static void dump_irq(struct ssb_bus *bus)
@@ -286,7 +287,7 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
286 if (!mcore->dev) 287 if (!mcore->dev)
287 return; /* We don't have a MIPS core */ 288 return; /* We don't have a MIPS core */
288 289
289 ssb_dprintk(KERN_INFO PFX "Initializing MIPS core...\n"); 290 ssb_dbg("Initializing MIPS core...\n");
290 291
291 bus = mcore->dev->bus; 292 bus = mcore->dev->bus;
292 hz = ssb_clockspeed(bus); 293 hz = ssb_clockspeed(bus);
@@ -334,7 +335,7 @@ void ssb_mipscore_init(struct ssb_mipscore *mcore)
334 break; 335 break;
335 } 336 }
336 } 337 }
337 ssb_dprintk(KERN_INFO PFX "after irq reconfiguration\n"); 338 ssb_dbg("after irq reconfiguration\n");
338 dump_irq(bus); 339 dump_irq(bus);
339 340
340 ssb_mips_serial_init(mcore); 341 ssb_mips_serial_init(mcore);
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c
index 59801d23d7ec..d75b72ba2672 100644
--- a/drivers/ssb/driver_pcicore.c
+++ b/drivers/ssb/driver_pcicore.c
@@ -263,8 +263,7 @@ int ssb_pcicore_plat_dev_init(struct pci_dev *d)
263 return -ENODEV; 263 return -ENODEV;
264 } 264 }
265 265
266 ssb_printk(KERN_INFO "PCI: Fixing up device %s\n", 266 ssb_info("PCI: Fixing up device %s\n", pci_name(d));
267 pci_name(d));
268 267
269 /* Fix up interrupt lines */ 268 /* Fix up interrupt lines */
270 d->irq = ssb_mips_irq(extpci_core->dev) + 2; 269 d->irq = ssb_mips_irq(extpci_core->dev) + 2;
@@ -285,12 +284,12 @@ static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
285 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0) 284 if (dev->bus->number != 0 || PCI_SLOT(dev->devfn) != 0)
286 return; 285 return;
287 286
288 ssb_printk(KERN_INFO "PCI: Fixing up bridge %s\n", pci_name(dev)); 287 ssb_info("PCI: Fixing up bridge %s\n", pci_name(dev));
289 288
290 /* Enable PCI bridge bus mastering and memory space */ 289 /* Enable PCI bridge bus mastering and memory space */
291 pci_set_master(dev); 290 pci_set_master(dev);
292 if (pcibios_enable_device(dev, ~0) < 0) { 291 if (pcibios_enable_device(dev, ~0) < 0) {
293 ssb_printk(KERN_ERR "PCI: SSB bridge enable failed\n"); 292 ssb_err("PCI: SSB bridge enable failed\n");
294 return; 293 return;
295 } 294 }
296 295
@@ -299,8 +298,8 @@ static void ssb_pcicore_fixup_pcibridge(struct pci_dev *dev)
299 298
300 /* Make sure our latency is high enough to handle the devices behind us */ 299 /* Make sure our latency is high enough to handle the devices behind us */
301 lat = 168; 300 lat = 168;
302 ssb_printk(KERN_INFO "PCI: Fixing latency timer of device %s to %u\n", 301 ssb_info("PCI: Fixing latency timer of device %s to %u\n",
303 pci_name(dev), lat); 302 pci_name(dev), lat);
304 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat); 303 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
305} 304}
306DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_pcicore_fixup_pcibridge); 305DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, ssb_pcicore_fixup_pcibridge);
@@ -323,7 +322,7 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
323 return; 322 return;
324 extpci_core = pc; 323 extpci_core = pc;
325 324
326 ssb_dprintk(KERN_INFO PFX "PCIcore in host mode found\n"); 325 ssb_dbg("PCIcore in host mode found\n");
327 /* Reset devices on the external PCI bus */ 326 /* Reset devices on the external PCI bus */
328 val = SSB_PCICORE_CTL_RST_OE; 327 val = SSB_PCICORE_CTL_RST_OE;
329 val |= SSB_PCICORE_CTL_CLK_OE; 328 val |= SSB_PCICORE_CTL_CLK_OE;
@@ -338,7 +337,7 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc)
338 udelay(1); /* Assertion time demanded by the PCI standard */ 337 udelay(1); /* Assertion time demanded by the PCI standard */
339 338
340 if (pc->dev->bus->has_cardbus_slot) { 339 if (pc->dev->bus->has_cardbus_slot) {
341 ssb_dprintk(KERN_INFO PFX "CardBus slot detected\n"); 340 ssb_dbg("CardBus slot detected\n");
342 pc->cardbusmode = 1; 341 pc->cardbusmode = 1;
343 /* GPIO 1 resets the bridge */ 342 /* GPIO 1 resets the bridge */
344 ssb_gpio_out(pc->dev->bus, 1, 1); 343 ssb_gpio_out(pc->dev->bus, 1, 1);
diff --git a/drivers/ssb/embedded.c b/drivers/ssb/embedded.c
index bb18d76f9f2c..55e101115038 100644
--- a/drivers/ssb/embedded.c
+++ b/drivers/ssb/embedded.c
@@ -57,9 +57,8 @@ int ssb_watchdog_register(struct ssb_bus *bus)
57 bus->busnumber, &wdt, 57 bus->busnumber, &wdt,
58 sizeof(wdt)); 58 sizeof(wdt));
59 if (IS_ERR(pdev)) { 59 if (IS_ERR(pdev)) {
60 ssb_dprintk(KERN_INFO PFX 60 ssb_dbg("can not register watchdog device, err: %li\n",
61 "can not register watchdog device, err: %li\n", 61 PTR_ERR(pdev));
62 PTR_ERR(pdev));
63 return PTR_ERR(pdev); 62 return PTR_ERR(pdev);
64 } 63 }
65 64
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 3b645b8a261f..812775a4bfb6 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -275,8 +275,8 @@ int ssb_devices_thaw(struct ssb_freeze_context *ctx)
275 275
276 err = sdrv->probe(sdev, &sdev->id); 276 err = sdrv->probe(sdev, &sdev->id);
277 if (err) { 277 if (err) {
278 ssb_printk(KERN_ERR PFX "Failed to thaw device %s\n", 278 ssb_err("Failed to thaw device %s\n",
279 dev_name(sdev->dev)); 279 dev_name(sdev->dev));
280 result = err; 280 result = err;
281 } 281 }
282 ssb_device_put(sdev); 282 ssb_device_put(sdev);
@@ -447,10 +447,9 @@ void ssb_bus_unregister(struct ssb_bus *bus)
447 447
448 err = ssb_gpio_unregister(bus); 448 err = ssb_gpio_unregister(bus);
449 if (err == -EBUSY) 449 if (err == -EBUSY)
450 ssb_dprintk(KERN_ERR PFX "Some GPIOs are still in use.\n"); 450 ssb_dbg("Some GPIOs are still in use\n");
451 else if (err) 451 else if (err)
452 ssb_dprintk(KERN_ERR PFX 452 ssb_dbg("Can not unregister GPIO driver: %i\n", err);
453 "Can not unregister GPIO driver: %i\n", err);
454 453
455 ssb_buses_lock(); 454 ssb_buses_lock();
456 ssb_devices_unregister(bus); 455 ssb_devices_unregister(bus);
@@ -497,8 +496,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
497 496
498 devwrap = kzalloc(sizeof(*devwrap), GFP_KERNEL); 497 devwrap = kzalloc(sizeof(*devwrap), GFP_KERNEL);
499 if (!devwrap) { 498 if (!devwrap) {
500 ssb_printk(KERN_ERR PFX 499 ssb_err("Could not allocate device\n");
501 "Could not allocate device\n");
502 err = -ENOMEM; 500 err = -ENOMEM;
503 goto error; 501 goto error;
504 } 502 }
@@ -537,9 +535,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
537 sdev->dev = dev; 535 sdev->dev = dev;
538 err = device_register(dev); 536 err = device_register(dev);
539 if (err) { 537 if (err) {
540 ssb_printk(KERN_ERR PFX 538 ssb_err("Could not register %s\n", dev_name(dev));
541 "Could not register %s\n",
542 dev_name(dev));
543 /* Set dev to NULL to not unregister 539 /* Set dev to NULL to not unregister
544 * dev on error unwinding. */ 540 * dev on error unwinding. */
545 sdev->dev = NULL; 541 sdev->dev = NULL;
@@ -825,10 +821,9 @@ static int ssb_bus_register(struct ssb_bus *bus,
825 ssb_mipscore_init(&bus->mipscore); 821 ssb_mipscore_init(&bus->mipscore);
826 err = ssb_gpio_init(bus); 822 err = ssb_gpio_init(bus);
827 if (err == -ENOTSUPP) 823 if (err == -ENOTSUPP)
828 ssb_dprintk(KERN_DEBUG PFX "GPIO driver not activated\n"); 824 ssb_dbg("GPIO driver not activated\n");
829 else if (err) 825 else if (err)
830 ssb_dprintk(KERN_ERR PFX 826 ssb_dbg("Error registering GPIO driver: %i\n", err);
831 "Error registering GPIO driver: %i\n", err);
832 err = ssb_fetch_invariants(bus, get_invariants); 827 err = ssb_fetch_invariants(bus, get_invariants);
833 if (err) { 828 if (err) {
834 ssb_bus_may_powerdown(bus); 829 ssb_bus_may_powerdown(bus);
@@ -878,11 +873,11 @@ int ssb_bus_pcibus_register(struct ssb_bus *bus, struct pci_dev *host_pci)
878 873
879 err = ssb_bus_register(bus, ssb_pci_get_invariants, 0); 874 err = ssb_bus_register(bus, ssb_pci_get_invariants, 0);
880 if (!err) { 875 if (!err) {
881 ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on " 876 ssb_info("Sonics Silicon Backplane found on PCI device %s\n",
882 "PCI device %s\n", dev_name(&host_pci->dev)); 877 dev_name(&host_pci->dev));
883 } else { 878 } else {
884 ssb_printk(KERN_ERR PFX "Failed to register PCI version" 879 ssb_err("Failed to register PCI version of SSB with error %d\n",
885 " of SSB with error %d\n", err); 880 err);
886 } 881 }
887 882
888 return err; 883 return err;
@@ -903,8 +898,8 @@ int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
903 898
904 err = ssb_bus_register(bus, ssb_pcmcia_get_invariants, baseaddr); 899 err = ssb_bus_register(bus, ssb_pcmcia_get_invariants, baseaddr);
905 if (!err) { 900 if (!err) {
906 ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on " 901 ssb_info("Sonics Silicon Backplane found on PCMCIA device %s\n",
907 "PCMCIA device %s\n", pcmcia_dev->devname); 902 pcmcia_dev->devname);
908 } 903 }
909 904
910 return err; 905 return err;
@@ -925,8 +920,8 @@ int ssb_bus_sdiobus_register(struct ssb_bus *bus, struct sdio_func *func,
925 920
926 err = ssb_bus_register(bus, ssb_sdio_get_invariants, ~0); 921 err = ssb_bus_register(bus, ssb_sdio_get_invariants, ~0);
927 if (!err) { 922 if (!err) {
928 ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found on " 923 ssb_info("Sonics Silicon Backplane found on SDIO device %s\n",
929 "SDIO device %s\n", sdio_func_id(func)); 924 sdio_func_id(func));
930 } 925 }
931 926
932 return err; 927 return err;
@@ -944,8 +939,8 @@ int ssb_bus_ssbbus_register(struct ssb_bus *bus, unsigned long baseaddr,
944 939
945 err = ssb_bus_register(bus, get_invariants, baseaddr); 940 err = ssb_bus_register(bus, get_invariants, baseaddr);
946 if (!err) { 941 if (!err) {
947 ssb_printk(KERN_INFO PFX "Sonics Silicon Backplane found at " 942 ssb_info("Sonics Silicon Backplane found at address 0x%08lX\n",
948 "address 0x%08lX\n", baseaddr); 943 baseaddr);
949 } 944 }
950 945
951 return err; 946 return err;
@@ -1339,7 +1334,7 @@ out:
1339#endif 1334#endif
1340 return err; 1335 return err;
1341error: 1336error:
1342 ssb_printk(KERN_ERR PFX "Bus powerdown failed\n"); 1337 ssb_err("Bus powerdown failed\n");
1343 goto out; 1338 goto out;
1344} 1339}
1345EXPORT_SYMBOL(ssb_bus_may_powerdown); 1340EXPORT_SYMBOL(ssb_bus_may_powerdown);
@@ -1362,7 +1357,7 @@ int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl)
1362 1357
1363 return 0; 1358 return 0;
1364error: 1359error:
1365 ssb_printk(KERN_ERR PFX "Bus powerup failed\n"); 1360 ssb_err("Bus powerup failed\n");
1366 return err; 1361 return err;
1367} 1362}
1368EXPORT_SYMBOL(ssb_bus_powerup); 1363EXPORT_SYMBOL(ssb_bus_powerup);
@@ -1470,15 +1465,13 @@ static int __init ssb_modinit(void)
1470 1465
1471 err = b43_pci_ssb_bridge_init(); 1466 err = b43_pci_ssb_bridge_init();
1472 if (err) { 1467 if (err) {
1473 ssb_printk(KERN_ERR "Broadcom 43xx PCI-SSB-bridge " 1468 ssb_err("Broadcom 43xx PCI-SSB-bridge initialization failed\n");
1474 "initialization failed\n");
1475 /* don't fail SSB init because of this */ 1469 /* don't fail SSB init because of this */
1476 err = 0; 1470 err = 0;
1477 } 1471 }
1478 err = ssb_gige_init(); 1472 err = ssb_gige_init();
1479 if (err) { 1473 if (err) {
1480 ssb_printk(KERN_ERR "SSB Broadcom Gigabit Ethernet " 1474 ssb_err("SSB Broadcom Gigabit Ethernet driver initialization failed\n");
1481 "driver initialization failed\n");
1482 /* don't fail SSB init because of this */ 1475 /* don't fail SSB init because of this */
1483 err = 0; 1476 err = 0;
1484 } 1477 }
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index e9d94968f394..a8dc95ebf2d6 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -56,7 +56,7 @@ int ssb_pci_switch_coreidx(struct ssb_bus *bus, u8 coreidx)
56 } 56 }
57 return 0; 57 return 0;
58error: 58error:
59 ssb_printk(KERN_ERR PFX "Failed to switch to core %u\n", coreidx); 59 ssb_err("Failed to switch to core %u\n", coreidx);
60 return -ENODEV; 60 return -ENODEV;
61} 61}
62 62
@@ -67,10 +67,9 @@ int ssb_pci_switch_core(struct ssb_bus *bus,
67 unsigned long flags; 67 unsigned long flags;
68 68
69#if SSB_VERBOSE_PCICORESWITCH_DEBUG 69#if SSB_VERBOSE_PCICORESWITCH_DEBUG
70 ssb_printk(KERN_INFO PFX 70 ssb_info("Switching to %s core, index %d\n",
71 "Switching to %s core, index %d\n", 71 ssb_core_name(dev->id.coreid),
72 ssb_core_name(dev->id.coreid), 72 dev->core_index);
73 dev->core_index);
74#endif 73#endif
75 74
76 spin_lock_irqsave(&bus->bar_lock, flags); 75 spin_lock_irqsave(&bus->bar_lock, flags);
@@ -231,6 +230,15 @@ static inline u8 ssb_crc8(u8 crc, u8 data)
231 return t[crc ^ data]; 230 return t[crc ^ data];
232} 231}
233 232
233static void sprom_get_mac(char *mac, const u16 *in)
234{
235 int i;
236 for (i = 0; i < 3; i++) {
237 *mac++ = in[i] >> 8;
238 *mac++ = in[i];
239 }
240}
241
234static u8 ssb_sprom_crc(const u16 *sprom, u16 size) 242static u8 ssb_sprom_crc(const u16 *sprom, u16 size)
235{ 243{
236 int word; 244 int word;
@@ -278,7 +286,7 @@ static int sprom_do_write(struct ssb_bus *bus, const u16 *sprom)
278 u32 spromctl; 286 u32 spromctl;
279 u16 size = bus->sprom_size; 287 u16 size = bus->sprom_size;
280 288
281 ssb_printk(KERN_NOTICE PFX "Writing SPROM. Do NOT turn off the power! Please stand by...\n"); 289 ssb_notice("Writing SPROM. Do NOT turn off the power! Please stand by...\n");
282 err = pci_read_config_dword(pdev, SSB_SPROMCTL, &spromctl); 290 err = pci_read_config_dword(pdev, SSB_SPROMCTL, &spromctl);
283 if (err) 291 if (err)
284 goto err_ctlreg; 292 goto err_ctlreg;
@@ -286,17 +294,17 @@ static int sprom_do_write(struct ssb_bus *bus, const u16 *sprom)
286 err = pci_write_config_dword(pdev, SSB_SPROMCTL, spromctl); 294 err = pci_write_config_dword(pdev, SSB_SPROMCTL, spromctl);
287 if (err) 295 if (err)
288 goto err_ctlreg; 296 goto err_ctlreg;
289 ssb_printk(KERN_NOTICE PFX "[ 0%%"); 297 ssb_notice("[ 0%%");
290 msleep(500); 298 msleep(500);
291 for (i = 0; i < size; i++) { 299 for (i = 0; i < size; i++) {
292 if (i == size / 4) 300 if (i == size / 4)
293 ssb_printk("25%%"); 301 ssb_cont("25%%");
294 else if (i == size / 2) 302 else if (i == size / 2)
295 ssb_printk("50%%"); 303 ssb_cont("50%%");
296 else if (i == (size * 3) / 4) 304 else if (i == (size * 3) / 4)
297 ssb_printk("75%%"); 305 ssb_cont("75%%");
298 else if (i % 2) 306 else if (i % 2)
299 ssb_printk("."); 307 ssb_cont(".");
300 writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2)); 308 writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2));
301 mmiowb(); 309 mmiowb();
302 msleep(20); 310 msleep(20);
@@ -309,12 +317,12 @@ static int sprom_do_write(struct ssb_bus *bus, const u16 *sprom)
309 if (err) 317 if (err)
310 goto err_ctlreg; 318 goto err_ctlreg;
311 msleep(500); 319 msleep(500);
312 ssb_printk("100%% ]\n"); 320 ssb_cont("100%% ]\n");
313 ssb_printk(KERN_NOTICE PFX "SPROM written.\n"); 321 ssb_notice("SPROM written\n");
314 322
315 return 0; 323 return 0;
316err_ctlreg: 324err_ctlreg:
317 ssb_printk(KERN_ERR PFX "Could not access SPROM control register.\n"); 325 ssb_err("Could not access SPROM control register.\n");
318 return err; 326 return err;
319} 327}
320 328
@@ -339,10 +347,23 @@ static s8 r123_extract_antgain(u8 sprom_revision, const u16 *in,
339 return (s8)gain; 347 return (s8)gain;
340} 348}
341 349
350static void sprom_extract_r23(struct ssb_sprom *out, const u16 *in)
351{
352 SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0);
353 SPEX(opo, SSB_SPROM2_OPO, SSB_SPROM2_OPO_VALUE, 0);
354 SPEX(pa1lob0, SSB_SPROM2_PA1LOB0, 0xFFFF, 0);
355 SPEX(pa1lob1, SSB_SPROM2_PA1LOB1, 0xFFFF, 0);
356 SPEX(pa1lob2, SSB_SPROM2_PA1LOB2, 0xFFFF, 0);
357 SPEX(pa1hib0, SSB_SPROM2_PA1HIB0, 0xFFFF, 0);
358 SPEX(pa1hib1, SSB_SPROM2_PA1HIB1, 0xFFFF, 0);
359 SPEX(pa1hib2, SSB_SPROM2_PA1HIB2, 0xFFFF, 0);
360 SPEX(maxpwr_ah, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_HI, 0);
361 SPEX(maxpwr_al, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_LO,
362 SSB_SPROM2_MAXP_A_LO_SHIFT);
363}
364
342static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) 365static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
343{ 366{
344 int i;
345 u16 v;
346 u16 loc[3]; 367 u16 loc[3];
347 368
348 if (out->revision == 3) /* rev 3 moved MAC */ 369 if (out->revision == 3) /* rev 3 moved MAC */
@@ -352,19 +373,10 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
352 loc[1] = SSB_SPROM1_ET0MAC; 373 loc[1] = SSB_SPROM1_ET0MAC;
353 loc[2] = SSB_SPROM1_ET1MAC; 374 loc[2] = SSB_SPROM1_ET1MAC;
354 } 375 }
355 for (i = 0; i < 3; i++) { 376 sprom_get_mac(out->il0mac, &in[SPOFF(loc[0])]);
356 v = in[SPOFF(loc[0]) + i];
357 *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v);
358 }
359 if (out->revision < 3) { /* only rev 1-2 have et0, et1 */ 377 if (out->revision < 3) { /* only rev 1-2 have et0, et1 */
360 for (i = 0; i < 3; i++) { 378 sprom_get_mac(out->et0mac, &in[SPOFF(loc[1])]);
361 v = in[SPOFF(loc[1]) + i]; 379 sprom_get_mac(out->et1mac, &in[SPOFF(loc[2])]);
362 *(((__be16 *)out->et0mac) + i) = cpu_to_be16(v);
363 }
364 for (i = 0; i < 3; i++) {
365 v = in[SPOFF(loc[2]) + i];
366 *(((__be16 *)out->et1mac) + i) = cpu_to_be16(v);
367 }
368 } 380 }
369 SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0); 381 SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0);
370 SPEX(et1phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1A, 382 SPEX(et1phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1A,
@@ -372,6 +384,7 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
372 SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); 384 SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14);
373 SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); 385 SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15);
374 SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); 386 SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0);
387 SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0);
375 if (out->revision == 1) 388 if (out->revision == 1)
376 SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, 389 SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE,
377 SSB_SPROM1_BINF_CCODE_SHIFT); 390 SSB_SPROM1_BINF_CCODE_SHIFT);
@@ -398,8 +411,7 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
398 SSB_SPROM1_ITSSI_A_SHIFT); 411 SSB_SPROM1_ITSSI_A_SHIFT);
399 SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG, 0); 412 SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG, 0);
400 SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); 413 SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0);
401 if (out->revision >= 2) 414
402 SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0);
403 SPEX(alpha2[0], SSB_SPROM1_CCODE, 0xff00, 8); 415 SPEX(alpha2[0], SSB_SPROM1_CCODE, 0xff00, 8);
404 SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0); 416 SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0);
405 417
@@ -410,6 +422,8 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)
410 out->antenna_gain.a1 = r123_extract_antgain(out->revision, in, 422 out->antenna_gain.a1 = r123_extract_antgain(out->revision, in,
411 SSB_SPROM1_AGAIN_A, 423 SSB_SPROM1_AGAIN_A,
412 SSB_SPROM1_AGAIN_A_SHIFT); 424 SSB_SPROM1_AGAIN_A_SHIFT);
425 if (out->revision >= 2)
426 sprom_extract_r23(out, in);
413} 427}
414 428
415/* Revs 4 5 and 8 have partially shared layout */ 429/* Revs 4 5 and 8 have partially shared layout */
@@ -454,23 +468,20 @@ static void sprom_extract_r458(struct ssb_sprom *out, const u16 *in)
454 468
455static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) 469static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
456{ 470{
457 int i;
458 u16 v;
459 u16 il0mac_offset; 471 u16 il0mac_offset;
460 472
461 if (out->revision == 4) 473 if (out->revision == 4)
462 il0mac_offset = SSB_SPROM4_IL0MAC; 474 il0mac_offset = SSB_SPROM4_IL0MAC;
463 else 475 else
464 il0mac_offset = SSB_SPROM5_IL0MAC; 476 il0mac_offset = SSB_SPROM5_IL0MAC;
465 /* extract the MAC address */ 477
466 for (i = 0; i < 3; i++) { 478 sprom_get_mac(out->il0mac, &in[SPOFF(il0mac_offset)]);
467 v = in[SPOFF(il0mac_offset) + i]; 479
468 *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v);
469 }
470 SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); 480 SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0);
471 SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, 481 SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A,
472 SSB_SPROM4_ETHPHY_ET1A_SHIFT); 482 SSB_SPROM4_ETHPHY_ET1A_SHIFT);
473 SPEX(board_rev, SSB_SPROM4_BOARDREV, 0xFFFF, 0); 483 SPEX(board_rev, SSB_SPROM4_BOARDREV, 0xFFFF, 0);
484 SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0);
474 if (out->revision == 4) { 485 if (out->revision == 4) {
475 SPEX(alpha2[0], SSB_SPROM4_CCODE, 0xff00, 8); 486 SPEX(alpha2[0], SSB_SPROM4_CCODE, 0xff00, 8);
476 SPEX(alpha2[1], SSB_SPROM4_CCODE, 0x00ff, 0); 487 SPEX(alpha2[1], SSB_SPROM4_CCODE, 0x00ff, 0);
@@ -530,7 +541,7 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
530static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) 541static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
531{ 542{
532 int i; 543 int i;
533 u16 v, o; 544 u16 o;
534 u16 pwr_info_offset[] = { 545 u16 pwr_info_offset[] = {
535 SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1, 546 SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1,
536 SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3 547 SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3
@@ -539,11 +550,10 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
539 ARRAY_SIZE(out->core_pwr_info)); 550 ARRAY_SIZE(out->core_pwr_info));
540 551
541 /* extract the MAC address */ 552 /* extract the MAC address */
542 for (i = 0; i < 3; i++) { 553 sprom_get_mac(out->il0mac, &in[SPOFF(SSB_SPROM8_IL0MAC)]);
543 v = in[SPOFF(SSB_SPROM8_IL0MAC) + i]; 554
544 *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v);
545 }
546 SPEX(board_rev, SSB_SPROM8_BOARDREV, 0xFFFF, 0); 555 SPEX(board_rev, SSB_SPROM8_BOARDREV, 0xFFFF, 0);
556 SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0);
547 SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8); 557 SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8);
548 SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0); 558 SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0);
549 SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); 559 SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0);
@@ -743,7 +753,7 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
743 memset(out, 0, sizeof(*out)); 753 memset(out, 0, sizeof(*out));
744 754
745 out->revision = in[size - 1] & 0x00FF; 755 out->revision = in[size - 1] & 0x00FF;
746 ssb_dprintk(KERN_DEBUG PFX "SPROM revision %d detected.\n", out->revision); 756 ssb_dbg("SPROM revision %d detected\n", out->revision);
747 memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */ 757 memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */
748 memset(out->et1mac, 0xFF, 6); 758 memset(out->et1mac, 0xFF, 6);
749 759
@@ -752,7 +762,7 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
752 * number stored in the SPROM. 762 * number stored in the SPROM.
753 * Always extract r1. */ 763 * Always extract r1. */
754 out->revision = 1; 764 out->revision = 1;
755 ssb_dprintk(KERN_DEBUG PFX "SPROM treated as revision %d\n", out->revision); 765 ssb_dbg("SPROM treated as revision %d\n", out->revision);
756 } 766 }
757 767
758 switch (out->revision) { 768 switch (out->revision) {
@@ -769,9 +779,8 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
769 sprom_extract_r8(out, in); 779 sprom_extract_r8(out, in);
770 break; 780 break;
771 default: 781 default:
772 ssb_printk(KERN_WARNING PFX "Unsupported SPROM" 782 ssb_warn("Unsupported SPROM revision %d detected. Will extract v1\n",
773 " revision %d detected. Will extract" 783 out->revision);
774 " v1\n", out->revision);
775 out->revision = 1; 784 out->revision = 1;
776 sprom_extract_r123(out, in); 785 sprom_extract_r123(out, in);
777 } 786 }
@@ -791,7 +800,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
791 u16 *buf; 800 u16 *buf;
792 801
793 if (!ssb_is_sprom_available(bus)) { 802 if (!ssb_is_sprom_available(bus)) {
794 ssb_printk(KERN_ERR PFX "No SPROM available!\n"); 803 ssb_err("No SPROM available!\n");
795 return -ENODEV; 804 return -ENODEV;
796 } 805 }
797 if (bus->chipco.dev) { /* can be unavailable! */ 806 if (bus->chipco.dev) { /* can be unavailable! */
@@ -810,7 +819,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
810 } else { 819 } else {
811 bus->sprom_offset = SSB_SPROM_BASE1; 820 bus->sprom_offset = SSB_SPROM_BASE1;
812 } 821 }
813 ssb_dprintk(KERN_INFO PFX "SPROM offset is 0x%x\n", bus->sprom_offset); 822 ssb_dbg("SPROM offset is 0x%x\n", bus->sprom_offset);
814 823
815 buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL); 824 buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
816 if (!buf) 825 if (!buf)
@@ -835,18 +844,15 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
835 * available for this device in some other storage */ 844 * available for this device in some other storage */
836 err = ssb_fill_sprom_with_fallback(bus, sprom); 845 err = ssb_fill_sprom_with_fallback(bus, sprom);
837 if (err) { 846 if (err) {
838 ssb_printk(KERN_WARNING PFX "WARNING: Using" 847 ssb_warn("WARNING: Using fallback SPROM failed (err %d)\n",
839 " fallback SPROM failed (err %d)\n", 848 err);
840 err);
841 } else { 849 } else {
842 ssb_dprintk(KERN_DEBUG PFX "Using SPROM" 850 ssb_dbg("Using SPROM revision %d provided by platform\n",
843 " revision %d provided by" 851 sprom->revision);
844 " platform.\n", sprom->revision);
845 err = 0; 852 err = 0;
846 goto out_free; 853 goto out_free;
847 } 854 }
848 ssb_printk(KERN_WARNING PFX "WARNING: Invalid" 855 ssb_warn("WARNING: Invalid SPROM CRC (corrupt SPROM)\n");
849 " SPROM CRC (corrupt SPROM)\n");
850 } 856 }
851 } 857 }
852 err = sprom_extract(bus, sprom, buf, bus->sprom_size); 858 err = sprom_extract(bus, sprom, buf, bus->sprom_size);
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c
index fbafed5b729b..b413e0187087 100644
--- a/drivers/ssb/pcmcia.c
+++ b/drivers/ssb/pcmcia.c
@@ -143,7 +143,7 @@ int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
143 143
144 return 0; 144 return 0;
145error: 145error:
146 ssb_printk(KERN_ERR PFX "Failed to switch to core %u\n", coreidx); 146 ssb_err("Failed to switch to core %u\n", coreidx);
147 return err; 147 return err;
148} 148}
149 149
@@ -153,10 +153,9 @@ int ssb_pcmcia_switch_core(struct ssb_bus *bus,
153 int err; 153 int err;
154 154
155#if SSB_VERBOSE_PCMCIACORESWITCH_DEBUG 155#if SSB_VERBOSE_PCMCIACORESWITCH_DEBUG
156 ssb_printk(KERN_INFO PFX 156 ssb_info("Switching to %s core, index %d\n",
157 "Switching to %s core, index %d\n", 157 ssb_core_name(dev->id.coreid),
158 ssb_core_name(dev->id.coreid), 158 dev->core_index);
159 dev->core_index);
160#endif 159#endif
161 160
162 err = ssb_pcmcia_switch_coreidx(bus, dev->core_index); 161 err = ssb_pcmcia_switch_coreidx(bus, dev->core_index);
@@ -192,7 +191,7 @@ int ssb_pcmcia_switch_segment(struct ssb_bus *bus, u8 seg)
192 191
193 return 0; 192 return 0;
194error: 193error:
195 ssb_printk(KERN_ERR PFX "Failed to switch pcmcia segment\n"); 194 ssb_err("Failed to switch pcmcia segment\n");
196 return err; 195 return err;
197} 196}
198 197
@@ -549,44 +548,39 @@ static int ssb_pcmcia_sprom_write_all(struct ssb_bus *bus, const u16 *sprom)
549 bool failed = 0; 548 bool failed = 0;
550 size_t size = SSB_PCMCIA_SPROM_SIZE; 549 size_t size = SSB_PCMCIA_SPROM_SIZE;
551 550
552 ssb_printk(KERN_NOTICE PFX 551 ssb_notice("Writing SPROM. Do NOT turn off the power! Please stand by...\n");
553 "Writing SPROM. Do NOT turn off the power! "
554 "Please stand by...\n");
555 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEEN); 552 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEEN);
556 if (err) { 553 if (err) {
557 ssb_printk(KERN_NOTICE PFX 554 ssb_notice("Could not enable SPROM write access\n");
558 "Could not enable SPROM write access.\n");
559 return -EBUSY; 555 return -EBUSY;
560 } 556 }
561 ssb_printk(KERN_NOTICE PFX "[ 0%%"); 557 ssb_notice("[ 0%%");
562 msleep(500); 558 msleep(500);
563 for (i = 0; i < size; i++) { 559 for (i = 0; i < size; i++) {
564 if (i == size / 4) 560 if (i == size / 4)
565 ssb_printk("25%%"); 561 ssb_cont("25%%");
566 else if (i == size / 2) 562 else if (i == size / 2)
567 ssb_printk("50%%"); 563 ssb_cont("50%%");
568 else if (i == (size * 3) / 4) 564 else if (i == (size * 3) / 4)
569 ssb_printk("75%%"); 565 ssb_cont("75%%");
570 else if (i % 2) 566 else if (i % 2)
571 ssb_printk("."); 567 ssb_cont(".");
572 err = ssb_pcmcia_sprom_write(bus, i, sprom[i]); 568 err = ssb_pcmcia_sprom_write(bus, i, sprom[i]);
573 if (err) { 569 if (err) {
574 ssb_printk(KERN_NOTICE PFX 570 ssb_notice("Failed to write to SPROM\n");
575 "Failed to write to SPROM.\n");
576 failed = 1; 571 failed = 1;
577 break; 572 break;
578 } 573 }
579 } 574 }
580 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS); 575 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS);
581 if (err) { 576 if (err) {
582 ssb_printk(KERN_NOTICE PFX 577 ssb_notice("Could not disable SPROM write access\n");
583 "Could not disable SPROM write access.\n");
584 failed = 1; 578 failed = 1;
585 } 579 }
586 msleep(500); 580 msleep(500);
587 if (!failed) { 581 if (!failed) {
588 ssb_printk("100%% ]\n"); 582 ssb_cont("100%% ]\n");
589 ssb_printk(KERN_NOTICE PFX "SPROM written.\n"); 583 ssb_notice("SPROM written\n");
590 } 584 }
591 585
592 return failed ? -EBUSY : 0; 586 return failed ? -EBUSY : 0;
@@ -700,7 +694,7 @@ static int ssb_pcmcia_do_get_invariants(struct pcmcia_device *p_dev,
700 return -ENOSPC; /* continue with next entry */ 694 return -ENOSPC; /* continue with next entry */
701 695
702error: 696error:
703 ssb_printk(KERN_ERR PFX 697 ssb_err(
704 "PCMCIA: Failed to fetch device invariants: %s\n", 698 "PCMCIA: Failed to fetch device invariants: %s\n",
705 error_description); 699 error_description);
706 return -ENODEV; 700 return -ENODEV;
@@ -722,7 +716,7 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
722 res = pcmcia_loop_tuple(bus->host_pcmcia, CISTPL_FUNCE, 716 res = pcmcia_loop_tuple(bus->host_pcmcia, CISTPL_FUNCE,
723 ssb_pcmcia_get_mac, sprom); 717 ssb_pcmcia_get_mac, sprom);
724 if (res != 0) { 718 if (res != 0) {
725 ssb_printk(KERN_ERR PFX 719 ssb_err(
726 "PCMCIA: Failed to fetch MAC address\n"); 720 "PCMCIA: Failed to fetch MAC address\n");
727 return -ENODEV; 721 return -ENODEV;
728 } 722 }
@@ -733,7 +727,7 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
733 if ((res == 0) || (res == -ENOSPC)) 727 if ((res == 0) || (res == -ENOSPC))
734 return 0; 728 return 0;
735 729
736 ssb_printk(KERN_ERR PFX 730 ssb_err(
737 "PCMCIA: Failed to fetch device invariants\n"); 731 "PCMCIA: Failed to fetch device invariants\n");
738 return -ENODEV; 732 return -ENODEV;
739} 733}
@@ -843,6 +837,6 @@ int ssb_pcmcia_init(struct ssb_bus *bus)
843 837
844 return 0; 838 return 0;
845error: 839error:
846 ssb_printk(KERN_ERR PFX "Failed to initialize PCMCIA host device\n"); 840 ssb_err("Failed to initialize PCMCIA host device\n");
847 return err; 841 return err;
848} 842}
diff --git a/drivers/ssb/scan.c b/drivers/ssb/scan.c
index ab4627cf1114..b9429df583eb 100644
--- a/drivers/ssb/scan.c
+++ b/drivers/ssb/scan.c
@@ -125,8 +125,7 @@ static u16 pcidev_to_chipid(struct pci_dev *pci_dev)
125 chipid_fallback = 0x4401; 125 chipid_fallback = 0x4401;
126 break; 126 break;
127 default: 127 default:
128 ssb_printk(KERN_ERR PFX 128 ssb_err("PCI-ID not in fallback list\n");
129 "PCI-ID not in fallback list\n");
130 } 129 }
131 130
132 return chipid_fallback; 131 return chipid_fallback;
@@ -152,8 +151,7 @@ static u8 chipid_to_nrcores(u16 chipid)
152 case 0x4704: 151 case 0x4704:
153 return 9; 152 return 9;
154 default: 153 default:
155 ssb_printk(KERN_ERR PFX 154 ssb_err("CHIPID not in nrcores fallback list\n");
156 "CHIPID not in nrcores fallback list\n");
157 } 155 }
158 156
159 return 1; 157 return 1;
@@ -320,15 +318,13 @@ int ssb_bus_scan(struct ssb_bus *bus,
320 bus->chip_package = 0; 318 bus->chip_package = 0;
321 } 319 }
322 } 320 }
323 ssb_printk(KERN_INFO PFX "Found chip with id 0x%04X, rev 0x%02X and " 321 ssb_info("Found chip with id 0x%04X, rev 0x%02X and package 0x%02X\n",
324 "package 0x%02X\n", bus->chip_id, bus->chip_rev, 322 bus->chip_id, bus->chip_rev, bus->chip_package);
325 bus->chip_package);
326 if (!bus->nr_devices) 323 if (!bus->nr_devices)
327 bus->nr_devices = chipid_to_nrcores(bus->chip_id); 324 bus->nr_devices = chipid_to_nrcores(bus->chip_id);
328 if (bus->nr_devices > ARRAY_SIZE(bus->devices)) { 325 if (bus->nr_devices > ARRAY_SIZE(bus->devices)) {
329 ssb_printk(KERN_ERR PFX 326 ssb_err("More than %d ssb cores found (%d)\n",
330 "More than %d ssb cores found (%d)\n", 327 SSB_MAX_NR_CORES, bus->nr_devices);
331 SSB_MAX_NR_CORES, bus->nr_devices);
332 goto err_unmap; 328 goto err_unmap;
333 } 329 }
334 if (bus->bustype == SSB_BUSTYPE_SSB) { 330 if (bus->bustype == SSB_BUSTYPE_SSB) {
@@ -370,8 +366,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
370 nr_80211_cores++; 366 nr_80211_cores++;
371 if (nr_80211_cores > 1) { 367 if (nr_80211_cores > 1) {
372 if (!we_support_multiple_80211_cores(bus)) { 368 if (!we_support_multiple_80211_cores(bus)) {
373 ssb_dprintk(KERN_INFO PFX "Ignoring additional " 369 ssb_dbg("Ignoring additional 802.11 core\n");
374 "802.11 core\n");
375 continue; 370 continue;
376 } 371 }
377 } 372 }
@@ -379,8 +374,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
379 case SSB_DEV_EXTIF: 374 case SSB_DEV_EXTIF:
380#ifdef CONFIG_SSB_DRIVER_EXTIF 375#ifdef CONFIG_SSB_DRIVER_EXTIF
381 if (bus->extif.dev) { 376 if (bus->extif.dev) {
382 ssb_printk(KERN_WARNING PFX 377 ssb_warn("WARNING: Multiple EXTIFs found\n");
383 "WARNING: Multiple EXTIFs found\n");
384 break; 378 break;
385 } 379 }
386 bus->extif.dev = dev; 380 bus->extif.dev = dev;
@@ -388,8 +382,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
388 break; 382 break;
389 case SSB_DEV_CHIPCOMMON: 383 case SSB_DEV_CHIPCOMMON:
390 if (bus->chipco.dev) { 384 if (bus->chipco.dev) {
391 ssb_printk(KERN_WARNING PFX 385 ssb_warn("WARNING: Multiple ChipCommon found\n");
392 "WARNING: Multiple ChipCommon found\n");
393 break; 386 break;
394 } 387 }
395 bus->chipco.dev = dev; 388 bus->chipco.dev = dev;
@@ -398,8 +391,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
398 case SSB_DEV_MIPS_3302: 391 case SSB_DEV_MIPS_3302:
399#ifdef CONFIG_SSB_DRIVER_MIPS 392#ifdef CONFIG_SSB_DRIVER_MIPS
400 if (bus->mipscore.dev) { 393 if (bus->mipscore.dev) {
401 ssb_printk(KERN_WARNING PFX 394 ssb_warn("WARNING: Multiple MIPS cores found\n");
402 "WARNING: Multiple MIPS cores found\n");
403 break; 395 break;
404 } 396 }
405 bus->mipscore.dev = dev; 397 bus->mipscore.dev = dev;
@@ -420,8 +412,7 @@ int ssb_bus_scan(struct ssb_bus *bus,
420 } 412 }
421 } 413 }
422 if (bus->pcicore.dev) { 414 if (bus->pcicore.dev) {
423 ssb_printk(KERN_WARNING PFX 415 ssb_warn("WARNING: Multiple PCI(E) cores found\n");
424 "WARNING: Multiple PCI(E) cores found\n");
425 break; 416 break;
426 } 417 }
427 bus->pcicore.dev = dev; 418 bus->pcicore.dev = dev;
diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
index 80d366fcf8d3..a3b23644b0fb 100644
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -127,13 +127,13 @@ ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
127 goto out_kfree; 127 goto out_kfree;
128 err = ssb_devices_freeze(bus, &freeze); 128 err = ssb_devices_freeze(bus, &freeze);
129 if (err) { 129 if (err) {
130 ssb_printk(KERN_ERR PFX "SPROM write: Could not freeze all devices\n"); 130 ssb_err("SPROM write: Could not freeze all devices\n");
131 goto out_unlock; 131 goto out_unlock;
132 } 132 }
133 res = sprom_write(bus, sprom); 133 res = sprom_write(bus, sprom);
134 err = ssb_devices_thaw(&freeze); 134 err = ssb_devices_thaw(&freeze);
135 if (err) 135 if (err)
136 ssb_printk(KERN_ERR PFX "SPROM write: Could not thaw all devices\n"); 136 ssb_err("SPROM write: Could not thaw all devices\n");
137out_unlock: 137out_unlock:
138 mutex_unlock(&bus->sprom_mutex); 138 mutex_unlock(&bus->sprom_mutex);
139out_kfree: 139out_kfree:
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h
index 466171b77f68..4671f17f09af 100644
--- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h
@@ -9,16 +9,27 @@
9#define PFX "ssb: " 9#define PFX "ssb: "
10 10
11#ifdef CONFIG_SSB_SILENT 11#ifdef CONFIG_SSB_SILENT
12# define ssb_printk(fmt, x...) do { /* nothing */ } while (0) 12# define ssb_printk(fmt, ...) \
13 do { if (0) printk(fmt, ##__VA_ARGS__); } while (0)
13#else 14#else
14# define ssb_printk printk 15# define ssb_printk(fmt, ...) \
16 printk(fmt, ##__VA_ARGS__)
15#endif /* CONFIG_SSB_SILENT */ 17#endif /* CONFIG_SSB_SILENT */
16 18
19#define ssb_emerg(fmt, ...) ssb_printk(KERN_EMERG PFX fmt, ##__VA_ARGS__)
20#define ssb_err(fmt, ...) ssb_printk(KERN_ERR PFX fmt, ##__VA_ARGS__)
21#define ssb_warn(fmt, ...) ssb_printk(KERN_WARNING PFX fmt, ##__VA_ARGS__)
22#define ssb_notice(fmt, ...) ssb_printk(KERN_NOTICE PFX fmt, ##__VA_ARGS__)
23#define ssb_info(fmt, ...) ssb_printk(KERN_INFO PFX fmt, ##__VA_ARGS__)
24#define ssb_cont(fmt, ...) ssb_printk(KERN_CONT fmt, ##__VA_ARGS__)
25
17/* dprintk: Debugging printk; vanishes for non-debug compilation */ 26/* dprintk: Debugging printk; vanishes for non-debug compilation */
18#ifdef CONFIG_SSB_DEBUG 27#ifdef CONFIG_SSB_DEBUG
19# define ssb_dprintk(fmt, x...) ssb_printk(fmt , ##x) 28# define ssb_dbg(fmt, ...) \
29 ssb_printk(KERN_DEBUG PFX fmt, ##__VA_ARGS__)
20#else 30#else
21# define ssb_dprintk(fmt, x...) do { /* nothing */ } while (0) 31# define ssb_dbg(fmt, ...) \
32 do { if (0) printk(KERN_DEBUG PFX fmt, ##__VA_ARGS__); } while (0)
22#endif 33#endif
23 34
24#ifdef CONFIG_SSB_DEBUG 35#ifdef CONFIG_SSB_DEBUG