Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[linux-2.6.git] / drivers / ssb / pci.c
index 158449e..a00b35f 100644 (file)
@@ -468,10 +468,14 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
                SPEX(country_code, SSB_SPROM4_CCODE, 0xFFFF, 0);
                SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0);
                SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0);
+               SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0);
+               SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0);
        } else {
                SPEX(country_code, SSB_SPROM5_CCODE, 0xFFFF, 0);
                SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0);
                SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0);
+               SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0);
+               SPEX(boardflags2_hi, SSB_SPROM5_BFL2HI, 0xFFFF, 0);
        }
        SPEX(ant_available_a, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_A,
             SSB_SPROM4_ANTAVAIL_A_SHIFT);
@@ -641,7 +645,7 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
                break;
        default:
                ssb_printk(KERN_WARNING PFX "Unsupported SPROM"
-                          "  revision %d detected. Will extract"
+                          " revision %d detected. Will extract"
                           " v1\n", out->revision);
                out->revision = 1;
                sprom_extract_r123(out, in);
@@ -658,7 +662,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
 static int ssb_pci_sprom_get(struct ssb_bus *bus,
                             struct ssb_sprom *sprom)
 {
-       const struct ssb_sprom *fallback;
        int err;
        u16 *buf;
 
@@ -666,7 +669,7 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
                ssb_printk(KERN_ERR PFX "No SPROM available!\n");
                return -ENODEV;
        }
-       if (bus->chipco.dev) {  /* can be unavailible! */
+       if (bus->chipco.dev) {  /* can be unavailable! */
                /*
                 * get SPROM offset: SSB_SPROM_BASE1 except for
                 * chipcommon rev >= 31 or chip ID is 0x4312 and
@@ -703,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
                if (err) {
                        /* All CRC attempts failed.
                         * Maybe there is no SPROM on the device?
-                        * If we have a fallback, use that. */
-                       fallback = ssb_get_fallback_sprom();
-                       if (fallback) {
-                               memcpy(sprom, fallback, sizeof(*sprom));
+                        * Now we ask the arch code if there is some sprom
+                        * available for this device in some other storage */
+                       err = ssb_fill_sprom_with_fallback(bus, sprom);
+                       if (err) {
+                               ssb_printk(KERN_WARNING PFX "WARNING: Using"
+                                          " fallback SPROM failed (err %d)\n",
+                                          err);
+                       } else {
+                               ssb_dprintk(KERN_DEBUG PFX "Using SPROM"
+                                           " revision %d provided by"
+                                           " platform.\n", sprom->revision);
                                err = 0;
                                goto out_free;
                        }
@@ -724,12 +734,9 @@ out_free:
 static void ssb_pci_get_boardinfo(struct ssb_bus *bus,
                                  struct ssb_boardinfo *bi)
 {
-       pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_VENDOR_ID,
-                            &bi->vendor);
-       pci_read_config_word(bus->host_pci, PCI_SUBSYSTEM_ID,
-                            &bi->type);
-       pci_read_config_word(bus->host_pci, PCI_REVISION_ID,
-                            &bi->rev);
+       bi->vendor = bus->host_pci->subsystem_vendor;
+       bi->type = bus->host_pci->subsystem_device;
+       bi->rev = bus->host_pci->revision;
 }
 
 int ssb_pci_get_invariants(struct ssb_bus *bus,