aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/brcm80211
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-03-09 14:57:30 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-09 14:57:30 -0500
commit74dd1521d0b4f940cdd3ce7b9d988836bef589b8 (patch)
tree42f3d4ee1d4e6d60a91aaadab771f766a3024bc0 /drivers/net/wireless/brcm80211
parent2f2d76cc3e938389feee671b46252dde6880b3b7 (diff)
parent1745e4405b2c0da6db2ec4b6bc0ad930612d8295 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
Diffstat (limited to 'drivers/net/wireless/brcm80211')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c4
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h4
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c30
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c32
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.h27
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/ampdu.c20
-rw-r--r--drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c31
7 files changed, 64 insertions, 84 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
index 83ca3cc2cccb..4688904908ec 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
@@ -604,7 +604,7 @@ void brcmf_sdio_exit(void)
604 sdio_unregister_driver(&brcmf_sdmmc_driver); 604 sdio_unregister_driver(&brcmf_sdmmc_driver);
605} 605}
606 606
607int brcmf_sdio_init(void) 607void brcmf_sdio_init(void)
608{ 608{
609 int ret; 609 int ret;
610 610
@@ -614,6 +614,4 @@ int brcmf_sdio_init(void)
614 614
615 if (ret) 615 if (ret)
616 brcmf_dbg(ERROR, "sdio_register_driver failed: %d\n", ret); 616 brcmf_dbg(ERROR, "sdio_register_driver failed: %d\n", ret);
617
618 return ret;
619} 617}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
index b7671b30692f..366916494be4 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h
@@ -108,11 +108,11 @@ extern int brcmf_add_if(struct device *dev, int ifidx,
108 108
109#ifdef CONFIG_BRCMFMAC_SDIO 109#ifdef CONFIG_BRCMFMAC_SDIO
110extern void brcmf_sdio_exit(void); 110extern void brcmf_sdio_exit(void);
111extern int brcmf_sdio_init(void); 111extern void brcmf_sdio_init(void);
112#endif 112#endif
113#ifdef CONFIG_BRCMFMAC_USB 113#ifdef CONFIG_BRCMFMAC_USB
114extern void brcmf_usb_exit(void); 114extern void brcmf_usb_exit(void);
115extern int brcmf_usb_init(void); 115extern void brcmf_usb_init(void);
116#endif 116#endif
117 117
118#endif /* _BRCMF_BUS_H_ */ 118#endif /* _BRCMF_BUS_H_ */
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
index c4da05817443..2a1e5ae0c402 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c
@@ -1181,27 +1181,29 @@ exit:
1181} 1181}
1182#endif /* DEBUG */ 1182#endif /* DEBUG */
1183 1183
1184static int __init brcmfmac_init(void) 1184static void brcmf_driver_init(struct work_struct *work)
1185{ 1185{
1186 int ret = 0;
1187
1188#ifdef CONFIG_BRCMFMAC_SDIO 1186#ifdef CONFIG_BRCMFMAC_SDIO
1189 ret = brcmf_sdio_init(); 1187 brcmf_sdio_init();
1190 if (ret)
1191 goto fail;
1192#endif 1188#endif
1193#ifdef CONFIG_BRCMFMAC_USB 1189#ifdef CONFIG_BRCMFMAC_USB
1194 ret = brcmf_usb_init(); 1190 brcmf_usb_init();
1195 if (ret)
1196 goto fail;
1197#endif 1191#endif
1192}
1193static DECLARE_WORK(brcmf_driver_work, brcmf_driver_init);
1198 1194
1199fail: 1195static int __init brcmfmac_module_init(void)
1200 return ret; 1196{
1197 if (!schedule_work(&brcmf_driver_work))
1198 return -EBUSY;
1199
1200 return 0;
1201} 1201}
1202 1202
1203static void __exit brcmfmac_exit(void) 1203static void __exit brcmfmac_module_exit(void)
1204{ 1204{
1205 cancel_work_sync(&brcmf_driver_work);
1206
1205#ifdef CONFIG_BRCMFMAC_SDIO 1207#ifdef CONFIG_BRCMFMAC_SDIO
1206 brcmf_sdio_exit(); 1208 brcmf_sdio_exit();
1207#endif 1209#endif
@@ -1210,5 +1212,5 @@ static void __exit brcmfmac_exit(void)
1210#endif 1212#endif
1211} 1213}
1212 1214
1213module_init(brcmfmac_init); 1215module_init(brcmfmac_module_init);
1214module_exit(brcmfmac_exit); 1216module_exit(brcmfmac_module_exit);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index d4a9e8e7deb3..82364223e817 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -514,9 +514,9 @@ static void brcmf_usb_tx_complete(struct urb *urb)
514 514
515 brcmf_usb_del_fromq(devinfo, req); 515 brcmf_usb_del_fromq(devinfo, req);
516 if (urb->status == 0) 516 if (urb->status == 0)
517 devinfo->bus_pub.stats.tx_packets++; 517 devinfo->bus_pub.bus->dstats.tx_packets++;
518 else 518 else
519 devinfo->bus_pub.stats.tx_errors++; 519 devinfo->bus_pub.bus->dstats.tx_errors++;
520 520
521 dev_kfree_skb(req->skb); 521 dev_kfree_skb(req->skb);
522 req->skb = NULL; 522 req->skb = NULL;
@@ -536,9 +536,9 @@ static void brcmf_usb_rx_complete(struct urb *urb)
536 req->skb = NULL; 536 req->skb = NULL;
537 537
538 if (urb->status == 0) { 538 if (urb->status == 0) {
539 devinfo->bus_pub.stats.rx_packets++; 539 devinfo->bus_pub.bus->dstats.rx_packets++;
540 } else { 540 } else {
541 devinfo->bus_pub.stats.rx_errors++; 541 devinfo->bus_pub.bus->dstats.rx_errors++;
542 dev_kfree_skb(skb); 542 dev_kfree_skb(skb);
543 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req); 543 brcmf_usb_enq(devinfo, &devinfo->rx_freeq, req);
544 return; 544 return;
@@ -712,9 +712,6 @@ static int brcmf_usb_up(struct device *dev)
712 struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); 712 struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev);
713 u16 ifnum; 713 u16 ifnum;
714 714
715 if (devinfo == NULL)
716 return -EINVAL;
717
718 if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP) 715 if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP)
719 return 0; 716 return 0;
720 717
@@ -900,8 +897,8 @@ brcmf_usb_dlneeded(struct brcmf_usbdev_info *devinfo)
900 sizeof(struct bootrom_id_le)); 897 sizeof(struct bootrom_id_le));
901 return false; 898 return false;
902 } else { 899 } else {
903 devinfo->bus_pub.attrib.devid = chipid; 900 devinfo->bus_pub.devid = chipid;
904 devinfo->bus_pub.attrib.chiprev = chiprev; 901 devinfo->bus_pub.chiprev = chiprev;
905 } 902 }
906 return true; 903 return true;
907} 904}
@@ -1067,7 +1064,7 @@ static int brcmf_usb_dlstart(struct brcmf_usbdev_info *devinfo, u8 *fw, int len)
1067 if (devinfo == NULL) 1064 if (devinfo == NULL)
1068 return -EINVAL; 1065 return -EINVAL;
1069 1066
1070 if (devinfo->bus_pub.attrib.devid == 0xDEAD) 1067 if (devinfo->bus_pub.devid == 0xDEAD)
1071 return -EINVAL; 1068 return -EINVAL;
1072 1069
1073 err = brcmf_usb_dl_writeimage(devinfo, fw, len); 1070 err = brcmf_usb_dl_writeimage(devinfo, fw, len);
@@ -1088,7 +1085,7 @@ static int brcmf_usb_dlrun(struct brcmf_usbdev_info *devinfo)
1088 if (!devinfo) 1085 if (!devinfo)
1089 return -EINVAL; 1086 return -EINVAL;
1090 1087
1091 if (devinfo->bus_pub.attrib.devid == 0xDEAD) 1088 if (devinfo->bus_pub.devid == 0xDEAD)
1092 return -EINVAL; 1089 return -EINVAL;
1093 1090
1094 /* Check we are runnable */ 1091 /* Check we are runnable */
@@ -1127,18 +1124,19 @@ static bool brcmf_usb_chip_support(int chipid, int chiprev)
1127static int 1124static int
1128brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo) 1125brcmf_usb_fw_download(struct brcmf_usbdev_info *devinfo)
1129{ 1126{
1130 struct brcmf_usb_attrib *attr; 1127 int devid, chiprev;
1131 int err; 1128 int err;
1132 1129
1133 brcmf_dbg(TRACE, "enter\n"); 1130 brcmf_dbg(TRACE, "enter\n");
1134 if (devinfo == NULL) 1131 if (devinfo == NULL)
1135 return -ENODEV; 1132 return -ENODEV;
1136 1133
1137 attr = &devinfo->bus_pub.attrib; 1134 devid = devinfo->bus_pub.devid;
1135 chiprev = devinfo->bus_pub.chiprev;
1138 1136
1139 if (!brcmf_usb_chip_support(attr->devid, attr->chiprev)) { 1137 if (!brcmf_usb_chip_support(devid, chiprev)) {
1140 brcmf_dbg(ERROR, "unsupported chip %d rev %d\n", 1138 brcmf_dbg(ERROR, "unsupported chip %d rev %d\n",
1141 attr->devid, attr->chiprev); 1139 devid, chiprev);
1142 return -EINVAL; 1140 return -EINVAL;
1143 } 1141 }
1144 1142
@@ -1617,7 +1615,7 @@ void brcmf_usb_exit(void)
1617 g_image.len = 0; 1615 g_image.len = 0;
1618} 1616}
1619 1617
1620int brcmf_usb_init(void) 1618void brcmf_usb_init(void)
1621{ 1619{
1622 return usb_register(&brcmf_usbdrvr); 1620 usb_register(&brcmf_usbdrvr);
1623} 1621}
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.h b/drivers/net/wireless/brcm80211/brcmfmac/usb.h
index b31da7b83ff7..acfa5e89872f 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.h
@@ -33,36 +33,12 @@ enum brcmf_usb_pnp_state {
33}; 33};
34 34
35struct brcmf_stats { 35struct brcmf_stats {
36 u32 tx_errors;
37 u32 tx_packets;
38 u32 tx_multicast;
39 u32 tx_ctlpkts; 36 u32 tx_ctlpkts;
40 u32 tx_ctlerrs; 37 u32 tx_ctlerrs;
41 u32 tx_dropped;
42 u32 tx_flushed;
43 u32 rx_errors;
44 u32 rx_packets;
45 u32 rx_multicast;
46 u32 rx_ctlpkts; 38 u32 rx_ctlpkts;
47 u32 rx_ctlerrs; 39 u32 rx_ctlerrs;
48 u32 rx_dropped;
49 u32 rx_flushed;
50
51};
52
53struct brcmf_usb_attrib {
54 int bustype;
55 int vid;
56 int pid;
57 int devid;
58 int chiprev; /* chip revsion number */
59 int mtu;
60 int nchan; /* Data Channels */
61 int has_2nd_bulk_in_ep;
62}; 40};
63 41
64struct brcmf_usbdev_info;
65
66struct brcmf_usbdev { 42struct brcmf_usbdev {
67 struct brcmf_bus *bus; 43 struct brcmf_bus *bus;
68 struct brcmf_usbdev_info *devinfo; 44 struct brcmf_usbdev_info *devinfo;
@@ -70,7 +46,8 @@ struct brcmf_usbdev {
70 struct brcmf_stats stats; 46 struct brcmf_stats stats;
71 int ntxq, nrxq, rxsize; 47 int ntxq, nrxq, rxsize;
72 u32 bus_mtu; 48 u32 bus_mtu;
73 struct brcmf_usb_attrib attrib; 49 int devid;
50 int chiprev; /* chip revsion number */
74}; 51};
75 52
76/* IO Request Block (IRB) */ 53/* IO Request Block (IRB) */
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
index dbee69620a90..95b5902bc4b3 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
@@ -959,14 +959,13 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
959 if (supr_status) { 959 if (supr_status) {
960 update_rate = false; 960 update_rate = false;
961 if (supr_status == TX_STATUS_SUPR_BADCH) { 961 if (supr_status == TX_STATUS_SUPR_BADCH) {
962 wiphy_err(wiphy, "%s: Pkt tx suppressed, " 962 wiphy_err(wiphy,
963 "illegal channel possibly %d\n", 963 "%s: Pkt tx suppressed, illegal channel possibly %d\n",
964 __func__, CHSPEC_CHANNEL( 964 __func__, CHSPEC_CHANNEL(
965 wlc->default_bss->chanspec)); 965 wlc->default_bss->chanspec));
966 } else { 966 } else {
967 if (supr_status != TX_STATUS_SUPR_FRAG) 967 if (supr_status != TX_STATUS_SUPR_FRAG)
968 wiphy_err(wiphy, "%s:" 968 wiphy_err(wiphy, "%s: supr_status 0x%x\n",
969 "supr_status 0x%x\n",
970 __func__, supr_status); 969 __func__, supr_status);
971 } 970 }
972 /* no need to retry for badch; will fail again */ 971 /* no need to retry for badch; will fail again */
@@ -988,9 +987,8 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
988 } 987 }
989 } else if (txs->phyerr) { 988 } else if (txs->phyerr) {
990 update_rate = false; 989 update_rate = false;
991 wiphy_err(wiphy, "wl%d: ampdu tx phy " 990 wiphy_err(wiphy, "%s: ampdu tx phy error (0x%x)\n",
992 "error (0x%x)\n", wlc->pub->unit, 991 __func__, txs->phyerr);
993 txs->phyerr);
994 992
995 if (brcm_msg_level & LOG_ERROR_VAL) { 993 if (brcm_msg_level & LOG_ERROR_VAL) {
996 brcmu_prpkt("txpkt (AMPDU)", p); 994 brcmu_prpkt("txpkt (AMPDU)", p);
@@ -1018,10 +1016,10 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
1018 ack_recd = false; 1016 ack_recd = false;
1019 if (ba_recd) { 1017 if (ba_recd) {
1020 bindex = MODSUB_POW2(seq, start_seq, SEQNUM_MAX); 1018 bindex = MODSUB_POW2(seq, start_seq, SEQNUM_MAX);
1021 BCMMSG(wlc->wiphy, "tid %d seq %d," 1019 BCMMSG(wiphy,
1022 " start_seq %d, bindex %d set %d, index %d\n", 1020 "tid %d seq %d, start_seq %d, bindex %d set %d, index %d\n",
1023 tid, seq, start_seq, bindex, 1021 tid, seq, start_seq, bindex,
1024 isset(bitmap, bindex), index); 1022 isset(bitmap, bindex), index);
1025 /* if acked then clear bit and free packet */ 1023 /* if acked then clear bit and free packet */
1026 if ((bindex < AMPDU_TX_BA_MAX_WSIZE) 1024 if ((bindex < AMPDU_TX_BA_MAX_WSIZE)
1027 && isset(bitmap, bindex)) { 1025 && isset(bitmap, bindex)) {
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index fec0f10773e5..569ab8abd2a1 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -1169,25 +1169,31 @@ static struct bcma_driver brcms_bcma_driver = {
1169/** 1169/**
1170 * This is the main entry point for the brcmsmac driver. 1170 * This is the main entry point for the brcmsmac driver.
1171 * 1171 *
1172 * This function determines if a device pointed to by pdev is a WL device, 1172 * This function is scheduled upon module initialization and
1173 * and if so, performs a brcms_attach() on it. 1173 * does the driver registration, which result in brcms_bcma_probe()
1174 * 1174 * call resulting in the driver bringup.
1175 */ 1175 */
1176static int __init brcms_module_init(void) 1176static void brcms_driver_init(struct work_struct *work)
1177{ 1177{
1178 int error = -ENODEV; 1178 int error;
1179 1179
1180 error = bcma_driver_register(&brcms_bcma_driver);
1181 if (error)
1182 pr_err("%s: register returned %d\n", __func__, error);
1183}
1184
1185static DECLARE_WORK(brcms_driver_work, brcms_driver_init);
1186
1187static int __init brcms_module_init(void)
1188{
1180#ifdef DEBUG 1189#ifdef DEBUG
1181 if (msglevel != 0xdeadbeef) 1190 if (msglevel != 0xdeadbeef)
1182 brcm_msg_level = msglevel; 1191 brcm_msg_level = msglevel;
1183#endif /* DEBUG */ 1192#endif
1184 1193 if (!schedule_work(&brcms_driver_work))
1185 error = bcma_driver_register(&brcms_bcma_driver); 1194 return -EBUSY;
1186 pr_err("%s: register returned %d\n", __func__, error);
1187 if (!error)
1188 return 0;
1189 1195
1190 return error; 1196 return 0;
1191} 1197}
1192 1198
1193/** 1199/**
@@ -1199,6 +1205,7 @@ static int __init brcms_module_init(void)
1199 */ 1205 */
1200static void __exit brcms_module_exit(void) 1206static void __exit brcms_module_exit(void)
1201{ 1207{
1208 cancel_work_sync(&brcms_driver_work);
1202 bcma_driver_unregister(&brcms_bcma_driver); 1209 bcma_driver_unregister(&brcms_bcma_driver);
1203} 1210}
1204 1211