diff options
author | Michael Buesch <mbuesch@freenet.de> | 2006-03-13 13:27:34 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-03-27 11:19:37 -0500 |
commit | e9357c056c5e62516f0044e60591d41f00ca7cfa (patch) | |
tree | a5dc842a43db15403207f1d763df008fb43cb8e6 /drivers/net/wireless/bcm43xx/bcm43xx_main.c | |
parent | aae3778176ec7a57b1c4f539b7252acfd7d99a1b (diff) |
[PATCH] bcm43xx: reduce the size of bcm43xx_private by removing unneeded members.
Signed-off-by: Michael Buesch <mbuesch@freenet.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_main.c')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 238 |
1 files changed, 114 insertions, 124 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 3ab02f4f8ec0..88e9a125c2d7 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
@@ -406,7 +406,7 @@ static void bcm43xx_write_mac_bssid_templates(struct bcm43xx_private *bcm) | |||
406 | static void bcm43xx_set_slot_time(struct bcm43xx_private *bcm, u16 slot_time) | 406 | static void bcm43xx_set_slot_time(struct bcm43xx_private *bcm, u16 slot_time) |
407 | { | 407 | { |
408 | /* slot_time is in usec. */ | 408 | /* slot_time is in usec. */ |
409 | if (bcm->current_core->phy->type != BCM43xx_PHYTYPE_G) | 409 | if (bcm43xx_current_phy(bcm)->type != BCM43xx_PHYTYPE_G) |
410 | return; | 410 | return; |
411 | bcm43xx_write16(bcm, 0x684, 510 + slot_time); | 411 | bcm43xx_write16(bcm, 0x684, 510 + slot_time); |
412 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0010, slot_time); | 412 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0010, slot_time); |
@@ -443,7 +443,7 @@ static void bcm43xx_disassociate(struct bcm43xx_private *bcm) | |||
443 | 443 | ||
444 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0004, 0x000003ff); | 444 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0004, 0x000003ff); |
445 | 445 | ||
446 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_G && | 446 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_G && |
447 | ieee80211_is_ofdm_rate(bcm->softmac->txrates.default_rate)) | 447 | ieee80211_is_ofdm_rate(bcm->softmac->txrates.default_rate)) |
448 | bcm43xx_short_slot_timing_enable(bcm); | 448 | bcm43xx_short_slot_timing_enable(bcm); |
449 | 449 | ||
@@ -510,8 +510,8 @@ static int bcm43xx_disable_interrupts_sync(struct bcm43xx_private *bcm, u32 *old | |||
510 | 510 | ||
511 | static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm) | 511 | static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm) |
512 | { | 512 | { |
513 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 513 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
514 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 514 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
515 | u32 radio_id; | 515 | u32 radio_id; |
516 | u16 manufact; | 516 | u16 manufact; |
517 | u16 version; | 517 | u16 version; |
@@ -566,10 +566,10 @@ static int bcm43xx_read_radioinfo(struct bcm43xx_private *bcm) | |||
566 | radio->txpower[2] = 3; | 566 | radio->txpower[2] = 3; |
567 | else | 567 | else |
568 | radio->txpower[2] = 0; | 568 | radio->txpower[2] = 0; |
569 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) | 569 | if (phy->type == BCM43xx_PHYTYPE_A) |
570 | radio->txpower_desired = bcm->sprom.maxpower_aphy; | 570 | radio->txpower_desired = bcm->sprom.maxpower_aphy; |
571 | else | 571 | else |
572 | bcm->current_core->radio->txpower_desired = bcm->sprom.maxpower_bgphy; | 572 | radio->txpower_desired = bcm->sprom.maxpower_bgphy; |
573 | 573 | ||
574 | /* Initialize the in-memory nrssi Lookup Table. */ | 574 | /* Initialize the in-memory nrssi Lookup Table. */ |
575 | for (i = 0; i < 64; i++) | 575 | for (i = 0; i < 64; i++) |
@@ -929,15 +929,14 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) | |||
929 | struct ieee80211_geo geo; | 929 | struct ieee80211_geo geo; |
930 | struct ieee80211_channel *chan; | 930 | struct ieee80211_channel *chan; |
931 | int have_a = 0, have_bg = 0; | 931 | int have_a = 0, have_bg = 0; |
932 | int i, num80211; | 932 | int i; |
933 | u8 channel; | 933 | u8 channel; |
934 | struct bcm43xx_phyinfo *phy; | 934 | struct bcm43xx_phyinfo *phy; |
935 | const char *iso_country; | 935 | const char *iso_country; |
936 | 936 | ||
937 | memset(&geo, 0, sizeof(geo)); | 937 | memset(&geo, 0, sizeof(geo)); |
938 | num80211 = bcm43xx_num_80211_cores(bcm); | 938 | for (i = 0; i < bcm->nr_80211_available; i++) { |
939 | for (i = 0; i < num80211; i++) { | 939 | phy = &(bcm->core_80211_ext[i].phy); |
940 | phy = bcm->phy + i; | ||
941 | switch (phy->type) { | 940 | switch (phy->type) { |
942 | case BCM43xx_PHYTYPE_B: | 941 | case BCM43xx_PHYTYPE_B: |
943 | case BCM43xx_PHYTYPE_G: | 942 | case BCM43xx_PHYTYPE_G: |
@@ -985,8 +984,8 @@ static void bcm43xx_geo_init(struct bcm43xx_private *bcm) | |||
985 | */ | 984 | */ |
986 | void bcm43xx_dummy_transmission(struct bcm43xx_private *bcm) | 985 | void bcm43xx_dummy_transmission(struct bcm43xx_private *bcm) |
987 | { | 986 | { |
988 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 987 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
989 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 988 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
990 | unsigned int i, max_loop; | 989 | unsigned int i, max_loop; |
991 | u16 value = 0; | 990 | u16 value = 0; |
992 | u32 buffer[5] = { | 991 | u32 buffer[5] = { |
@@ -1213,14 +1212,20 @@ int bcm43xx_switch_core(struct bcm43xx_private *bcm, struct bcm43xx_coreinfo *ne | |||
1213 | 1212 | ||
1214 | if (unlikely(!new_core)) | 1213 | if (unlikely(!new_core)) |
1215 | return 0; | 1214 | return 0; |
1216 | if (!(new_core->flags & BCM43xx_COREFLAG_AVAILABLE)) | 1215 | if (!new_core->available) |
1217 | return -ENODEV; | 1216 | return -ENODEV; |
1218 | if (bcm->current_core == new_core) | 1217 | if (bcm->current_core == new_core) |
1219 | return 0; | 1218 | return 0; |
1220 | err = _switch_core(bcm, new_core->index); | 1219 | err = _switch_core(bcm, new_core->index); |
1221 | if (likely(!err)) | 1220 | if (unlikely(err)) |
1222 | bcm->current_core = new_core; | 1221 | goto out; |
1223 | 1222 | ||
1223 | bcm->current_core = new_core; | ||
1224 | bcm->current_80211_core_idx = -1; | ||
1225 | if (new_core->id == BCM43xx_COREID_80211) | ||
1226 | bcm->current_80211_core_idx = (int)(new_core - &(bcm->core_80211[0])); | ||
1227 | |||
1228 | out: | ||
1224 | return err; | 1229 | return err; |
1225 | } | 1230 | } |
1226 | 1231 | ||
@@ -1295,7 +1300,8 @@ static int bcm43xx_core_disable(struct bcm43xx_private *bcm, u32 core_flags) | |||
1295 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); | 1300 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); |
1296 | 1301 | ||
1297 | out: | 1302 | out: |
1298 | bcm->current_core->flags &= ~ BCM43xx_COREFLAG_ENABLED; | 1303 | bcm->current_core->enabled = 0; |
1304 | |||
1299 | return 0; | 1305 | return 0; |
1300 | } | 1306 | } |
1301 | 1307 | ||
@@ -1340,7 +1346,7 @@ static int bcm43xx_core_enable(struct bcm43xx_private *bcm, u32 core_flags) | |||
1340 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); | 1346 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); |
1341 | udelay(1); | 1347 | udelay(1); |
1342 | 1348 | ||
1343 | bcm->current_core->flags |= BCM43xx_COREFLAG_ENABLED; | 1349 | bcm->current_core->enabled = 1; |
1344 | assert(err == 0); | 1350 | assert(err == 0); |
1345 | out: | 1351 | out: |
1346 | return err; | 1352 | return err; |
@@ -1411,7 +1417,7 @@ static int bcm43xx_wireless_core_mark_inactive(struct bcm43xx_private *bcm, | |||
1411 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); | 1417 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, sbtmstatelow); |
1412 | udelay(1); | 1418 | udelay(1); |
1413 | 1419 | ||
1414 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) { | 1420 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_G) { |
1415 | old_core = bcm->current_core; | 1421 | old_core = bcm->current_core; |
1416 | err = bcm43xx_switch_core(bcm, active_80211_core); | 1422 | err = bcm43xx_switch_core(bcm, active_80211_core); |
1417 | if (err) | 1423 | if (err) |
@@ -1433,9 +1439,6 @@ static void handle_irq_transmit_status(struct bcm43xx_private *bcm) | |||
1433 | u16 tmp; | 1439 | u16 tmp; |
1434 | struct bcm43xx_xmitstatus stat; | 1440 | struct bcm43xx_xmitstatus stat; |
1435 | 1441 | ||
1436 | assert(bcm->current_core->id == BCM43xx_COREID_80211); | ||
1437 | assert(bcm->current_core->rev >= 5); | ||
1438 | |||
1439 | while (1) { | 1442 | while (1) { |
1440 | v0 = bcm43xx_read32(bcm, BCM43xx_MMIO_XMITSTAT_0); | 1443 | v0 = bcm43xx_read32(bcm, BCM43xx_MMIO_XMITSTAT_0); |
1441 | if (!v0) | 1444 | if (!v0) |
@@ -1473,7 +1476,7 @@ static void bcm43xx_generate_noise_sample(struct bcm43xx_private *bcm) | |||
1473 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD, | 1476 | bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD, |
1474 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD) | (1 << 4)); | 1477 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD) | (1 << 4)); |
1475 | assert(bcm->noisecalc.core_at_start == bcm->current_core); | 1478 | assert(bcm->noisecalc.core_at_start == bcm->current_core); |
1476 | assert(bcm->noisecalc.channel_at_start == bcm->current_core->radio->channel); | 1479 | assert(bcm->noisecalc.channel_at_start == bcm43xx_current_radio(bcm)->channel); |
1477 | } | 1480 | } |
1478 | 1481 | ||
1479 | static void bcm43xx_calculate_link_quality(struct bcm43xx_private *bcm) | 1482 | static void bcm43xx_calculate_link_quality(struct bcm43xx_private *bcm) |
@@ -1483,7 +1486,7 @@ static void bcm43xx_calculate_link_quality(struct bcm43xx_private *bcm) | |||
1483 | if (bcm->noisecalc.calculation_running) | 1486 | if (bcm->noisecalc.calculation_running) |
1484 | return; | 1487 | return; |
1485 | bcm->noisecalc.core_at_start = bcm->current_core; | 1488 | bcm->noisecalc.core_at_start = bcm->current_core; |
1486 | bcm->noisecalc.channel_at_start = bcm->current_core->radio->channel; | 1489 | bcm->noisecalc.channel_at_start = bcm43xx_current_radio(bcm)->channel; |
1487 | bcm->noisecalc.calculation_running = 1; | 1490 | bcm->noisecalc.calculation_running = 1; |
1488 | bcm->noisecalc.nr_samples = 0; | 1491 | bcm->noisecalc.nr_samples = 0; |
1489 | 1492 | ||
@@ -1492,7 +1495,7 @@ static void bcm43xx_calculate_link_quality(struct bcm43xx_private *bcm) | |||
1492 | 1495 | ||
1493 | static void handle_irq_noise(struct bcm43xx_private *bcm) | 1496 | static void handle_irq_noise(struct bcm43xx_private *bcm) |
1494 | { | 1497 | { |
1495 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1498 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1496 | u16 tmp; | 1499 | u16 tmp; |
1497 | u8 noise[4]; | 1500 | u8 noise[4]; |
1498 | u8 i, j; | 1501 | u8 i, j; |
@@ -1759,16 +1762,16 @@ static void bcm43xx_interrupt_tasklet(struct bcm43xx_private *bcm) | |||
1759 | assert(!(dma_reason[2] & BCM43xx_DMAIRQ_RX_DONE)); | 1762 | assert(!(dma_reason[2] & BCM43xx_DMAIRQ_RX_DONE)); |
1760 | if (dma_reason[0] & BCM43xx_DMAIRQ_RX_DONE) { | 1763 | if (dma_reason[0] & BCM43xx_DMAIRQ_RX_DONE) { |
1761 | if (bcm43xx_using_pio(bcm)) | 1764 | if (bcm43xx_using_pio(bcm)) |
1762 | bcm43xx_pio_rx(bcm->current_core->pio->queue0); | 1765 | bcm43xx_pio_rx(bcm43xx_current_pio(bcm)->queue0); |
1763 | else | 1766 | else |
1764 | bcm43xx_dma_rx(bcm->current_core->dma->rx_ring0); | 1767 | bcm43xx_dma_rx(bcm43xx_current_dma(bcm)->rx_ring0); |
1765 | /* We intentionally don't set "activity" to 1, here. */ | 1768 | /* We intentionally don't set "activity" to 1, here. */ |
1766 | } | 1769 | } |
1767 | if (dma_reason[3] & BCM43xx_DMAIRQ_RX_DONE) { | 1770 | if (dma_reason[3] & BCM43xx_DMAIRQ_RX_DONE) { |
1768 | if (bcm43xx_using_pio(bcm)) | 1771 | if (bcm43xx_using_pio(bcm)) |
1769 | bcm43xx_pio_rx(bcm->current_core->pio->queue3); | 1772 | bcm43xx_pio_rx(bcm43xx_current_pio(bcm)->queue3); |
1770 | else | 1773 | else |
1771 | bcm43xx_dma_rx(bcm->current_core->dma->rx_ring1); | 1774 | bcm43xx_dma_rx(bcm43xx_current_dma(bcm)->rx_ring1); |
1772 | activity = 1; | 1775 | activity = 1; |
1773 | } | 1776 | } |
1774 | bcmirq_handled(BCM43xx_IRQ_RX); | 1777 | bcmirq_handled(BCM43xx_IRQ_RX); |
@@ -1911,7 +1914,7 @@ static void bcm43xx_release_firmware(struct bcm43xx_private *bcm, int force) | |||
1911 | 1914 | ||
1912 | static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) | 1915 | static int bcm43xx_request_firmware(struct bcm43xx_private *bcm) |
1913 | { | 1916 | { |
1914 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1917 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1915 | u8 rev = bcm->current_core->rev; | 1918 | u8 rev = bcm->current_core->rev; |
1916 | int err = 0; | 1919 | int err = 0; |
1917 | int nr; | 1920 | int nr; |
@@ -2349,6 +2352,8 @@ static void bcm43xx_chip_cleanup(struct bcm43xx_private *bcm) | |||
2349 | */ | 2352 | */ |
2350 | static int bcm43xx_chip_init(struct bcm43xx_private *bcm) | 2353 | static int bcm43xx_chip_init(struct bcm43xx_private *bcm) |
2351 | { | 2354 | { |
2355 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
2356 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
2352 | int err; | 2357 | int err; |
2353 | int iw_mode = bcm->ieee->iw_mode; | 2358 | int iw_mode = bcm->ieee->iw_mode; |
2354 | int tmp; | 2359 | int tmp; |
@@ -2388,13 +2393,13 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm) | |||
2388 | goto err_radio_off; | 2393 | goto err_radio_off; |
2389 | 2394 | ||
2390 | /* Select initial Interference Mitigation. */ | 2395 | /* Select initial Interference Mitigation. */ |
2391 | tmp = bcm->current_core->radio->interfmode; | 2396 | tmp = radio->interfmode; |
2392 | bcm->current_core->radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE; | 2397 | radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE; |
2393 | bcm43xx_radio_set_interference_mitigation(bcm, tmp); | 2398 | bcm43xx_radio_set_interference_mitigation(bcm, tmp); |
2394 | 2399 | ||
2395 | bcm43xx_phy_set_antenna_diversity(bcm); | 2400 | bcm43xx_phy_set_antenna_diversity(bcm); |
2396 | bcm43xx_radio_set_txantenna(bcm, BCM43xx_RADIO_TXANTENNA_DEFAULT); | 2401 | bcm43xx_radio_set_txantenna(bcm, BCM43xx_RADIO_TXANTENNA_DEFAULT); |
2397 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B) { | 2402 | if (phy->type == BCM43xx_PHYTYPE_B) { |
2398 | value16 = bcm43xx_read16(bcm, 0x005E); | 2403 | value16 = bcm43xx_read16(bcm, 0x005E); |
2399 | value16 |= 0x0004; | 2404 | value16 |= 0x0004; |
2400 | bcm43xx_write16(bcm, 0x005E, value16); | 2405 | bcm43xx_write16(bcm, 0x005E, value16); |
@@ -2512,6 +2517,32 @@ error: | |||
2512 | return -ENODEV; | 2517 | return -ENODEV; |
2513 | } | 2518 | } |
2514 | 2519 | ||
2520 | void bcm43xx_init_struct_phyinfo(struct bcm43xx_phyinfo *phy) | ||
2521 | { | ||
2522 | /* Initialize a "phyinfo" structure. The structure is already | ||
2523 | * zeroed out. | ||
2524 | */ | ||
2525 | phy->antenna_diversity = 0xFFFF; | ||
2526 | phy->savedpctlreg = 0xFFFF; | ||
2527 | phy->minlowsig[0] = 0xFFFF; | ||
2528 | phy->minlowsig[1] = 0xFFFF; | ||
2529 | spin_lock_init(&phy->lock); | ||
2530 | } | ||
2531 | |||
2532 | void bcm43xx_init_struct_radioinfo(struct bcm43xx_radioinfo *radio) | ||
2533 | { | ||
2534 | /* Initialize a "radioinfo" structure. The structure is already | ||
2535 | * zeroed out. | ||
2536 | */ | ||
2537 | radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE; | ||
2538 | radio->channel = 0xFF; | ||
2539 | radio->initial_channel = 0xFF; | ||
2540 | radio->lofcal = 0xFFFF; | ||
2541 | radio->initval = 0xFFFF; | ||
2542 | radio->nrssi[0] = -1000; | ||
2543 | radio->nrssi[1] = -1000; | ||
2544 | } | ||
2545 | |||
2515 | static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | 2546 | static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) |
2516 | { | 2547 | { |
2517 | int err, i; | 2548 | int err, i; |
@@ -2523,15 +2554,14 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2523 | 2554 | ||
2524 | memset(&bcm->core_chipcommon, 0, sizeof(struct bcm43xx_coreinfo)); | 2555 | memset(&bcm->core_chipcommon, 0, sizeof(struct bcm43xx_coreinfo)); |
2525 | memset(&bcm->core_pci, 0, sizeof(struct bcm43xx_coreinfo)); | 2556 | memset(&bcm->core_pci, 0, sizeof(struct bcm43xx_coreinfo)); |
2526 | memset(&bcm->core_v90, 0, sizeof(struct bcm43xx_coreinfo)); | ||
2527 | memset(&bcm->core_pcmcia, 0, sizeof(struct bcm43xx_coreinfo)); | ||
2528 | memset(&bcm->core_80211, 0, sizeof(struct bcm43xx_coreinfo) | 2557 | memset(&bcm->core_80211, 0, sizeof(struct bcm43xx_coreinfo) |
2529 | * BCM43xx_MAX_80211_CORES); | 2558 | * BCM43xx_MAX_80211_CORES); |
2530 | 2559 | memset(&bcm->core_80211_ext, 0, sizeof(struct bcm43xx_coreinfo_80211) | |
2531 | memset(&bcm->phy, 0, sizeof(struct bcm43xx_phyinfo) | 2560 | * BCM43xx_MAX_80211_CORES); |
2532 | * BCM43xx_MAX_80211_CORES); | 2561 | bcm->current_80211_core_idx = -1; |
2533 | memset(&bcm->radio, 0, sizeof(struct bcm43xx_radioinfo) | 2562 | bcm->nr_80211_available = 0; |
2534 | * BCM43xx_MAX_80211_CORES); | 2563 | bcm->current_core = NULL; |
2564 | bcm->active_80211_core = NULL; | ||
2535 | 2565 | ||
2536 | /* map core 0 */ | 2566 | /* map core 0 */ |
2537 | err = _switch_core(bcm, 0); | 2567 | err = _switch_core(bcm, 0); |
@@ -2549,7 +2579,7 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2549 | if (core_id == BCM43xx_COREID_CHIPCOMMON) { | 2579 | if (core_id == BCM43xx_COREID_CHIPCOMMON) { |
2550 | chip_id_32 = bcm43xx_read32(bcm, 0); | 2580 | chip_id_32 = bcm43xx_read32(bcm, 0); |
2551 | chip_id_16 = chip_id_32 & 0xFFFF; | 2581 | chip_id_16 = chip_id_32 & 0xFFFF; |
2552 | bcm->core_chipcommon.flags |= BCM43xx_COREFLAG_AVAILABLE; | 2582 | bcm->core_chipcommon.available = 1; |
2553 | bcm->core_chipcommon.id = core_id; | 2583 | bcm->core_chipcommon.id = core_id; |
2554 | bcm->core_chipcommon.rev = core_rev; | 2584 | bcm->core_chipcommon.rev = core_rev; |
2555 | bcm->core_chipcommon.index = 0; | 2585 | bcm->core_chipcommon.index = 0; |
@@ -2618,18 +2648,19 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2618 | dprintk(KERN_INFO PFX "Chip ID 0x%x, rev 0x%x\n", | 2648 | dprintk(KERN_INFO PFX "Chip ID 0x%x, rev 0x%x\n", |
2619 | bcm->chip_id, bcm->chip_rev); | 2649 | bcm->chip_id, bcm->chip_rev); |
2620 | dprintk(KERN_INFO PFX "Number of cores: %d\n", core_count); | 2650 | dprintk(KERN_INFO PFX "Number of cores: %d\n", core_count); |
2621 | if (bcm->core_chipcommon.flags & BCM43xx_COREFLAG_AVAILABLE) { | 2651 | if (bcm->core_chipcommon.available) { |
2622 | dprintk(KERN_INFO PFX "Core 0: ID 0x%x, rev 0x%x, vendor 0x%x, %s\n", | 2652 | dprintk(KERN_INFO PFX "Core 0: ID 0x%x, rev 0x%x, vendor 0x%x, %s\n", |
2623 | core_id, core_rev, core_vendor, | 2653 | core_id, core_rev, core_vendor, |
2624 | bcm43xx_core_enabled(bcm) ? "enabled" : "disabled"); | 2654 | bcm43xx_core_enabled(bcm) ? "enabled" : "disabled"); |
2625 | } | 2655 | } |
2626 | 2656 | ||
2627 | if (bcm->core_chipcommon.flags & BCM43xx_COREFLAG_AVAILABLE) | 2657 | if (bcm->core_chipcommon.available) |
2628 | current_core = 1; | 2658 | current_core = 1; |
2629 | else | 2659 | else |
2630 | current_core = 0; | 2660 | current_core = 0; |
2631 | for ( ; current_core < core_count; current_core++) { | 2661 | for ( ; current_core < core_count; current_core++) { |
2632 | struct bcm43xx_coreinfo *core; | 2662 | struct bcm43xx_coreinfo *core; |
2663 | struct bcm43xx_coreinfo_80211 *ext_80211; | ||
2633 | 2664 | ||
2634 | err = _switch_core(bcm, current_core); | 2665 | err = _switch_core(bcm, current_core); |
2635 | if (err) | 2666 | if (err) |
@@ -2651,36 +2682,16 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2651 | switch (core_id) { | 2682 | switch (core_id) { |
2652 | case BCM43xx_COREID_PCI: | 2683 | case BCM43xx_COREID_PCI: |
2653 | core = &bcm->core_pci; | 2684 | core = &bcm->core_pci; |
2654 | if (core->flags & BCM43xx_COREFLAG_AVAILABLE) { | 2685 | if (core->available) { |
2655 | printk(KERN_WARNING PFX "Multiple PCI cores found.\n"); | 2686 | printk(KERN_WARNING PFX "Multiple PCI cores found.\n"); |
2656 | continue; | 2687 | continue; |
2657 | } | 2688 | } |
2658 | break; | 2689 | break; |
2659 | case BCM43xx_COREID_V90: | ||
2660 | core = &bcm->core_v90; | ||
2661 | if (core->flags & BCM43xx_COREFLAG_AVAILABLE) { | ||
2662 | printk(KERN_WARNING PFX "Multiple V90 cores found.\n"); | ||
2663 | continue; | ||
2664 | } | ||
2665 | break; | ||
2666 | case BCM43xx_COREID_PCMCIA: | ||
2667 | core = &bcm->core_pcmcia; | ||
2668 | if (core->flags & BCM43xx_COREFLAG_AVAILABLE) { | ||
2669 | printk(KERN_WARNING PFX "Multiple PCMCIA cores found.\n"); | ||
2670 | continue; | ||
2671 | } | ||
2672 | break; | ||
2673 | case BCM43xx_COREID_ETHERNET: | ||
2674 | core = &bcm->core_ethernet; | ||
2675 | if (core->flags & BCM43xx_COREFLAG_AVAILABLE) { | ||
2676 | printk(KERN_WARNING PFX "Multiple Ethernet cores found.\n"); | ||
2677 | continue; | ||
2678 | } | ||
2679 | break; | ||
2680 | case BCM43xx_COREID_80211: | 2690 | case BCM43xx_COREID_80211: |
2681 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { | 2691 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { |
2682 | core = &(bcm->core_80211[i]); | 2692 | core = &(bcm->core_80211[i]); |
2683 | if (!(core->flags & BCM43xx_COREFLAG_AVAILABLE)) | 2693 | ext_80211 = &(bcm->core_80211_ext[i]); |
2694 | if (!core->available) | ||
2684 | break; | 2695 | break; |
2685 | core = NULL; | 2696 | core = NULL; |
2686 | } | 2697 | } |
@@ -2715,40 +2726,23 @@ static int bcm43xx_probe_cores(struct bcm43xx_private *bcm) | |||
2715 | err = -ENODEV; | 2726 | err = -ENODEV; |
2716 | goto out; | 2727 | goto out; |
2717 | } | 2728 | } |
2718 | core->phy = &bcm->phy[i]; | 2729 | bcm->nr_80211_available++; |
2719 | core->phy->antenna_diversity = 0xffff; | 2730 | bcm43xx_init_struct_phyinfo(&ext_80211->phy); |
2720 | core->phy->savedpctlreg = 0xFFFF; | 2731 | bcm43xx_init_struct_radioinfo(&ext_80211->radio); |
2721 | core->phy->minlowsig[0] = 0xFFFF; | ||
2722 | core->phy->minlowsig[1] = 0xFFFF; | ||
2723 | core->phy->minlowsigpos[0] = 0; | ||
2724 | core->phy->minlowsigpos[1] = 0; | ||
2725 | spin_lock_init(&core->phy->lock); | ||
2726 | core->radio = &bcm->radio[i]; | ||
2727 | core->radio->interfmode = BCM43xx_RADIO_INTERFMODE_NONE; | ||
2728 | core->radio->channel = 0xFF; | ||
2729 | core->radio->initial_channel = 0xFF; | ||
2730 | core->radio->lofcal = 0xFFFF; | ||
2731 | core->radio->initval = 0xFFFF; | ||
2732 | core->radio->nrssi[0] = -1000; | ||
2733 | core->radio->nrssi[1] = -1000; | ||
2734 | core->dma = &bcm->dma[i]; | ||
2735 | core->pio = &bcm->pio[i]; | ||
2736 | break; | 2732 | break; |
2737 | case BCM43xx_COREID_CHIPCOMMON: | 2733 | case BCM43xx_COREID_CHIPCOMMON: |
2738 | printk(KERN_WARNING PFX "Multiple CHIPCOMMON cores found.\n"); | 2734 | printk(KERN_WARNING PFX "Multiple CHIPCOMMON cores found.\n"); |
2739 | break; | 2735 | break; |
2740 | default: | ||
2741 | printk(KERN_WARNING PFX "Unknown core found (ID 0x%x)\n", core_id); | ||
2742 | } | 2736 | } |
2743 | if (core) { | 2737 | if (core) { |
2744 | core->flags |= BCM43xx_COREFLAG_AVAILABLE; | 2738 | core->available = 1; |
2745 | core->id = core_id; | 2739 | core->id = core_id; |
2746 | core->rev = core_rev; | 2740 | core->rev = core_rev; |
2747 | core->index = current_core; | 2741 | core->index = current_core; |
2748 | } | 2742 | } |
2749 | } | 2743 | } |
2750 | 2744 | ||
2751 | if (!(bcm->core_80211[0].flags & BCM43xx_COREFLAG_AVAILABLE)) { | 2745 | if (!bcm->core_80211[0].available) { |
2752 | printk(KERN_ERR PFX "Error: No 80211 core found!\n"); | 2746 | printk(KERN_ERR PFX "Error: No 80211 core found!\n"); |
2753 | err = -ENODEV; | 2747 | err = -ENODEV; |
2754 | goto out; | 2748 | goto out; |
@@ -2802,7 +2796,7 @@ static void bcm43xx_rate_memory_write(struct bcm43xx_private *bcm, | |||
2802 | 2796 | ||
2803 | static void bcm43xx_rate_memory_init(struct bcm43xx_private *bcm) | 2797 | static void bcm43xx_rate_memory_init(struct bcm43xx_private *bcm) |
2804 | { | 2798 | { |
2805 | switch (bcm->current_core->phy->type) { | 2799 | switch (bcm43xx_current_phy(bcm)->type) { |
2806 | case BCM43xx_PHYTYPE_A: | 2800 | case BCM43xx_PHYTYPE_A: |
2807 | case BCM43xx_PHYTYPE_G: | 2801 | case BCM43xx_PHYTYPE_G: |
2808 | bcm43xx_rate_memory_write(bcm, IEEE80211_OFDM_RATE_6MB, 1); | 2802 | bcm43xx_rate_memory_write(bcm, IEEE80211_OFDM_RATE_6MB, 1); |
@@ -2829,12 +2823,14 @@ static void bcm43xx_wireless_core_cleanup(struct bcm43xx_private *bcm) | |||
2829 | bcm43xx_pio_free(bcm); | 2823 | bcm43xx_pio_free(bcm); |
2830 | bcm43xx_dma_free(bcm); | 2824 | bcm43xx_dma_free(bcm); |
2831 | 2825 | ||
2832 | bcm->current_core->flags &= ~ BCM43xx_COREFLAG_INITIALIZED; | 2826 | bcm->current_core->initialized = 0; |
2833 | } | 2827 | } |
2834 | 2828 | ||
2835 | /* http://bcm-specs.sipsolutions.net/80211Init */ | 2829 | /* http://bcm-specs.sipsolutions.net/80211Init */ |
2836 | static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm) | 2830 | static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm) |
2837 | { | 2831 | { |
2832 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
2833 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
2838 | u32 ucodeflags; | 2834 | u32 ucodeflags; |
2839 | int err; | 2835 | int err; |
2840 | u32 sbimconfiglow; | 2836 | u32 sbimconfiglow; |
@@ -2867,16 +2863,15 @@ static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm) | |||
2867 | /* HW decryption needs to be set now */ | 2863 | /* HW decryption needs to be set now */ |
2868 | ucodeflags |= 0x40000000; | 2864 | ucodeflags |= 0x40000000; |
2869 | 2865 | ||
2870 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) { | 2866 | if (phy->type == BCM43xx_PHYTYPE_G) { |
2871 | ucodeflags |= BCM43xx_UCODEFLAG_UNKBGPHY; | 2867 | ucodeflags |= BCM43xx_UCODEFLAG_UNKBGPHY; |
2872 | if (bcm->current_core->phy->rev == 1) | 2868 | if (phy->rev == 1) |
2873 | ucodeflags |= BCM43xx_UCODEFLAG_UNKGPHY; | 2869 | ucodeflags |= BCM43xx_UCODEFLAG_UNKGPHY; |
2874 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) | 2870 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) |
2875 | ucodeflags |= BCM43xx_UCODEFLAG_UNKPACTRL; | 2871 | ucodeflags |= BCM43xx_UCODEFLAG_UNKPACTRL; |
2876 | } else if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B) { | 2872 | } else if (phy->type == BCM43xx_PHYTYPE_B) { |
2877 | ucodeflags |= BCM43xx_UCODEFLAG_UNKBGPHY; | 2873 | ucodeflags |= BCM43xx_UCODEFLAG_UNKBGPHY; |
2878 | if ((bcm->current_core->phy->rev >= 2) && | 2874 | if (phy->rev >= 2 && radio->version == 0x2050) |
2879 | (bcm->current_core->radio->version == 0x2050)) | ||
2880 | ucodeflags &= ~BCM43xx_UCODEFLAG_UNKGPHY; | 2875 | ucodeflags &= ~BCM43xx_UCODEFLAG_UNKGPHY; |
2881 | } | 2876 | } |
2882 | 2877 | ||
@@ -2901,7 +2896,7 @@ static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm) | |||
2901 | bcm43xx_rate_memory_init(bcm); | 2896 | bcm43xx_rate_memory_init(bcm); |
2902 | 2897 | ||
2903 | /* Minimum Contention Window */ | 2898 | /* Minimum Contention Window */ |
2904 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B) | 2899 | if (phy->type == BCM43xx_PHYTYPE_B) |
2905 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0003, 0x0000001f); | 2900 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0003, 0x0000001f); |
2906 | else | 2901 | else |
2907 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0003, 0x0000000f); | 2902 | bcm43xx_shm_write32(bcm, BCM43xx_SHM_WIRELESS, 0x0003, 0x0000000f); |
@@ -2927,7 +2922,7 @@ static int bcm43xx_wireless_core_init(struct bcm43xx_private *bcm) | |||
2927 | bcm43xx_mac_enable(bcm); | 2922 | bcm43xx_mac_enable(bcm); |
2928 | bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate); | 2923 | bcm43xx_interrupt_enable(bcm, bcm->irq_savedstate); |
2929 | 2924 | ||
2930 | bcm->current_core->flags |= BCM43xx_COREFLAG_INITIALIZED; | 2925 | bcm->current_core->initialized = 1; |
2931 | out: | 2926 | out: |
2932 | return err; | 2927 | return err; |
2933 | 2928 | ||
@@ -3048,7 +3043,7 @@ static void bcm43xx_softmac_init(struct bcm43xx_private *bcm) | |||
3048 | 3043 | ||
3049 | static void bcm43xx_periodic_every120sec(struct bcm43xx_private *bcm) | 3044 | static void bcm43xx_periodic_every120sec(struct bcm43xx_private *bcm) |
3050 | { | 3045 | { |
3051 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 3046 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
3052 | 3047 | ||
3053 | if (phy->type != BCM43xx_PHYTYPE_G || phy->rev < 2) | 3048 | if (phy->type != BCM43xx_PHYTYPE_G || phy->rev < 2) |
3054 | return; | 3049 | return; |
@@ -3076,8 +3071,8 @@ static void bcm43xx_periodic_every30sec(struct bcm43xx_private *bcm) | |||
3076 | 3071 | ||
3077 | static void bcm43xx_periodic_every15sec(struct bcm43xx_private *bcm) | 3072 | static void bcm43xx_periodic_every15sec(struct bcm43xx_private *bcm) |
3078 | { | 3073 | { |
3079 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 3074 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
3080 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 3075 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
3081 | 3076 | ||
3082 | if (phy->type == BCM43xx_PHYTYPE_G) { | 3077 | if (phy->type == BCM43xx_PHYTYPE_G) { |
3083 | //TODO: update_aci_moving_average | 3078 | //TODO: update_aci_moving_average |
@@ -3170,9 +3165,9 @@ static void bcm43xx_free_board(struct bcm43xx_private *bcm) | |||
3170 | bcm43xx_unlock(bcm, flags); | 3165 | bcm43xx_unlock(bcm, flags); |
3171 | 3166 | ||
3172 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { | 3167 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { |
3173 | if (!(bcm->core_80211[i].flags & BCM43xx_COREFLAG_AVAILABLE)) | 3168 | if (!bcm->core_80211[i].available) |
3174 | continue; | 3169 | continue; |
3175 | if (!(bcm->core_80211[i].flags & BCM43xx_COREFLAG_INITIALIZED)) | 3170 | if (!bcm->core_80211[i].initialized) |
3176 | continue; | 3171 | continue; |
3177 | 3172 | ||
3178 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); | 3173 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); |
@@ -3190,7 +3185,6 @@ static void bcm43xx_free_board(struct bcm43xx_private *bcm) | |||
3190 | static int bcm43xx_init_board(struct bcm43xx_private *bcm) | 3185 | static int bcm43xx_init_board(struct bcm43xx_private *bcm) |
3191 | { | 3186 | { |
3192 | int i, err; | 3187 | int i, err; |
3193 | int num_80211_cores; | ||
3194 | int connect_phy; | 3188 | int connect_phy; |
3195 | unsigned long flags; | 3189 | unsigned long flags; |
3196 | 3190 | ||
@@ -3212,8 +3206,7 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm) | |||
3212 | goto err_crystal_off; | 3206 | goto err_crystal_off; |
3213 | 3207 | ||
3214 | tasklet_enable(&bcm->isr_tasklet); | 3208 | tasklet_enable(&bcm->isr_tasklet); |
3215 | num_80211_cores = bcm43xx_num_80211_cores(bcm); | 3209 | for (i = 0; i < bcm->nr_80211_available; i++) { |
3216 | for (i = 0; i < num_80211_cores; i++) { | ||
3217 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); | 3210 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); |
3218 | assert(err != -ENODEV); | 3211 | assert(err != -ENODEV); |
3219 | if (err) | 3212 | if (err) |
@@ -3223,8 +3216,8 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm) | |||
3223 | * Connect PHY only on the first core. | 3216 | * Connect PHY only on the first core. |
3224 | */ | 3217 | */ |
3225 | if (!bcm43xx_core_enabled(bcm)) { | 3218 | if (!bcm43xx_core_enabled(bcm)) { |
3226 | if (num_80211_cores == 1) { | 3219 | if (bcm->nr_80211_available == 1) { |
3227 | connect_phy = bcm->current_core->phy->connected; | 3220 | connect_phy = bcm43xx_current_phy(bcm)->connected; |
3228 | } else { | 3221 | } else { |
3229 | if (i == 0) | 3222 | if (i == 0) |
3230 | connect_phy = 1; | 3223 | connect_phy = 1; |
@@ -3248,7 +3241,7 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm) | |||
3248 | } | 3241 | } |
3249 | } | 3242 | } |
3250 | bcm->active_80211_core = &bcm->core_80211[0]; | 3243 | bcm->active_80211_core = &bcm->core_80211[0]; |
3251 | if (num_80211_cores >= 2) { | 3244 | if (bcm->nr_80211_available >= 2) { |
3252 | bcm43xx_switch_core(bcm, &bcm->core_80211[0]); | 3245 | bcm43xx_switch_core(bcm, &bcm->core_80211[0]); |
3253 | bcm43xx_mac_enable(bcm); | 3246 | bcm43xx_mac_enable(bcm); |
3254 | } | 3247 | } |
@@ -3260,9 +3253,9 @@ static int bcm43xx_init_board(struct bcm43xx_private *bcm) | |||
3260 | 3253 | ||
3261 | bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_DYNAMIC); | 3254 | bcm43xx_pctl_set_clock(bcm, BCM43xx_PCTL_CLK_DYNAMIC); |
3262 | 3255 | ||
3263 | if (bcm->current_core->radio->initial_channel != 0xFF) { | 3256 | if (bcm43xx_current_radio(bcm)->initial_channel != 0xFF) { |
3264 | bcm43xx_mac_suspend(bcm); | 3257 | bcm43xx_mac_suspend(bcm); |
3265 | bcm43xx_radio_selectchannel(bcm, bcm->current_core->radio->initial_channel, 0); | 3258 | bcm43xx_radio_selectchannel(bcm, bcm43xx_current_radio(bcm)->initial_channel, 0); |
3266 | bcm43xx_mac_enable(bcm); | 3259 | bcm43xx_mac_enable(bcm); |
3267 | } | 3260 | } |
3268 | 3261 | ||
@@ -3282,8 +3275,8 @@ out: | |||
3282 | err_80211_unwind: | 3275 | err_80211_unwind: |
3283 | tasklet_disable(&bcm->isr_tasklet); | 3276 | tasklet_disable(&bcm->isr_tasklet); |
3284 | /* unwind all 80211 initialization */ | 3277 | /* unwind all 80211 initialization */ |
3285 | for (i = 0; i < num_80211_cores; i++) { | 3278 | for (i = 0; i < bcm->nr_80211_available; i++) { |
3286 | if (!(bcm->core_80211[i].flags & BCM43xx_COREFLAG_INITIALIZED)) | 3279 | if (!bcm->core_80211[i].initialized) |
3287 | continue; | 3280 | continue; |
3288 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); | 3281 | bcm43xx_interrupt_disable(bcm, BCM43xx_IRQ_ALL); |
3289 | bcm43xx_wireless_core_cleanup(bcm); | 3282 | bcm43xx_wireless_core_cleanup(bcm); |
@@ -3307,15 +3300,15 @@ static void bcm43xx_detach_board(struct bcm43xx_private *bcm) | |||
3307 | 3300 | ||
3308 | /* Free allocated structures/fields */ | 3301 | /* Free allocated structures/fields */ |
3309 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { | 3302 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { |
3310 | kfree(bcm->phy[i]._lo_pairs); | 3303 | kfree(bcm->core_80211_ext[i].phy._lo_pairs); |
3311 | if (bcm->phy[i].dyn_tssi_tbl) | 3304 | if (bcm->core_80211_ext[i].phy.dyn_tssi_tbl) |
3312 | kfree(bcm->phy[i].tssi2dbm); | 3305 | kfree(bcm->core_80211_ext[i].phy.tssi2dbm); |
3313 | } | 3306 | } |
3314 | } | 3307 | } |
3315 | 3308 | ||
3316 | static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm) | 3309 | static int bcm43xx_read_phyinfo(struct bcm43xx_private *bcm) |
3317 | { | 3310 | { |
3318 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 3311 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
3319 | u16 value; | 3312 | u16 value; |
3320 | u8 phy_version; | 3313 | u8 phy_version; |
3321 | u8 phy_type; | 3314 | u8 phy_type; |
@@ -3393,7 +3386,6 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) | |||
3393 | int i; | 3386 | int i; |
3394 | void __iomem *ioaddr; | 3387 | void __iomem *ioaddr; |
3395 | unsigned long mmio_start, mmio_end, mmio_flags, mmio_len; | 3388 | unsigned long mmio_start, mmio_end, mmio_flags, mmio_len; |
3396 | int num_80211_cores; | ||
3397 | u32 coremask; | 3389 | u32 coremask; |
3398 | 3390 | ||
3399 | err = pci_enable_device(pci_dev); | 3391 | err = pci_enable_device(pci_dev); |
@@ -3467,11 +3459,9 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) | |||
3467 | if (err) | 3459 | if (err) |
3468 | goto err_chipset_detach; | 3460 | goto err_chipset_detach; |
3469 | 3461 | ||
3470 | num_80211_cores = bcm43xx_num_80211_cores(bcm); | ||
3471 | |||
3472 | /* Attach all IO cores to the backplane. */ | 3462 | /* Attach all IO cores to the backplane. */ |
3473 | coremask = 0; | 3463 | coremask = 0; |
3474 | for (i = 0; i < num_80211_cores; i++) | 3464 | for (i = 0; i < bcm->nr_80211_available; i++) |
3475 | coremask |= (1 << bcm->core_80211[i].index); | 3465 | coremask |= (1 << bcm->core_80211[i].index); |
3476 | //FIXME: Also attach some non80211 cores? | 3466 | //FIXME: Also attach some non80211 cores? |
3477 | err = bcm43xx_setup_backplane_pci_connection(bcm, coremask); | 3467 | err = bcm43xx_setup_backplane_pci_connection(bcm, coremask); |
@@ -3487,7 +3477,7 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) | |||
3487 | if (err) | 3477 | if (err) |
3488 | goto err_chipset_detach; | 3478 | goto err_chipset_detach; |
3489 | 3479 | ||
3490 | for (i = 0; i < num_80211_cores; i++) { | 3480 | for (i = 0; i < bcm->nr_80211_available; i++) { |
3491 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); | 3481 | err = bcm43xx_switch_core(bcm, &bcm->core_80211[i]); |
3492 | assert(err != -ENODEV); | 3482 | assert(err != -ENODEV); |
3493 | if (err) | 3483 | if (err) |
@@ -3519,7 +3509,7 @@ static int bcm43xx_attach_board(struct bcm43xx_private *bcm) | |||
3519 | bcm43xx_pctl_set_crystal(bcm, 0); | 3509 | bcm43xx_pctl_set_crystal(bcm, 0); |
3520 | 3510 | ||
3521 | /* Set the MAC address in the networking subsystem */ | 3511 | /* Set the MAC address in the networking subsystem */ |
3522 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) | 3512 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) |
3523 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); | 3513 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.et1macaddr, 6); |
3524 | else | 3514 | else |
3525 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); | 3515 | memcpy(bcm->net_dev->dev_addr, bcm->sprom.il0macaddr, 6); |
@@ -3535,9 +3525,9 @@ out: | |||
3535 | 3525 | ||
3536 | err_80211_unwind: | 3526 | err_80211_unwind: |
3537 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { | 3527 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { |
3538 | kfree(bcm->phy[i]._lo_pairs); | 3528 | kfree(bcm->core_80211_ext[i].phy._lo_pairs); |
3539 | if (bcm->phy[i].dyn_tssi_tbl) | 3529 | if (bcm->core_80211_ext[i].phy.dyn_tssi_tbl) |
3540 | kfree(bcm->phy[i].tssi2dbm); | 3530 | kfree(bcm->core_80211_ext[i].phy.tssi2dbm); |
3541 | } | 3531 | } |
3542 | err_chipset_detach: | 3532 | err_chipset_detach: |
3543 | bcm43xx_chipset_detach(bcm); | 3533 | bcm43xx_chipset_detach(bcm); |