if_bwn.c (299782) | if_bwn.c (299792) |
---|---|
1/*- 2 * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/bwn/if_bwn.c 299782 2016-05-14 23:27:55Z adrian $"); | 31__FBSDID("$FreeBSD: head/sys/dev/bwn/if_bwn.c 299792 2016-05-14 23:41:28Z adrian $"); |
32 33/* 34 * The Broadcom Wireless LAN controller driver. 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> --- 1104 unchanged lines hidden (view full) --- 1144 siba_powerup(sc->sc_dev, 0); 1145 1146 high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH); 1147 bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ)); 1148 error = bwn_phy_getinfo(mac, high); 1149 if (error) 1150 goto fail; 1151 | 32 33/* 34 * The Broadcom Wireless LAN controller driver. 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/kernel.h> --- 1104 unchanged lines hidden (view full) --- 1144 siba_powerup(sc->sc_dev, 0); 1145 1146 high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH); 1147 bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ)); 1148 error = bwn_phy_getinfo(mac, high); 1149 if (error) 1150 goto fail; 1151 |
1152 have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0; 1153 have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0; | 1152 /* XXX need bhnd */ 1153 if (bwn_is_bus_siba(mac)) { 1154 have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0; 1155 have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0; 1156 } else { 1157 device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__); 1158 error = ENXIO; 1159 goto fail; 1160 } 1161 1162#if 0 1163 device_printf(sc->sc_dev, "%s: high=0x%08x, have_a=%d, have_bg=%d," 1164 " deviceid=0x%04x, siba_deviceid=0x%04x\n", 1165 __func__, 1166 high, 1167 have_a, 1168 have_bg, 1169 siba_get_pci_device(sc->sc_dev), 1170 siba_get_chipid(sc->sc_dev)); 1171#endif 1172 |
1154 if (siba_get_pci_device(sc->sc_dev) != 0x4312 && 1155 siba_get_pci_device(sc->sc_dev) != 0x4319 && 1156 siba_get_pci_device(sc->sc_dev) != 0x4324) { 1157 have_a = have_bg = 0; 1158 if (mac->mac_phy.type == BWN_PHYTYPE_A) 1159 have_a = 1; 1160 else if (mac->mac_phy.type == BWN_PHYTYPE_G || 1161 mac->mac_phy.type == BWN_PHYTYPE_N || --- 168 unchanged lines hidden (view full) --- 1330 BWN_WRITE_2(mac, BWN_RFCTL, BWN_RFCTL_ID); 1331 tmp = BWN_READ_2(mac, BWN_RFDATALO); 1332 BWN_WRITE_2(mac, BWN_RFCTL, BWN_RFCTL_ID); 1333 tmp |= (uint32_t)BWN_READ_2(mac, BWN_RFDATAHI) << 16; 1334 } 1335 phy->rf_rev = (tmp & 0xf0000000) >> 28; 1336 phy->rf_ver = (tmp & 0x0ffff000) >> 12; 1337 phy->rf_manuf = (tmp & 0x00000fff); | 1173 if (siba_get_pci_device(sc->sc_dev) != 0x4312 && 1174 siba_get_pci_device(sc->sc_dev) != 0x4319 && 1175 siba_get_pci_device(sc->sc_dev) != 0x4324) { 1176 have_a = have_bg = 0; 1177 if (mac->mac_phy.type == BWN_PHYTYPE_A) 1178 have_a = 1; 1179 else if (mac->mac_phy.type == BWN_PHYTYPE_G || 1180 mac->mac_phy.type == BWN_PHYTYPE_N || --- 168 unchanged lines hidden (view full) --- 1349 BWN_WRITE_2(mac, BWN_RFCTL, BWN_RFCTL_ID); 1350 tmp = BWN_READ_2(mac, BWN_RFDATALO); 1351 BWN_WRITE_2(mac, BWN_RFCTL, BWN_RFCTL_ID); 1352 tmp |= (uint32_t)BWN_READ_2(mac, BWN_RFDATAHI) << 16; 1353 } 1354 phy->rf_rev = (tmp & 0xf0000000) >> 28; 1355 phy->rf_ver = (tmp & 0x0ffff000) >> 12; 1356 phy->rf_manuf = (tmp & 0x00000fff); |
1357 1358 /* 1359 * For now, just always do full init (ie, what bwn has traditionally 1360 * done) 1361 */ 1362 phy->phy_do_full_init = 1; 1363 |
|
1338 if (phy->rf_manuf != 0x17f) /* 0x17f is broadcom */ 1339 goto unsupradio; 1340 if ((phy->type == BWN_PHYTYPE_A && (phy->rf_ver != 0x2060 || 1341 phy->rf_rev != 1 || phy->rf_manuf != 0x17f)) || 1342 (phy->type == BWN_PHYTYPE_B && (phy->rf_ver & 0xfff0) != 0x2050) || 1343 (phy->type == BWN_PHYTYPE_G && phy->rf_ver != 0x2050) || 1344 (phy->type == BWN_PHYTYPE_N && 1345 phy->rf_ver != 0x2055 && phy->rf_ver != 0x2056) || --- 65 unchanged lines hidden (view full) --- 1411bwn_setup_channels(struct bwn_mac *mac, int have_bg, int have_a) 1412{ 1413 struct bwn_softc *sc = mac->mac_sc; 1414 struct ieee80211com *ic = &sc->sc_ic; 1415 1416 memset(ic->ic_channels, 0, sizeof(ic->ic_channels)); 1417 ic->ic_nchans = 0; 1418 | 1364 if (phy->rf_manuf != 0x17f) /* 0x17f is broadcom */ 1365 goto unsupradio; 1366 if ((phy->type == BWN_PHYTYPE_A && (phy->rf_ver != 0x2060 || 1367 phy->rf_rev != 1 || phy->rf_manuf != 0x17f)) || 1368 (phy->type == BWN_PHYTYPE_B && (phy->rf_ver & 0xfff0) != 0x2050) || 1369 (phy->type == BWN_PHYTYPE_G && phy->rf_ver != 0x2050) || 1370 (phy->type == BWN_PHYTYPE_N && 1371 phy->rf_ver != 0x2055 && phy->rf_ver != 0x2056) || --- 65 unchanged lines hidden (view full) --- 1437bwn_setup_channels(struct bwn_mac *mac, int have_bg, int have_a) 1438{ 1439 struct bwn_softc *sc = mac->mac_sc; 1440 struct ieee80211com *ic = &sc->sc_ic; 1441 1442 memset(ic->ic_channels, 0, sizeof(ic->ic_channels)); 1443 ic->ic_nchans = 0; 1444 |
1445 DPRINTF(sc, BWN_DEBUG_EEPROM, "%s: called; bg=%d, a=%d\n", 1446 __func__, 1447 have_bg, 1448 have_a); 1449 |
|
1419 if (have_bg) 1420 bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX, 1421 &ic->ic_nchans, &bwn_chantable_bg, IEEE80211_CHAN_G); 1422 if (mac->mac_phy.type == BWN_PHYTYPE_N) { 1423 if (have_a) 1424 bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX, 1425 &ic->ic_nchans, &bwn_chantable_n, 1426 IEEE80211_CHAN_HTA); --- 5703 unchanged lines hidden --- | 1450 if (have_bg) 1451 bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX, 1452 &ic->ic_nchans, &bwn_chantable_bg, IEEE80211_CHAN_G); 1453 if (mac->mac_phy.type == BWN_PHYTYPE_N) { 1454 if (have_a) 1455 bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX, 1456 &ic->ic_nchans, &bwn_chantable_n, 1457 IEEE80211_CHAN_HTA); --- 5703 unchanged lines hidden --- |