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 | |
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')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx.h | 94 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_dma.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_ilt.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_leds.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.c | 238 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_main.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_phy.c | 128 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_pio.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_radio.c | 72 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_wx.c | 35 | ||||
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_xmit.c | 14 |
13 files changed, 320 insertions, 301 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h index 29c95b07122a..a358646ad3eb 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx.h | |||
@@ -556,33 +556,37 @@ struct bcm43xx_pio { | |||
556 | 556 | ||
557 | #define BCM43xx_MAX_80211_CORES 2 | 557 | #define BCM43xx_MAX_80211_CORES 2 |
558 | 558 | ||
559 | #define BCM43xx_COREFLAG_AVAILABLE (1 << 0) | ||
560 | #define BCM43xx_COREFLAG_ENABLED (1 << 1) | ||
561 | #define BCM43xx_COREFLAG_INITIALIZED (1 << 2) | ||
562 | |||
563 | #ifdef CONFIG_BCM947XX | 559 | #ifdef CONFIG_BCM947XX |
564 | #define core_offset(bcm) (bcm)->current_core_offset | 560 | #define core_offset(bcm) (bcm)->current_core_offset |
565 | #else | 561 | #else |
566 | #define core_offset(bcm) 0 | 562 | #define core_offset(bcm) 0 |
567 | #endif | 563 | #endif |
568 | 564 | ||
565 | /* Generic information about a core. */ | ||
569 | struct bcm43xx_coreinfo { | 566 | struct bcm43xx_coreinfo { |
570 | /** Driver internal flags. See BCM43xx_COREFLAG_* */ | 567 | u8 available:1, |
571 | u32 flags; | 568 | enabled:1, |
569 | initialized:1; | ||
572 | /** core_id ID number */ | 570 | /** core_id ID number */ |
573 | u16 id; | 571 | u16 id; |
574 | /** core_rev revision number */ | 572 | /** core_rev revision number */ |
575 | u8 rev; | 573 | u8 rev; |
576 | /** Index number for _switch_core() */ | 574 | /** Index number for _switch_core() */ |
577 | u8 index; | 575 | u8 index; |
578 | /* Pointer to the PHYinfo, which belongs to this core (if 80211 core) */ | 576 | }; |
579 | struct bcm43xx_phyinfo *phy; | 577 | |
580 | /* Pointer to the RadioInfo, which belongs to this core (if 80211 core) */ | 578 | /* Additional information for each 80211 core. */ |
581 | struct bcm43xx_radioinfo *radio; | 579 | struct bcm43xx_coreinfo_80211 { |
582 | /* Pointer to the DMA rings, which belong to this core (if 80211 core) */ | 580 | /* PHY device. */ |
583 | struct bcm43xx_dma *dma; | 581 | struct bcm43xx_phyinfo phy; |
584 | /* Pointer to the PIO queues, which belong to this core (if 80211 core) */ | 582 | /* Radio device. */ |
585 | struct bcm43xx_pio *pio; | 583 | struct bcm43xx_radioinfo radio; |
584 | union { | ||
585 | /* DMA context. */ | ||
586 | struct bcm43xx_dma dma; | ||
587 | /* PIO context. */ | ||
588 | struct bcm43xx_pio pio; | ||
589 | }; | ||
586 | }; | 590 | }; |
587 | 591 | ||
588 | /* Context information for a noise calculation (Link Quality). */ | 592 | /* Context information for a noise calculation (Link Quality). */ |
@@ -652,7 +656,7 @@ struct bcm43xx_private { | |||
652 | #define BCM43xx_NR_LEDS 4 | 656 | #define BCM43xx_NR_LEDS 4 |
653 | struct bcm43xx_led leds[BCM43xx_NR_LEDS]; | 657 | struct bcm43xx_led leds[BCM43xx_NR_LEDS]; |
654 | 658 | ||
655 | /* The currently active core. NULL if not initialized, yet. */ | 659 | /* The currently active core. */ |
656 | struct bcm43xx_coreinfo *current_core; | 660 | struct bcm43xx_coreinfo *current_core; |
657 | #ifdef CONFIG_BCM947XX | 661 | #ifdef CONFIG_BCM947XX |
658 | /** current core memory offset */ | 662 | /** current core memory offset */ |
@@ -665,18 +669,15 @@ struct bcm43xx_private { | |||
665 | */ | 669 | */ |
666 | struct bcm43xx_coreinfo core_chipcommon; | 670 | struct bcm43xx_coreinfo core_chipcommon; |
667 | struct bcm43xx_coreinfo core_pci; | 671 | struct bcm43xx_coreinfo core_pci; |
668 | struct bcm43xx_coreinfo core_v90; | ||
669 | struct bcm43xx_coreinfo core_pcmcia; | ||
670 | struct bcm43xx_coreinfo core_ethernet; | ||
671 | struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ]; | 672 | struct bcm43xx_coreinfo core_80211[ BCM43xx_MAX_80211_CORES ]; |
672 | /* Info about the PHY for each 80211 core. */ | 673 | /* Additional information, specific to the 80211 cores. */ |
673 | struct bcm43xx_phyinfo phy[ BCM43xx_MAX_80211_CORES ]; | 674 | struct bcm43xx_coreinfo_80211 core_80211_ext[ BCM43xx_MAX_80211_CORES ]; |
674 | /* Info about the Radio for each 80211 core. */ | 675 | /* Index of the current 80211 core. If current_core is not |
675 | struct bcm43xx_radioinfo radio[ BCM43xx_MAX_80211_CORES ]; | 676 | * an 80211 core, this is -1. |
676 | /* DMA */ | 677 | */ |
677 | struct bcm43xx_dma dma[ BCM43xx_MAX_80211_CORES ]; | 678 | int current_80211_core_idx; |
678 | /* PIO */ | 679 | /* Number of available 80211 cores. */ |
679 | struct bcm43xx_pio pio[ BCM43xx_MAX_80211_CORES ]; | 680 | int nr_80211_available; |
680 | 681 | ||
681 | u32 chipcommon_capabilities; | 682 | u32 chipcommon_capabilities; |
682 | 683 | ||
@@ -769,18 +770,39 @@ int bcm43xx_using_pio(struct bcm43xx_private *bcm) | |||
769 | # error "Using neither DMA nor PIO? Confused..." | 770 | # error "Using neither DMA nor PIO? Confused..." |
770 | #endif | 771 | #endif |
771 | 772 | ||
772 | 773 | /* Helper functions to access data structures private to the 80211 cores. | |
774 | * Note that we _must_ have an 80211 core mapped when calling | ||
775 | * any of these functions. | ||
776 | */ | ||
773 | static inline | 777 | static inline |
774 | int bcm43xx_num_80211_cores(struct bcm43xx_private *bcm) | 778 | struct bcm43xx_pio * bcm43xx_current_pio(struct bcm43xx_private *bcm) |
775 | { | 779 | { |
776 | int i, cnt = 0; | 780 | assert(bcm43xx_using_pio(bcm)); |
777 | 781 | assert(bcm->current_80211_core_idx >= 0); | |
778 | for (i = 0; i < BCM43xx_MAX_80211_CORES; i++) { | 782 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); |
779 | if (bcm->core_80211[i].flags & BCM43xx_COREFLAG_AVAILABLE) | 783 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].pio); |
780 | cnt++; | 784 | } |
781 | } | 785 | static inline |
782 | 786 | struct bcm43xx_dma * bcm43xx_current_dma(struct bcm43xx_private *bcm) | |
783 | return cnt; | 787 | { |
788 | assert(!bcm43xx_using_pio(bcm)); | ||
789 | assert(bcm->current_80211_core_idx >= 0); | ||
790 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); | ||
791 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].dma); | ||
792 | } | ||
793 | static inline | ||
794 | struct bcm43xx_phyinfo * bcm43xx_current_phy(struct bcm43xx_private *bcm) | ||
795 | { | ||
796 | assert(bcm->current_80211_core_idx >= 0); | ||
797 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); | ||
798 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].phy); | ||
799 | } | ||
800 | static inline | ||
801 | struct bcm43xx_radioinfo * bcm43xx_current_radio(struct bcm43xx_private *bcm) | ||
802 | { | ||
803 | assert(bcm->current_80211_core_idx >= 0); | ||
804 | assert(bcm->current_80211_core_idx < BCM43xx_MAX_80211_CORES); | ||
805 | return &(bcm->core_80211_ext[bcm->current_80211_core_idx].radio); | ||
784 | } | 806 | } |
785 | 807 | ||
786 | /* Are we running in init_board() context? */ | 808 | /* Are we running in init_board() context? */ |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c index bcfcebe28261..f73d36b8e0f4 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_debugfs.c | |||
@@ -104,16 +104,13 @@ static ssize_t devinfo_read_file(struct file *file, char __user *userbuf, | |||
104 | fappend("\nCores:\n"); | 104 | fappend("\nCores:\n"); |
105 | #define fappend_core(name, info) fappend("core \"" name "\" %s, %s, id: 0x%04x, " \ | 105 | #define fappend_core(name, info) fappend("core \"" name "\" %s, %s, id: 0x%04x, " \ |
106 | "rev: 0x%02x, index: 0x%02x\n", \ | 106 | "rev: 0x%02x, index: 0x%02x\n", \ |
107 | (info).flags & BCM43xx_COREFLAG_AVAILABLE \ | 107 | (info).available \ |
108 | ? "available" : "nonavailable", \ | 108 | ? "available" : "nonavailable", \ |
109 | (info).flags & BCM43xx_COREFLAG_ENABLED \ | 109 | (info).enabled \ |
110 | ? "enabled" : "disabled", \ | 110 | ? "enabled" : "disabled", \ |
111 | (info).id, (info).rev, (info).index) | 111 | (info).id, (info).rev, (info).index) |
112 | fappend_core("CHIPCOMMON", bcm->core_chipcommon); | 112 | fappend_core("CHIPCOMMON", bcm->core_chipcommon); |
113 | fappend_core("PCI", bcm->core_pci); | 113 | fappend_core("PCI", bcm->core_pci); |
114 | fappend_core("V90", bcm->core_v90); | ||
115 | fappend_core("PCMCIA", bcm->core_pcmcia); | ||
116 | fappend_core("ETHERNET", bcm->core_ethernet); | ||
117 | fappend_core("first 80211", bcm->core_80211[0]); | 114 | fappend_core("first 80211", bcm->core_80211[0]); |
118 | fappend_core("second 80211", bcm->core_80211[1]); | 115 | fappend_core("second 80211", bcm->core_80211[1]); |
119 | #undef fappend_core | 116 | #undef fappend_core |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c index fbe19b922aa7..7ed368a587f3 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c | |||
@@ -531,7 +531,7 @@ static void bcm43xx_destroy_dmaring(struct bcm43xx_dmaring *ring) | |||
531 | 531 | ||
532 | void bcm43xx_dma_free(struct bcm43xx_private *bcm) | 532 | void bcm43xx_dma_free(struct bcm43xx_private *bcm) |
533 | { | 533 | { |
534 | struct bcm43xx_dma *dma = bcm->current_core->dma; | 534 | struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm); |
535 | 535 | ||
536 | bcm43xx_destroy_dmaring(dma->rx_ring1); | 536 | bcm43xx_destroy_dmaring(dma->rx_ring1); |
537 | dma->rx_ring1 = NULL; | 537 | dma->rx_ring1 = NULL; |
@@ -549,7 +549,7 @@ void bcm43xx_dma_free(struct bcm43xx_private *bcm) | |||
549 | 549 | ||
550 | int bcm43xx_dma_init(struct bcm43xx_private *bcm) | 550 | int bcm43xx_dma_init(struct bcm43xx_private *bcm) |
551 | { | 551 | { |
552 | struct bcm43xx_dma *dma = bcm->current_core->dma; | 552 | struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm); |
553 | struct bcm43xx_dmaring *ring; | 553 | struct bcm43xx_dmaring *ring; |
554 | int err = -ENOMEM; | 554 | int err = -ENOMEM; |
555 | 555 | ||
@@ -652,7 +652,7 @@ static | |||
652 | struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm, | 652 | struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm, |
653 | u16 cookie, int *slot) | 653 | u16 cookie, int *slot) |
654 | { | 654 | { |
655 | struct bcm43xx_dma *dma = bcm->current_core->dma; | 655 | struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm); |
656 | struct bcm43xx_dmaring *ring = NULL; | 656 | struct bcm43xx_dmaring *ring = NULL; |
657 | 657 | ||
658 | switch (cookie & 0xF000) { | 658 | switch (cookie & 0xF000) { |
@@ -755,7 +755,7 @@ int bcm43xx_dma_tx(struct bcm43xx_private *bcm, | |||
755 | * the device to send the stuff. | 755 | * the device to send the stuff. |
756 | * Note that this is called from atomic context. | 756 | * Note that this is called from atomic context. |
757 | */ | 757 | */ |
758 | struct bcm43xx_dmaring *ring = bcm->current_core->dma->tx_ring1; | 758 | struct bcm43xx_dmaring *ring = bcm43xx_current_dma(bcm)->tx_ring1; |
759 | u8 i; | 759 | u8 i; |
760 | struct sk_buff *skb; | 760 | struct sk_buff *skb; |
761 | 761 | ||
@@ -784,6 +784,7 @@ int bcm43xx_dma_tx(struct bcm43xx_private *bcm, | |||
784 | void bcm43xx_dma_handle_xmitstatus(struct bcm43xx_private *bcm, | 784 | void bcm43xx_dma_handle_xmitstatus(struct bcm43xx_private *bcm, |
785 | struct bcm43xx_xmitstatus *status) | 785 | struct bcm43xx_xmitstatus *status) |
786 | { | 786 | { |
787 | struct bcm43xx_dma *dma = bcm43xx_current_dma(bcm); | ||
787 | struct bcm43xx_dmaring *ring; | 788 | struct bcm43xx_dmaring *ring; |
788 | struct bcm43xx_dmadesc *desc; | 789 | struct bcm43xx_dmadesc *desc; |
789 | struct bcm43xx_dmadesc_meta *meta; | 790 | struct bcm43xx_dmadesc_meta *meta; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_ilt.c b/drivers/net/wireless/bcm43xx/bcm43xx_ilt.c index 865ed5c33613..ad8e569d1faf 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_ilt.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_ilt.c | |||
@@ -314,7 +314,7 @@ const u16 bcm43xx_ilt_sigmasqr2[BCM43xx_ILT_SIGMASQR_SIZE] = { | |||
314 | 314 | ||
315 | void bcm43xx_ilt_write(struct bcm43xx_private *bcm, u16 offset, u16 val) | 315 | void bcm43xx_ilt_write(struct bcm43xx_private *bcm, u16 offset, u16 val) |
316 | { | 316 | { |
317 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) { | 317 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) { |
318 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset); | 318 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset); |
319 | mmiowb(); | 319 | mmiowb(); |
320 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_DATA1, val); | 320 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_DATA1, val); |
@@ -327,7 +327,7 @@ void bcm43xx_ilt_write(struct bcm43xx_private *bcm, u16 offset, u16 val) | |||
327 | 327 | ||
328 | u16 bcm43xx_ilt_read(struct bcm43xx_private *bcm, u16 offset) | 328 | u16 bcm43xx_ilt_read(struct bcm43xx_private *bcm, u16 offset) |
329 | { | 329 | { |
330 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) { | 330 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) { |
331 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset); | 331 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, offset); |
332 | return bcm43xx_phy_read(bcm, BCM43xx_PHY_ILT_A_DATA1); | 332 | return bcm43xx_phy_read(bcm, BCM43xx_PHY_ILT_A_DATA1); |
333 | } else { | 333 | } else { |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c index 949555da5aa9..72a243aac6cb 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_leds.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_leds.c | |||
@@ -171,8 +171,8 @@ void bcm43xx_leds_exit(struct bcm43xx_private *bcm) | |||
171 | void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity) | 171 | void bcm43xx_leds_update(struct bcm43xx_private *bcm, int activity) |
172 | { | 172 | { |
173 | struct bcm43xx_led *led; | 173 | struct bcm43xx_led *led; |
174 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 174 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
175 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 175 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
176 | const int transferring = (jiffies - bcm->stats.last_tx) < BCM43xx_LED_XFER_THRES; | 176 | const int transferring = (jiffies - bcm->stats.last_tx) < BCM43xx_LED_XFER_THRES; |
177 | int i, turn_on; | 177 | int i, turn_on; |
178 | unsigned long interval = 0; | 178 | unsigned long interval = 0; |
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); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.h b/drivers/net/wireless/bcm43xx/bcm43xx_main.h index 086136c3d01f..eca79a38594a 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.h +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.h | |||
@@ -80,7 +80,7 @@ static inline | |||
80 | u8 bcm43xx_freq_to_channel(struct bcm43xx_private *bcm, | 80 | u8 bcm43xx_freq_to_channel(struct bcm43xx_private *bcm, |
81 | int freq) | 81 | int freq) |
82 | { | 82 | { |
83 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) | 83 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) |
84 | return bcm43xx_freq_to_channel_a(freq); | 84 | return bcm43xx_freq_to_channel_a(freq); |
85 | return bcm43xx_freq_to_channel_bg(freq); | 85 | return bcm43xx_freq_to_channel_bg(freq); |
86 | } | 86 | } |
@@ -107,7 +107,7 @@ static inline | |||
107 | int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm, | 107 | int bcm43xx_channel_to_freq(struct bcm43xx_private *bcm, |
108 | u8 channel) | 108 | u8 channel) |
109 | { | 109 | { |
110 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) | 110 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) |
111 | return bcm43xx_channel_to_freq_a(channel); | 111 | return bcm43xx_channel_to_freq_a(channel); |
112 | return bcm43xx_channel_to_freq_bg(channel); | 112 | return bcm43xx_channel_to_freq_bg(channel); |
113 | } | 113 | } |
@@ -129,7 +129,7 @@ static inline | |||
129 | int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, | 129 | int bcm43xx_is_valid_channel(struct bcm43xx_private *bcm, |
130 | u8 channel) | 130 | u8 channel) |
131 | { | 131 | { |
132 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) | 132 | if (bcm43xx_current_phy(bcm)->type == BCM43xx_PHYTYPE_A) |
133 | return bcm43xx_is_valid_channel_a(channel); | 133 | return bcm43xx_is_valid_channel_a(channel); |
134 | return bcm43xx_is_valid_channel_bg(channel); | 134 | return bcm43xx_is_valid_channel_bg(channel); |
135 | } | 135 | } |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index dbbef6ccd153..1ce9a4599903 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
@@ -83,7 +83,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm); | |||
83 | 83 | ||
84 | void bcm43xx_raw_phy_lock(struct bcm43xx_private *bcm) | 84 | void bcm43xx_raw_phy_lock(struct bcm43xx_private *bcm) |
85 | { | 85 | { |
86 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 86 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
87 | 87 | ||
88 | assert(irqs_disabled()); | 88 | assert(irqs_disabled()); |
89 | if (bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) == 0x00000000) { | 89 | if (bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD) == 0x00000000) { |
@@ -102,7 +102,7 @@ void bcm43xx_raw_phy_lock(struct bcm43xx_private *bcm) | |||
102 | 102 | ||
103 | void bcm43xx_raw_phy_unlock(struct bcm43xx_private *bcm) | 103 | void bcm43xx_raw_phy_unlock(struct bcm43xx_private *bcm) |
104 | { | 104 | { |
105 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 105 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
106 | 106 | ||
107 | assert(irqs_disabled()); | 107 | assert(irqs_disabled()); |
108 | if (bcm->current_core->rev < 3) { | 108 | if (bcm->current_core->rev < 3) { |
@@ -132,7 +132,7 @@ void bcm43xx_phy_write(struct bcm43xx_private *bcm, u16 offset, u16 val) | |||
132 | 132 | ||
133 | void bcm43xx_phy_calibrate(struct bcm43xx_private *bcm) | 133 | void bcm43xx_phy_calibrate(struct bcm43xx_private *bcm) |
134 | { | 134 | { |
135 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 135 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
136 | unsigned long flags; | 136 | unsigned long flags; |
137 | 137 | ||
138 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* Dummy read. */ | 138 | bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS_BITFIELD); /* Dummy read. */ |
@@ -158,39 +158,32 @@ void bcm43xx_phy_calibrate(struct bcm43xx_private *bcm) | |||
158 | */ | 158 | */ |
159 | int bcm43xx_phy_connect(struct bcm43xx_private *bcm, int connect) | 159 | int bcm43xx_phy_connect(struct bcm43xx_private *bcm, int connect) |
160 | { | 160 | { |
161 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
161 | u32 flags; | 162 | u32 flags; |
162 | 163 | ||
163 | if (bcm->current_core->rev < 5) { | 164 | if (bcm->current_core->rev < 5) |
164 | if (connect) { | 165 | goto out; |
165 | bcm->current_core->phy->connected = 1; | 166 | |
166 | dprintk(KERN_INFO PFX "PHY connected\n"); | ||
167 | } else { | ||
168 | bcm->current_core->phy->connected = 0; | ||
169 | dprintk(KERN_INFO PFX "PHY disconnected\n"); | ||
170 | } | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATEHIGH); | 167 | flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATEHIGH); |
175 | if (connect) { | 168 | if (connect) { |
176 | if (!(flags & 0x00010000)) | 169 | if (!(flags & 0x00010000)) |
177 | return -ENODEV; | 170 | return -ENODEV; |
178 | bcm->current_core->phy->connected = 1; | ||
179 | |||
180 | flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); | 171 | flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); |
181 | flags |= (0x800 << 18); | 172 | flags |= (0x800 << 18); |
182 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags); | 173 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags); |
183 | dprintk(KERN_INFO PFX "PHY connected\n"); | ||
184 | } else { | 174 | } else { |
185 | if (!(flags & 0x00020000)) | 175 | if (!(flags & 0x00020000)) |
186 | return -ENODEV; | 176 | return -ENODEV; |
187 | bcm->current_core->phy->connected = 0; | ||
188 | |||
189 | flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); | 177 | flags = bcm43xx_read32(bcm, BCM43xx_CIR_SBTMSTATELOW); |
190 | flags &= ~(0x800 << 18); | 178 | flags &= ~(0x800 << 18); |
191 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags); | 179 | bcm43xx_write32(bcm, BCM43xx_CIR_SBTMSTATELOW, flags); |
192 | dprintk(KERN_INFO PFX "PHY disconnected\n"); | ||
193 | } | 180 | } |
181 | out: | ||
182 | phy->connected = connect; | ||
183 | if (connect) | ||
184 | dprintk(KERN_INFO PFX "PHY connected\n"); | ||
185 | else | ||
186 | dprintk(KERN_INFO PFX "PHY disconnected\n"); | ||
194 | 187 | ||
195 | return 0; | 188 | return 0; |
196 | } | 189 | } |
@@ -200,8 +193,8 @@ int bcm43xx_phy_connect(struct bcm43xx_private *bcm, int connect) | |||
200 | */ | 193 | */ |
201 | static void bcm43xx_phy_init_pctl(struct bcm43xx_private *bcm) | 194 | static void bcm43xx_phy_init_pctl(struct bcm43xx_private *bcm) |
202 | { | 195 | { |
203 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 196 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
204 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 197 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
205 | u16 saved_batt = 0, saved_ratt = 0, saved_txctl1 = 0; | 198 | u16 saved_batt = 0, saved_ratt = 0, saved_txctl1 = 0; |
206 | int must_reset_txpower = 0; | 199 | int must_reset_txpower = 0; |
207 | 200 | ||
@@ -250,7 +243,7 @@ static void bcm43xx_phy_init_pctl(struct bcm43xx_private *bcm) | |||
250 | 243 | ||
251 | static void bcm43xx_phy_agcsetup(struct bcm43xx_private *bcm) | 244 | static void bcm43xx_phy_agcsetup(struct bcm43xx_private *bcm) |
252 | { | 245 | { |
253 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 246 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
254 | u16 offset = 0x0000; | 247 | u16 offset = 0x0000; |
255 | 248 | ||
256 | if (phy->rev == 1) | 249 | if (phy->rev == 1) |
@@ -326,7 +319,7 @@ static void bcm43xx_phy_agcsetup(struct bcm43xx_private *bcm) | |||
326 | 319 | ||
327 | static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm) | 320 | static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm) |
328 | { | 321 | { |
329 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 322 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
330 | u16 i; | 323 | u16 i; |
331 | 324 | ||
332 | assert(phy->type == BCM43xx_PHYTYPE_G); | 325 | assert(phy->type == BCM43xx_PHYTYPE_G); |
@@ -420,7 +413,7 @@ static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm) | |||
420 | /* Initialize the noisescaletable for APHY */ | 413 | /* Initialize the noisescaletable for APHY */ |
421 | static void bcm43xx_phy_init_noisescaletbl(struct bcm43xx_private *bcm) | 414 | static void bcm43xx_phy_init_noisescaletbl(struct bcm43xx_private *bcm) |
422 | { | 415 | { |
423 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 416 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
424 | int i; | 417 | int i; |
425 | 418 | ||
426 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, 0x1400); | 419 | bcm43xx_phy_write(bcm, BCM43xx_PHY_ILT_A_CTRL, 0x1400); |
@@ -448,10 +441,11 @@ static void bcm43xx_phy_init_noisescaletbl(struct bcm43xx_private *bcm) | |||
448 | 441 | ||
449 | static void bcm43xx_phy_setupa(struct bcm43xx_private *bcm) | 442 | static void bcm43xx_phy_setupa(struct bcm43xx_private *bcm) |
450 | { | 443 | { |
444 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
451 | u16 i; | 445 | u16 i; |
452 | 446 | ||
453 | assert(bcm->current_core->phy->type == BCM43xx_PHYTYPE_A); | 447 | assert(phy->type == BCM43xx_PHYTYPE_A); |
454 | switch (bcm->current_core->phy->rev) { | 448 | switch (phy->rev) { |
455 | case 2: | 449 | case 2: |
456 | bcm43xx_phy_write(bcm, 0x008E, 0x3800); | 450 | bcm43xx_phy_write(bcm, 0x008E, 0x3800); |
457 | bcm43xx_phy_write(bcm, 0x0035, 0x03FF); | 451 | bcm43xx_phy_write(bcm, 0x0035, 0x03FF); |
@@ -563,7 +557,8 @@ static void bcm43xx_phy_setupa(struct bcm43xx_private *bcm) | |||
563 | /* Initialize APHY. This is also called for the GPHY in some cases. */ | 557 | /* Initialize APHY. This is also called for the GPHY in some cases. */ |
564 | static void bcm43xx_phy_inita(struct bcm43xx_private *bcm) | 558 | static void bcm43xx_phy_inita(struct bcm43xx_private *bcm) |
565 | { | 559 | { |
566 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 560 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
561 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
567 | u16 tval; | 562 | u16 tval; |
568 | 563 | ||
569 | if (phy->type == BCM43xx_PHYTYPE_A) { | 564 | if (phy->type == BCM43xx_PHYTYPE_A) { |
@@ -586,11 +581,11 @@ static void bcm43xx_phy_inita(struct bcm43xx_private *bcm) | |||
586 | 581 | ||
587 | if ((bcm->board_vendor == PCI_VENDOR_ID_BROADCOM) | 582 | if ((bcm->board_vendor == PCI_VENDOR_ID_BROADCOM) |
588 | && ((bcm->board_type == 0x0416) || (bcm->board_type == 0x040A))) { | 583 | && ((bcm->board_type == 0x0416) || (bcm->board_type == 0x040A))) { |
589 | if (bcm->current_core->radio->lofcal == 0xFFFF) { | 584 | if (radio->lofcal == 0xFFFF) { |
590 | TODO();//TODO: LOF Cal | 585 | TODO();//TODO: LOF Cal |
591 | bcm43xx_radio_set_tx_iq(bcm); | 586 | bcm43xx_radio_set_tx_iq(bcm); |
592 | } else | 587 | } else |
593 | bcm43xx_radio_write16(bcm, 0x001E, bcm->current_core->radio->lofcal); | 588 | bcm43xx_radio_write16(bcm, 0x001E, radio->lofcal); |
594 | } | 589 | } |
595 | 590 | ||
596 | bcm43xx_phy_write(bcm, 0x007A, 0xF111); | 591 | bcm43xx_phy_write(bcm, 0x007A, 0xF111); |
@@ -620,7 +615,7 @@ static void bcm43xx_phy_inita(struct bcm43xx_private *bcm) | |||
620 | 615 | ||
621 | static void bcm43xx_phy_initb2(struct bcm43xx_private *bcm) | 616 | static void bcm43xx_phy_initb2(struct bcm43xx_private *bcm) |
622 | { | 617 | { |
623 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 618 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
624 | u16 offset, val; | 619 | u16 offset, val; |
625 | 620 | ||
626 | bcm43xx_write16(bcm, 0x03EC, 0x3F22); | 621 | bcm43xx_write16(bcm, 0x03EC, 0x3F22); |
@@ -671,7 +666,7 @@ static void bcm43xx_phy_initb2(struct bcm43xx_private *bcm) | |||
671 | 666 | ||
672 | static void bcm43xx_phy_initb4(struct bcm43xx_private *bcm) | 667 | static void bcm43xx_phy_initb4(struct bcm43xx_private *bcm) |
673 | { | 668 | { |
674 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 669 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
675 | u16 offset, val; | 670 | u16 offset, val; |
676 | 671 | ||
677 | bcm43xx_write16(bcm, 0x03EC, 0x3F22); | 672 | bcm43xx_write16(bcm, 0x03EC, 0x3F22); |
@@ -729,8 +724,8 @@ static void bcm43xx_phy_initb4(struct bcm43xx_private *bcm) | |||
729 | 724 | ||
730 | static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm) | 725 | static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm) |
731 | { | 726 | { |
732 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 727 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
733 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 728 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
734 | u16 offset; | 729 | u16 offset; |
735 | 730 | ||
736 | if (phy->version == 1 && | 731 | if (phy->version == 1 && |
@@ -835,8 +830,8 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm) | |||
835 | 830 | ||
836 | static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | 831 | static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) |
837 | { | 832 | { |
838 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 833 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
839 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 834 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
840 | u16 offset, val; | 835 | u16 offset, val; |
841 | 836 | ||
842 | bcm43xx_phy_write(bcm, 0x003E, 0x817A); | 837 | bcm43xx_phy_write(bcm, 0x003E, 0x817A); |
@@ -946,9 +941,9 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
946 | udelay(40); | 941 | udelay(40); |
947 | bcm43xx_radio_write16(bcm, 0x007C, (bcm43xx_radio_read16(bcm, 0x007C) | 0x0002)); | 942 | bcm43xx_radio_write16(bcm, 0x007C, (bcm43xx_radio_read16(bcm, 0x007C) | 0x0002)); |
948 | bcm43xx_radio_write16(bcm, 0x0050, 0x0020); | 943 | bcm43xx_radio_write16(bcm, 0x0050, 0x0020); |
949 | if ((bcm->current_core->radio->manufact == 0x17F) && | 944 | if (radio->manufact == 0x17F && |
950 | (bcm->current_core->radio->version == 0x2050) && | 945 | radio->version == 0x2050 && |
951 | (bcm->current_core->radio->revision <= 2)) { | 946 | radio->revision <= 2) { |
952 | bcm43xx_radio_write16(bcm, 0x0050, 0x0020); | 947 | bcm43xx_radio_write16(bcm, 0x0050, 0x0020); |
953 | bcm43xx_radio_write16(bcm, 0x005A, 0x0070); | 948 | bcm43xx_radio_write16(bcm, 0x005A, 0x0070); |
954 | bcm43xx_radio_write16(bcm, 0x005B, 0x007B); | 949 | bcm43xx_radio_write16(bcm, 0x005B, 0x007B); |
@@ -1001,8 +996,8 @@ static void bcm43xx_phy_initb6(struct bcm43xx_private *bcm) | |||
1001 | 996 | ||
1002 | static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | 997 | static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) |
1003 | { | 998 | { |
1004 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 999 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1005 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1000 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1006 | u16 tmp; | 1001 | u16 tmp; |
1007 | 1002 | ||
1008 | if (phy->rev == 1) | 1003 | if (phy->rev == 1) |
@@ -1096,8 +1091,8 @@ static u16 bcm43xx_phy_lo_b_r15_loop(struct bcm43xx_private *bcm) | |||
1096 | 1091 | ||
1097 | void bcm43xx_phy_lo_b_measure(struct bcm43xx_private *bcm) | 1092 | void bcm43xx_phy_lo_b_measure(struct bcm43xx_private *bcm) |
1098 | { | 1093 | { |
1099 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1094 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1100 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1095 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1101 | u16 regstack[12] = { 0 }; | 1096 | u16 regstack[12] = { 0 }; |
1102 | u16 mls; | 1097 | u16 mls; |
1103 | u16 fval; | 1098 | u16 fval; |
@@ -1190,7 +1185,9 @@ void bcm43xx_phy_lo_b_measure(struct bcm43xx_private *bcm) | |||
1190 | static inline | 1185 | static inline |
1191 | u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control) | 1186 | u16 bcm43xx_phy_lo_g_deviation_subval(struct bcm43xx_private *bcm, u16 control) |
1192 | { | 1187 | { |
1193 | if (bcm->current_core->phy->connected) { | 1188 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1189 | |||
1190 | if (phy->connected) { | ||
1194 | bcm43xx_phy_write(bcm, 0x15, 0xE300); | 1191 | bcm43xx_phy_write(bcm, 0x15, 0xE300); |
1195 | control <<= 8; | 1192 | control <<= 8; |
1196 | bcm43xx_phy_write(bcm, 0x0812, control | 0x00B0); | 1193 | bcm43xx_phy_write(bcm, 0x0812, control | 0x00B0); |
@@ -1242,7 +1239,7 @@ void bcm43xx_lo_write(struct bcm43xx_private *bcm, | |||
1242 | "WARNING: Writing invalid LOpair " | 1239 | "WARNING: Writing invalid LOpair " |
1243 | "(low: %d, high: %d, index: %lu)\n", | 1240 | "(low: %d, high: %d, index: %lu)\n", |
1244 | pair->low, pair->high, | 1241 | pair->low, pair->high, |
1245 | (unsigned long)(pair - bcm->current_core->phy->_lo_pairs)); | 1242 | (unsigned long)(pair - bcm43xx_current_phy(bcm)->_lo_pairs)); |
1246 | dump_stack(); | 1243 | dump_stack(); |
1247 | } | 1244 | } |
1248 | #endif | 1245 | #endif |
@@ -1257,7 +1254,7 @@ struct bcm43xx_lopair * bcm43xx_find_lopair(struct bcm43xx_private *bcm, | |||
1257 | u16 tx) | 1254 | u16 tx) |
1258 | { | 1255 | { |
1259 | static const u8 dict[10] = { 11, 10, 11, 12, 13, 12, 13, 12, 13, 12 }; | 1256 | static const u8 dict[10] = { 11, 10, 11, 12, 13, 12, 13, 12, 13, 12 }; |
1260 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1257 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1261 | 1258 | ||
1262 | if (baseband_attenuation > 6) | 1259 | if (baseband_attenuation > 6) |
1263 | baseband_attenuation = 6; | 1260 | baseband_attenuation = 6; |
@@ -1275,10 +1272,12 @@ struct bcm43xx_lopair * bcm43xx_find_lopair(struct bcm43xx_private *bcm, | |||
1275 | static inline | 1272 | static inline |
1276 | struct bcm43xx_lopair * bcm43xx_current_lopair(struct bcm43xx_private *bcm) | 1273 | struct bcm43xx_lopair * bcm43xx_current_lopair(struct bcm43xx_private *bcm) |
1277 | { | 1274 | { |
1275 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
1276 | |||
1278 | return bcm43xx_find_lopair(bcm, | 1277 | return bcm43xx_find_lopair(bcm, |
1279 | bcm->current_core->radio->txpower[0], | 1278 | radio->txpower[0], |
1280 | bcm->current_core->radio->txpower[1], | 1279 | radio->txpower[1], |
1281 | bcm->current_core->radio->txpower[2]); | 1280 | radio->txpower[2]); |
1282 | } | 1281 | } |
1283 | 1282 | ||
1284 | /* Adjust B/G LO */ | 1283 | /* Adjust B/G LO */ |
@@ -1294,9 +1293,9 @@ void bcm43xx_phy_lo_adjust(struct bcm43xx_private *bcm, int fixed) | |||
1294 | bcm43xx_lo_write(bcm, pair); | 1293 | bcm43xx_lo_write(bcm, pair); |
1295 | } | 1294 | } |
1296 | 1295 | ||
1297 | static inline | 1296 | static void bcm43xx_phy_lo_g_measure_txctl2(struct bcm43xx_private *bcm) |
1298 | void bcm43xx_phy_lo_g_measure_txctl2(struct bcm43xx_private *bcm) | ||
1299 | { | 1297 | { |
1298 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
1300 | u16 txctl2 = 0, i; | 1299 | u16 txctl2 = 0, i; |
1301 | u32 smallest, tmp; | 1300 | u32 smallest, tmp; |
1302 | 1301 | ||
@@ -1312,7 +1311,7 @@ void bcm43xx_phy_lo_g_measure_txctl2(struct bcm43xx_private *bcm) | |||
1312 | txctl2 = i; | 1311 | txctl2 = i; |
1313 | } | 1312 | } |
1314 | } | 1313 | } |
1315 | bcm->current_core->radio->txpower[3] = txctl2; | 1314 | radio->txpower[3] = txctl2; |
1316 | } | 1315 | } |
1317 | 1316 | ||
1318 | static | 1317 | static |
@@ -1402,16 +1401,17 @@ void bcm43xx_phy_lo_g_state(struct bcm43xx_private *bcm, | |||
1402 | void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm, | 1401 | void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm, |
1403 | u16 baseband_attenuation) | 1402 | u16 baseband_attenuation) |
1404 | { | 1403 | { |
1404 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
1405 | u16 value; | 1405 | u16 value; |
1406 | 1406 | ||
1407 | if (bcm->current_core->phy->version == 0) { | 1407 | if (phy->version == 0) { |
1408 | value = (bcm43xx_read16(bcm, 0x03E6) & 0xFFF0); | 1408 | value = (bcm43xx_read16(bcm, 0x03E6) & 0xFFF0); |
1409 | value |= (baseband_attenuation & 0x000F); | 1409 | value |= (baseband_attenuation & 0x000F); |
1410 | bcm43xx_write16(bcm, 0x03E6, value); | 1410 | bcm43xx_write16(bcm, 0x03E6, value); |
1411 | return; | 1411 | return; |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | if (bcm->current_core->phy->version > 1) { | 1414 | if (phy->version > 1) { |
1415 | value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C; | 1415 | value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C; |
1416 | value |= (baseband_attenuation << 2) & 0x003C; | 1416 | value |= (baseband_attenuation << 2) & 0x003C; |
1417 | } else { | 1417 | } else { |
@@ -1426,8 +1426,8 @@ void bcm43xx_phy_lo_g_measure(struct bcm43xx_private *bcm) | |||
1426 | { | 1426 | { |
1427 | static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 }; | 1427 | static const u8 pairorder[10] = { 3, 1, 5, 7, 9, 2, 0, 4, 6, 8 }; |
1428 | const int is_initializing = bcm43xx_is_initializing(bcm); | 1428 | const int is_initializing = bcm43xx_is_initializing(bcm); |
1429 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1429 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1430 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1430 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1431 | u16 h, i, oldi = 0, j; | 1431 | u16 h, i, oldi = 0, j; |
1432 | struct bcm43xx_lopair control; | 1432 | struct bcm43xx_lopair control; |
1433 | struct bcm43xx_lopair *tmp_control; | 1433 | struct bcm43xx_lopair *tmp_control; |
@@ -1653,7 +1653,7 @@ void bcm43xx_phy_lo_mark_current_used(struct bcm43xx_private *bcm) | |||
1653 | 1653 | ||
1654 | void bcm43xx_phy_lo_mark_all_unused(struct bcm43xx_private *bcm) | 1654 | void bcm43xx_phy_lo_mark_all_unused(struct bcm43xx_private *bcm) |
1655 | { | 1655 | { |
1656 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1656 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1657 | struct bcm43xx_lopair *pair; | 1657 | struct bcm43xx_lopair *pair; |
1658 | int i; | 1658 | int i; |
1659 | 1659 | ||
@@ -1668,7 +1668,7 @@ void bcm43xx_phy_lo_mark_all_unused(struct bcm43xx_private *bcm) | |||
1668 | */ | 1668 | */ |
1669 | static s8 bcm43xx_phy_estimate_power_out(struct bcm43xx_private *bcm, s8 tssi) | 1669 | static s8 bcm43xx_phy_estimate_power_out(struct bcm43xx_private *bcm, s8 tssi) |
1670 | { | 1670 | { |
1671 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1671 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1672 | s8 dbm = 0; | 1672 | s8 dbm = 0; |
1673 | s32 tmp; | 1673 | s32 tmp; |
1674 | 1674 | ||
@@ -1698,8 +1698,8 @@ static s8 bcm43xx_phy_estimate_power_out(struct bcm43xx_private *bcm, s8 tssi) | |||
1698 | /* http://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */ | 1698 | /* http://bcm-specs.sipsolutions.net/RecalculateTransmissionPower */ |
1699 | void bcm43xx_phy_xmitpower(struct bcm43xx_private *bcm) | 1699 | void bcm43xx_phy_xmitpower(struct bcm43xx_private *bcm) |
1700 | { | 1700 | { |
1701 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1701 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1702 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1702 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1703 | 1703 | ||
1704 | if (phy->savedpctlreg == 0xFFFF) | 1704 | if (phy->savedpctlreg == 0xFFFF) |
1705 | return; | 1705 | return; |
@@ -1880,8 +1880,8 @@ s8 bcm43xx_tssi2dbm_entry(s8 entry [], u8 index, s16 pab0, s16 pab1, s16 pab2) | |||
1880 | /* http://bcm-specs.sipsolutions.net/TSSI_to_DBM_Table */ | 1880 | /* http://bcm-specs.sipsolutions.net/TSSI_to_DBM_Table */ |
1881 | int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm) | 1881 | int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm) |
1882 | { | 1882 | { |
1883 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1883 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1884 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1884 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1885 | s16 pab0, pab1, pab2; | 1885 | s16 pab0, pab1, pab2; |
1886 | u8 idx; | 1886 | u8 idx; |
1887 | s8 *dyn_tssi2dbm; | 1887 | s8 *dyn_tssi2dbm; |
@@ -1958,7 +1958,7 @@ int bcm43xx_phy_init_tssi2dbm_table(struct bcm43xx_private *bcm) | |||
1958 | 1958 | ||
1959 | int bcm43xx_phy_init(struct bcm43xx_private *bcm) | 1959 | int bcm43xx_phy_init(struct bcm43xx_private *bcm) |
1960 | { | 1960 | { |
1961 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1961 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1962 | int err = -ENODEV; | 1962 | int err = -ENODEV; |
1963 | unsigned long flags; | 1963 | unsigned long flags; |
1964 | 1964 | ||
@@ -2008,7 +2008,7 @@ int bcm43xx_phy_init(struct bcm43xx_private *bcm) | |||
2008 | 2008 | ||
2009 | void bcm43xx_phy_set_antenna_diversity(struct bcm43xx_private *bcm) | 2009 | void bcm43xx_phy_set_antenna_diversity(struct bcm43xx_private *bcm) |
2010 | { | 2010 | { |
2011 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 2011 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
2012 | u16 antennadiv; | 2012 | u16 antennadiv; |
2013 | u16 offset; | 2013 | u16 offset; |
2014 | u16 value; | 2014 | u16 value; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c index 26dc6047d458..7bddae910de9 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_pio.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_pio.c | |||
@@ -146,7 +146,7 @@ struct bcm43xx_pioqueue * parse_cookie(struct bcm43xx_private *bcm, | |||
146 | u16 cookie, | 146 | u16 cookie, |
147 | struct bcm43xx_pio_txpacket **packet) | 147 | struct bcm43xx_pio_txpacket **packet) |
148 | { | 148 | { |
149 | struct bcm43xx_pio *pio = bcm->current_core->pio; | 149 | struct bcm43xx_pio *pio = bcm43xx_current_pio(bcm); |
150 | struct bcm43xx_pioqueue *queue = NULL; | 150 | struct bcm43xx_pioqueue *queue = NULL; |
151 | int packetindex; | 151 | int packetindex; |
152 | 152 | ||
@@ -377,7 +377,7 @@ static void bcm43xx_destroy_pioqueue(struct bcm43xx_pioqueue *queue) | |||
377 | 377 | ||
378 | void bcm43xx_pio_free(struct bcm43xx_private *bcm) | 378 | void bcm43xx_pio_free(struct bcm43xx_private *bcm) |
379 | { | 379 | { |
380 | struct bcm43xx_pio *pio = bcm->current_core->pio; | 380 | struct bcm43xx_pio *pio = bcm43xx_current_pio(bcm); |
381 | 381 | ||
382 | bcm43xx_destroy_pioqueue(pio->queue3); | 382 | bcm43xx_destroy_pioqueue(pio->queue3); |
383 | pio->queue3 = NULL; | 383 | pio->queue3 = NULL; |
@@ -391,7 +391,7 @@ void bcm43xx_pio_free(struct bcm43xx_private *bcm) | |||
391 | 391 | ||
392 | int bcm43xx_pio_init(struct bcm43xx_private *bcm) | 392 | int bcm43xx_pio_init(struct bcm43xx_private *bcm) |
393 | { | 393 | { |
394 | struct bcm43xx_pio *pio = bcm->current_core->pio; | 394 | struct bcm43xx_pio *pio = bcm43xx_current_pio(bcm); |
395 | struct bcm43xx_pioqueue *queue; | 395 | struct bcm43xx_pioqueue *queue; |
396 | int err = -ENOMEM; | 396 | int err = -ENOMEM; |
397 | 397 | ||
@@ -438,7 +438,7 @@ err_destroy0: | |||
438 | int bcm43xx_pio_tx(struct bcm43xx_private *bcm, | 438 | int bcm43xx_pio_tx(struct bcm43xx_private *bcm, |
439 | struct ieee80211_txb *txb) | 439 | struct ieee80211_txb *txb) |
440 | { | 440 | { |
441 | struct bcm43xx_pioqueue *queue = bcm->current_core->pio->queue1; | 441 | struct bcm43xx_pioqueue *queue = bcm43xx_current_pio(bcm)->queue1; |
442 | struct bcm43xx_pio_txpacket *packet; | 442 | struct bcm43xx_pio_txpacket *packet; |
443 | u16 tmp; | 443 | u16 tmp; |
444 | 444 | ||
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c index 4d3b0e85876c..07a6169a0b34 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c | |||
@@ -114,8 +114,8 @@ void bcm43xx_radio_unlock(struct bcm43xx_private *bcm) | |||
114 | 114 | ||
115 | u16 bcm43xx_radio_read16(struct bcm43xx_private *bcm, u16 offset) | 115 | u16 bcm43xx_radio_read16(struct bcm43xx_private *bcm, u16 offset) |
116 | { | 116 | { |
117 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 117 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
118 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 118 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
119 | 119 | ||
120 | switch (phy->type) { | 120 | switch (phy->type) { |
121 | case BCM43xx_PHYTYPE_A: | 121 | case BCM43xx_PHYTYPE_A: |
@@ -151,7 +151,7 @@ void bcm43xx_radio_write16(struct bcm43xx_private *bcm, u16 offset, u16 val) | |||
151 | static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm, | 151 | static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm, |
152 | s16 first, s16 second, s16 third) | 152 | s16 first, s16 second, s16 third) |
153 | { | 153 | { |
154 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 154 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
155 | u16 i; | 155 | u16 i; |
156 | u16 start = 0x08, end = 0x18; | 156 | u16 start = 0x08, end = 0x18; |
157 | u16 offset = 0x0400; | 157 | u16 offset = 0x0400; |
@@ -183,7 +183,7 @@ static void bcm43xx_set_all_gains(struct bcm43xx_private *bcm, | |||
183 | 183 | ||
184 | static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm) | 184 | static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm) |
185 | { | 185 | { |
186 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 186 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
187 | u16 i, tmp; | 187 | u16 i, tmp; |
188 | u16 offset = 0x0400; | 188 | u16 offset = 0x0400; |
189 | u16 start = 0x0008, end = 0x0018; | 189 | u16 start = 0x0008, end = 0x0018; |
@@ -217,7 +217,7 @@ static void bcm43xx_set_original_gains(struct bcm43xx_private *bcm) | |||
217 | /* Synthetic PU workaround */ | 217 | /* Synthetic PU workaround */ |
218 | static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel) | 218 | static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel) |
219 | { | 219 | { |
220 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 220 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
221 | 221 | ||
222 | if (radio->version != 0x2050 || radio->revision >= 6) { | 222 | if (radio->version != 0x2050 || radio->revision >= 6) { |
223 | /* We do not need the workaround. */ | 223 | /* We do not need the workaround. */ |
@@ -238,7 +238,7 @@ static void bcm43xx_synth_pu_workaround(struct bcm43xx_private *bcm, u8 channel) | |||
238 | 238 | ||
239 | u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel) | 239 | u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel) |
240 | { | 240 | { |
241 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 241 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
242 | u8 ret = 0; | 242 | u8 ret = 0; |
243 | u16 saved, rssi, temp; | 243 | u16 saved, rssi, temp; |
244 | int i, j = 0; | 244 | int i, j = 0; |
@@ -269,8 +269,8 @@ u8 bcm43xx_radio_aci_detect(struct bcm43xx_private *bcm, u8 channel) | |||
269 | 269 | ||
270 | u8 bcm43xx_radio_aci_scan(struct bcm43xx_private *bcm) | 270 | u8 bcm43xx_radio_aci_scan(struct bcm43xx_private *bcm) |
271 | { | 271 | { |
272 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 272 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
273 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 273 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
274 | u8 ret[13]; | 274 | u8 ret[13]; |
275 | unsigned int channel = radio->channel; | 275 | unsigned int channel = radio->channel; |
276 | unsigned int i, j, start, end; | 276 | unsigned int i, j, start, end; |
@@ -351,22 +351,23 @@ void bcm43xx_nrssi_hw_update(struct bcm43xx_private *bcm, u16 val) | |||
351 | /* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ | 351 | /* http://bcm-specs.sipsolutions.net/NRSSILookupTable */ |
352 | void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm) | 352 | void bcm43xx_nrssi_mem_update(struct bcm43xx_private *bcm) |
353 | { | 353 | { |
354 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
354 | s16 i, delta; | 355 | s16 i, delta; |
355 | s32 tmp; | 356 | s32 tmp; |
356 | 357 | ||
357 | delta = 0x1F - bcm->current_core->radio->nrssi[0]; | 358 | delta = 0x1F - radio->nrssi[0]; |
358 | for (i = 0; i < 64; i++) { | 359 | for (i = 0; i < 64; i++) { |
359 | tmp = (i - delta) * bcm->current_core->radio->nrssislope; | 360 | tmp = (i - delta) * radio->nrssislope; |
360 | tmp /= 0x10000; | 361 | tmp /= 0x10000; |
361 | tmp += 0x3A; | 362 | tmp += 0x3A; |
362 | tmp = limit_value(tmp, 0, 0x3F); | 363 | tmp = limit_value(tmp, 0, 0x3F); |
363 | bcm->current_core->radio->nrssi_lt[i] = tmp; | 364 | radio->nrssi_lt[i] = tmp; |
364 | } | 365 | } |
365 | } | 366 | } |
366 | 367 | ||
367 | static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm) | 368 | static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm) |
368 | { | 369 | { |
369 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 370 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
370 | u16 backup[20] = { 0 }; | 371 | u16 backup[20] = { 0 }; |
371 | s16 v47F; | 372 | s16 v47F; |
372 | u16 i; | 373 | u16 i; |
@@ -531,8 +532,8 @@ static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm) | |||
531 | 532 | ||
532 | void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm) | 533 | void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm) |
533 | { | 534 | { |
534 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 535 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
535 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 536 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
536 | u16 backup[18] = { 0 }; | 537 | u16 backup[18] = { 0 }; |
537 | u16 tmp; | 538 | u16 tmp; |
538 | s16 nrssi0, nrssi1; | 539 | s16 nrssi0, nrssi1; |
@@ -779,8 +780,8 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm) | |||
779 | 780 | ||
780 | void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm) | 781 | void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm) |
781 | { | 782 | { |
782 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 783 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
783 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 784 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
784 | s16 threshold; | 785 | s16 threshold; |
785 | s32 a, b; | 786 | s32 a, b; |
786 | int tmp; | 787 | int tmp; |
@@ -804,7 +805,7 @@ void bcm43xx_calc_nrssi_threshold(struct bcm43xx_private *bcm) | |||
804 | radiotype = 1; | 805 | radiotype = 1; |
805 | 806 | ||
806 | if (radiotype == 1) { | 807 | if (radiotype == 1) { |
807 | threshold = bcm->current_core->radio->nrssi[1] - 5; | 808 | threshold = radio->nrssi[1] - 5; |
808 | } else { | 809 | } else { |
809 | threshold = 40 * radio->nrssi[0]; | 810 | threshold = 40 * radio->nrssi[0]; |
810 | threshold += 33 * (radio->nrssi[1] - radio->nrssi[0]); | 811 | threshold += 33 * (radio->nrssi[1] - radio->nrssi[0]); |
@@ -901,8 +902,8 @@ static void | |||
901 | bcm43xx_radio_interference_mitigation_enable(struct bcm43xx_private *bcm, | 902 | bcm43xx_radio_interference_mitigation_enable(struct bcm43xx_private *bcm, |
902 | int mode) | 903 | int mode) |
903 | { | 904 | { |
904 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 905 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
905 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 906 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
906 | int i = 0; | 907 | int i = 0; |
907 | u16 *stack = radio->interfstack; | 908 | u16 *stack = radio->interfstack; |
908 | u16 tmp, flipped; | 909 | u16 tmp, flipped; |
@@ -1052,8 +1053,8 @@ static void | |||
1052 | bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm, | 1053 | bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm, |
1053 | int mode) | 1054 | int mode) |
1054 | { | 1055 | { |
1055 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1056 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1056 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1057 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1057 | int i = 0; | 1058 | int i = 0; |
1058 | u16 *stack = radio->interfstack; | 1059 | u16 *stack = radio->interfstack; |
1059 | u16 tmp, flipped; | 1060 | u16 tmp, flipped; |
@@ -1142,8 +1143,8 @@ bcm43xx_radio_interference_mitigation_disable(struct bcm43xx_private *bcm, | |||
1142 | int bcm43xx_radio_set_interference_mitigation(struct bcm43xx_private *bcm, | 1143 | int bcm43xx_radio_set_interference_mitigation(struct bcm43xx_private *bcm, |
1143 | int mode) | 1144 | int mode) |
1144 | { | 1145 | { |
1145 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1146 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1146 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1147 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1147 | int currentmode; | 1148 | int currentmode; |
1148 | 1149 | ||
1149 | if ((phy->type != BCM43xx_PHYTYPE_G) || | 1150 | if ((phy->type != BCM43xx_PHYTYPE_G) || |
@@ -1199,8 +1200,8 @@ u16 bcm43xx_radio_calibrationvalue(struct bcm43xx_private *bcm) | |||
1199 | 1200 | ||
1200 | u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm) | 1201 | u16 bcm43xx_radio_init2050(struct bcm43xx_private *bcm) |
1201 | { | 1202 | { |
1202 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1203 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1203 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1204 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1204 | u16 backup[19] = { 0 }; | 1205 | u16 backup[19] = { 0 }; |
1205 | u16 ret; | 1206 | u16 ret; |
1206 | u16 i, j; | 1207 | u16 i, j; |
@@ -1444,7 +1445,7 @@ int bcm43xx_radio_selectchannel(struct bcm43xx_private *bcm, | |||
1444 | u8 channel, | 1445 | u8 channel, |
1445 | int synthetic_pu_workaround) | 1446 | int synthetic_pu_workaround) |
1446 | { | 1447 | { |
1447 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1448 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1448 | u16 r8, tmp; | 1449 | u16 r8, tmp; |
1449 | u16 freq; | 1450 | u16 freq; |
1450 | 1451 | ||
@@ -1628,6 +1629,7 @@ static u16 bcm43xx_get_txgain_dac(u16 txpower) | |||
1628 | 1629 | ||
1629 | void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower) | 1630 | void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower) |
1630 | { | 1631 | { |
1632 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
1631 | u16 pamp, base, dac, ilt; | 1633 | u16 pamp, base, dac, ilt; |
1632 | 1634 | ||
1633 | txpower = limit_value(txpower, 0, 63); | 1635 | txpower = limit_value(txpower, 0, 63); |
@@ -1650,7 +1652,7 @@ void bcm43xx_radio_set_txpower_a(struct bcm43xx_private *bcm, u16 txpower) | |||
1650 | 1652 | ||
1651 | bcm43xx_ilt_write(bcm, 0x3001, dac); | 1653 | bcm43xx_ilt_write(bcm, 0x3001, dac); |
1652 | 1654 | ||
1653 | bcm->current_core->radio->txpower[0] = txpower; | 1655 | radio->txpower[0] = txpower; |
1654 | 1656 | ||
1655 | TODO(); | 1657 | TODO(); |
1656 | //TODO: FuncPlaceholder (Adjust BB loft cancel) | 1658 | //TODO: FuncPlaceholder (Adjust BB loft cancel) |
@@ -1660,8 +1662,8 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm, | |||
1660 | u16 baseband_attenuation, u16 radio_attenuation, | 1662 | u16 baseband_attenuation, u16 radio_attenuation, |
1661 | u16 txpower) | 1663 | u16 txpower) |
1662 | { | 1664 | { |
1663 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1665 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1664 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1666 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1665 | 1667 | ||
1666 | if (baseband_attenuation == 0xFFFF) | 1668 | if (baseband_attenuation == 0xFFFF) |
1667 | baseband_attenuation = radio->txpower[0]; | 1669 | baseband_attenuation = radio->txpower[0]; |
@@ -1698,8 +1700,8 @@ void bcm43xx_radio_set_txpower_bg(struct bcm43xx_private *bcm, | |||
1698 | 1700 | ||
1699 | void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm) | 1701 | void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm) |
1700 | { | 1702 | { |
1701 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1703 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1702 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1704 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1703 | int err; | 1705 | int err; |
1704 | 1706 | ||
1705 | if (radio->enabled) | 1707 | if (radio->enabled) |
@@ -1730,8 +1732,8 @@ void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm) | |||
1730 | 1732 | ||
1731 | void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm) | 1733 | void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm) |
1732 | { | 1734 | { |
1733 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 1735 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1734 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 1736 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
1735 | 1737 | ||
1736 | if (phy->type == BCM43xx_PHYTYPE_A) { | 1738 | if (phy->type == BCM43xx_PHYTYPE_A) { |
1737 | bcm43xx_radio_write16(bcm, 0x0004, 0x00FF); | 1739 | bcm43xx_radio_write16(bcm, 0x0004, 0x00FF); |
@@ -1750,7 +1752,9 @@ void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm) | |||
1750 | 1752 | ||
1751 | void bcm43xx_radio_clear_tssi(struct bcm43xx_private *bcm) | 1753 | void bcm43xx_radio_clear_tssi(struct bcm43xx_private *bcm) |
1752 | { | 1754 | { |
1753 | switch (bcm->current_core->phy->type) { | 1755 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
1756 | |||
1757 | switch (phy->type) { | ||
1754 | case BCM43xx_PHYTYPE_A: | 1758 | case BCM43xx_PHYTYPE_A: |
1755 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0068, 0x7F7F); | 1759 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x0068, 0x7F7F); |
1756 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x006a, 0x7F7F); | 1760 | bcm43xx_shm_write16(bcm, BCM43xx_SHM_SHARED, 0x006a, 0x7F7F); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c index 713ec601c342..35c3c9704c3c 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_sysfs.c | |||
@@ -150,7 +150,7 @@ static ssize_t bcm43xx_attr_interfmode_show(struct device *dev, | |||
150 | bcm43xx_lock(bcm, flags); | 150 | bcm43xx_lock(bcm, flags); |
151 | assert(bcm->initialized); | 151 | assert(bcm->initialized); |
152 | 152 | ||
153 | switch (bcm->current_core->radio->interfmode) { | 153 | switch (bcm43xx_current_radio(bcm)->interfmode) { |
154 | case BCM43xx_RADIO_INTERFMODE_NONE: | 154 | case BCM43xx_RADIO_INTERFMODE_NONE: |
155 | count = snprintf(buf, PAGE_SIZE, "0 (No Interference Mitigation)\n"); | 155 | count = snprintf(buf, PAGE_SIZE, "0 (No Interference Mitigation)\n"); |
156 | break; | 156 | break; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c index 208193851e8e..651ba6054957 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c | |||
@@ -56,15 +56,14 @@ static int bcm43xx_wx_get_name(struct net_device *net_dev, | |||
56 | { | 56 | { |
57 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 57 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
58 | unsigned long flags; | 58 | unsigned long flags; |
59 | int i, nr_80211; | 59 | int i; |
60 | struct bcm43xx_phyinfo *phy; | 60 | struct bcm43xx_phyinfo *phy; |
61 | char suffix[7] = { 0 }; | 61 | char suffix[7] = { 0 }; |
62 | int have_a = 0, have_b = 0, have_g = 0; | 62 | int have_a = 0, have_b = 0, have_g = 0; |
63 | 63 | ||
64 | bcm43xx_lock(bcm, flags); | 64 | bcm43xx_lock(bcm, flags); |
65 | nr_80211 = bcm43xx_num_80211_cores(bcm); | 65 | for (i = 0; i < bcm->nr_80211_available; i++) { |
66 | for (i = 0; i < nr_80211; i++) { | 66 | phy = &(bcm->core_80211_ext[i].phy); |
67 | phy = bcm->phy + i; | ||
68 | switch (phy->type) { | 67 | switch (phy->type) { |
69 | case BCM43xx_PHYTYPE_A: | 68 | case BCM43xx_PHYTYPE_A: |
70 | have_a = 1; | 69 | have_a = 1; |
@@ -129,7 +128,7 @@ static int bcm43xx_wx_set_channelfreq(struct net_device *net_dev, | |||
129 | err = bcm43xx_radio_selectchannel(bcm, channel, 0); | 128 | err = bcm43xx_radio_selectchannel(bcm, channel, 0); |
130 | bcm43xx_mac_enable(bcm); | 129 | bcm43xx_mac_enable(bcm); |
131 | } else { | 130 | } else { |
132 | bcm->current_core->radio->initial_channel = channel; | 131 | bcm43xx_current_radio(bcm)->initial_channel = channel; |
133 | err = 0; | 132 | err = 0; |
134 | } | 133 | } |
135 | out_unlock: | 134 | out_unlock: |
@@ -144,15 +143,17 @@ static int bcm43xx_wx_get_channelfreq(struct net_device *net_dev, | |||
144 | char *extra) | 143 | char *extra) |
145 | { | 144 | { |
146 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); | 145 | struct bcm43xx_private *bcm = bcm43xx_priv(net_dev); |
146 | struct bcm43xx_radioinfo *radio; | ||
147 | unsigned long flags; | 147 | unsigned long flags; |
148 | int err = -ENODEV; | 148 | int err = -ENODEV; |
149 | u16 channel; | 149 | u16 channel; |
150 | 150 | ||
151 | bcm43xx_lock(bcm, flags); | 151 | bcm43xx_lock(bcm, flags); |
152 | channel = bcm->current_core->radio->channel; | 152 | radio = bcm43xx_current_radio(bcm); |
153 | channel = radio->channel; | ||
153 | if (channel == 0xFF) { | 154 | if (channel == 0xFF) { |
154 | assert(!bcm->initialized); | 155 | assert(!bcm->initialized); |
155 | channel = bcm->current_core->radio->initial_channel; | 156 | channel = radio->initial_channel; |
156 | if (channel == 0xFF) | 157 | if (channel == 0xFF) |
157 | goto out_unlock; | 158 | goto out_unlock; |
158 | } | 159 | } |
@@ -232,6 +233,7 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
232 | const struct ieee80211_geo *geo; | 233 | const struct ieee80211_geo *geo; |
233 | unsigned long flags; | 234 | unsigned long flags; |
234 | int i, j; | 235 | int i, j; |
236 | struct bcm43xx_phyinfo *phy; | ||
235 | 237 | ||
236 | data->data.length = sizeof(*range); | 238 | data->data.length = sizeof(*range); |
237 | memset(range, 0, sizeof(*range)); | 239 | memset(range, 0, sizeof(*range)); |
@@ -270,11 +272,12 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
270 | IW_ENC_CAPA_CIPHER_CCMP; | 272 | IW_ENC_CAPA_CIPHER_CCMP; |
271 | 273 | ||
272 | bcm43xx_lock(bcm, flags); | 274 | bcm43xx_lock(bcm, flags); |
275 | phy = bcm43xx_current_phy(bcm); | ||
273 | 276 | ||
274 | range->num_bitrates = 0; | 277 | range->num_bitrates = 0; |
275 | i = 0; | 278 | i = 0; |
276 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A || | 279 | if (phy->type == BCM43xx_PHYTYPE_A || |
277 | bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) { | 280 | phy->type == BCM43xx_PHYTYPE_G) { |
278 | range->num_bitrates = 8; | 281 | range->num_bitrates = 8; |
279 | range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB; | 282 | range->bitrate[i++] = IEEE80211_OFDM_RATE_6MB; |
280 | range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB; | 283 | range->bitrate[i++] = IEEE80211_OFDM_RATE_9MB; |
@@ -285,8 +288,8 @@ static int bcm43xx_wx_get_rangeparams(struct net_device *net_dev, | |||
285 | range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB; | 288 | range->bitrate[i++] = IEEE80211_OFDM_RATE_48MB; |
286 | range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB; | 289 | range->bitrate[i++] = IEEE80211_OFDM_RATE_54MB; |
287 | } | 290 | } |
288 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_B || | 291 | if (phy->type == BCM43xx_PHYTYPE_B || |
289 | bcm->current_core->phy->type == BCM43xx_PHYTYPE_G) { | 292 | phy->type == BCM43xx_PHYTYPE_G) { |
290 | range->num_bitrates += 4; | 293 | range->num_bitrates += 4; |
291 | range->bitrate[i++] = IEEE80211_CCK_RATE_1MB; | 294 | range->bitrate[i++] = IEEE80211_CCK_RATE_1MB; |
292 | range->bitrate[i++] = IEEE80211_CCK_RATE_2MB; | 295 | range->bitrate[i++] = IEEE80211_CCK_RATE_2MB; |
@@ -461,8 +464,8 @@ static int bcm43xx_wx_set_xmitpower(struct net_device *net_dev, | |||
461 | bcm43xx_lock_mmio(bcm, flags); | 464 | bcm43xx_lock_mmio(bcm, flags); |
462 | if (!bcm->initialized) | 465 | if (!bcm->initialized) |
463 | goto out_unlock; | 466 | goto out_unlock; |
464 | radio = bcm->current_core->radio; | 467 | radio = bcm43xx_current_radio(bcm); |
465 | phy = bcm->current_core->phy; | 468 | phy = bcm43xx_current_phy(bcm); |
466 | if (data->txpower.disabled != (!(radio->enabled))) { | 469 | if (data->txpower.disabled != (!(radio->enabled))) { |
467 | if (data->txpower.disabled) | 470 | if (data->txpower.disabled) |
468 | bcm43xx_radio_turn_off(bcm); | 471 | bcm43xx_radio_turn_off(bcm); |
@@ -500,7 +503,7 @@ static int bcm43xx_wx_get_xmitpower(struct net_device *net_dev, | |||
500 | bcm43xx_lock(bcm, flags); | 503 | bcm43xx_lock(bcm, flags); |
501 | if (!bcm->initialized) | 504 | if (!bcm->initialized) |
502 | goto out_unlock; | 505 | goto out_unlock; |
503 | radio = bcm->current_core->radio; | 506 | radio = bcm43xx_current_radio(bcm); |
504 | /* desired dBm value is in Q5.2 */ | 507 | /* desired dBm value is in Q5.2 */ |
505 | data->txpower.value = radio->txpower_desired >> 2; | 508 | data->txpower.value = radio->txpower_desired >> 2; |
506 | data->txpower.fixed = 1; | 509 | data->txpower.fixed = 1; |
@@ -645,7 +648,7 @@ static int bcm43xx_wx_set_interfmode(struct net_device *net_dev, | |||
645 | "not supported while the interface is down.\n"); | 648 | "not supported while the interface is down.\n"); |
646 | err = -ENODEV; | 649 | err = -ENODEV; |
647 | } else | 650 | } else |
648 | bcm->current_core->radio->interfmode = mode; | 651 | bcm43xx_current_radio(bcm)->interfmode = mode; |
649 | } | 652 | } |
650 | bcm43xx_unlock_mmio(bcm, flags); | 653 | bcm43xx_unlock_mmio(bcm, flags); |
651 | 654 | ||
@@ -662,7 +665,7 @@ static int bcm43xx_wx_get_interfmode(struct net_device *net_dev, | |||
662 | int mode; | 665 | int mode; |
663 | 666 | ||
664 | bcm43xx_lock(bcm, flags); | 667 | bcm43xx_lock(bcm, flags); |
665 | mode = bcm->current_core->radio->interfmode; | 668 | mode = bcm43xx_current_radio(bcm)->interfmode; |
666 | bcm43xx_unlock(bcm, flags); | 669 | bcm43xx_unlock(bcm, flags); |
667 | 670 | ||
668 | switch (mode) { | 671 | switch (mode) { |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c index 5ee572e79f61..c4809da8e9c7 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c | |||
@@ -284,7 +284,7 @@ void bcm43xx_generate_txhdr(struct bcm43xx_private *bcm, | |||
284 | const int is_first_fragment, | 284 | const int is_first_fragment, |
285 | const u16 cookie) | 285 | const u16 cookie) |
286 | { | 286 | { |
287 | const struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 287 | const struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
288 | const struct ieee80211_hdr_4addr *wireless_header = (const struct ieee80211_hdr_4addr *)fragment_data; | 288 | const struct ieee80211_hdr_4addr *wireless_header = (const struct ieee80211_hdr_4addr *)fragment_data; |
289 | const struct ieee80211_security *secinfo = &bcm->ieee->sec; | 289 | const struct ieee80211_security *secinfo = &bcm->ieee->sec; |
290 | u8 bitrate; | 290 | u8 bitrate; |
@@ -382,8 +382,8 @@ static s8 bcm43xx_rssi_postprocess(struct bcm43xx_private *bcm, | |||
382 | u8 in_rssi, int ofdm, | 382 | u8 in_rssi, int ofdm, |
383 | int adjust_2053, int adjust_2050) | 383 | int adjust_2053, int adjust_2050) |
384 | { | 384 | { |
385 | struct bcm43xx_radioinfo *radio = bcm->current_core->radio; | 385 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
386 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 386 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
387 | s32 tmp; | 387 | s32 tmp; |
388 | 388 | ||
389 | switch (radio->version) { | 389 | switch (radio->version) { |
@@ -442,7 +442,7 @@ static s8 bcm43xx_rssi_postprocess(struct bcm43xx_private *bcm, | |||
442 | static s8 bcm43xx_rssinoise_postprocess(struct bcm43xx_private *bcm, | 442 | static s8 bcm43xx_rssinoise_postprocess(struct bcm43xx_private *bcm, |
443 | u8 in_rssi) | 443 | u8 in_rssi) |
444 | { | 444 | { |
445 | struct bcm43xx_phyinfo *phy = bcm->current_core->phy; | 445 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
446 | s8 ret; | 446 | s8 ret; |
447 | 447 | ||
448 | if (phy->type == BCM43xx_PHYTYPE_A) { | 448 | if (phy->type == BCM43xx_PHYTYPE_A) { |
@@ -458,6 +458,8 @@ int bcm43xx_rx(struct bcm43xx_private *bcm, | |||
458 | struct sk_buff *skb, | 458 | struct sk_buff *skb, |
459 | struct bcm43xx_rxhdr *rxhdr) | 459 | struct bcm43xx_rxhdr *rxhdr) |
460 | { | 460 | { |
461 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | ||
462 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | ||
461 | struct bcm43xx_plcp_hdr4 *plcp; | 463 | struct bcm43xx_plcp_hdr4 *plcp; |
462 | struct ieee80211_rx_stats stats; | 464 | struct ieee80211_rx_stats stats; |
463 | struct ieee80211_hdr_4addr *wlhdr; | 465 | struct ieee80211_hdr_4addr *wlhdr; |
@@ -494,13 +496,13 @@ int bcm43xx_rx(struct bcm43xx_private *bcm, | |||
494 | else | 496 | else |
495 | stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); | 497 | stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); |
496 | //printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate); | 498 | //printk("RX ofdm %d, rate == %u\n", is_ofdm, stats.rate); |
497 | stats.received_channel = bcm->current_core->radio->channel; | 499 | stats.received_channel = radio->channel; |
498 | //TODO stats.control = | 500 | //TODO stats.control = |
499 | stats.mask = IEEE80211_STATMASK_SIGNAL | | 501 | stats.mask = IEEE80211_STATMASK_SIGNAL | |
500 | //TODO IEEE80211_STATMASK_NOISE | | 502 | //TODO IEEE80211_STATMASK_NOISE | |
501 | IEEE80211_STATMASK_RATE | | 503 | IEEE80211_STATMASK_RATE | |
502 | IEEE80211_STATMASK_RSSI; | 504 | IEEE80211_STATMASK_RSSI; |
503 | if (bcm->current_core->phy->type == BCM43xx_PHYTYPE_A) | 505 | if (phy->type == BCM43xx_PHYTYPE_A) |
504 | stats.freq = IEEE80211_52GHZ_BAND; | 506 | stats.freq = IEEE80211_52GHZ_BAND; |
505 | else | 507 | else |
506 | stats.freq = IEEE80211_24GHZ_BAND; | 508 | stats.freq = IEEE80211_24GHZ_BAND; |