Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[deliverable/linux.git] / drivers / net / wireless / brcm80211 / brcmsmac / main.c
index 547ae5bca5673ad0627c9ae69e124d317c032a6b..cb73f2250b11db1ae976fe131d6cbc202f7da126 100644 (file)
@@ -269,7 +269,7 @@ struct brcms_c_bit_desc {
  */
 
 /* Starting corerev for the fifo size table */
-#define XMTFIFOTBL_STARTREV    20
+#define XMTFIFOTBL_STARTREV    17
 
 struct d11init {
        __le16 addr;
@@ -333,6 +333,12 @@ const u8 wlc_prio2prec_map[] = {
 };
 
 static const u16 xmtfifo_sz[][NFIFO] = {
+       /* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */
+       {20, 192, 192, 21, 17, 5},
+       /* corerev 18: */
+       {0, 0, 0, 0, 0, 0},
+       /* corerev 19: */
+       {0, 0, 0, 0, 0, 0},
        /* corerev 20: 5120, 49152, 49152, 5376, 4352, 1280 */
        {20, 192, 192, 21, 17, 5},
        /* corerev 21: 2304, 14848, 5632, 3584, 3584, 1280 */
@@ -343,6 +349,14 @@ static const u16 xmtfifo_sz[][NFIFO] = {
        {20, 192, 192, 21, 17, 5},
        /* corerev 24: 2304, 14848, 5632, 3584, 3584, 1280 */
        {9, 58, 22, 14, 14, 5},
+       /* corerev 25: */
+       {0, 0, 0, 0, 0, 0},
+       /* corerev 26: */
+       {0, 0, 0, 0, 0, 0},
+       /* corerev 27: */
+       {0, 0, 0, 0, 0, 0},
+       /* corerev 28: 2304, 14848, 5632, 3584, 3584, 1280 */
+       {9, 58, 22, 14, 14, 5},
 };
 
 #ifdef DEBUG
@@ -4455,11 +4469,9 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
        }
 
        /* verify again the device is supported */
-       if (core->bus->hosttype == BCMA_HOSTTYPE_PCI &&
-           !brcms_c_chipmatch(pcidev->vendor, pcidev->device)) {
-               wiphy_err(wiphy, "wl%d: brcms_b_attach: Unsupported "
-                       "vendor/device (0x%x/0x%x)\n",
-                        unit, pcidev->vendor, pcidev->device);
+       if (!brcms_c_chipmatch(core)) {
+               wiphy_err(wiphy, "wl%d: brcms_b_attach: Unsupported device\n",
+                        unit);
                err = 12;
                goto fail;
        }
@@ -4596,8 +4608,12 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
                wlc_hw->machwcap_backup = wlc_hw->machwcap;
 
                /* init tx fifo size */
+               WARN_ON((wlc_hw->corerev - XMTFIFOTBL_STARTREV) < 0 ||
+                       (wlc_hw->corerev - XMTFIFOTBL_STARTREV) >
+                               ARRAY_SIZE(xmtfifo_sz));
                wlc_hw->xmtfifo_sz =
                    xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)];
+               WARN_ON(!wlc_hw->xmtfifo_sz[0]);
 
                /* Get a phy for this band */
                wlc_hw->band->pi =
@@ -5768,8 +5784,12 @@ void brcms_c_print_txstatus(struct tx_status *txs)
                 (txs->ackphyrxsh & PRXS1_SQ_MASK) >> PRXS1_SQ_SHIFT);
 }
 
-bool brcms_c_chipmatch(u16 vendor, u16 device)
+static bool brcms_c_chipmatch_pci(struct bcma_device *core)
 {
+       struct pci_dev *pcidev = core->bus->host_pci;
+       u16 vendor = pcidev->vendor;
+       u16 device = pcidev->device;
+
        if (vendor != PCI_VENDOR_ID_BROADCOM) {
                pr_err("unknown vendor id %04x\n", vendor);
                return false;
@@ -5788,6 +5808,30 @@ bool brcms_c_chipmatch(u16 vendor, u16 device)
        return false;
 }
 
+static bool brcms_c_chipmatch_soc(struct bcma_device *core)
+{
+       struct bcma_chipinfo *chipinfo = &core->bus->chipinfo;
+
+       if (chipinfo->id == BCMA_CHIP_ID_BCM4716)
+               return true;
+
+       pr_err("unknown chip id %04x\n", chipinfo->id);
+       return false;
+}
+
+bool brcms_c_chipmatch(struct bcma_device *core)
+{
+       switch (core->bus->hosttype) {
+       case BCMA_HOSTTYPE_PCI:
+               return brcms_c_chipmatch_pci(core);
+       case BCMA_HOSTTYPE_SOC:
+               return brcms_c_chipmatch_soc(core);
+       default:
+               pr_err("unknown host type: %i\n", core->bus->hosttype);
+               return false;
+       }
+}
+
 #if defined(DEBUG)
 void brcms_c_print_txdesc(struct d11txh *txh)
 {
@@ -8297,7 +8341,7 @@ brcms_c_attach(struct brcms_info *wl, struct bcma_device *core, uint unit,
        struct brcms_pub *pub;
 
        /* allocate struct brcms_c_info state and its substructures */
-       wlc = (struct brcms_c_info *) brcms_c_attach_malloc(unit, &err, 0);
+       wlc = brcms_c_attach_malloc(unit, &err, 0);
        if (wlc == NULL)
                goto fail;
        wlc->wiphy = wl->wiphy;
This page took 0.027746 seconds and 5 git commands to generate.